Upgrade to version 3.3 of arduino-lmic

This commit is contained in:
Manuel Bl 2021-01-05 21:57:11 +01:00
parent 3086b1bb58
commit 5c695fd223
5 changed files with 16 additions and 7 deletions

View File

@ -34,9 +34,9 @@
// This should be defined elsewhere // This should be defined elsewhere
void lmic_aes_encrypt(u1_t *data, u1_t *key); void lmic_aes_encrypt(u1_t *data, u1_t *key);
// global area for passing parameters (aux, key) and for storing round keys // global area for passing parameters (aux, key)
u4_t AESAUX[16/sizeof(u4_t)]; u4_t AESAUX[16/sizeof(u4_t)];
u4_t AESKEY[11*16/sizeof(u4_t)]; u4_t AESKEY[16/sizeof(u4_t)];
// Shift the given buffer left one bit // Shift the given buffer left one bit
static void shift_left(xref2u1_t buf, u1_t len) { static void shift_left(xref2u1_t buf, u1_t len) {

View File

@ -187,9 +187,17 @@
#endif #endif
// LMIC_ENABLE_long_messages // LMIC_ENABLE_long_messages
// LMIC certification requires that this be enabled. // LMIC certification requires full-length 255 frames, but to save RAM,
#if !defined(LMIC_ENABLE_long_messages) // a shorter maximum can be set. This controls both RX and TX buffers,
# define LMIC_ENABLE_long_messages 1 /* PARAM */ // so reducing this by 1 saves 2 bytes of RAM.
#if defined(LMIC_ENABLE_long_messages) && defined(LMIC_MAX_FRAME_LENGTH)
#error "Use only one of LMIC_ENABLE_long_messages or LMIC_MAX_FRAME_LENGTH"
#elif defined(LMIC_ENABLE_long_messages) && LMIC_ENABLE_long_messages == 0
# define LMIC_MAX_FRAME_LENGTH 64
#elif !defined(LMIC_MAX_FRAME_LENGTH)
# define LMIC_MAX_FRAME_LENGTH 255
#elif LMIC_MAX_FRAME_LENGTH > 255
#error "LMIC_MAX_FRAME_LENGTH cannot be larger than 255"
#endif #endif
// LMIC_ENABLE_event_logging // LMIC_ENABLE_event_logging

View File

@ -105,7 +105,7 @@ extern "C"{
#define ARDUINO_LMIC_VERSION_CALC(major, minor, patch, local) \ #define ARDUINO_LMIC_VERSION_CALC(major, minor, patch, local) \
((((major)*UINT32_C(1)) << 24) | (((minor)*UINT32_C(1)) << 16) | (((patch)*UINT32_C(1)) << 8) | (((local)*UINT32_C(1)) << 0)) ((((major)*UINT32_C(1)) << 24) | (((minor)*UINT32_C(1)) << 16) | (((patch)*UINT32_C(1)) << 8) | (((local)*UINT32_C(1)) << 0))
#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(3, 2, 0, 0) /* v3.2.0 */ #define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(3, 3, 0, 0) /* v3.3.0 */
#define ARDUINO_LMIC_VERSION_GET_MAJOR(v) \ #define ARDUINO_LMIC_VERSION_GET_MAJOR(v) \
((((v)*UINT32_C(1)) >> 24u) & 0xFFu) ((((v)*UINT32_C(1)) >> 24u) & 0xFFu)

View File

@ -60,7 +60,7 @@ enum { ILLEGAL_RPS = 0xFF };
// Global maximum frame length // Global maximum frame length
enum { STD_PREAMBLE_LEN = 8 }; enum { STD_PREAMBLE_LEN = 8 };
enum { MAX_LEN_FRAME = LMIC_ENABLE_long_messages ? 255 : 64 }; enum { MAX_LEN_FRAME = LMIC_MAX_FRAME_LENGTH };
enum { LEN_DEVNONCE = 2 }; enum { LEN_DEVNONCE = 2 };
enum { LEN_ARTNONCE = 3 }; enum { LEN_ARTNONCE = 3 };
enum { LEN_NETID = 3 }; enum { LEN_NETID = 3 };

View File

@ -382,6 +382,7 @@ static void writeReg (u1_t addr, u1_t data ) {
hal_spi_write(addr | 0x80, &data, 1); hal_spi_write(addr | 0x80, &data, 1);
} }
// ttn-esp32: it's safer if buffer is static
static u1_t reg_value_buf[1]; static u1_t reg_value_buf[1];
static u1_t readReg (u1_t addr) { static u1_t readReg (u1_t addr) {