openbeacon: set mac

This commit is contained in:
schneider 2011-07-17 21:01:09 +02:00
parent c9ca6d1be6
commit cf9a19de17
1 changed files with 6 additions and 6 deletions

View File

@ -7,6 +7,7 @@
const uint32_t key[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; const uint32_t key[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
const uint8_t enctoggle = 0; const uint8_t enctoggle = 0;
const uint8_t mac[5] = {1,2,3,2,1};
uint32_t oid = 0; uint32_t oid = 0;
uint32_t ctr = 0; uint32_t ctr = 0;
@ -14,7 +15,7 @@ uint8_t strength = 0;
void openbeaconSave() void openbeaconSave()
{ {
FIL file; /* File object */ FIL file;
BYTE buf[4]; BYTE buf[4];
UINT readbytes; UINT readbytes;
@ -31,7 +32,7 @@ void openbeaconSave()
void openbeaconRead() void openbeaconRead()
{ {
FIL file; /* File object */ FIL file;
BYTE buf[4]; BYTE buf[4];
UINT readbytes; UINT readbytes;
@ -72,14 +73,13 @@ void openbeaconSendPacket(uint32_t id, uint32_t ctr, uint8_t flags, uint8_t stre
void openbeaconSend(void) void openbeaconSend(void)
{ {
//uint8_t tmp = nrfgetstrength();
uint8_t tmp = 3;
nrf_set_strength(strength); nrf_set_strength(strength);
nrf_set_tx_mac(sizeof(mac), mac);
openbeaconSendPacket(oid, ctr++, 0xFF, strength++); openbeaconSendPacket(oid, ctr++, 0xFF, strength++);
if( strength == 4 ) if( strength == 4 )
strength = 0; strength = 0;
if( ctr % OPENBEACON_SAVECOUNTER == 0 ) if( ctr % OPENBEACON_SAVECOUNTER == 0 )
openbeaconSave(); openbeaconSave();
//maybe this produces timing problems?
nrf_set_strength(tmp);
} }