Example of using the mDot UDK with the X-NUCLEO-IKS01A2 board

Dependencies:   MTS_X_NUCLEO_IKS01A2 libmDot-mbed5

Fork of mDot-IKS01A1 by Peter Ferland

Committer:
pferland
Date:
Fri Jan 26 17:53:23 2018 +0000
Revision:
13:e165a137c3af
Parent:
12:63e90d375afd
Child:
15:fb9fa3ac530e
Updated to libmdot 3.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pferland 0:9e88a9018fc0 1 #include "mbed.h"
pferland 0:9e88a9018fc0 2 #include "mDot.h"
pferland 13:e165a137c3af 3 #include "ChannelPlan.h"
pferland 12:63e90d375afd 4 #include "XNucleoIKS01A2.h"
pferland 0:9e88a9018fc0 5 #include "dot_util.h"
pferland 0:9e88a9018fc0 6 #include "RadioEvent.h"
pferland 9:e642e8f9ea37 7 #include <cmath>
pferland 0:9e88a9018fc0 8
pferland 12:63e90d375afd 9 #define TTN
pferland 12:63e90d375afd 10
pferland 13:e165a137c3af 11 #if !defined(CHANNEL_PLAN)
pferland 13:e165a137c3af 12 #define CHANNEL_PLAN CP_US915
pferland 13:e165a137c3af 13 #endif
pferland 13:e165a137c3af 14
pferland 4:142c85980a6f 15 // mDot UDK board demo with X-NUCLEO-IKS01A1 sensor card
pferland 4:142c85980a6f 16 // For more examples see the Dot-Examples project:
pferland 4:142c85980a6f 17 // https://developer.mbed.org/teams/MultiTech/code/Dot-Examples/
pferland 4:142c85980a6f 18
pferland 4:142c85980a6f 19 // This triggers an I2C issue in mbed-os 5.1.5
pferland 4:142c85980a6f 20 // Use any other revision to compile. (Tested with libmDot-dev/mbed-os 5.2.2
pferland 12:63e90d375afd 21 //#define ACTILITY
pferland 10:1e3e3ab9c29c 22 #ifdef ACTILITY
pferland 10:1e3e3ab9c29c 23 // Network Id for Senet public network
pferland 10:1e3e3ab9c29c 24 static uint8_t network_id[] = {0xF0, 0x3D, 0x29,0xAC,0x71,0x00,0x00, 0x00};
pferland 12:63e90d375afd 25 static uint8_t network_key[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
pferland 10:1e3e3ab9c29c 26 static uint8_t frequency_sub_band = 0;
pferland 10:1e3e3ab9c29c 27 static bool public_network = true;
pferland 10:1e3e3ab9c29c 28 #elif defined(SENET)
pferland 4:142c85980a6f 29 // Network Id for Senet public network
pferland 4:142c85980a6f 30 static uint8_t network_id[] = {0x00,0x25,0x0C,0x00,0x00,0x01,0x00,0x01};
pferland 4:142c85980a6f 31 // Register at or Sign in to http://portal.senetco.com/ and register your NodeId to receive your AppId
pferland 12:63e90d375afd 32 //
pferland 12:63e90d375afd 33 static uint8_t network_key[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
pferland 4:142c85980a6f 34 // 1 For Senet, configurable on your Conduit
pferland 0:9e88a9018fc0 35 static uint8_t frequency_sub_band = 1;
pferland 4:142c85980a6f 36 // True for Senet, false for your Conduit.
pferland 4:142c85980a6f 37 static bool public_network = true;
pferland 12:63e90d375afd 38 #elif defined(TTN)
pferland 12:63e90d375afd 39 // Network Id for TheThingsNetwork public network
pferland 12:63e90d375afd 40 static uint8_t network_id[] = {0x70,0xB3,0xD5,0x7E,0xD0,0x00,0x98,0xE6};
pferland 12:63e90d375afd 41 // Network Key is known as "App Key" in TTN console
pferland 12:63e90d375afd 42 static uint8_t network_key[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
pferland 12:63e90d375afd 43 // FSB if supported by region
pferland 12:63e90d375afd 44 static uint8_t frequency_sub_band = 1;
pferland 12:63e90d375afd 45
pferland 12:63e90d375afd 46 static bool public_network = true;
pferland 12:63e90d375afd 47
pferland 9:e642e8f9ea37 48 #else
pferland 9:e642e8f9ea37 49 //Replace with settings on your Conduit
pferland 12:63e90d375afd 50 static std::string network_name = "TestTest";
pferland 12:63e90d375afd 51 static std::string network_passphrase = "TestTest";
pferland 9:e642e8f9ea37 52 // 1 For Senet, configurable on your Conduit
pferland 9:e642e8f9ea37 53 static uint8_t frequency_sub_band = 1;
pferland 9:e642e8f9ea37 54 // True for Senet, false for your Conduit.
pferland 9:e642e8f9ea37 55 static bool public_network = false;
pferland 9:e642e8f9ea37 56 #endif
pferland 10:1e3e3ab9c29c 57 static uint8_t ack = 0;
pferland 10:1e3e3ab9c29c 58 static uint8_t tx_datarate = mDot::SF_7;
pferland 0:9e88a9018fc0 59
pferland 4:142c85980a6f 60 // deepsleep consumes slightly less current than sleep
pferland 4:142c85980a6f 61 // in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up
pferland 4:142c85980a6f 62 // in deepsleep mode, IOs float, RAM is lost, and application will start from beginning after waking up
pferland 4:142c85980a6f 63 // if deep_sleep == true, device will enter deepsleep mode
pferland 4:142c85980a6f 64 static bool deep_sleep = false;
pferland 4:142c85980a6f 65
pferland 0:9e88a9018fc0 66 mDot *dot = NULL;
pferland 13:e165a137c3af 67 lora::ChannelPlan* plan = NULL;
pferland 0:9e88a9018fc0 68
pferland 0:9e88a9018fc0 69 int main()
pferland 0:9e88a9018fc0 70 {
pferland 4:142c85980a6f 71 Serial pc(USBTX, USBRX);
pferland 4:142c85980a6f 72
pferland 4:142c85980a6f 73 /* Instantiate the expansion board */
pferland 12:63e90d375afd 74 XNucleoIKS01A2 *mems_expansion_board = XNucleoIKS01A2::instance(I2C_SDA, I2C_SCL, PC_1);
pferland 4:142c85980a6f 75
pferland 4:142c85980a6f 76 /* Retrieve the composing elements of the expansion board */
pferland 12:63e90d375afd 77 /* Retrieve the composing elements of the expansion board */
pferland 12:63e90d375afd 78 // LSM303AGRMagSensor *magnetometer = mems_expansion_board->magnetometer;
pferland 12:63e90d375afd 79 // HTS221Sensor *hum_temp = mems_expansion_board->ht_sensor;
pferland 12:63e90d375afd 80 // LPS22HBSensor *press_temp = mems_expansion_board->pt_sensor;
pferland 12:63e90d375afd 81 // LSM6DSLSensor *acc_gyro = mems_expansion_board->acc_gyro;
pferland 12:63e90d375afd 82 // LSM303AGRAccSensor *accelerometer = mems_expansion_board->accelerometer;
pferland 12:63e90d375afd 83 GyroSensor *gyroscope = mems_expansion_board->acc_gyro;
pferland 12:63e90d375afd 84 mems_expansion_board->acc_gyro->enable_g();
pferland 12:63e90d375afd 85 MotionSensor *accelerometer = mems_expansion_board->accelerometer;
pferland 12:63e90d375afd 86 mems_expansion_board->accelerometer->enable();
pferland 4:142c85980a6f 87 MagneticSensor *magnetometer = mems_expansion_board->magnetometer;
pferland 12:63e90d375afd 88 mems_expansion_board->magnetometer->enable();
pferland 4:142c85980a6f 89 HumiditySensor *humidity_sensor = mems_expansion_board->ht_sensor;
pferland 12:63e90d375afd 90 mems_expansion_board->ht_sensor->enable();
pferland 4:142c85980a6f 91 PressureSensor *pressure_sensor = mems_expansion_board->pt_sensor;
pferland 12:63e90d375afd 92 mems_expansion_board->pt_sensor->enable();
pferland 4:142c85980a6f 93 TempSensor *temp_sensor1 = mems_expansion_board->ht_sensor;
pferland 4:142c85980a6f 94 TempSensor *temp_sensor2 = mems_expansion_board->pt_sensor;
pferland 12:63e90d375afd 95
pferland 0:9e88a9018fc0 96 // Custom event handler for automatically displaying RX data
pferland 0:9e88a9018fc0 97 RadioEvent events;
pferland 0:9e88a9018fc0 98 pc.baud(115200);
pferland 13:e165a137c3af 99 #if CHANNEL_PLAN == CP_US915
pferland 13:e165a137c3af 100 plan = new lora::ChannelPlan_US915();
pferland 13:e165a137c3af 101 #elif CHANNEL_PLAN == CP_AU915
pferland 13:e165a137c3af 102 plan = new lora::ChannelPlan_AU915();
pferland 13:e165a137c3af 103 #elif CHANNEL_PLAN == CP_EU868
pferland 13:e165a137c3af 104 plan = new lora::ChannelPlan_EU868();
pferland 13:e165a137c3af 105 #elif CHANNEL_PLAN == CP_KR920
pferland 13:e165a137c3af 106 plan = new lora::ChannelPlan_KR920();
pferland 13:e165a137c3af 107 #elif CHANNEL_PLAN == CP_AS923
pferland 13:e165a137c3af 108 plan = new lora::ChannelPlan_AS923();
pferland 13:e165a137c3af 109 #elif CHANNEL_PLAN == CP_AS923_JAPAN
pferland 13:e165a137c3af 110 plan = new lora::ChannelPlan_AS923_Japan();
pferland 13:e165a137c3af 111 #elif CHANNEL_PLAN == CP_IN865
pferland 13:e165a137c3af 112 plan = new lora::ChannelPlan_IN865();
pferland 13:e165a137c3af 113 #endif
pferland 0:9e88a9018fc0 114 /* Initialize mDot */
pferland 13:e165a137c3af 115 dot = mDot::getInstance(plan);
pferland 8:bfbc3dd47166 116
pferland 8:bfbc3dd47166 117 //dot->setAdr(true);
pferland 4:142c85980a6f 118 mts::MTSLog::setLogLevel(mts::MTSLog::INFO_LEVEL);
pferland 0:9e88a9018fc0 119 dot->setEvents(&events);
pferland 0:9e88a9018fc0 120
pferland 0:9e88a9018fc0 121
pferland 0:9e88a9018fc0 122 if (!dot->getStandbyFlag()) {
pferland 0:9e88a9018fc0 123 logInfo("mbed-os library version: %d", MBED_LIBRARY_VERSION);
pferland 0:9e88a9018fc0 124 // start from a well-known state
pferland 0:9e88a9018fc0 125 logInfo("defaulting Dot configuration");
pferland 0:9e88a9018fc0 126 dot->resetConfig();
pferland 0:9e88a9018fc0 127 dot->resetNetworkSession();
pferland 0:9e88a9018fc0 128
pferland 0:9e88a9018fc0 129 // update configuration if necessary
pferland 0:9e88a9018fc0 130 // in AUTO_OTA mode the session is automatically saved, so saveNetworkSession and restoreNetworkSession are not needed
pferland 0:9e88a9018fc0 131 if (dot->getJoinMode() != mDot::AUTO_OTA) {
pferland 0:9e88a9018fc0 132 logInfo("changing network join mode to AUTO_OTA");
pferland 0:9e88a9018fc0 133 if (dot->setJoinMode(mDot::AUTO_OTA) != mDot::MDOT_OK) {
pferland 0:9e88a9018fc0 134 logError("failed to set network join mode to AUTO_OTA");
pferland 0:9e88a9018fc0 135 }
pferland 0:9e88a9018fc0 136 }
pferland 8:bfbc3dd47166 137
pferland 8:bfbc3dd47166 138 uint32_t current_tx_datarate = dot->getTxDataRate();
pferland 8:bfbc3dd47166 139 if (current_tx_datarate != tx_datarate) {
pferland 8:bfbc3dd47166 140 logInfo("changing TX datarate from %u to %u", current_tx_datarate, tx_datarate);
pferland 8:bfbc3dd47166 141 if (dot->setTxDataRate(tx_datarate) != mDot::MDOT_OK) {
pferland 8:bfbc3dd47166 142 logError("failed to set TX datarate to %u", tx_datarate);
pferland 8:bfbc3dd47166 143 }
pferland 8:bfbc3dd47166 144 }
pferland 0:9e88a9018fc0 145 // in OTA and AUTO_OTA join modes, the credentials can be passed to the library as a name and passphrase or an ID and KEY
pferland 0:9e88a9018fc0 146 // only one method or the other should be used!
pferland 0:9e88a9018fc0 147 // network ID = crc64(network name)
pferland 12:63e90d375afd 148 #if defined(SENET) || defined(ACTILITY) || defined(TTN)
pferland 0:9e88a9018fc0 149 // network KEY = cmac(network passphrase)
pferland 4:142c85980a6f 150 update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack);
pferland 9:e642e8f9ea37 151 #else
pferland 9:e642e8f9ea37 152 update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, public_network, ack);
pferland 9:e642e8f9ea37 153 #endif
pferland 0:9e88a9018fc0 154
pferland 0:9e88a9018fc0 155 // configure network link checks
pferland 0:9e88a9018fc0 156 // network link checks are a good alternative to requiring the gateway to ACK every packet and should allow a single gateway to handle more Dots
pferland 0:9e88a9018fc0 157 // check the link every count packets
pferland 0:9e88a9018fc0 158 // declare the Dot disconnected after threshold failed link checks
pferland 0:9e88a9018fc0 159 // for count = 3 and threshold = 5, the Dot will be considered disconnected after 15 missed packets in a row
pferland 0:9e88a9018fc0 160 update_network_link_check_config(3, 5);
pferland 0:9e88a9018fc0 161
pferland 0:9e88a9018fc0 162 // save changes to configuration
pferland 0:9e88a9018fc0 163 logInfo("saving configuration");
pferland 0:9e88a9018fc0 164 if (!dot->saveConfig()) {
pferland 0:9e88a9018fc0 165 logError("failed to save configuration");
pferland 0:9e88a9018fc0 166 }
pferland 0:9e88a9018fc0 167
pferland 0:9e88a9018fc0 168 // display configuration
pferland 0:9e88a9018fc0 169 display_config();
pferland 0:9e88a9018fc0 170 } else {
pferland 0:9e88a9018fc0 171 // restore the saved session if the dot woke from deepsleep mode
pferland 0:9e88a9018fc0 172 // useful to use with deepsleep because session info is otherwise lost when the dot enters deepsleep
pferland 0:9e88a9018fc0 173 logInfo("restoring network session from NVM");
pferland 0:9e88a9018fc0 174 dot->restoreNetworkSession();
pferland 0:9e88a9018fc0 175 }
pferland 3:d34798ffcaf8 176
pferland 3:d34798ffcaf8 177
pferland 0:9e88a9018fc0 178
pferland 0:9e88a9018fc0 179 while (true) {
pferland 0:9e88a9018fc0 180 std::vector<uint8_t> tx_data;
pferland 0:9e88a9018fc0 181
pferland 0:9e88a9018fc0 182 // join network if not joined
pferland 0:9e88a9018fc0 183 if (!dot->getNetworkJoinStatus()) {
pferland 0:9e88a9018fc0 184 join_network();
pferland 0:9e88a9018fc0 185 }
pferland 7:d2052933ebcb 186
pferland 9:e642e8f9ea37 187 // Payload structure for mydevices cayenne:
pferland 9:e642e8f9ea37 188 // 1 byte Data1 ID
pferland 9:e642e8f9ea37 189 // 1 Byte Data1 Type
pferland 9:e642e8f9ea37 190 // N Bytes Data1
pferland 9:e642e8f9ea37 191 // 1 byte data 2 ID
pferland 9:e642e8f9ea37 192 // 1 byte data 2 type
pferland 9:e642e8f9ea37 193 // n Bytes data 2
pferland 9:e642e8f9ea37 194 // ...
pferland 9:e642e8f9ea37 195
pferland 9:e642e8f9ea37 196 // formats:
pferland 9:e642e8f9ea37 197 // Temperature sensor:
pferland 9:e642e8f9ea37 198 /*
pferland 9:e642e8f9ea37 199 * IPSO: 3303
pferland 9:e642e8f9ea37 200 * LPP 103
pferland 9:e642e8f9ea37 201 * HEX: 67
pferland 9:e642e8f9ea37 202 * Data size: 2
pferland 12:63e90d375afd 203 * Resolution: 0.1 degrees C
pferland 9:e642e8f9ea37 204
pferland 9:e642e8f9ea37 205 * Humidity sensor
pferland 9:e642e8f9ea37 206 * IPSO: 3304
pferland 9:e642e8f9ea37 207 * LPP: 104
pferland 9:e642e8f9ea37 208 * Hex: 68
pferland 9:e642e8f9ea37 209 * Datasize: 1
pferland 9:e642e8f9ea37 210 * Resolution: 0.5% unsigned
pferland 9:e642e8f9ea37 211
pferland 9:e642e8f9ea37 212 * Barometer/pressure sensor
pferland 9:e642e8f9ea37 213 * IPSO: 3315
pferland 9:e642e8f9ea37 214 * LPP: 115
pferland 9:e642e8f9ea37 215 * Hex: 73
pferland 9:e642e8f9ea37 216 * Datasize: 2
pferland 9:e642e8f9ea37 217 * Resolution 0.1hPa unsigned MSB
pferland 9:e642e8f9ea37 218
pferland 9:e642e8f9ea37 219 * Accelerometer
pferland 9:e642e8f9ea37 220 * IPSO: 3313
pferland 9:e642e8f9ea37 221 * LPP: 113
pferland 9:e642e8f9ea37 222 * Hex: 71
pferland 9:e642e8f9ea37 223 * Data size: 6
pferland 9:e642e8f9ea37 224 * Resolution: 0.001G signed MSB per axis
pferland 9:e642e8f9ea37 225
pferland 9:e642e8f9ea37 226 * Gyrometer
pferland 9:e642e8f9ea37 227 * IPSO: 3334
pferland 9:e642e8f9ea37 228 * LPP: 134
pferland 9:e642e8f9ea37 229 * Hex: 86
pferland 9:e642e8f9ea37 230 * Data size: 6
pferland 9:e642e8f9ea37 231 * Resolution: 0.01 degrees/s signed msb per axis
pferland 9:e642e8f9ea37 232 */
pferland 9:e642e8f9ea37 233
pferland 0:9e88a9018fc0 234 //temp floats
pferland 0:9e88a9018fc0 235 float value1, value2;
pferland 4:142c85980a6f 236
pferland 0:9e88a9018fc0 237 // HTS221 Humidity sensor
pferland 12:63e90d375afd 238 temp_sensor1->get_temperature(&value1);
pferland 12:63e90d375afd 239 humidity_sensor->get_humidity(&value2);
pferland 4:142c85980a6f 240
pferland 0:9e88a9018fc0 241 //serialize data and append to packet
pferland 9:e642e8f9ea37 242 // Cayenne data: temperature; tag is 0x67, 2 bytes signed, 0.1 C/bit
pferland 9:e642e8f9ea37 243 tx_data.push_back(uint8_t(1)); // data id
pferland 9:e642e8f9ea37 244 tx_data.push_back(uint8_t(0x67)); // data type - temp
pferland 9:e642e8f9ea37 245 int16_t temp = floor(value1*10 + 0.5f);
pferland 9:e642e8f9ea37 246 logInfo("Temp payload: %d", temp);
pferland 9:e642e8f9ea37 247 tx_data.push_back(uint8_t( 0xFF & (temp >> 8)));
pferland 9:e642e8f9ea37 248 tx_data.push_back(uint8_t(0xFF & temp));
pferland 9:e642e8f9ea37 249
pferland 9:e642e8f9ea37 250
pferland 9:e642e8f9ea37 251 tx_data.push_back(uint8_t(2)); // data id
pferland 9:e642e8f9ea37 252 tx_data.push_back(uint8_t(0x68)); // data type - humidity
pferland 9:e642e8f9ea37 253 temp = floor(value2 * 2.0f + 0.5f);
pferland 9:e642e8f9ea37 254 tx_data.push_back(uint8_t(0xFF & temp ));
pferland 9:e642e8f9ea37 255
pferland 4:142c85980a6f 256 logInfo("Temperature data %f", value1);
pferland 9:e642e8f9ea37 257 logInfo("Humidity data: %f", value2);
pferland 4:142c85980a6f 258
pferland 12:63e90d375afd 259 pressure_sensor->get_pressure(&value1);
pferland 12:63e90d375afd 260 logInfo("Pressure data: %f", value1);
pferland 9:e642e8f9ea37 261 // pressure is reported in mbar, cayenne wants it in 0.1 hPa
pferland 9:e642e8f9ea37 262 // 1mbar = 1 hPa
pferland 9:e642e8f9ea37 263 temp = floor(value1 * 100.0f + 0.5f);
pferland 9:e642e8f9ea37 264 tx_data.push_back(uint8_t(3)); // data id
pferland 9:e642e8f9ea37 265 tx_data.push_back(uint8_t(0x73)); // data type - pressure
pferland 9:e642e8f9ea37 266 temp = floor(value1 / 0.1f + 0.5f);
pferland 9:e642e8f9ea37 267 tx_data.push_back(uint8_t(0xFF & (temp >> 8)));
pferland 9:e642e8f9ea37 268 tx_data.push_back(uint8_t(0xFF & temp));
pferland 9:e642e8f9ea37 269
pferland 9:e642e8f9ea37 270
pferland 9:e642e8f9ea37 271 // Get accelerometer data
pferland 4:142c85980a6f 272 int32_t accel_vector[3];
pferland 9:e642e8f9ea37 273 // returns in mG
pferland 12:63e90d375afd 274 accelerometer->get_x_axes(accel_vector);
pferland 4:142c85980a6f 275 logInfo("Acclerometer Z axis: %d", accel_vector[2]);
pferland 4:142c85980a6f 276
pferland 9:e642e8f9ea37 277 tx_data.push_back(uint8_t(4)); // data id
pferland 9:e642e8f9ea37 278 tx_data.push_back(uint8_t(0x71)); // data type - accelerometer
pferland 9:e642e8f9ea37 279 for(int i=0; i<3; i++){
pferland 9:e642e8f9ea37 280 tx_data.push_back(uint8_t(0xFF & accel_vector[i]) >> 8);
pferland 9:e642e8f9ea37 281 tx_data.push_back(uint8_t(0xFF & accel_vector[i]));
pferland 9:e642e8f9ea37 282 }
pferland 9:e642e8f9ea37 283
pferland 9:e642e8f9ea37 284 // Get gyro data
pferland 12:63e90d375afd 285 gyroscope->get_g_axes
pferland 12:63e90d375afd 286 (accel_vector);
pferland 9:e642e8f9ea37 287 // gyro reports in milidegrees/sec, cayenne wants centidegrees/sec
pferland 9:e642e8f9ea37 288 tx_data.push_back(uint8_t(5)); //data id
pferland 9:e642e8f9ea37 289 tx_data.push_back(uint8_t(0x86)); // data type - gyrometer
pferland 9:e642e8f9ea37 290 for(int i=0; i<3; i++){
pferland 9:e642e8f9ea37 291 accel_vector[i] /= 10;
pferland 9:e642e8f9ea37 292 tx_data.push_back(uint8_t(0xFF & (accel_vector[i] >> 8)));
pferland 9:e642e8f9ea37 293 tx_data.push_back(uint8_t(0xFF & accel_vector[i]));
pferland 9:e642e8f9ea37 294 }
pferland 9:e642e8f9ea37 295
pferland 9:e642e8f9ea37 296
pferland 0:9e88a9018fc0 297 send_data(tx_data);
pferland 0:9e88a9018fc0 298
pferland 10:1e3e3ab9c29c 299 if(deep_sleep){
pferland 0:9e88a9018fc0 300 // if going into deepsleep mode, save the session so we don't need to join again after waking up
pferland 0:9e88a9018fc0 301 // not necessary if going into sleep mode since RAM is retained
pferland 10:1e3e3ab9c29c 302 logInfo("saving network session to NVM");
pferland 10:1e3e3ab9c29c 303 dot->saveNetworkSession();
pferland 10:1e3e3ab9c29c 304 }
pferland 0:9e88a9018fc0 305
pferland 0:9e88a9018fc0 306
pferland 0:9e88a9018fc0 307 // ONLY ONE of the three functions below should be uncommented depending on the desired wakeup method
pferland 6:9e6ac13de3e9 308 sleep_wake_rtc_only(deep_sleep);
pferland 0:9e88a9018fc0 309 //sleep_wake_interrupt_only(deep_sleep);
pferland 6:9e6ac13de3e9 310 //sleep_wake_rtc_or_interrupt(deep_sleep);
pferland 0:9e88a9018fc0 311
pferland 0:9e88a9018fc0 312 }
pferland 0:9e88a9018fc0 313
pferland 0:9e88a9018fc0 314 return 0;
pferland 0:9e88a9018fc0 315 }