added l0dable to see who is nearby

This commit is contained in:
schneider 2011-12-22 15:05:50 +01:00
parent 8e26d2b81c
commit 6ecc1e5f84
1 changed files with 38 additions and 0 deletions

38
firmware/l0dable/people.c Normal file
View File

@ -0,0 +1,38 @@
#include <sysinit.h>
#include <string.h>
#include "basic/basic.h"
#include "basic/config.h"
#include "lcd/render.h"
#include "lcd/print.h"
#include "funk/nrf24l01p.h"
#include "usetable.h"
/**************************************************************************/
void ram(void) {
struct NRF_CFG config;
uint8_t buf[16];
config.nrmacs=1;
config.maclen[0] = 16;
config.channel = 81;
memcpy(config.mac0, "\x01\x02\x03\x02\x01", 5);
nrf_config_set(&config);
lcdClear();
lcdPrintln("People nearby:");
//lcdPrint("nearby:");
lcdRefresh();
do{
if( nrf_rcv_pkt_time(64,sizeof(buf),buf) == 16 ){
buf[14] = 0;
if( buf[1] == 0x23 || buf[1] == 0x24){
lcdPrintln(buf+6);
//lcdPrintln("foo");
}
lcdRefresh();
}
}while ((getInputRaw())==BTN_NONE);
}