ver. 1

Dependencies:   mbed OneWireCRC_LoRa_Node

Committer:
lukas_formanek
Date:
Sun Apr 05 16:00:23 2020 +0000
Revision:
1:8a60d7a33fa5
Parent:
0:7f12b35d7969
Child:
2:e731b7dba32b
ver.0 - 5.4.2020

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lukas_formanek 1:8a60d7a33fa5 1 #include "stm32f4xx_hal.h"
lukas_formanek 1:8a60d7a33fa5 2 #include "stm32f4xx.h"
lukas_formanek 1:8a60d7a33fa5 3 #include "hal_tick.h"
lukas_formanek 0:7f12b35d7969 4 #include "mbed.h"
lukas_formanek 0:7f12b35d7969 5 //#include "stdio.h"
lukas_formanek 0:7f12b35d7969 6 //#include <sstream>
lukas_formanek 0:7f12b35d7969 7 //#include <iostream>
lukas_formanek 0:7f12b35d7969 8 #include <string>
lukas_formanek 0:7f12b35d7969 9 #include "DS18B20.h"
lukas_formanek 0:7f12b35d7969 10 #include "OneWireDefs.h"
lukas_formanek 0:7f12b35d7969 11
lukas_formanek 0:7f12b35d7969 12
lukas_formanek 0:7f12b35d7969 13 //#define MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER 0
lukas_formanek 0:7f12b35d7969 14 /* Select the clock sources (other than HSI) to start with (0=OFF, 1=ON) */
lukas_formanek 0:7f12b35d7969 15 //#define USE_PLL_HSE_EXTC (1) /* Use external clock */
lukas_formanek 0:7f12b35d7969 16 //#define USE_PLL_HSE_XTAL (1) /* Use external xtal */
lukas_formanek 0:7f12b35d7969 17 //#define DEBUG_MCO (0) // Output the MCO1/MCO2 on PA8/PC9 for debugging (0=OFF, 1=ON)
lukas_formanek 0:7f12b35d7969 18
lukas_formanek 0:7f12b35d7969 19
lukas_formanek 0:7f12b35d7969 20 #ifndef DEBUG_CONSOLE
lukas_formanek 1:8a60d7a33fa5 21 #define DEBUG_CONSOLE 0
lukas_formanek 0:7f12b35d7969 22 #endif
lukas_formanek 0:7f12b35d7969 23
lukas_formanek 0:7f12b35d7969 24
lukas_formanek 0:7f12b35d7969 25 #define V_BATT_REFF 8.20 // max napatie baterii
lukas_formanek 0:7f12b35d7969 26 const double voltage_divider_ref = V_BATT_REFF * (1.00/(1.00+1.60)); // max uroven napatia na delici
lukas_formanek 0:7f12b35d7969 27 const char *delimiter=":"; // delimiter na prijatie spravy
lukas_formanek 0:7f12b35d7969 28 // #define MEASURE_PERIOD 30.00
lukas_formanek 0:7f12b35d7969 29 volatile int measurePeriod = 60; // in seconds
lukas_formanek 0:7f12b35d7969 30 volatile uint32_t timeCounter = 0;
lukas_formanek 0:7f12b35d7969 31
lukas_formanek 0:7f12b35d7969 32
lukas_formanek 1:8a60d7a33fa5 33 #define USB_TX PA_9
lukas_formanek 1:8a60d7a33fa5 34 #define USB_RX PA_10
lukas_formanek 0:7f12b35d7969 35
lukas_formanek 1:8a60d7a33fa5 36 #define LORA_TX PA_11
lukas_formanek 1:8a60d7a33fa5 37 #define LORA_RX PA_12
lukas_formanek 0:7f12b35d7969 38
lukas_formanek 1:8a60d7a33fa5 39 #define THERM_PIN PB_8
lukas_formanek 1:8a60d7a33fa5 40 #define LED_PIN PB_0
lukas_formanek 0:7f12b35d7969 41
lukas_formanek 1:8a60d7a33fa5 42 #define BUF_SIZE 256
lukas_formanek 0:7f12b35d7969 43
lukas_formanek 0:7f12b35d7969 44 #define FOTO_PIN PA_1
lukas_formanek 0:7f12b35d7969 45 #define BATTERY_PIN PA_3
lukas_formanek 0:7f12b35d7969 46
lukas_formanek 0:7f12b35d7969 47 AnalogIn foto(FOTO_PIN);
lukas_formanek 0:7f12b35d7969 48 AnalogIn battery(BATTERY_PIN);
lukas_formanek 0:7f12b35d7969 49 DigitalOut led(LED_PIN);
lukas_formanek 0:7f12b35d7969 50 Ticker measureTicker;
lukas_formanek 0:7f12b35d7969 51
lukas_formanek 0:7f12b35d7969 52 Serial lora(LORA_TX, LORA_RX,115200);
lukas_formanek 0:7f12b35d7969 53 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 54 Serial usb(USB_TX, USB_RX,115200);
lukas_formanek 0:7f12b35d7969 55 #endif
lukas_formanek 0:7f12b35d7969 56
lukas_formanek 0:7f12b35d7969 57 DS18B20 thermometer(true, true, false,THERM_PIN);
lukas_formanek 0:7f12b35d7969 58 char buffer[64];
lukas_formanek 0:7f12b35d7969 59 char hexBuffer[128];
lukas_formanek 0:7f12b35d7969 60 char rxBuffer[BUF_SIZE];
lukas_formanek 0:7f12b35d7969 61 char rxMessage[BUF_SIZE];
lukas_formanek 0:7f12b35d7969 62 char message[BUF_SIZE];
lukas_formanek 0:7f12b35d7969 63 volatile int8_t rxPtr = 0;
lukas_formanek 0:7f12b35d7969 64 volatile bool measure = true;
lukas_formanek 0:7f12b35d7969 65 volatile bool rxDone = false;
lukas_formanek 0:7f12b35d7969 66
lukas_formanek 0:7f12b35d7969 67 volatile bool receiveOK=false;
lukas_formanek 0:7f12b35d7969 68 volatile bool receiveACK=false;
lukas_formanek 0:7f12b35d7969 69 volatile bool receiveJOIN=false;
lukas_formanek 0:7f12b35d7969 70 volatile bool receiveERR=false;
lukas_formanek 0:7f12b35d7969 71 volatile uint8_t numOfERR = 0;
lukas_formanek 0:7f12b35d7969 72 volatile float batteryValue = 0.00;
lukas_formanek 0:7f12b35d7969 73 volatile uint16_t fotoValue = 0;
lukas_formanek 0:7f12b35d7969 74 /*
lukas_formanek 0:7f12b35d7969 75 int main() {
lukas_formanek 0:7f12b35d7969 76
lukas_formanek 0:7f12b35d7969 77 while(1) {
lukas_formanek 0:7f12b35d7969 78 while(usb.readable()) {
lukas_formanek 0:7f12b35d7969 79 lora.putc(usb.getc());
lukas_formanek 0:7f12b35d7969 80 }
lukas_formanek 0:7f12b35d7969 81 while(lora.readable()) {
lukas_formanek 0:7f12b35d7969 82 usb.putc(lora.getc());
lukas_formanek 0:7f12b35d7969 83 }
lukas_formanek 0:7f12b35d7969 84 }
lukas_formanek 0:7f12b35d7969 85 }
lukas_formanek 0:7f12b35d7969 86 */
lukas_formanek 0:7f12b35d7969 87
lukas_formanek 0:7f12b35d7969 88 void clearRxBuffer()
lukas_formanek 0:7f12b35d7969 89 {
lukas_formanek 0:7f12b35d7969 90 memset(rxBuffer, '\0', sizeof(rxBuffer));
lukas_formanek 0:7f12b35d7969 91 rxPtr = 0;
lukas_formanek 0:7f12b35d7969 92 };
lukas_formanek 0:7f12b35d7969 93
lukas_formanek 0:7f12b35d7969 94 void resetModule()
lukas_formanek 0:7f12b35d7969 95 {
lukas_formanek 0:7f12b35d7969 96 numOfERR = 0;
lukas_formanek 0:7f12b35d7969 97 lora.printf("at+set_config=device:sleep:0\r\n");
lukas_formanek 0:7f12b35d7969 98 wait(0.2);
lukas_formanek 0:7f12b35d7969 99 receiveJOIN = false;
lukas_formanek 0:7f12b35d7969 100 lora.printf("at+set_config=device:restart\r\n");
lukas_formanek 0:7f12b35d7969 101 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 102 usb.printf("Joining to network... \r\n");
lukas_formanek 0:7f12b35d7969 103 #endif
lukas_formanek 0:7f12b35d7969 104
lukas_formanek 0:7f12b35d7969 105 Timer timer;
lukas_formanek 0:7f12b35d7969 106 timer.reset();
lukas_formanek 0:7f12b35d7969 107 timer.start();
lukas_formanek 0:7f12b35d7969 108 while(1)
lukas_formanek 0:7f12b35d7969 109 {
lukas_formanek 0:7f12b35d7969 110 if(receiveJOIN)
lukas_formanek 0:7f12b35d7969 111 {
lukas_formanek 0:7f12b35d7969 112 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 113 usb.printf("Join OK \r\n");
lukas_formanek 0:7f12b35d7969 114 #endif
lukas_formanek 0:7f12b35d7969 115 timer.stop();
lukas_formanek 0:7f12b35d7969 116 receiveJOIN=false;
lukas_formanek 0:7f12b35d7969 117 break;
lukas_formanek 0:7f12b35d7969 118 }
lukas_formanek 0:7f12b35d7969 119 if(timer.read_ms() > 30000)
lukas_formanek 0:7f12b35d7969 120 {
lukas_formanek 0:7f12b35d7969 121 timer.stop();
lukas_formanek 0:7f12b35d7969 122 timer.reset();
lukas_formanek 0:7f12b35d7969 123 timer.start();
lukas_formanek 0:7f12b35d7969 124 lora.printf("at+join\r\n");
lukas_formanek 0:7f12b35d7969 125 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 126 usb.printf("Joining...\r\n");
lukas_formanek 0:7f12b35d7969 127 #endif
lukas_formanek 0:7f12b35d7969 128 }
lukas_formanek 0:7f12b35d7969 129 }
lukas_formanek 0:7f12b35d7969 130 timer.stop();
lukas_formanek 0:7f12b35d7969 131 }
lukas_formanek 0:7f12b35d7969 132
lukas_formanek 0:7f12b35d7969 133
lukas_formanek 0:7f12b35d7969 134 void rxLoraInterrupt()
lukas_formanek 0:7f12b35d7969 135 {
lukas_formanek 0:7f12b35d7969 136 while (lora.readable())
lukas_formanek 0:7f12b35d7969 137 {
lukas_formanek 0:7f12b35d7969 138 char c = lora.getc();
lukas_formanek 0:7f12b35d7969 139 // usb.putc(c);
lukas_formanek 0:7f12b35d7969 140 if(rxPtr >= sizeof(rxBuffer) - 1)
lukas_formanek 0:7f12b35d7969 141 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 142 rxBuffer[rxPtr++] = c;
lukas_formanek 0:7f12b35d7969 143
lukas_formanek 0:7f12b35d7969 144 if(c =='\n')
lukas_formanek 0:7f12b35d7969 145 {
lukas_formanek 0:7f12b35d7969 146 rxDone = true;
lukas_formanek 0:7f12b35d7969 147
lukas_formanek 0:7f12b35d7969 148 if( strncmp( ( const char* )rxBuffer, "at+recv", 7) == 0)
lukas_formanek 0:7f12b35d7969 149 {
lukas_formanek 0:7f12b35d7969 150 receiveACK = true;
lukas_formanek 0:7f12b35d7969 151 snprintf((char *)rxMessage, BUF_SIZE, "%s", rxBuffer);
lukas_formanek 0:7f12b35d7969 152 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 153 return;
lukas_formanek 0:7f12b35d7969 154 }
lukas_formanek 0:7f12b35d7969 155
lukas_formanek 0:7f12b35d7969 156 if(strncmp( ( const char* )rxBuffer, "OK", 2) == 0)
lukas_formanek 0:7f12b35d7969 157 {
lukas_formanek 0:7f12b35d7969 158 receiveOK = true;
lukas_formanek 0:7f12b35d7969 159 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 160 return;
lukas_formanek 0:7f12b35d7969 161 }
lukas_formanek 0:7f12b35d7969 162
lukas_formanek 0:7f12b35d7969 163 if(strncmp( ( const char* )rxBuffer, "ERROR", 5) == 0)
lukas_formanek 0:7f12b35d7969 164 {
lukas_formanek 0:7f12b35d7969 165 receiveERR = true;
lukas_formanek 0:7f12b35d7969 166 numOfERR++;
lukas_formanek 0:7f12b35d7969 167 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 168 return;
lukas_formanek 0:7f12b35d7969 169 }
lukas_formanek 0:7f12b35d7969 170
lukas_formanek 0:7f12b35d7969 171 if( strncmp( ( const char* )rxBuffer, "[LoRa]:Join Success", 19) == 0)
lukas_formanek 0:7f12b35d7969 172 {
lukas_formanek 0:7f12b35d7969 173 receiveJOIN = true;
lukas_formanek 0:7f12b35d7969 174 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 175 return;
lukas_formanek 0:7f12b35d7969 176 }
lukas_formanek 0:7f12b35d7969 177
lukas_formanek 0:7f12b35d7969 178 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 179 }
lukas_formanek 0:7f12b35d7969 180 }
lukas_formanek 0:7f12b35d7969 181 }
lukas_formanek 0:7f12b35d7969 182
lukas_formanek 0:7f12b35d7969 183 void onMeasure()
lukas_formanek 0:7f12b35d7969 184 {
lukas_formanek 0:7f12b35d7969 185 timeCounter++;
lukas_formanek 0:7f12b35d7969 186 if(timeCounter >= measurePeriod)
lukas_formanek 0:7f12b35d7969 187 {
lukas_formanek 0:7f12b35d7969 188 timeCounter = 0;
lukas_formanek 0:7f12b35d7969 189 measure = true;
lukas_formanek 0:7f12b35d7969 190 return;
lukas_formanek 0:7f12b35d7969 191 }
lukas_formanek 0:7f12b35d7969 192 }
lukas_formanek 0:7f12b35d7969 193
lukas_formanek 0:7f12b35d7969 194 void init()
lukas_formanek 0:7f12b35d7969 195 {
lukas_formanek 0:7f12b35d7969 196 timeCounter = 0;
lukas_formanek 0:7f12b35d7969 197 measureTicker.detach();
lukas_formanek 0:7f12b35d7969 198 led = 1;
lukas_formanek 0:7f12b35d7969 199 clearRxBuffer();
lukas_formanek 0:7f12b35d7969 200 lora.attach(&rxLoraInterrupt, Serial::RxIrq);
lukas_formanek 0:7f12b35d7969 201 resetModule();
lukas_formanek 0:7f12b35d7969 202 thermometer.initialize();
lukas_formanek 0:7f12b35d7969 203 thermometer.setResolution(twelveBit);
lukas_formanek 0:7f12b35d7969 204 memset(buffer, '\0', sizeof(buffer));
lukas_formanek 0:7f12b35d7969 205 memset(hexBuffer, '\0', sizeof(hexBuffer));
lukas_formanek 0:7f12b35d7969 206 memset(rxBuffer, '\0', sizeof(rxBuffer));
lukas_formanek 0:7f12b35d7969 207 sprintf(hexBuffer,"at+send=lora:11:");
lukas_formanek 0:7f12b35d7969 208 measureTicker.attach(&onMeasure, 1.0);
lukas_formanek 0:7f12b35d7969 209 }
lukas_formanek 0:7f12b35d7969 210
lukas_formanek 0:7f12b35d7969 211
lukas_formanek 0:7f12b35d7969 212
lukas_formanek 0:7f12b35d7969 213 int main()
lukas_formanek 0:7f12b35d7969 214 {
lukas_formanek 0:7f12b35d7969 215 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 216 usb.printf("\r\n ------------ START APPLICATION ------------ \r\n");
lukas_formanek 0:7f12b35d7969 217 usb.printf("HCLK frequency : %d \r\n",HAL_RCC_GetHCLKFreq());
lukas_formanek 0:7f12b35d7969 218 usb.printf("System clock : %d \r\n", SystemCoreClock);
lukas_formanek 0:7f12b35d7969 219 #endif
lukas_formanek 0:7f12b35d7969 220 init();
lukas_formanek 0:7f12b35d7969 221 float val = 0.0;
lukas_formanek 0:7f12b35d7969 222 while(true)
lukas_formanek 0:7f12b35d7969 223 {
lukas_formanek 0:7f12b35d7969 224 if(measure)
lukas_formanek 0:7f12b35d7969 225 {
lukas_formanek 0:7f12b35d7969 226 fotoValue = foto.read_u16();
lukas_formanek 0:7f12b35d7969 227 batteryValue = (((battery.read_u16()/65535.0)*3.30)/voltage_divider_ref)*V_BATT_REFF;
lukas_formanek 0:7f12b35d7969 228 lora.printf("at+set_config=device:sleep:0\r\n");
lukas_formanek 0:7f12b35d7969 229 val = thermometer.readTemperature();
lukas_formanek 0:7f12b35d7969 230 sprintf(buffer, "%.2f;%.2f;%d", batteryValue, val, fotoValue);
lukas_formanek 0:7f12b35d7969 231 for(int i=0; i < sizeof(buffer); i++)
lukas_formanek 0:7f12b35d7969 232 {
lukas_formanek 0:7f12b35d7969 233 if(buffer[i] == '\0')
lukas_formanek 0:7f12b35d7969 234 break;
lukas_formanek 0:7f12b35d7969 235 sprintf(hexBuffer + strlen(hexBuffer), "%02x",buffer[i]);
lukas_formanek 0:7f12b35d7969 236 }
lukas_formanek 0:7f12b35d7969 237 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 238 usb.printf("Buffer : %s\r\n", buffer);
lukas_formanek 0:7f12b35d7969 239 // usb.printf("HEX Buffer : %s\r\n", hexBuffer);
lukas_formanek 0:7f12b35d7969 240 #endif
lukas_formanek 0:7f12b35d7969 241 lora.printf("%s\r\n", hexBuffer);
lukas_formanek 0:7f12b35d7969 242 memset(buffer, '\0', sizeof(buffer));
lukas_formanek 0:7f12b35d7969 243 memset(hexBuffer, '\0', sizeof(hexBuffer));
lukas_formanek 0:7f12b35d7969 244 sprintf(hexBuffer,"at+send=lora:11:");
lukas_formanek 0:7f12b35d7969 245 measure=false;
lukas_formanek 0:7f12b35d7969 246 }
lukas_formanek 0:7f12b35d7969 247
lukas_formanek 0:7f12b35d7969 248 if(receiveACK)
lukas_formanek 0:7f12b35d7969 249 {
lukas_formanek 0:7f12b35d7969 250 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 251 usb.printf("%s",rxMessage);
lukas_formanek 0:7f12b35d7969 252 #endif
lukas_formanek 0:7f12b35d7969 253 if(rxMessage[8] != '0')
lukas_formanek 0:7f12b35d7969 254 {
lukas_formanek 0:7f12b35d7969 255 char *e;
lukas_formanek 0:7f12b35d7969 256 int idx;
lukas_formanek 0:7f12b35d7969 257
lukas_formanek 0:7f12b35d7969 258 e = strchr(rxMessage, ':');
lukas_formanek 0:7f12b35d7969 259 idx = (int)(e - rxMessage);
lukas_formanek 0:7f12b35d7969 260
lukas_formanek 0:7f12b35d7969 261 char str[3];
lukas_formanek 0:7f12b35d7969 262 str[2]='\0';
lukas_formanek 0:7f12b35d7969 263 int8_t j = 0;
lukas_formanek 0:7f12b35d7969 264 memset(message, '\0', sizeof(message));
lukas_formanek 0:7f12b35d7969 265
lukas_formanek 0:7f12b35d7969 266 for(int i=idx+1; i<sizeof(rxMessage); i+=2)
lukas_formanek 0:7f12b35d7969 267 {
lukas_formanek 0:7f12b35d7969 268 if((rxMessage[i] == '\r') || (rxMessage[i] == '\n'))
lukas_formanek 0:7f12b35d7969 269 break;
lukas_formanek 0:7f12b35d7969 270 str[0]=rxMessage[i];
lukas_formanek 0:7f12b35d7969 271 str[1]=rxMessage[i+1];
lukas_formanek 0:7f12b35d7969 272 char chr = (char)(int)strtol((const char *)str, NULL, 16);
lukas_formanek 0:7f12b35d7969 273
lukas_formanek 0:7f12b35d7969 274 message[j++] = chr;
lukas_formanek 0:7f12b35d7969 275 }
lukas_formanek 0:7f12b35d7969 276
lukas_formanek 0:7f12b35d7969 277 if(rxMessage[8] == '1') // nastavenie intervalu merania v sekundach
lukas_formanek 0:7f12b35d7969 278 {
lukas_formanek 0:7f12b35d7969 279 timeCounter = 0;
lukas_formanek 0:7f12b35d7969 280 measurePeriod = atoi((const char*)(message));
lukas_formanek 0:7f12b35d7969 281 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 282 usb.printf("Converted number : %d \r\n", measurePeriod);
lukas_formanek 0:7f12b35d7969 283 #endif
lukas_formanek 0:7f12b35d7969 284 // measure = true;
lukas_formanek 0:7f12b35d7969 285 }
lukas_formanek 0:7f12b35d7969 286 else if(rxMessage[8] == '2')
lukas_formanek 0:7f12b35d7969 287 {
lukas_formanek 0:7f12b35d7969 288 lora.printf("%s\r\n", message);
lukas_formanek 0:7f12b35d7969 289 wait(0.2);
lukas_formanek 0:7f12b35d7969 290 }
lukas_formanek 0:7f12b35d7969 291 #if DEBUG_CONSOLE
lukas_formanek 0:7f12b35d7969 292 usb.printf("Received message : %s \r\n", message);
lukas_formanek 0:7f12b35d7969 293 #endif
lukas_formanek 0:7f12b35d7969 294
lukas_formanek 0:7f12b35d7969 295 // if( strncmp( ( const char* )message, "at+set_config=lora:class:", 25) == 0)
lukas_formanek 0:7f12b35d7969 296 // resetModule();
lukas_formanek 0:7f12b35d7969 297
lukas_formanek 0:7f12b35d7969 298
lukas_formanek 0:7f12b35d7969 299 }
lukas_formanek 0:7f12b35d7969 300
lukas_formanek 0:7f12b35d7969 301 memset(rxMessage, '\0', sizeof(rxMessage));
lukas_formanek 0:7f12b35d7969 302 // usb.printf("HAL SLEEP \r\n");
lukas_formanek 0:7f12b35d7969 303 lora.printf("at+set_config=device:sleep:1\r\n");
lukas_formanek 0:7f12b35d7969 304 receiveACK = false;
lukas_formanek 0:7f12b35d7969 305 // hal_sleep();
lukas_formanek 0:7f12b35d7969 306 }
lukas_formanek 0:7f12b35d7969 307
lukas_formanek 0:7f12b35d7969 308 if(receiveERR)
lukas_formanek 0:7f12b35d7969 309 {
lukas_formanek 0:7f12b35d7969 310 receiveERR = false;
lukas_formanek 0:7f12b35d7969 311 // memset(rxMessage, '\0', sizeof(rxMessage));
lukas_formanek 1:8a60d7a33fa5 312 /*
lukas_formanek 0:7f12b35d7969 313 if(numOfERR > 4)
lukas_formanek 0:7f12b35d7969 314 {
lukas_formanek 0:7f12b35d7969 315 measureTicker.detach();
lukas_formanek 0:7f12b35d7969 316 resetModule();
lukas_formanek 0:7f12b35d7969 317 measureTicker.attach(&onMeasure, 1.00);
lukas_formanek 0:7f12b35d7969 318 }
lukas_formanek 1:8a60d7a33fa5 319 */
lukas_formanek 0:7f12b35d7969 320 }
lukas_formanek 0:7f12b35d7969 321
lukas_formanek 0:7f12b35d7969 322 if(receiveOK)
lukas_formanek 0:7f12b35d7969 323 {
lukas_formanek 0:7f12b35d7969 324 receiveOK = false;
lukas_formanek 0:7f12b35d7969 325 }
lukas_formanek 0:7f12b35d7969 326
lukas_formanek 0:7f12b35d7969 327 hal_sleep();
lukas_formanek 0:7f12b35d7969 328 // hal_deepsleep();
lukas_formanek 0:7f12b35d7969 329
lukas_formanek 0:7f12b35d7969 330 }
lukas_formanek 1:8a60d7a33fa5 331 }