Created
June 9, 2012 01:48
-
-
Save schneider42/2899052 to your computer and use it in GitHub Desktop.
l0dable to test openbeacon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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]; | |
int priv = GLOBAL(privacy); | |
GLOBAL(privacy) = 2; | |
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("rx beacons"); | |
lcdRefresh(); | |
nrf_rcv_pkt_start(); | |
do{ | |
if( nrf_rcv_pkt_poll(sizeof(buf),buf) == 16 ){ | |
if( buf[1] == 0x17 ){ | |
int strength = buf[3]; | |
uint32_t seq = uint8ptouint32(buf+4); | |
uint32_t id = uint8ptouint32(buf+8); | |
lcdPrintInt(seq & 0xFF); | |
lcdPrint(" "); | |
lcdPrintIntHex(id); | |
lcdPrint(" "); | |
lcdPrintInt(strength/85); | |
lcdPrintln(""); | |
} | |
lcdRefresh(); | |
} | |
}while ((getInputRaw())==BTN_NONE); | |
GLOBAL(privacy) = priv; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment