Merge branch 'master' of github.com:r0ket/r0ket
Conflicts: firmware/basic/uuid.c
This commit is contained in:
commit
b58166a771
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
#include "core/iap/iap.h"
|
#include "core/iap/iap.h"
|
||||||
|
|
||||||
uint32_t GetUUID32(void){
|
uint32_t uuid32=0;
|
||||||
static uint32_t uuid = 0;
|
uint16_t uuid16=0;
|
||||||
if( uuid == 0){
|
|
||||||
|
uint32_t __GetUUID32(void){
|
||||||
IAP_return_t iap_return;
|
IAP_return_t iap_return;
|
||||||
iap_return = iapReadSerialNumber();
|
iap_return = iapReadSerialNumber();
|
||||||
if (iap_return.ReturnCode == 0){
|
if (iap_return.ReturnCode == 0){
|
||||||
|
@ -17,15 +18,34 @@ uint32_t GetUUID32(void){
|
||||||
for(i=0; i<4; i++)
|
for(i=0; i<4; i++)
|
||||||
block[i] = iap_return.Result[i];
|
block[i] = iap_return.Result[i];
|
||||||
xxtea_encode_words(block, 4, k);
|
xxtea_encode_words(block, 4, k);
|
||||||
uuid = block[0];
|
return block[0];
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
return uuid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// What OpenBeacon used. Do we want this?
|
// What OpenBeacon used. Do we want this?
|
||||||
uint16_t GetUUID16(void){
|
uint16_t __GetUUID16(void){
|
||||||
IAP_return_t iap_return;
|
IAP_return_t iap_return;
|
||||||
iap_return = iapReadSerialNumber();
|
iap_return = iapReadSerialNumber();
|
||||||
return crc16 ((uint8_t *) iap_return.Result, sizeof (iap_return.Result));
|
return crc16 ((uint8_t *) iap_return.Result, sizeof (iap_return.Result));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint32_t initUUID(void){
|
||||||
|
uuid32=__GetUUID32();
|
||||||
|
uuid16=__GetUUID16();
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t GetUUID32(void){
|
||||||
|
if(uuid32==0){
|
||||||
|
initUUID();
|
||||||
|
};
|
||||||
|
return uuid32;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint16_t GetUUID16(void){
|
||||||
|
if(uuid32==0){
|
||||||
|
initUUID();
|
||||||
|
};
|
||||||
|
return uuid16;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue