mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-27 20:48:29 +00:00
29 lines
1.2 KiB
C
29 lines
1.2 KiB
C
#pragma once
|
|
#include "nrf.h"
|
|
#define MG_ARCH MG_ARCH_ARMGCC
|
|
#define MG_ENABLE_TCPIP 1
|
|
#define MG_ENABLE_DRIVER_NRF52 1 // Radio: the network interface
|
|
#define MG_ENABLE_DRIVER_USB_NRF52 1 // nRF52840 USB controller
|
|
#define MG_ENABLE_USB_SERIAL 1 // USB serial log console
|
|
// 1200 baud touch: restart into the Adafruit bootloader, staying in DFU mode
|
|
#define MG_USB_REBOOT() \
|
|
do { \
|
|
NRF_POWER->GPREGRET = 0x57; \
|
|
NVIC_SystemReset(); \
|
|
} while (0)
|
|
#define MG_ENABLE_TCPIP_TCPRTX 1
|
|
#define MG_ENABLE_CUSTOM_MICROS 1
|
|
#define MG_ENABLE_CUSTOM_RANDOM 1
|
|
#define MG_TLS MG_TLS_BUILTIN
|
|
#define MQTT_CLIENT_ID "xiao-nrf52840"
|
|
|
|
// Stable, locally administered MAC derived from the factory device ID.
|
|
#define MG_SET_MAC_ADDRESS(mac) \
|
|
do { \
|
|
uint32_t id_[2] = {NRF_FICR->DEVICEID[0], NRF_FICR->DEVICEID[1]}; \
|
|
uint8_t hash_[32]; \
|
|
mg_sha256(hash_, (uint8_t *) id_, sizeof(id_)); \
|
|
memcpy(mac, hash_, 6); \
|
|
(mac)[0] = ((mac)[0] & 0xfc) | 2; \
|
|
} while (0)
|