openbeacon: use chip id

This commit is contained in:
schneider 2011-07-23 19:17:14 +02:00
parent 76a84b354f
commit 404b789c04
4 changed files with 24 additions and 5 deletions

View File

@ -227,7 +227,7 @@ void main_funk(void) {
backlightInit();
font=&Font_7x8;
openbeaconSetup(0x5ec);
openbeaconSetup();
while (1) {
lcdFill(0); // clear display buffer
lcdDisplay();

View File

@ -1,14 +1,24 @@
#include "lpc134x.h"
#include "sysdefs.h"
#include "basic.h"
#include "xxtea.h"
#include "core/iap/iap.h"
uint32_t GetUUID32(void){
IAP_return_t iap_return;
iap_return = iapReadSerialNumber();
return iap_return.Result[1];
if (iap_return.ReturnCode == 0){
uint32_t block[4];
uint32_t k[4] = {1,2,3,4};
block[0] = iap_return.Result[0];
block[1] = iap_return.Result[1];
block[2] = iap_return.Result[2];
block[3] = iap_return.Result[3];
xxtea_encode_words(block, 4, k);
return block[0];
}
return 0;
};
// What OpenBeacon used. Do we want this?

8
firmware/basic/uuid.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef _UUID_H_
#define _UUID_H_
#include <stdint.h>
uint32_t GetUUID32(void);
#endif

View File

@ -4,6 +4,7 @@
#include "basic/byteorder.h"
#include "sysdefs.h"
#include "filesystem/ff.h"
#include "basic/uuid.h"
//const uint32_t key[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
const uint32_t openbeaconkey[4] = { 0xB4595344,0xD3E119B6,0xA814D0EC,0xEFF5A24E };
@ -59,9 +60,9 @@ void openbeaconRead()
}
void openbeaconSetup(uint32_t id)
void openbeaconSetup(void)
{
oid = id;
oid = GetUUID32();
strength = 0;
openbeaconRead();
openbeaconSaveBlock();