Configuration files

The library is centered on the SensorsTlera class, which is described in SensorsTlera.h and SensorsTlera.cpp whose documentation is discussed in Sensors Tlera Documentation.

However, to use properly this library is required to create some configuration files which are explained here.

1. Sensor Configuration

These configurations are provided by sensors_config.h file.

There is two global definitions to take into account:

BOARD_TYPE

Board configuration.

DEBUG

Debug settings.

Then there are some groups of definitions which could be modified according to the required, but only the first two groups are suggested to be edited by user.

1.1. Sensors definitions

These definitions are related to the sensors which could be enabled or disabled in function of the corresponding definition is uncommented or commented.

WITH_GNSS

Enable GNSS.

WITH_BMA400

Enable BMA400 sensor.

WITH_BME280

Enable BME280 sensor.

WITH_ADXL345

Enable ADXL345 sensor.

WITH_L3G4200D

Enable L3G4200D sensor.

WITH_HMC5883L

Enable HMC5883L sensor.

1.2. Debug definitions

These definitions where created for debugging purposes, enabling them by assigning them a 1 value.

DEBUG_BOARD

Enable debugging for onboard sensors.

DEBUG_GNSS

Enable debugging for GNSS sensor.

DEBUG_BMA400

Enable debugging for BMA400 sensor.

DEBUG_BME280

Enable debugging for BME280 sensor.

DEBUG_ADXL345

Enable debugging for ADXL345 sensor.

DEBUG_L3G4200D

Enable debugging for L3G4200D sensor.

DEBUG_HMC5883L

Enable debugging for HMC5883L sensor.

1.3. Board definitions

These definitions varies according the BOARD_TYPE. In this case, those are set for the Cricket board.

LED_BOARD

LED blue.

VBAT_CTRL

Enable battery voltage monitoring.

VBAT_MON

ADC for Lipo voltage monitoring.

USER_BUTTON

user button

2. Boards declaration

These definitions are meant to assign an ID for each BOARD_TYPE.

For this purpose there are some macros and enumeration type declaration to generate an ID for each board type.

enum board_t

Board type enumeration

Values:

enumerator CRICKET

CRICKET type definition.

enumerator GNAT

GNAT type definition.

enumerator GRASSHOPPER

GRASSHOPPER type definition.

CRI(x)

CRICKET board macro generation.

GNAT(x)

GNAT board macro generation.

GRASS(x)

GRASSHOPPER board macro generation.

These macros are used to generate an ID for each board used to upload the application. For example, you could employ CRI(x) to generate an ID for a x board number:

CRI(4)  = 1004 // ID for the fourth Cricket board

In general, you shouldn’t require to modify this file, unless you add other boards definitions.

3. Radio communication settings (Commissioning)

These settings are meant to configure the GATEWAY TYPE and the LoRaWAN parametters.

3.1. Gateway definitions

GATEWAY_TEKTELIC

Defines the gateway as TEKTELIC type.

For the network sever there are two options GATEWAY_TEKTELIC for Tektelic network server and GATEWAY_TTN for TTN network server.

3.2. LoRaWAN settings

In LoRaWAN settings, there are some which sould be modified according with personal settings of application server configurations such as:

MYAPPKEY

APPKey from network server.

Then, it is required to define the specific device to be flashed through:

MYDEVICE

Device identification.

In addition to this, there is a struct definition which holds all LoRaWAN settings:

struct LoRaSettings

Structure for storing LoRaSettings.

Public Members

const int id

Device ID.

const char *appEui

AppEui from application server.

const char *appKey

AppKey from application server.

const char *devEui

DevEui set in applicatio and device.

In fact, you do not require to create the structure manually. There is a macro which facilitates its creation:

LORA_SETTINGS(...)

Macro to create LoRaWAN settings using LoRaSettings struct.

LORA_SETTINGS_CRI(NUM, ...)

Macro to create LoRaWAN settings using LoRaSettings struct for Cricket devices.

You could use either LORA_SETTINGS(...) for a general definition or LORA_SETTINGS_CRI(NUM, ...) for a cricket definition.

On the other hand, there are several cricket definitions, which you could adapt to your own devices.

To sum, only you need to set the corresponding MYAPPKEY and the MYDEVICE, for example:

#define MYAPPKEY "XXXXXXX" // Your App key from application server
#define MYDEVICE CRI(2)    // The current device (in this case, 2)

In addition to this, you could add more definitions to allow other device settings as in the example file:

#if MYDEVICE == CRI(1)
LORA_SETTINGS_CRI(1, MYAPPKEY, "CRI-1-appkey", "CRI-1-deveui");
#elif MYDEVICE == CRI(2)
LORA_SETTINGS_CRI(2, MYAPPKEY, "CRI-2-appkey", "CRI-2-deveui");
#elif MYDEVICE == CRI(3)
LORA_SETTINGS_CRI(3, MYAPPKEY, "CRI-3-appkey", "CRI-3-deveui");
...
#elif MYDEVICE == CRI(n)
LORA_SETTINGS_CRI(n, MYAPPKEY, "CRI-n-appkey", "CRI-n-deveui");
#endif