Skip to content

Commit bb53f2f

Browse files
committed
Fix #800: make it easier to patch APPEUI, DEVEUI and APPKEY
1 parent dcf8e52 commit bb53f2f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/compliance-otaa-halconfig/compliance-otaa-halconfig.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ class cEventQueue;
3030
// collisions with a registered app on TTN.
3131
//
3232

33-
// This EUI must be in little-endian format, so least-significant-byte
34-
// first. This corresponds to 0x0000000000000001
35-
// static const u1_t PROGMEM APPEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
36-
void os_getArtEui (u1_t* buf) { memset(buf, 0, 8); buf[0] = 1; }
33+
// AppEUI: must be in little-endian format, so least-significant-byte
34+
// first. This corresponds to 0x0000000000000000
35+
static const u1_t PROGMEM APPEUI[8]= { 0, 0, 0, 0, 0, 0, 0, 0 };
36+
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8); }
3737

38-
// This should also be in little endian format, see above.
38+
// DevEUI: This should also be in little endian format, see above.
3939
// This corresponds to 0x0000000000000001
40-
// static const u1_t PROGMEM DEVEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
41-
void os_getDevEui (u1_t* buf) { memset(buf, 0, 8); buf[0] = 1; }
40+
static const u1_t PROGMEM DEVEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
41+
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8); }
4242

4343
// This key should be in big endian format (or, since it is not really a
4444
// number but a block of memory, endianness does not really apply).
45-
// static const u1_t PROGMEM APPKEY[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
46-
void os_getDevKey (u1_t* buf) { memset(buf, 0, 16); buf[15] = 2; }
45+
static const u1_t PROGMEM APPKEY[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
46+
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16); }
4747

4848
// this data must be kept short -- max is 11 bytes for US DR0
4949
static uint8_t mydata[] = { 0xCA, 0xFE, 0xF0, 0x0D };

0 commit comments

Comments
 (0)