test

Dependencies:   mbed BufferedSerial SX1276GenericLib X_NUCLEO_IKS01A2

Committer:
TMRL123
Date:
Wed Jun 05 00:20:00 2019 +0000
Revision:
1:92160b13f3c3
Parent:
0:a73914f20498
Telemetry TX

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMRL123 0:a73914f20498 1 /* Includes */
TMRL123 0:a73914f20498 2 #include "mbed.h" /* Mbed include */
TMRL123 0:a73914f20498 3
TMRL123 0:a73914f20498 4 #include "XNucleoIKS01A2.h" /* Sensors include*/
TMRL123 0:a73914f20498 5
TMRL123 0:a73914f20498 6 /* LoRa includes */
TMRL123 0:a73914f20498 7 #include "PinMap.h"
TMRL123 0:a73914f20498 8 #include "sx1276-mbed-hal.h"
TMRL123 0:a73914f20498 9
TMRL123 1:92160b13f3c3 10 /* Serial communication include */
TMRL123 1:92160b13f3c3 11 #include "BufferedSerial.h"
TMRL123 1:92160b13f3c3 12
TMRL123 1:92160b13f3c3 13 /* SD card includes */
TMRL123 1:92160b13f3c3 14 #include "SDCard_Y.hh"
TMRL123 1:92160b13f3c3 15
TMRL123 1:92160b13f3c3 16 /* GPS include */
TMRL123 1:92160b13f3c3 17 #include "UbxGpsNavSol.hh"
TMRL123 1:92160b13f3c3 18
TMRL123 1:92160b13f3c3 19
TMRL123 1:92160b13f3c3 20 /* GPS definitions */
TMRL123 1:92160b13f3c3 21 #define GPS_BAUDRATE 115200
TMRL123 1:92160b13f3c3 22 //#define GPS_EN
TMRL123 1:92160b13f3c3 23
TMRL123 1:92160b13f3c3 24 /* Definition of buzzer time in ms */
TMRL123 1:92160b13f3c3 25 #define BUZZER_TIME 500
TMRL123 1:92160b13f3c3 26
TMRL123 1:92160b13f3c3 27 /* Definition of Disable enable flag */
TMRL123 1:92160b13f3c3 28 //#define KEY_ENABLE
TMRL123 1:92160b13f3c3 29
TMRL123 1:92160b13f3c3 30 /* Definition of the SD card */
TMRL123 1:92160b13f3c3 31 #define SPI_FREQUENCY 1000000
TMRL123 1:92160b13f3c3 32
TMRL123 1:92160b13f3c3 33 /* Definition of the SD card */
TMRL123 1:92160b13f3c3 34 //#define SD_EN
TMRL123 1:92160b13f3c3 35
TMRL123 0:a73914f20498 36 /* LoRa definitions */
TMRL123 0:a73914f20498 37
TMRL123 1:92160b13f3c3 38 /* Set this flag to display debug messages on the console */
TMRL123 1:92160b13f3c3 39 #define DEBUG_MESSAGE
TMRL123 0:a73914f20498 40
TMRL123 1:92160b13f3c3 41 /* Set this flag to '1' to use the LoRa modulation */
TMRL123 1:92160b13f3c3 42 #define USE_MODEM_LORA 1
TMRL123 1:92160b13f3c3 43 #define USE_MODEM_FSK !USE_MODEM_LORA
TMRL123 0:a73914f20498 44 #define RF_FREQUENCY RF_FREQUENCY_915_0 // Hz
TMRL123 1:92160b13f3c3 45 #define TX_OUTPUT_POWER 14 // 20 dBm
TMRL123 0:a73914f20498 46
TMRL123 0:a73914f20498 47 #if USE_MODEM_LORA == 1
TMRL123 0:a73914f20498 48
TMRL123 0:a73914f20498 49 #define LORA_BANDWIDTH 125000 // LoRa default, details in SX1276::BandwidthMap
TMRL123 0:a73914f20498 50 #define LORA_SPREADING_FACTOR LORA_SF7
TMRL123 0:a73914f20498 51 #define LORA_CODINGRATE LORA_ERROR_CODING_RATE_4_5
TMRL123 0:a73914f20498 52
TMRL123 0:a73914f20498 53 #define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
TMRL123 0:a73914f20498 54 #define LORA_SYMBOL_TIMEOUT 5 // Symbols
TMRL123 0:a73914f20498 55 #define LORA_FIX_LENGTH_PAYLOAD_ON false
TMRL123 0:a73914f20498 56 #define LORA_FHSS_ENABLED false
TMRL123 0:a73914f20498 57 #define LORA_NB_SYMB_HOP 4
TMRL123 0:a73914f20498 58 #define LORA_IQ_INVERSION_ON false
TMRL123 0:a73914f20498 59 #define LORA_CRC_ENABLED true
TMRL123 0:a73914f20498 60
TMRL123 0:a73914f20498 61 #endif
TMRL123 0:a73914f20498 62
TMRL123 0:a73914f20498 63
TMRL123 1:92160b13f3c3 64 #define RX_TIMEOUT_VALUE 0 // In ms
TMRL123 1:92160b13f3c3 65 #define TX_TIMEOUT_VALUE 1000000 // In ms
TMRL123 0:a73914f20498 66
TMRL123 0:a73914f20498 67 /* Sensors instances */
TMRL123 0:a73914f20498 68
TMRL123 1:92160b13f3c3 69
TMRL123 0:a73914f20498 70 /* Instantiate the expansion board */
TMRL123 0:a73914f20498 71 static XNucleoIKS01A2 *mems_expansion_board = XNucleoIKS01A2::instance(D14, D15, D4, D5);
TMRL123 0:a73914f20498 72
TMRL123 0:a73914f20498 73 /* Retrieve the composing elements of the expansion board */
TMRL123 0:a73914f20498 74 static LSM303AGRMagSensor *magnetometer = mems_expansion_board->magnetometer;
TMRL123 0:a73914f20498 75 static HTS221Sensor *hum_temp = mems_expansion_board->ht_sensor;
TMRL123 0:a73914f20498 76 static LPS22HBSensor *press_temp = mems_expansion_board->pt_sensor;
TMRL123 0:a73914f20498 77 static LSM6DSLSensor *acc_gyro = mems_expansion_board->acc_gyro;
TMRL123 0:a73914f20498 78 static LSM303AGRAccSensor *accelerometer = mems_expansion_board->accelerometer;
TMRL123 0:a73914f20498 79
TMRL123 1:92160b13f3c3 80 typedef struct {
TMRL123 1:92160b13f3c3 81 /* Header for identification of updated informations */
TMRL123 1:92160b13f3c3 82 bool header [8];
TMRL123 1:92160b13f3c3 83 int time; // Time between transmissions
TMRL123 1:92160b13f3c3 84 int32_t ag[3]; // Acceleration of the accelerometer and gyroscope LSM6DSL
TMRL123 1:92160b13f3c3 85 int32_t w[3]; // Angular velocity of LSM6DSL
TMRL123 1:92160b13f3c3 86 int32_t a[3]; // Acceleration of the accelerometer LSM303AGR
TMRL123 1:92160b13f3c3 87 int32_t m [3]; // Heading of LSM303AGR
TMRL123 1:92160b13f3c3 88 float p; // Pressure of LPS22HB
TMRL123 1:92160b13f3c3 89 float temperatureLPS22HB; // Temperature from LPS22HB
TMRL123 1:92160b13f3c3 90 float humidity; // Humidity of HTS221
TMRL123 1:92160b13f3c3 91 float temperatureHTS221; // Temperature from HTS221
TMRL123 1:92160b13f3c3 92 unsigned long timeOfWeek; //GPS time of week
TMRL123 1:92160b13f3c3 93 long timeOfWeekFracPart; // GPS time of week fractional part
TMRL123 1:92160b13f3c3 94 unsigned char gpsFix; // GPS fix
TMRL123 1:92160b13f3c3 95 long ecefx; // GPS X posiition
TMRL123 1:92160b13f3c3 96 long ecefy; // GPS Y posistion
TMRL123 1:92160b13f3c3 97 long ecefz; // GPS Z postion
TMRL123 1:92160b13f3c3 98 unsigned long positionAcc3D; // GPS 3D position accuracy
TMRL123 1:92160b13f3c3 99 long ecefvx; // GPS X velocity
TMRL123 1:92160b13f3c3 100 long ecefvy; // GPS Y velocity
TMRL123 1:92160b13f3c3 101 long ecefvz; // GPS Z velocity
TMRL123 1:92160b13f3c3 102 unsigned long speedAcc; // GPS speed accuracy
TMRL123 1:92160b13f3c3 103 unsigned char numbSat; // GPS number of satellites conected
TMRL123 1:92160b13f3c3 104 bool drogueStatus; // Drogue parachute status provided by Avionics
TMRL123 1:92160b13f3c3 105 bool mainStatus; //Main parachute status provided by Avionics
TMRL123 1:92160b13f3c3 106 float pressureBar; // Pressure by COTS Altimeter
TMRL123 1:92160b13f3c3 107 float temperature; // Temperature by COTS Altimeter
TMRL123 1:92160b13f3c3 108 bool mainStatusCOTS; // Main parachute status provided by COTS Altimeter
TMRL123 1:92160b13f3c3 109 bool drogueStatusCOTS; // Drogue status provided by COTS Altimeter
TMRL123 1:92160b13f3c3 110 int16_t timeStamp; //Timestamp from COTS Altimeter
TMRL123 1:92160b13f3c3 111 int16_t aglAlt; //AGL Altitude from COTS Altimeter
TMRL123 1:92160b13f3c3 112 int8_t battery; //Battery voltage reading from COTS Altimeter
TMRL123 1:92160b13f3c3 113 }Data; // Data struct
TMRL123 0:a73914f20498 114
TMRL123 1:92160b13f3c3 115 Data data;
TMRL123 1:92160b13f3c3 116
TMRL123 0:a73914f20498 117
TMRL123 0:a73914f20498 118 /* LoRa modem instances and configurations */
TMRL123 0:a73914f20498 119
TMRL123 0:a73914f20498 120 static RadioEvents_t RadioEvents; // Calback functions struct
TMRL123 0:a73914f20498 121
TMRL123 1:92160b13f3c3 122 SX1276Generic *Radio; // Definition of a Radio object
TMRL123 0:a73914f20498 123
TMRL123 1:92160b13f3c3 124 /* Configuration function */
TMRL123 0:a73914f20498 125 void SystemClock_Config(void);
TMRL123 0:a73914f20498 126
TMRL123 1:92160b13f3c3 127 bool transmited = true;// Flag to indicate the end of transmission
TMRL123 0:a73914f20498 128
TMRL123 0:a73914f20498 129 /* Callback functions prototypes */
TMRL123 1:92160b13f3c3 130
TMRL123 1:92160b13f3c3 131 // Brief Function to be executed on Radio Tx Done event
TMRL123 0:a73914f20498 132 void OnTxDone(void *radio, void *userThisPtr, void *userData);
TMRL123 0:a73914f20498 133
TMRL123 1:92160b13f3c3 134 // Brief Function to be executed on Radio Rx Done event
TMRL123 0:a73914f20498 135 void OnRxDone(void *radio, void *userThisPtr, void *userData, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
TMRL123 0:a73914f20498 136
TMRL123 1:92160b13f3c3 137 // Brief Function executed on Radio Tx Timeout event
TMRL123 0:a73914f20498 138 void OnTxTimeout(void *radio, void *userThisPtr, void *userData);
TMRL123 0:a73914f20498 139
TMRL123 1:92160b13f3c3 140 // Brief Function executed on Radio Rx Timeout event
TMRL123 0:a73914f20498 141 void OnRxTimeout(void *radio, void *userThisPtr, void *userData);
TMRL123 0:a73914f20498 142
TMRL123 1:92160b13f3c3 143 // Brief Function executed on Radio Rx Error event
TMRL123 0:a73914f20498 144 void OnRxError(void *radio, void *userThisPtr, void *userData);
TMRL123 0:a73914f20498 145
TMRL123 1:92160b13f3c3 146 // Brief Function executed on Radio Fhss Change Channel event
TMRL123 0:a73914f20498 147 void OnFhssChangeChannel(void *radio, void *userThisPtr, void *userData, uint8_t channelIndex);
TMRL123 0:a73914f20498 148
TMRL123 1:92160b13f3c3 149 #ifdef DEBUG_MESSAGE
TMRL123 0:a73914f20498 150 /* Serial communication to debug program */
TMRL123 1:92160b13f3c3 151 BufferedSerial *ser;
TMRL123 1:92160b13f3c3 152 #endif
TMRL123 0:a73914f20498 153
TMRL123 1:92160b13f3c3 154 /* Buzzer definition */
TMRL123 1:92160b13f3c3 155 DigitalOut buzzer (PA_0);
TMRL123 1:92160b13f3c3 156
TMRL123 1:92160b13f3c3 157 #ifdef KEY_ENABLE
TMRL123 1:92160b13f3c3 158 /* Key digital input port */
TMRL123 1:92160b13f3c3 159 DigitalIn key (PA_8);
TMRL123 1:92160b13f3c3 160 #endif
TMRL123 0:a73914f20498 161
TMRL123 0:a73914f20498 162 int main() {
TMRL123 1:92160b13f3c3 163 #ifdef KEY_ENABLE
TMRL123 1:92160b13f3c3 164 while (key == 0);
TMRL123 1:92160b13f3c3 165 #endif
TMRL123 1:92160b13f3c3 166 buzzer = 0;
TMRL123 1:92160b13f3c3 167 /* Power on*/
TMRL123 1:92160b13f3c3 168 buzzer = 1;
TMRL123 1:92160b13f3c3 169 wait_ms (BUZZER_TIME);
TMRL123 1:92160b13f3c3 170 buzzer = 0;
TMRL123 1:92160b13f3c3 171 wait_ms (BUZZER_TIME);
TMRL123 1:92160b13f3c3 172 /* Set to zero all parameters of the data struct */
TMRL123 1:92160b13f3c3 173 data.header [0] = 0;
TMRL123 1:92160b13f3c3 174 data.header [1] = 0;
TMRL123 1:92160b13f3c3 175 data.header [2] = 0;
TMRL123 1:92160b13f3c3 176 data.header [3] = 0;
TMRL123 1:92160b13f3c3 177 data.header [4] = 0;
TMRL123 1:92160b13f3c3 178 data.header [5] = 0;
TMRL123 1:92160b13f3c3 179 data.header [6] = 0;
TMRL123 1:92160b13f3c3 180 data.header [7] = 0;
TMRL123 1:92160b13f3c3 181 data.time = 0;
TMRL123 1:92160b13f3c3 182 data.ag[0] = 0;
TMRL123 1:92160b13f3c3 183 data.ag[1] = 0;
TMRL123 1:92160b13f3c3 184 data.ag[2] = 0;
TMRL123 1:92160b13f3c3 185 data.w[0] = 0;
TMRL123 1:92160b13f3c3 186 data.w[1] = 0;
TMRL123 1:92160b13f3c3 187 data.w[2] = 0;
TMRL123 1:92160b13f3c3 188 data.a[0] = 0;
TMRL123 1:92160b13f3c3 189 data.a[1] = 0;
TMRL123 1:92160b13f3c3 190 data.a[2] = 0;
TMRL123 1:92160b13f3c3 191 data.m [0] = 0;
TMRL123 1:92160b13f3c3 192 data.m [1] = 0;
TMRL123 1:92160b13f3c3 193 data.m [2] = 0;
TMRL123 1:92160b13f3c3 194 data.p = 0;
TMRL123 1:92160b13f3c3 195 data.temperatureLPS22HB = 0;
TMRL123 1:92160b13f3c3 196 data.humidity = 0;
TMRL123 1:92160b13f3c3 197 data.temperatureHTS221 = 0;
TMRL123 1:92160b13f3c3 198 data.timeOfWeek = 0;
TMRL123 1:92160b13f3c3 199 data.timeOfWeekFracPart = 0;
TMRL123 1:92160b13f3c3 200 data.gpsFix = 0;
TMRL123 1:92160b13f3c3 201 data.ecefx = 0;
TMRL123 1:92160b13f3c3 202 data.ecefy = 0;
TMRL123 1:92160b13f3c3 203 data.ecefz = 0;
TMRL123 1:92160b13f3c3 204 data.positionAcc3D = 0;
TMRL123 1:92160b13f3c3 205 data.ecefvx = 0;
TMRL123 1:92160b13f3c3 206 data.ecefvy = 0;
TMRL123 1:92160b13f3c3 207 data.ecefvz = 0;
TMRL123 1:92160b13f3c3 208 data.speedAcc = 0;
TMRL123 1:92160b13f3c3 209 data.numbSat = 0;
TMRL123 1:92160b13f3c3 210 data.drogueStatus = 0;
TMRL123 1:92160b13f3c3 211 data.mainStatus = 0;
TMRL123 1:92160b13f3c3 212 data.pressureBar = 0;
TMRL123 1:92160b13f3c3 213 data.temperature = 0;
TMRL123 1:92160b13f3c3 214 data.mainStatusCOTS = 0;
TMRL123 1:92160b13f3c3 215 data.drogueStatusCOTS = 0;
TMRL123 1:92160b13f3c3 216 data.timeStamp = 0;
TMRL123 1:92160b13f3c3 217 data.aglAlt = 0;
TMRL123 1:92160b13f3c3 218 data.battery = 0;
TMRL123 1:92160b13f3c3 219
TMRL123 1:92160b13f3c3 220 #ifdef GPS_EN
TMRL123 1:92160b13f3c3 221 //Serial connections (GPS)(TX,RX,baud)
TMRL123 1:92160b13f3c3 222 UbxGpsNavSol gps(PA_9, PA_10, GPS_BAUDRATE);
TMRL123 1:92160b13f3c3 223 #endif
TMRL123 0:a73914f20498 224
TMRL123 1:92160b13f3c3 225 SystemClock_Config(); /* Synchronize clock for TX and RX boards */
TMRL123 0:a73914f20498 226
TMRL123 1:92160b13f3c3 227 /* Serial configuration */
TMRL123 1:92160b13f3c3 228 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 229 ser = new BufferedSerial(USBTX, USBRX);
TMRL123 1:92160b13f3c3 230 ser->baud(115200);
TMRL123 1:92160b13f3c3 231 ser->format(8);
TMRL123 1:92160b13f3c3 232 #endif
TMRL123 1:92160b13f3c3 233
TMRL123 1:92160b13f3c3 234 /* General Header*/
TMRL123 1:92160b13f3c3 235 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 236 ser->printf ("Telemetry Tx inicial version program\r\n\r\n");
TMRL123 0:a73914f20498 237 uint8_t id; //Sensor id parameter for debug purpose
TMRL123 1:92160b13f3c3 238 #endif
TMRL123 0:a73914f20498 239
TMRL123 0:a73914f20498 240 /* Enable all sensors */
TMRL123 1:92160b13f3c3 241 if (hum_temp->enable() != 0) {
TMRL123 1:92160b13f3c3 242 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 243 ser->printf ("Humidity sensor not enabled\r\n");
TMRL123 1:92160b13f3c3 244 #endif
TMRL123 1:92160b13f3c3 245 }
TMRL123 1:92160b13f3c3 246 if (press_temp->enable() != 0) {
TMRL123 1:92160b13f3c3 247 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 248 ser->printf ("Temperature sensor not enabled\r\n");
TMRL123 1:92160b13f3c3 249 #endif
TMRL123 1:92160b13f3c3 250 }
TMRL123 1:92160b13f3c3 251 if (magnetometer->enable() != 0) {
TMRL123 1:92160b13f3c3 252 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 253 ser->printf ("Magnetometer sensor not enabled\r\n");
TMRL123 1:92160b13f3c3 254 #endif
TMRL123 1:92160b13f3c3 255 }
TMRL123 1:92160b13f3c3 256 if (accelerometer->enable() != 0) {
TMRL123 1:92160b13f3c3 257 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 258 ser->printf ("Accelerometer1 sensor not enabled\r\n");
TMRL123 1:92160b13f3c3 259 #endif
TMRL123 1:92160b13f3c3 260 }
TMRL123 1:92160b13f3c3 261 if (acc_gyro->enable_x() != 0) {
TMRL123 1:92160b13f3c3 262 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 263 ser->printf ("Gyroscope sensor not enabled\r\n");
TMRL123 1:92160b13f3c3 264 #endif
TMRL123 1:92160b13f3c3 265 }
TMRL123 1:92160b13f3c3 266 if (acc_gyro->enable_g() != 0) {
TMRL123 1:92160b13f3c3 267 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 268 ser->printf ("Accelerometer2 sensor not enabled\r\n");
TMRL123 1:92160b13f3c3 269 #endif
TMRL123 1:92160b13f3c3 270 }
TMRL123 0:a73914f20498 271
TMRL123 1:92160b13f3c3 272 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 273 ser->printf("\r\n--- Starting the sensors ---\r\n");
TMRL123 1:92160b13f3c3 274
TMRL123 0:a73914f20498 275 hum_temp->read_id(&id);
TMRL123 1:92160b13f3c3 276 ser->printf("HTS221 humidity & temperature = 0x%X\r\n", id);
TMRL123 0:a73914f20498 277 press_temp->read_id(&id);
TMRL123 1:92160b13f3c3 278 ser->printf("LPS22HB pressure & temperature = 0x%X\r\n", id);
TMRL123 0:a73914f20498 279 magnetometer->read_id(&id);
TMRL123 1:92160b13f3c3 280 ser->printf("LSM303AGR magnetometer = 0x%X\r\n", id);
TMRL123 0:a73914f20498 281 accelerometer->read_id(&id);
TMRL123 1:92160b13f3c3 282 ser->printf("LSM303AGR accelerometer = 0x%X\r\n", id);
TMRL123 0:a73914f20498 283 acc_gyro->read_id(&id);
TMRL123 1:92160b13f3c3 284 ser->printf("LSM6DSL accelerometer & gyroscope = 0x%X\r\n", id);
TMRL123 1:92160b13f3c3 285
TMRL123 1:92160b13f3c3 286 ser->printf("\r\n");
TMRL123 1:92160b13f3c3 287 #endif
TMRL123 0:a73914f20498 288
TMRL123 1:92160b13f3c3 289 /* Radio setup */
TMRL123 1:92160b13f3c3 290 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 291 ser->printf("\r\n--- Starting the modem LoRa ---\r\n");
TMRL123 1:92160b13f3c3 292 #endif
TMRL123 0:a73914f20498 293 Radio = new SX1276Generic(NULL, MURATA_SX1276,
TMRL123 0:a73914f20498 294 LORA_SPI_MOSI, LORA_SPI_MISO, LORA_SPI_SCLK, LORA_CS, LORA_RESET,
TMRL123 0:a73914f20498 295 LORA_DIO0, LORA_DIO1, LORA_DIO2, LORA_DIO3, LORA_DIO4, LORA_DIO5,
TMRL123 0:a73914f20498 296 LORA_ANT_RX, LORA_ANT_TX, LORA_ANT_BOOST, LORA_TCXO);
TMRL123 1:92160b13f3c3 297 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 298 ser->printf("SX1276 Simple transmission aplication\r\n" );
TMRL123 1:92160b13f3c3 299 ser->printf("Frequency: %.1f\r\n", (double)RF_FREQUENCY/1000000.0);
TMRL123 1:92160b13f3c3 300 ser->printf("TXPower: %d dBm\r\n", TX_OUTPUT_POWER);
TMRL123 1:92160b13f3c3 301 ser->printf("Bandwidth: %d Hz\r\n", LORA_BANDWIDTH);
TMRL123 1:92160b13f3c3 302 ser->printf("Spreading factor: SF%d\r\n", LORA_SPREADING_FACTOR);
TMRL123 1:92160b13f3c3 303 #endif
TMRL123 0:a73914f20498 304
TMRL123 0:a73914f20498 305 // Initialize Radio driver
TMRL123 0:a73914f20498 306 RadioEvents.TxDone = OnTxDone;
TMRL123 0:a73914f20498 307 RadioEvents.RxDone = OnRxDone;
TMRL123 0:a73914f20498 308 RadioEvents.RxError = OnRxError;
TMRL123 0:a73914f20498 309 RadioEvents.TxTimeout = OnTxTimeout;
TMRL123 1:92160b13f3c3 310 RadioEvents.RxTimeout = OnRxTimeout;
TMRL123 1:92160b13f3c3 311
TMRL123 1:92160b13f3c3 312 for (int i = 0; Radio->Init( &RadioEvents ) != true && i < 40; i++) {
TMRL123 1:92160b13f3c3 313 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 314 ser->printf("Radio could not be detected!\r\n");
TMRL123 1:92160b13f3c3 315 #endif
TMRL123 1:92160b13f3c3 316 buzzer = 1;
TMRL123 1:92160b13f3c3 317 wait_ms (BUZZER_TIME);
TMRL123 1:92160b13f3c3 318 buzzer = 0;
TMRL123 1:92160b13f3c3 319 wait_ms (BUZZER_TIME);
TMRL123 0:a73914f20498 320 }
TMRL123 0:a73914f20498 321
TMRL123 1:92160b13f3c3 322 // Display the board type
TMRL123 1:92160b13f3c3 323 #ifdef DEBUG_MESSAGE
TMRL123 0:a73914f20498 324 switch(Radio->DetectBoardType()) {
TMRL123 0:a73914f20498 325 case SX1276MB1LAS:
TMRL123 1:92160b13f3c3 326 ser->printf(" > Board Type: SX1276MB1LAS <\r\n");
TMRL123 0:a73914f20498 327 break;
TMRL123 0:a73914f20498 328 case SX1276MB1MAS:
TMRL123 1:92160b13f3c3 329 ser->printf(" > Board Type: SX1276MB1LAS <\r\n");
TMRL123 1:92160b13f3c3 330 break;
TMRL123 0:a73914f20498 331 case MURATA_SX1276:
TMRL123 1:92160b13f3c3 332 ser->printf(" > Board Type: MURATA_SX1276_STM32L0 <\r\n");
TMRL123 0:a73914f20498 333 break;
TMRL123 0:a73914f20498 334 case RFM95_SX1276:
TMRL123 1:92160b13f3c3 335 ser->printf(" > HopeRF RFM95xx <\r\n");
TMRL123 0:a73914f20498 336 break;
TMRL123 0:a73914f20498 337 default:
TMRL123 1:92160b13f3c3 338 ser->printf(" > Board Type: unknown <\r\n");
TMRL123 0:a73914f20498 339 }
TMRL123 1:92160b13f3c3 340 #endif
TMRL123 1:92160b13f3c3 341 Radio->SetChannel(RF_FREQUENCY ); // Sets the frequency of the communication
TMRL123 0:a73914f20498 342
TMRL123 1:92160b13f3c3 343 // Debug message of the state of fhss
TMRL123 1:92160b13f3c3 344 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 345 if (LORA_FHSS_ENABLED) {
TMRL123 1:92160b13f3c3 346 ser->printf(" > LORA FHSS Mode <\r\n");
TMRL123 1:92160b13f3c3 347 }
TMRL123 1:92160b13f3c3 348 if (!LORA_FHSS_ENABLED) {
TMRL123 1:92160b13f3c3 349 ser->printf(" > LORA Mode <\r\n");
TMRL123 1:92160b13f3c3 350 }
TMRL123 1:92160b13f3c3 351 #endif
TMRL123 1:92160b13f3c3 352 // Sets the configuration of the transmission
TMRL123 0:a73914f20498 353 Radio->SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
TMRL123 0:a73914f20498 354 LORA_SPREADING_FACTOR, LORA_CODINGRATE,
TMRL123 0:a73914f20498 355 LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
TMRL123 0:a73914f20498 356 LORA_CRC_ENABLED, LORA_FHSS_ENABLED, LORA_NB_SYMB_HOP,
TMRL123 0:a73914f20498 357 LORA_IQ_INVERSION_ON, 2000 );
TMRL123 0:a73914f20498 358
TMRL123 1:92160b13f3c3 359 // Sets the configuration of the reception
TMRL123 0:a73914f20498 360 Radio->SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
TMRL123 0:a73914f20498 361 LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
TMRL123 0:a73914f20498 362 LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON, 0,
TMRL123 0:a73914f20498 363 LORA_CRC_ENABLED, LORA_FHSS_ENABLED, LORA_NB_SYMB_HOP,
TMRL123 0:a73914f20498 364 LORA_IQ_INVERSION_ON, true );
TMRL123 0:a73914f20498 365
TMRL123 1:92160b13f3c3 366
TMRL123 1:92160b13f3c3 367 #ifdef SD_EN
TMRL123 1:92160b13f3c3 368 SPI spi (PA_7, PA_6, PA_5);
TMRL123 1:92160b13f3c3 369 spi.frequency (SPI_FREQUENCY);
TMRL123 1:92160b13f3c3 370 SDCard sdCard (&spi, PB_10);
TMRL123 1:92160b13f3c3 371 uint8_t sdData[sizeof(data)];
TMRL123 1:92160b13f3c3 372 int block = 0;
TMRL123 1:92160b13f3c3 373 #endif
TMRL123 1:92160b13f3c3 374
TMRL123 1:92160b13f3c3 375
TMRL123 1:92160b13f3c3 376 Radio->Tx(TX_TIMEOUT_VALUE); // Puts the device in transmission mode for a long period
TMRL123 1:92160b13f3c3 377
TMRL123 1:92160b13f3c3 378 Timer timer; // Timer
TMRL123 1:92160b13f3c3 379 timer.start(); // Starting timer
TMRL123 0:a73914f20498 380
TMRL123 0:a73914f20498 381 while(1) {
TMRL123 0:a73914f20498 382
TMRL123 1:92160b13f3c3 383 if (press_temp->get_pressure(&data.p) == 0) { // Get the pressure
TMRL123 1:92160b13f3c3 384 data.header[3] = 1; // LPS22HB updated
TMRL123 1:92160b13f3c3 385 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 386 //ser->printf("The pressure data from LPS22HB was read\r\n");
TMRL123 1:92160b13f3c3 387 #endif
TMRL123 1:92160b13f3c3 388 } else {
TMRL123 1:92160b13f3c3 389 data.header[3] = 0; // LPS22HB was not updated
TMRL123 1:92160b13f3c3 390 }
TMRL123 1:92160b13f3c3 391 if (press_temp->get_temperature(&data.temperatureLPS22HB) == 0) { // Get temperature from LPS22HB
TMRL123 1:92160b13f3c3 392 data.header [3] = 1; // LPS22HB updated
TMRL123 1:92160b13f3c3 393 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 394 //ser->printf("The temperature data from LPS22HB was read\r\n");
TMRL123 1:92160b13f3c3 395 #endif
TMRL123 1:92160b13f3c3 396 } else {
TMRL123 1:92160b13f3c3 397 data.header[3] = 0; // LPS22HB not updated
TMRL123 1:92160b13f3c3 398 }
TMRL123 1:92160b13f3c3 399 if (accelerometer->get_x_axes(data.a) == 0) {// Get the acceleration
TMRL123 1:92160b13f3c3 400 data.header [2] = 1; // LSM303AGR updated
TMRL123 1:92160b13f3c3 401 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 402 //ser->printf("The acceleration data from LSM303AGR was read\r\n");
TMRL123 1:92160b13f3c3 403 #endif
TMRL123 1:92160b13f3c3 404 } else {
TMRL123 1:92160b13f3c3 405 data.header [2] = 0; // LSM303AGR not updated
TMRL123 1:92160b13f3c3 406 }
TMRL123 1:92160b13f3c3 407 if (acc_gyro->get_x_axes(data.ag) == 0) {// Get the acceleration
TMRL123 1:92160b13f3c3 408 data.header [1] = 1; // LSM6DSL updated
TMRL123 1:92160b13f3c3 409 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 410 //ser->printf("The acceleration data from LSM6DSL was read\r\n");
TMRL123 1:92160b13f3c3 411 #endif
TMRL123 1:92160b13f3c3 412 } else {
TMRL123 1:92160b13f3c3 413 data.header [1] = 0; // LSM6DSL not updated
TMRL123 1:92160b13f3c3 414 }
TMRL123 1:92160b13f3c3 415 if (acc_gyro->get_g_axes(data.w) == 0) {// Get the angular velocity
TMRL123 1:92160b13f3c3 416 data.header [1] = 1; // LSM6DSL updated
TMRL123 1:92160b13f3c3 417 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 418 //ser->printf("The angular velocity data from LSM6DSL was read\r\n");
TMRL123 1:92160b13f3c3 419 #endif
TMRL123 1:92160b13f3c3 420 } else {
TMRL123 1:92160b13f3c3 421 data.header [1] = 0; // LSM6DSL not updated
TMRL123 1:92160b13f3c3 422 }
TMRL123 1:92160b13f3c3 423 if (magnetometer->get_m_axes(data.m) == 0) { // Get the magnetometer heading
TMRL123 1:92160b13f3c3 424 data.header [2] = 1; // LSM303AGR updated
TMRL123 1:92160b13f3c3 425 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 426 //ser->printf("The heading data from LSM6DSL was read\r\n");
TMRL123 1:92160b13f3c3 427 #endif
TMRL123 1:92160b13f3c3 428 } else {
TMRL123 1:92160b13f3c3 429 data.header [2] = 0; // LSM303AGR not updated
TMRL123 1:92160b13f3c3 430 }
TMRL123 1:92160b13f3c3 431 if (timer.read_ms() >= 10) {
TMRL123 1:92160b13f3c3 432 if (hum_temp->get_humidity(&data.humidity)) { // Get humidity
TMRL123 1:92160b13f3c3 433 data.header [4] = 1; // HTS221 updated
TMRL123 1:92160b13f3c3 434 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 435 //ser->printf("The humidity data from HTS221 was read\r\n");
TMRL123 1:92160b13f3c3 436 #endif
TMRL123 1:92160b13f3c3 437 } else {
TMRL123 1:92160b13f3c3 438 data.header [4] = 0; // HTS221 not updated
TMRL123 1:92160b13f3c3 439 }
TMRL123 1:92160b13f3c3 440 if (hum_temp->get_temperature(&data.temperatureHTS221)== 0) { // Get temperature from HTS221
TMRL123 1:92160b13f3c3 441 data.header [4] = 1; // HTS221 updated
TMRL123 1:92160b13f3c3 442 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 443 //ser->printf("The temperature data from HTS221 was read\r\n");
TMRL123 1:92160b13f3c3 444 #endif
TMRL123 1:92160b13f3c3 445 } else {
TMRL123 1:92160b13f3c3 446 data.header [4] = 0; // HTS221 not updated
TMRL123 1:92160b13f3c3 447 }
TMRL123 1:92160b13f3c3 448 #ifdef GPS_EN
TMRL123 1:92160b13f3c3 449 if (gps.readable()) {
TMRL123 1:92160b13f3c3 450 if (gps.ready()) {
TMRL123 1:92160b13f3c3 451 data.ecefx = gps.ecefX;
TMRL123 1:92160b13f3c3 452 data.ecefy = gps.ecefY;
TMRL123 1:92160b13f3c3 453 data.ecefz = gps.ecefZ;
TMRL123 1:92160b13f3c3 454 data.ecefvx = gps.ecefVX;
TMRL123 1:92160b13f3c3 455 data.ecefvy = gps.ecefVY;
TMRL123 1:92160b13f3c3 456 data.ecefvz = gps.ecefVZ;
TMRL123 1:92160b13f3c3 457 data.timeOfWeek = gps.iTOW;
TMRL123 1:92160b13f3c3 458 data.timeOfWeekFracPart = gps.fTOW;
TMRL123 1:92160b13f3c3 459 data.positionAcc3D = gps.pAcc;
TMRL123 1:92160b13f3c3 460 data.speedAcc = gps.sAcc;
TMRL123 1:92160b13f3c3 461 data.numbSat = gps.numSV;
TMRL123 1:92160b13f3c3 462 data.gpsFix = gps.gpsFix;
TMRL123 1:92160b13f3c3 463 data.header [5] = 1; // GPS updated
TMRL123 1:92160b13f3c3 464 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 465 ser->printf("The GPS data was read\r\n");
TMRL123 1:92160b13f3c3 466 #endif
TMRL123 1:92160b13f3c3 467 } else {
TMRL123 1:92160b13f3c3 468 data.header [5] = 1; // GPS not updated
TMRL123 1:92160b13f3c3 469 }
TMRL123 1:92160b13f3c3 470 }
TMRL123 1:92160b13f3c3 471 #endif
TMRL123 1:92160b13f3c3 472 timer.reset();
TMRL123 1:92160b13f3c3 473 }
TMRL123 1:92160b13f3c3 474 /* Check internal comunication for avionicas data */
TMRL123 1:92160b13f3c3 475 // Implement this part here
TMRL123 1:92160b13f3c3 476 //...
TMRL123 1:92160b13f3c3 477 //end
TMRL123 1:92160b13f3c3 478
TMRL123 1:92160b13f3c3 479 #ifdef SD_EN
TMRL123 1:92160b13f3c3 480 // Saving the data on SD Card
TMRL123 1:92160b13f3c3 481 memcpy (sdData, &data, sizeof(data));
TMRL123 1:92160b13f3c3 482 while(sdCard.write(&sdData[0],block) == 0);
TMRL123 1:92160b13f3c3 483 block ++;
TMRL123 1:92160b13f3c3 484 while (sdCard.write (&sdData[64],block) == 0);
TMRL123 1:92160b13f3c3 485 block++;
TMRL123 1:92160b13f3c3 486 while (sdCard.write(&sdData[128],block) == 0);
TMRL123 1:92160b13f3c3 487 block++;
TMRL123 1:92160b13f3c3 488 #endif
TMRL123 0:a73914f20498 489
TMRL123 1:92160b13f3c3 490 // Only sends a new packet when the device already have transmited the previous one
TMRL123 0:a73914f20498 491 if (transmited==true) {
TMRL123 0:a73914f20498 492 transmited = false;
TMRL123 0:a73914f20498 493 wait_ms(10);
TMRL123 1:92160b13f3c3 494 Radio->Send( &data, sizeof(data) );
TMRL123 1:92160b13f3c3 495 ser->printf("%d\r\n", sizeof(data));
TMRL123 0:a73914f20498 496 }
TMRL123 0:a73914f20498 497 }
TMRL123 0:a73914f20498 498 }
TMRL123 0:a73914f20498 499
TMRL123 0:a73914f20498 500 void SystemClock_Config(void)
TMRL123 0:a73914f20498 501 {
TMRL123 0:a73914f20498 502 #ifdef B_L072Z_LRWAN1_LORA
TMRL123 0:a73914f20498 503 /*
TMRL123 0:a73914f20498 504 * The L072Z_LRWAN1_LORA clock setup is somewhat differnt from the Nucleo board.
TMRL123 0:a73914f20498 505 * It has no LSE.
TMRL123 0:a73914f20498 506 */
TMRL123 0:a73914f20498 507 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
TMRL123 0:a73914f20498 508 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
TMRL123 0:a73914f20498 509
TMRL123 0:a73914f20498 510 /* Enable HSE Oscillator and Activate PLL with HSE as source */
TMRL123 0:a73914f20498 511 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
TMRL123 0:a73914f20498 512 RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
TMRL123 0:a73914f20498 513 RCC_OscInitStruct.HSIState = RCC_HSI_ON;
TMRL123 0:a73914f20498 514 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
TMRL123 0:a73914f20498 515 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
TMRL123 0:a73914f20498 516 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
TMRL123 0:a73914f20498 517 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_6;
TMRL123 0:a73914f20498 518 RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_3;
TMRL123 0:a73914f20498 519
TMRL123 0:a73914f20498 520 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
TMRL123 0:a73914f20498 521 // Error_Handler();
TMRL123 0:a73914f20498 522 }
TMRL123 0:a73914f20498 523
TMRL123 0:a73914f20498 524 /* Set Voltage scale1 as MCU will run at 32MHz */
TMRL123 0:a73914f20498 525 __HAL_RCC_PWR_CLK_ENABLE();
TMRL123 0:a73914f20498 526 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
TMRL123 0:a73914f20498 527
TMRL123 0:a73914f20498 528 /* Poll VOSF bit of in PWR_CSR. Wait until it is reset to 0 */
TMRL123 0:a73914f20498 529 while (__HAL_PWR_GET_FLAG(PWR_FLAG_VOS) != RESET) {};
TMRL123 0:a73914f20498 530
TMRL123 0:a73914f20498 531 /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
TMRL123 0:a73914f20498 532 clocks dividers */
TMRL123 0:a73914f20498 533 RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
TMRL123 0:a73914f20498 534 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
TMRL123 0:a73914f20498 535 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
TMRL123 0:a73914f20498 536 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
TMRL123 0:a73914f20498 537 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
TMRL123 0:a73914f20498 538 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
TMRL123 0:a73914f20498 539 // Error_Handler();
TMRL123 0:a73914f20498 540 }
TMRL123 0:a73914f20498 541 #endif
TMRL123 0:a73914f20498 542 }
TMRL123 0:a73914f20498 543
TMRL123 0:a73914f20498 544
TMRL123 0:a73914f20498 545
TMRL123 0:a73914f20498 546 void OnTxDone(void *radio, void *userThisPtr, void *userData)
TMRL123 0:a73914f20498 547 {
TMRL123 0:a73914f20498 548 Radio->Sleep( );
TMRL123 0:a73914f20498 549 transmited = true;
TMRL123 1:92160b13f3c3 550 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 551 ser->printf("> OnTxDone\r\n");
TMRL123 1:92160b13f3c3 552 ser->printf("I transmited %d mg, %d mg, %d mg, %d mg, %d mg, %d mg, %d mdps, %d mdps, %d mdps\r\n", data.a[0], data.a[1], data.a[2], data.ag[0], data.ag[1], data.ag[2], data.w[0], data.w[1], data.w[2]);
TMRL123 1:92160b13f3c3 553 ser->printf("and %d mG, %d mG, %d mG, %g %%, %g C, %g C, %g mBar\r\n", data.m[0], data.m[1], data.m[2], data.humidity, data.temperatureHTS221, data.temperatureLPS22HB, data.p);
TMRL123 1:92160b13f3c3 554 ser->printf("and time - %d ms, time of the week - %d ms, time of week frac part - %d ns\r\n",data.time, data.timeOfWeek, data.timeOfWeekFracPart);
TMRL123 1:92160b13f3c3 555 ser->printf("and GPS fix %c, ECEFX %d cm, ECEFY %d cm, ECEFZ %d cm\r\n", data.gpsFix, data.ecefx, data.ecefy, data.ecefz);
TMRL123 1:92160b13f3c3 556 ser->printf("and 3D Position accuracy %d cm, ECEFVX %d cm/s, ECEFVY %d cm/s, ECEFVZ %d cm/s, Speed accuracy %d cm/s\r\n", data.positionAcc3D, data.ecefvx, data.ecefvy, data.ecefvz, data.speedAcc);
TMRL123 1:92160b13f3c3 557 ser->printf("and Number of satelites %x, Drogue Status %x, Main status %x, BMP280 %f bar, temperature %f C\r\n", data.numbSat, data.drogueStatus, data.mainStatus, data.pressureBar, data.temperature);
TMRL123 1:92160b13f3c3 558 ser->printf("Main Status COTS %x, Drogue Status COTS %x, Time Stamp %d s, AGL altitude %d m, Battery voltage %d V\r\n",data.mainStatusCOTS, data.drogueStatusCOTS, data.timeStamp, data.aglAlt, data.battery);
TMRL123 1:92160b13f3c3 559 ser->printf("Header: %d, %d, %d, %d, %d, %d, %d, %d\r\n",data.header[0], data.header[1], data.header[2], data.header[3], data.header[4], data.header[5], data.header[6], data.header[7]);
TMRL123 1:92160b13f3c3 560 uint8_t payload[sizeof(data)];
TMRL123 1:92160b13f3c3 561 memcpy(payload, &data, sizeof(data));
TMRL123 1:92160b13f3c3 562 ser->printf("%x\r\n", *payload);
TMRL123 1:92160b13f3c3 563 #endif
TMRL123 0:a73914f20498 564 }
TMRL123 0:a73914f20498 565
TMRL123 0:a73914f20498 566 void OnRxDone(void *radio, void *userThisPtr, void *userData, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
TMRL123 0:a73914f20498 567 {
TMRL123 0:a73914f20498 568 Radio->Sleep( );
TMRL123 1:92160b13f3c3 569 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 570 ser->printf("> OnRxDone: RssiValue=%d dBm, SnrValue=%d\r\n", rssi, snr);
TMRL123 1:92160b13f3c3 571 #endif
TMRL123 0:a73914f20498 572 }
TMRL123 0:a73914f20498 573
TMRL123 0:a73914f20498 574 void OnTxTimeout(void *radio, void *userThisPtr, void *userData)
TMRL123 0:a73914f20498 575 {
TMRL123 0:a73914f20498 576 Radio->Sleep( );
TMRL123 1:92160b13f3c3 577 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 578 ser->printf("> OnTxTimeout\r\n");
TMRL123 1:92160b13f3c3 579 #endif
TMRL123 0:a73914f20498 580 }
TMRL123 0:a73914f20498 581
TMRL123 0:a73914f20498 582 void OnRxTimeout(void *radio, void *userThisPtr, void *userData)
TMRL123 0:a73914f20498 583 {
TMRL123 0:a73914f20498 584 Radio->Sleep( );
TMRL123 1:92160b13f3c3 585 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 586 ser->printf("> OnRxTimeout\r\n");
TMRL123 1:92160b13f3c3 587 #endif
TMRL123 0:a73914f20498 588 }
TMRL123 0:a73914f20498 589
TMRL123 0:a73914f20498 590 void OnRxError(void *radio, void *userThisPtr, void *userData)
TMRL123 0:a73914f20498 591 {
TMRL123 0:a73914f20498 592 Radio->Sleep( );
TMRL123 1:92160b13f3c3 593 #ifdef DEBUG_MESSAGE
TMRL123 1:92160b13f3c3 594 ser->printf("> OnRxError\r\n");
TMRL123 1:92160b13f3c3 595 #endif
TMRL123 0:a73914f20498 596 }