-
Notifications
You must be signed in to change notification settings - Fork 2
4. Configuration Reference
Ioannis Charalampidis edited this page Jan 16, 2019
·
3 revisions
The uNode library is configured by a statically declared global variable of type uNodeConfig that should be defined in the beginning of your sketch. It’s complete specification is listed below:
uNodeConfig unode_config = {
//
// LoRa module configuration
//
.lora = {
//
// The activation mode to use. Can be one of:
// LORA_TTN_DISABLED, LORA_TTN_ABP, LORA_TTN_OTAA
//
.mode = LORA_TTN_ABP,
//
// The activation mode details. Both options are mutually exclusive
//
.activation = {
// ABP Activation Configuration
.abp = {
.appKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.netKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.devAddr = 0x00000000
}
// OTAA Activation Configuration
.otaa = {
.appKey = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
// (The following keys should be copied from the TTN Console in LSB format)
.appEui = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.devEui = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
}
},
// The default Spreading Factor for the LoRa module. Can be one of:
// LORA_SF_DEFAULT, LORA_SF12, LORA_SF11, LORA_SF10, LORA_SF9,
// LORA_SF8, LORA_SF7, LORA_SF7B
.tx_sf = LORA_SF_DEFAULT,
// The default transmission value to use. Can be one of:
// CONFIG_DEFAULT or an 8-bit number
.tx_power = 14,
// When using managed transmission, this defines the number of seconds to wait
// for a transmission acknowledgment before considering it timed out (in ms).
.tx_timeout = 10000,
// When using managed transmission, this defines the number of re-transmission
// attempts to perform, before bailing out.
.tx_retries = 3,
// Enable or disable Adaptive Data Rate (ADR) on the LoRa Chip. Can be
// 1 (enabled), 0 (disabled)
.adr = 0
},
//
// Configures the undervoltage protection module
//
// You can use either use one of the pre-defined constants:
// UNDERVOLTAGE_DEFAULT or UNDERVOLTAGE_DISABLED
//
.undervoltageProtection = UNDERVOLTAGE_DEFAULT,
//
// ... or you can manually configure it
//
.undervoltageProtection = {
//
// Cut-off voltage (in mV)
//
.disableThreshold = 3100,
//
// Activation voltage (in mV)
//
.enableThreshold = 3200
},
//
// Configures the log messages emitted by the library. By default, they are
// written on the serial port, but you can disable or adjust it according to
// your needs.
//
// You can either use one of the pre-defined constants:
// LOG_DEFAULT, LOG_DISABLED, LOG_INFO, LOG_INFO_74880, LOG_INFO_9600
//
.logging = LOG_DEFAULT,
//
// ... or you can manually configure it
//
.logging = {
//
// The logging level. Can be one of:
// LOG_LEVEL_DEFAULT, LOG_LEVEL_DISABLED, LOG_LEVEL_INFO
//
.level = LOG_LEVEL_DEFAULT,
//
// The baud rate for the serial console. Can be one of:
// CONFIG_DEFAULT or any valid baud rate, eg. 115200
//
uint32_t baud;
}
};