Commit 564c230a authored by hark's avatar hark

docs and some emulation stuff

parent b69e4fdb
......@@ -3,4 +3,31 @@
*.swa
*.swp
*.swn
arduino-rx/build-atmega328/
arduino-rx/core
arduino-tx/build-atmega328/
base-tx/Makefile.avr
base-tx/avr-hello.c
base-tx/avr-hello.cpp
base-tx/avr-hello.lst
base-tx/keygen
base-tx/old/
base-tx/receiver_test.keypair
base-tx/rx-test
base-tx/sender_test.keypair
base-tx/test
base-tx/tx-test
lorawan-arduino-test/
old/
presentation/pdf/diy-pager.aux
presentation/pdf/diy-pager.log
presentation/pdf/diy-pager.nav
presentation/pdf/diy-pager.out
presentation/pdf/diy-pager.snm
presentation/pdf/diy-pager.toc
avr-src/blink.hex
base-tx/avr-hello.eeprom.hex
base-tx/avr-hello.elf
base-tx/avr-hello.flash.hex
base-tx/avr-hello.fuses.hex
base-tx/avr-hello.hex
......@@ -4,8 +4,8 @@ BOARD_TAG=atmega328
ARDUINO_LIBS=RadioHead SPI AESLib Wire LCDI2C_LK162 MemoryFree micro-ecc pagerlib LiquidCrystal
include /usr/share/arduino/Arduino.mk
#DEVICE_PATH = /dev/ttyUSB0
DEVICE_PATH = /tmp/simavr-uart0
DEVICE_PATH = /dev/ttyUSB0
#DEVICE_PATH = /tmp/simavr-uart0
TARGET = arduino-rx
debugger: all
......
ABIN=avr-hello
AOBJS=avr-hello.o
ACC=avr-gcc
AOBJCOPY=avr-objcopy
AGDB=avr-gdb
ACFLAGS=-Os -DF_CPU=16000000UL -mmcu=atmega328p
APORT=/dev/ttyACM0
${ABIN}.hex: ${ABIN}.elf
${AOBJCOPY} -O ihex -R .eeprom $< $@
${ABIN}.elf: ${AOBJS}
${ACC} -o $@ $^
flash: ${ABIN}.hex
avrdude -F -V -c arduino -p ATMEGA328P -P ${APORT} -b 115200 -U flash:w:$<
clean:
rm -f ${ABIN}.elf ${ABIN}.hex ${AOBJS}
CC=colorgcc
CFLAGS="-I ../libs -DDEBUG"
......@@ -22,3 +46,4 @@ test2: test2.c
$(CC) -std=c99 -o test2 test2.c ../libs/micro-ecc/uECC.c -lmbedtls -lmbedx509 -lmbedcrypto $(LIBS) $(CFLAGS)
clean :
rm -r test tx-test rx-test keygen
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.thumbnail {
position:relative;
overflow:hidden;
}
.caption
{
position:absolute;
bottom:0;
right:0;
background:rgba(92, 184, 92, 0.33);
width:100%;
height:45%;
padding:2%;
display: none;
text-align:center;
color:#fff !important;
z-index:2;
}
\ No newline at end of file
.white
{
color: white;
}
.green
{
color: #5CB85C;
}
.blue
{
color: blue;
}
\ No newline at end of file
.comment-section
{
padding: 10px;
margin-top: 10px;
border-top: 1px solid #DADADA;
}
.comment-list
{
list-style:none;
max-height: 500px;
overflow-y: auto;
}
.comment-avatar
{
width: 32px;
height: 100%;
float: left;
}
.comment-avatar a > img
{
width: 100%;
border-radius: 50%;
}
.comment-list li
{
margin-top:10px;
}
.comment-text p
{
margin:0;
padding-left: 10px;
}
.comment-text h1
{
margin:0;
padding-left: 10px;
}
.comment-list li > div
{
display:table-cell;
}
.sub-text
{
color:#aaa;
font-family:verdana;
font-size:11px;
padding-left: 10px;
}
.add-comment
{
margin-left: 20px;
/*width: 500px;*/
}
.preview-section
{
margin-bottom: 60px;
}
/*
#rawTextField
{
height: 100px;
}
#markdownPreview
{
height: 100px;
padding 20px;
}
*/
function getPostComments(issueNumber, callback)
{
// get the issue, specified by number, for the site page
$.get("https://api.github.com/repos/nnarain/nnarain.github.io/issues/" + issueNumber, function(issueData){
// get the issue's comments url
var commentsUrl = issueData.comments_url;
// if the issuse has comments
if(issueData.comments != 0)
{
// get the comments
$.get(commentsUrl, function(commentsData){
var len = commentsData.length;
var ret = {"comments":[]};
// for every comment object
for(var i = 0; i < len; ++i)
{
var data = commentsData["" + i];
var comment = {};
comment["body"] = getMarkdownPreview(data.body);
comment["date"] = data.created_at;
comment["user"] = {
"name" : data.user.login,
"avatar_url" : data.user.avatar_url,
"url" : "https://github.com/" + data.user.login
};
ret.comments.push(comment);
}
callback(ret);
});
}
else
{
callback({"comments":[]});
}
});
}
function makeBasicAuth(username, password)
{
var token = username + ":" + password;
var hash = btoa(token);
return "Basic " + hash;
}
function generateCommentPanel(comment)
{
var output = '';
output += '<li>';
{
output += '<div class="comment-avatar">';
{
output += '<a href="' + comment.user.url + '">';
{
output += '<img src="' + comment.user.avatar_url + '"/>';
}
output += '</a>';
}
output += '</div>';
output += '<div class="comment-text">';
{
// output += '<p>';
{
output += comment.body;
}
// output += '</p>';
output += '<span class="date sub-text">' + comment.date.split('T')[0] + '</span>';
}
output += '</div>';
}
output += '</li>';
return output;
}
/**
Generate the comment section for the comments recieved
*/
function generateCommentSection(data)
{
var comments = data.comments;
var len = comments.length;
var output = '';
for(var i = 0; i < len; ++i)
{
var comment = comments["" + i];
output += generateCommentPanel(comment);
}
$("#commentList").html(output);
}
function setupAddComments()
{
// disable the default action of the add comment form
$("#addCommentForm").submit(function(event){
event.preventDefault();
var commentText = $("#commentTextField").val();
if(commentText)
{
$("#credDialog").modal();
}
else
{
$("#warningDialog").modal();
}
});
}
function setupPostComment(issueNumber)
{
// focus on the username input field when credential form is displayed
$("#credDialog").on('shown.bs.modal', function(){
$("#usernameField").focus();
});
$("#credForm").submit(function(event){
event.preventDefault();
var username = $("#usernameField").val();
var password = $("#passwordField").val();
var commentBody = $("#commentTextField").val();
if(username && password && commentBody)
{
$.ajax({
type:"POST",
url: "https://api.github.com/repos/nnarain/nnarain.github.io/issues/" + issueNumber + "/comments",
dataType: "json",
contentType:"application/json",
data:JSON.stringify({"body":commentBody}),
beforeSend: function(xhr){
xhr.setRequestHeader("Authorization", makeBasicAuth(username, password));
},
success:function(data){
location.reload();
},
error: function(xhr, ajaxOptions, error){
console.log(xhr.responseText);
}
});
}
});
}
function setupPreview()
{
$("#previewLink").click(function(){
// get the markdown formatted text in the comment section and convert to html
var markdownContent = $("#commentTextField").val();
var htmlText = getMarkdownPreview(markdownContent);
$("#markdownPreview").html(htmlText);
});
}
\ No newline at end of file
function initPostThumbnails()
{
$('.thumbnail').hover(
function(){
$(this).find('.caption').slideDown(250); //.fadeIn(250)
},
function(){
$(this).find('.caption').slideUp(250); //.fadeOut(205)
}
);
}
\ No newline at end of file
.post-title-green
{
display: block;
font-size: 24px;
color: #5CB85C;
}
.page-links-green
{
display: block;
color: #5CB85C;
}
.pagination>li>a
{
color: #5CB85C;
}
.hidden
{
display: none;
}
.label-as-badge {
border-radius: 1em;
}
pre
{
background-color: transparent;
border: 0px;
}
pre>code {
white-space: pre;
overflow-x: auto;
}
.hljs {
display: inline-block;
overflow-x: auto;
-webkit-text-size-adjust: none;
}
.post-sequence-bottom
{
padding-bottom: 10px;
}
.archive-list-entry{
list-style-type: none;
}
.panel-heading>h4>small>a
{
text-decoration: none;
}
.list-group-item
{
word-wrap: break-word;
font-size: 14px;
}
.list-group-item:hover
{
background-color: #d8ffd8;
}
\ No newline at end of file
var PLUS_ICON = 'glyphicon-plus-sign';
var MINUS_ICON = 'glyphicon-minus-sign';
function getGithubActivityFeed(username, callback)
{
$.get("https://api.github.com/users/" + username + "/events/public", function(data){
//console.log(data);
var len = data.length;
var commits = {};
// loop for each object (objects are named 0, 1, 2, 3, etc...)
for(var i = 0; i < len; i++)
{
// get the event
var event = data["" + i];
// only consider push events
if(event.type == "PushEvent")
{
// get the repo name
var name = event.repo.name;
// ... if the repo hasn't been added to the dictionary
if(commits[name] === undefined)
{
// add repo to dictionary
commits[name] = {
"num": 0,
"url": "https://github.com/" + name,
"messages":[]
};
}
var numCommits = event.payload.distinct_size;
// increment commit count
commits[name].num += numCommits;
if(numCommits > 0)
{
// add commit messages
for(var j = numCommits-1; j >= 0; --j)
{
var commit = event.payload.commits["" + j];
var message = commit.message;
commits[name].messages.push(message);
}
}
}
}
// create the result object
var activity = {};
// add commits
activity["commits"] = commits;
// send back to caller
callback(activity);
});
}
function getGithubAvatar(username, callback)
{
$.get("https://api.github.com/users/" + username, function(data){
callback(data.avatar_url);
});
}
function setupFeed(username)
{
getGithubAvatar(username, function(avatarURL){
$("#avatarImg").attr("src", avatarURL);
});
getGithubActivityFeed(username, function(activity){
var output = "";
var idx = 0;
for(var key in activity.commits)
{
var repo = activity.commits[key];
output += "<div class=\"panel panel-default\">";
{
output += "<div class=\"panel-heading\">";
{
output += "<h4 class=\"panel-title\">";
{
output += "<small>"
{
// output += "<a class=\"accordion-toggle\" data-toggle=\"collapse\" data-parent=\"#feedList\" href=\"#collapse" + idx + "\">";
// output += "<span data-toggle='tooltip' data-placement='top' title='View Commits'>pushed</span> to " + key;
// output += "</a>";
output += "<a class=\"accordion-toggle\" data-toggle=\"collapse\" data-parent=\"#feedList\" href=\"#collapse" + idx + "\">";
output += "<span data-toggle='tooltip' data-placement='top' title='Show Commits' class='glyphicon green icon-toggle'></span> ";
output += "</a>";
output += "pushed to <a href='" + repo.url + "'>" + key + "</a>";
}
output += "</small>"
}
output += "</h4>";
}
output += "</div>";
output += "<div id=\"collapse" + idx + "\" class=\"panel-collapse collapse\">";
{
output += "<div class=\"panel-body\">";
{
output += "<ul class=\"list-group\">";
{
var numMessages = repo.messages.length >= 10 ? 10 : repo.messages.length;
for(var i = 0; i < numMessages; i++)
{
output += "<li class=\"list-group-item\">";
{
output += "<small>";
{
output += repo.messages[i];
}
output += "</small>";
}
output += "</li>";
}
}
output += "</ul>";
}