Here

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351 nRF24L01 FXOS8700

Committer:
tdh50
Date:
Mon Apr 10 22:33:14 2017 +0000
Revision:
16:b09f27c2dbe7
Parent:
14:9e6b87e322a2
Child:
18:9e23169b297a
Fixed accelerometer screen; BLE delay is gone and is transmitting Data; Alarm is triggered when fall occurs; Images were moved to main to fix delay issues

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-Hexiwear-Alert-System 0:6384ad26fe6c 1 #include "mbed.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 2 #include "Hexi_KW40Z.h"
tdh50 5:09837d22b28f 3 #include "FXOS8700.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 4 #include "Hexi_OLED_SSD1351.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 5 #include "OLED_types.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 6 #include "OpenSans_Font.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 7 #include "nRF24L01P.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 8 #include "string.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 9 #include "images.h"
group-Hexiwear-Alert-System 0:6384ad26fe6c 10
tdh50 16:b09f27c2dbe7 11
group-Hexiwear-Alert-System 0:6384ad26fe6c 12 #define NAME "RB"
group-Hexiwear-Alert-System 0:6384ad26fe6c 13
group-Hexiwear-Alert-System 0:6384ad26fe6c 14 #define LED_ON 0
group-Hexiwear-Alert-System 0:6384ad26fe6c 15 #define LED_OFF 1
group-Hexiwear-Alert-System 0:6384ad26fe6c 16 #define TRANSFER_SIZE 4
tdh50 3:065e8a7824d4 17
group-Hexiwear-Alert-System 0:6384ad26fe6c 18 void StartHaptic(void);
group-Hexiwear-Alert-System 0:6384ad26fe6c 19 void StopHaptic(void const *n);
tdh50 12:8db1b8fb5866 20 void txTask(void);
tdh50 5:09837d22b28f 21 void accelero(void);
tdh50 7:46729d931f26 22 void drawAccel(void);
tdh50 3:065e8a7824d4 23 void displayHome();
tdh50 16:b09f27c2dbe7 24
group-Hexiwear-Alert-System 0:6384ad26fe6c 25
tdh50 12:8db1b8fb5866 26
group-Hexiwear-Alert-System 0:6384ad26fe6c 27 DigitalOut redLed(LED1,1);
group-Hexiwear-Alert-System 0:6384ad26fe6c 28 DigitalOut greenLed(LED2,1);
group-Hexiwear-Alert-System 0:6384ad26fe6c 29 DigitalOut blueLed(LED3,1);
group-Hexiwear-Alert-System 0:6384ad26fe6c 30 DigitalOut haptic(PTB9);
group-Hexiwear-Alert-System 0:6384ad26fe6c 31
tdh50 11:deecd2b72129 32 // Define timer for haptic feedback
group-Hexiwear-Alert-System 0:6384ad26fe6c 33 RtosTimer hapticTimer(StopHaptic, osTimerOnce);
tdh50 16:b09f27c2dbe7 34 // Instantiates the FX0S8700 accelerometer driver
tdh50 5:09837d22b28f 35 FXOS8700 accel(PTC11, PTC10);
tdh50 11:deecd2b72129 36 // Instantiate the Hexi KW40Z Driver (UART TX, UART RX)
group-Hexiwear-Alert-System 0:6384ad26fe6c 37 KW40Z kw40z_device(PTE24, PTE25);
tdh50 5:09837d22b28f 38 Serial pc(USBTX, USBRX); // Serial interface
tdh50 11:deecd2b72129 39 // Instantiate the SSD1351 OLED Driver
tdh50 11:deecd2b72129 40 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // (MOSI,SCLK,POWER,CS,RST,DC)
group-Hexiwear-Alert-System 0:6384ad26fe6c 41 oled_text_properties_t textProperties = {0};
tdh50 12:8db1b8fb5866 42
tdh50 12:8db1b8fb5866 43
tdh50 12:8db1b8fb5866 44 /*Create a Thread to handle sending BLE Sensor Data */
tdh50 12:8db1b8fb5866 45 Thread txThread;
tdh50 12:8db1b8fb5866 46
tdh50 11:deecd2b72129 47 // Text Buffer
tdh50 5:09837d22b28f 48 char text1[20]; // Text Buffer for dynamic value displayed
tdh50 5:09837d22b28f 49 char text2[20]; // Text Buffer for dynamic value displayed
tdh50 5:09837d22b28f 50 char text3[20]; // Text Buffer for dynamic value displayed
tdh50 16:b09f27c2dbe7 51 char pass [20]; // Passcode
group-Hexiwear-Alert-System 0:6384ad26fe6c 52
tdh50 5:09837d22b28f 53 float accel_data[3]; // Storage for the data from the sensor
tdh50 5:09837d22b28f 54 float accel_rms=0.0; // RMS value from the sensor
group-Hexiwear-Alert-System 0:6384ad26fe6c 55 uint8_t screenNum=0;
tdh50 16:b09f27c2dbe7 56 bool alert = false; //Sets alarm to zero
tdh50 16:b09f27c2dbe7 57 uint8_t previous; //Keeps track of previous screen
tdh50 16:b09f27c2dbe7 58 bool trigger = false;
group-Hexiwear-Alert-System 0:6384ad26fe6c 59 bool sentMessageDisplayedFlag=0;
group-Hexiwear-Alert-System 0:6384ad26fe6c 60 char rxData[TRANSFER_SIZE];
tdh50 16:b09f27c2dbe7 61 char txData[TRANSFER_SIZE];//Data send via BLE
tdh50 16:b09f27c2dbe7 62 int16_t x=0,y=0,z=0;
group-Hexiwear-Alert-System 0:6384ad26fe6c 63
tdh50 11:deecd2b72129 64 // Pointer for the image to be displayed
tdh50 3:065e8a7824d4 65 const uint8_t *HeartBMP = HeartRate_bmp;
tdh50 3:065e8a7824d4 66 const uint8_t *FallBMP = FallDet_bmp;
tdh50 3:065e8a7824d4 67 const uint8_t *FallPageBMP = FallDetPage_bmp;
tdh50 3:065e8a7824d4 68 const uint8_t *HomeBMP = Home_bmp;
tdh50 3:065e8a7824d4 69 const uint8_t *HeartPageBMP = HeartRatePage_bmp;
DeanBritt 8:5532a9c895be 70 const uint8_t *AlertBMP = Alert_bmp;
DeanBritt 2:172492c41c48 71
tdh50 11:deecd2b72129 72 //***************************Call Back Functions******************************
tdh50 11:deecd2b72129 73 //Enter Button
group-Hexiwear-Alert-System 0:6384ad26fe6c 74 void ButtonRight(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 75 {
tdh50 7:46729d931f26 76 // All screens other than 1 have either and enter button
tdh50 7:46729d931f26 77 // or a home buttom.
DeanBritt 14:9e6b87e322a2 78 if(screenNum != 0) {
group-Hexiwear-Alert-System 0:6384ad26fe6c 79 StartHaptic();
tdh50 3:065e8a7824d4 80 switch(screenNum) {
DeanBritt 14:9e6b87e322a2 81 case 1: {
tdh50 16:b09f27c2dbe7 82 screenNum = screenNum + 2;
tdh50 16:b09f27c2dbe7 83
tdh50 3:065e8a7824d4 84 break;
tdh50 3:065e8a7824d4 85 }
tdh50 3:065e8a7824d4 86 case 2: {
tdh50 3:065e8a7824d4 87 screenNum = screenNum + 2;
tdh50 16:b09f27c2dbe7 88 trigger = true;
tdh50 3:065e8a7824d4 89 break;
tdh50 3:065e8a7824d4 90 }
DeanBritt 14:9e6b87e322a2 91 case 3:
DeanBritt 14:9e6b87e322a2 92 case 4: {
tdh50 3:065e8a7824d4 93 screenNum = 0;
tdh50 3:065e8a7824d4 94 break;
tdh50 3:065e8a7824d4 95 }
DeanBritt 14:9e6b87e322a2 96 case 5: {
tdh50 16:b09f27c2dbe7 97 screenNum = previous;
tdh50 16:b09f27c2dbe7 98 alert = false;
tdh50 11:deecd2b72129 99 break;
tdh50 11:deecd2b72129 100 }
tdh50 3:065e8a7824d4 101 default: {
tdh50 3:065e8a7824d4 102 break;
tdh50 3:065e8a7824d4 103 }
tdh50 3:065e8a7824d4 104 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 105 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 106 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 107
tdh50 11:deecd2b72129 108 //Back Button
group-Hexiwear-Alert-System 0:6384ad26fe6c 109 void ButtonLeft(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 110 {
tdh50 16:b09f27c2dbe7 111
tdh50 16:b09f27c2dbe7 112 if(screenNum > 0 && screenNum != 5) {
tdh50 16:b09f27c2dbe7 113 StartHaptic();
tdh50 3:065e8a7824d4 114 //Allow user to go back to correct screen based on srceen number
tdh50 16:b09f27c2dbe7 115 if(screenNum == 2 || screenNum == 3 || screenNum == 4) {
tdh50 3:065e8a7824d4 116 screenNum = screenNum - 2;
tdh50 7:46729d931f26 117 } else {
tdh50 3:065e8a7824d4 118 screenNum--;
tdh50 11:deecd2b72129 119 }
tdh50 16:b09f27c2dbe7 120 } else {
tdh50 16:b09f27c2dbe7 121 StartHaptic();
DeanBritt 14:9e6b87e322a2 122 screenNum = 5;
DeanBritt 8:5532a9c895be 123 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 124 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 125
tdh50 7:46729d931f26 126 //Advances to Heartrate only when user
tdh50 11:deecd2b72129 127 //is on Hexisafe screen
group-Hexiwear-Alert-System 0:6384ad26fe6c 128 void ButtonUp(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 129 {
DeanBritt 14:9e6b87e322a2 130 if (screenNum == 0) {
group-Hexiwear-Alert-System 0:6384ad26fe6c 131 StartHaptic();
tdh50 3:065e8a7824d4 132 screenNum++;
tdh50 3:065e8a7824d4 133 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 134
tdh50 3:065e8a7824d4 135
group-Hexiwear-Alert-System 0:6384ad26fe6c 136 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 137
tdh50 7:46729d931f26 138 //Advances to Fall Detection only when user
tdh50 11:deecd2b72129 139 //is on Hexisafe screen
group-Hexiwear-Alert-System 0:6384ad26fe6c 140 void ButtonDown(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 141 {
DeanBritt 14:9e6b87e322a2 142 if (screenNum == 0) {
tdh50 3:065e8a7824d4 143 StartHaptic();
tdh50 3:065e8a7824d4 144 screenNum= screenNum + 2;
tdh50 16:b09f27c2dbe7 145
group-Hexiwear-Alert-System 0:6384ad26fe6c 146 }
tdh50 3:065e8a7824d4 147
group-Hexiwear-Alert-System 0:6384ad26fe6c 148 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 149
tdh50 12:8db1b8fb5866 150 void PassKey(void)
tdh50 12:8db1b8fb5866 151 {
tdh50 12:8db1b8fb5866 152 StartHaptic();
tdh50 16:b09f27c2dbe7 153 strcpy((char *) pass,"PAIR CODE");
tdh50 16:b09f27c2dbe7 154 oled.TextBox((uint8_t *)pass,0,25,95,18);
tdh50 12:8db1b8fb5866 155
tdh50 12:8db1b8fb5866 156 /* Display Bond Pass Key in a 95px by 18px textbox at x=0,y=40 */
tdh50 16:b09f27c2dbe7 157 sprintf(pass,"%d", kw40z_device.GetPassKey());
tdh50 16:b09f27c2dbe7 158 oled.TextBox((uint8_t *)pass,0,40,95,18);
tdh50 12:8db1b8fb5866 159 }
tdh50 12:8db1b8fb5866 160
group-Hexiwear-Alert-System 0:6384ad26fe6c 161
tdh50 11:deecd2b72129 162 //**********************End of Call Back Functions****************************
group-Hexiwear-Alert-System 0:6384ad26fe6c 163
tdh50 11:deecd2b72129 164 //*******************************Main*****************************************
group-Hexiwear-Alert-System 0:6384ad26fe6c 165
group-Hexiwear-Alert-System 0:6384ad26fe6c 166 int main()
tdh50 3:065e8a7824d4 167 {
tdh50 11:deecd2b72129 168 accel.accel_config();
tdh50 3:065e8a7824d4 169
tdh50 16:b09f27c2dbe7 170 // Get & set OLED Class Default Text Properties
tdh50 3:065e8a7824d4 171 oled.GetTextProperties(&textProperties);
tdh50 16:b09f27c2dbe7 172 oled_text_properties_t textProperties = {0};
tdh50 16:b09f27c2dbe7 173 oled.SetTextProperties(&textProperties);
tdh50 16:b09f27c2dbe7 174
tdh50 11:deecd2b72129 175 // Register callbacks to application functions
group-Hexiwear-Alert-System 0:6384ad26fe6c 176 kw40z_device.attach_buttonLeft(&ButtonLeft);
group-Hexiwear-Alert-System 0:6384ad26fe6c 177 kw40z_device.attach_buttonRight(&ButtonRight);
group-Hexiwear-Alert-System 0:6384ad26fe6c 178 kw40z_device.attach_buttonUp(&ButtonUp);
group-Hexiwear-Alert-System 0:6384ad26fe6c 179 kw40z_device.attach_buttonDown(&ButtonDown);
tdh50 16:b09f27c2dbe7 180
tdh50 16:b09f27c2dbe7 181 uint8_t num = 0;
tdh50 16:b09f27c2dbe7 182 displayHome();
tdh50 12:8db1b8fb5866 183
tdh50 12:8db1b8fb5866 184 //Passcode
tdh50 12:8db1b8fb5866 185 kw40z_device.attach_passkey(&PassKey);
tdh50 3:065e8a7824d4 186
tdh50 16:b09f27c2dbe7 187 //Change font color to white
group-Hexiwear-Alert-System 0:6384ad26fe6c 188 textProperties.fontColor = COLOR_WHITE;
group-Hexiwear-Alert-System 0:6384ad26fe6c 189 textProperties.alignParam = OLED_TEXT_ALIGN_CENTER;
tdh50 12:8db1b8fb5866 190
tdh50 16:b09f27c2dbe7 191 txThread.start(txTask); //Start transmitting Sensor Tag Data
tdh50 3:065e8a7824d4 192
tdh50 3:065e8a7824d4 193 while (true) {
tdh50 11:deecd2b72129 194 accel.acquire_accel_data_g(accel_data);
tdh50 11:deecd2b72129 195 accel_rms = sqrt(((accel_data[0]*accel_data[0])+(accel_data[1]*accel_data[1])+(accel_data[2]*accel_data[2]))/3);
tdh50 12:8db1b8fb5866 196 x = accel_data[0] *10000;
tdh50 12:8db1b8fb5866 197 y = accel_data[1] *10000;
tdh50 12:8db1b8fb5866 198 z = accel_data[2] *10000;
tdh50 16:b09f27c2dbe7 199 //Displays the screen number, and the Alert Value
tdh50 16:b09f27c2dbe7 200 printf("Screen = %i Num = %i alert = %d\n\r",screenNum,num,alert);
tdh50 16:b09f27c2dbe7 201 //printf("%4.4f\n\r",accel_rms);
tdh50 16:b09f27c2dbe7 202 if(accel_rms*10 > 12.4)//Triggers alarmbmp if fall is detected
tdh50 16:b09f27c2dbe7 203 {
tdh50 16:b09f27c2dbe7 204 oled.DrawImage(AlertBMP,0,0);
tdh50 16:b09f27c2dbe7 205 previous = screenNum;//Allows to return to previous screen.
tdh50 16:b09f27c2dbe7 206 num = screenNum - 1;//^
tdh50 16:b09f27c2dbe7 207 screenNum = 5;
tdh50 16:b09f27c2dbe7 208 alert = true;
tdh50 11:deecd2b72129 209 }
tdh50 16:b09f27c2dbe7 210 if((screenNum != num && alert == false) || screenNum == 4) {
tdh50 16:b09f27c2dbe7 211 switch(screenNum) {
tdh50 16:b09f27c2dbe7 212 case 0: {
tdh50 16:b09f27c2dbe7 213 displayHome();
tdh50 16:b09f27c2dbe7 214 num = screenNum;
tdh50 16:b09f27c2dbe7 215 break;
tdh50 16:b09f27c2dbe7 216 }
tdh50 16:b09f27c2dbe7 217 case 1: {
tdh50 16:b09f27c2dbe7 218 //Switching to HeartBMP
tdh50 16:b09f27c2dbe7 219 oled.DrawImage(HeartBMP,0,0);
tdh50 16:b09f27c2dbe7 220 num = screenNum;
tdh50 16:b09f27c2dbe7 221 break;
tdh50 16:b09f27c2dbe7 222 }
tdh50 16:b09f27c2dbe7 223 case 2: {
tdh50 16:b09f27c2dbe7 224 //Switching to FallBMP
tdh50 16:b09f27c2dbe7 225 oled.DrawImage(FallBMP,0,0);
tdh50 16:b09f27c2dbe7 226 num = screenNum;
tdh50 16:b09f27c2dbe7 227 break;
tdh50 16:b09f27c2dbe7 228 }
tdh50 16:b09f27c2dbe7 229 case 3: {
tdh50 16:b09f27c2dbe7 230 //Switching to HeartPageBMP
tdh50 16:b09f27c2dbe7 231 oled.DrawImage(HeartPageBMP,0,0);
tdh50 16:b09f27c2dbe7 232 num = screenNum;
tdh50 16:b09f27c2dbe7 233 break;
tdh50 16:b09f27c2dbe7 234 }
tdh50 16:b09f27c2dbe7 235 case 4: {
tdh50 16:b09f27c2dbe7 236 //Switching to FallPageBMP
tdh50 16:b09f27c2dbe7 237 if(trigger == true) {
tdh50 16:b09f27c2dbe7 238 oled.DrawBox (23,18,50 ,50 , COLOR_BLACK);
tdh50 16:b09f27c2dbe7 239 trigger = false;
tdh50 16:b09f27c2dbe7 240 }
tdh50 16:b09f27c2dbe7 241 drawAccel();
tdh50 16:b09f27c2dbe7 242 num = screenNum;
tdh50 16:b09f27c2dbe7 243 break;
tdh50 16:b09f27c2dbe7 244 }
tdh50 16:b09f27c2dbe7 245 case 5: {
tdh50 16:b09f27c2dbe7 246 //Switching to alarm
tdh50 16:b09f27c2dbe7 247 oled.DrawImage(AlertBMP,0,0);
tdh50 16:b09f27c2dbe7 248 num = screenNum;
tdh50 16:b09f27c2dbe7 249 break;
tdh50 16:b09f27c2dbe7 250 }
tdh50 16:b09f27c2dbe7 251 default: {
tdh50 16:b09f27c2dbe7 252 break;
tdh50 16:b09f27c2dbe7 253 }
tdh50 16:b09f27c2dbe7 254 }
tdh50 16:b09f27c2dbe7 255 }
tdh50 16:b09f27c2dbe7 256 Thread::wait(100);
group-Hexiwear-Alert-System 0:6384ad26fe6c 257 }
tdh50 12:8db1b8fb5866 258
tdh50 12:8db1b8fb5866 259
group-Hexiwear-Alert-System 0:6384ad26fe6c 260 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 261
tdh50 11:deecd2b72129 262 //*****************************End of Main************************************
tdh50 3:065e8a7824d4 263 //Intiates Vibration
tdh50 3:065e8a7824d4 264 void StartHaptic(void)
tdh50 3:065e8a7824d4 265 {
group-Hexiwear-Alert-System 0:6384ad26fe6c 266 hapticTimer.start(50);
group-Hexiwear-Alert-System 0:6384ad26fe6c 267 haptic = 1;
group-Hexiwear-Alert-System 0:6384ad26fe6c 268 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 269
tdh50 3:065e8a7824d4 270 void StopHaptic(void const *n)
tdh50 3:065e8a7824d4 271 {
group-Hexiwear-Alert-System 0:6384ad26fe6c 272 haptic = 0;
group-Hexiwear-Alert-System 0:6384ad26fe6c 273 hapticTimer.stop();
group-Hexiwear-Alert-System 0:6384ad26fe6c 274 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 275
tdh50 3:065e8a7824d4 276 void displayHome(void)
group-Hexiwear-Alert-System 0:6384ad26fe6c 277 {
tdh50 3:065e8a7824d4 278 oled.DrawImage(HomeBMP,0,0);
tdh50 3:065e8a7824d4 279 }
group-Hexiwear-Alert-System 0:6384ad26fe6c 280
tdh50 11:deecd2b72129 281 void drawAccel(void)
tdh50 11:deecd2b72129 282 {
tdh50 5:09837d22b28f 283
tdh50 12:8db1b8fb5866 284 textProperties.fontColor = COLOR_GREEN;
tdh50 11:deecd2b72129 285 textProperties.alignParam = OLED_TEXT_ALIGN_LEFT;
tdh50 11:deecd2b72129 286 oled.SetTextProperties(&textProperties);
tdh50 5:09837d22b28f 287
tdh50 11:deecd2b72129 288 // Display Legends
tdh50 11:deecd2b72129 289 strcpy((char *) text1,"X-Axis (g):");
tdh50 11:deecd2b72129 290 oled.Label((uint8_t *)text1,5,26);
tdh50 11:deecd2b72129 291 strcpy((char *) text2,"Y-Axis (g):");
tdh50 11:deecd2b72129 292 oled.Label((uint8_t *)text2,5,43);
tdh50 11:deecd2b72129 293 strcpy((char *) text3,"Z-Axis (g):");
tdh50 11:deecd2b72129 294 oled.Label((uint8_t *)text3,5,60);
tdh50 7:46729d931f26 295
tdh50 11:deecd2b72129 296 // Format the value
tdh50 12:8db1b8fb5866 297 sprintf(text1,"%4.2f", accel_data[0]);
tdh50 12:8db1b8fb5866 298 // Display time reading in 35px by 15px textbox at(x=55, y=40)
tdh50 12:8db1b8fb5866 299 oled.TextBox((uint8_t *)text1,70,26,20,15); //Increase textbox for more digits
tdh50 12:8db1b8fb5866 300
tdh50 12:8db1b8fb5866 301 // Format the value
tdh50 12:8db1b8fb5866 302 sprintf(text2,"%4.2f",accel_data[1]);
tdh50 12:8db1b8fb5866 303 // Display time reading in 35px by 15px textbox at(x=55, y=40)
tdh50 12:8db1b8fb5866 304 oled.TextBox((uint8_t *)text2,70,43,20,15); //Increase textbox for more digits
tdh50 12:8db1b8fb5866 305
tdh50 12:8db1b8fb5866 306
tdh50 12:8db1b8fb5866 307 // Format the value
tdh50 12:8db1b8fb5866 308 sprintf(text3,"%4.2f", accel_data[2]);
tdh50 11:deecd2b72129 309 // Display time reading in 35px by 15px textbox at(x=55, y=40)
tdh50 11:deecd2b72129 310 oled.TextBox((uint8_t *)text3,70,60,20,15); //Increase textbox for more digits
tdh50 7:46729d931f26 311
tdh50 11:deecd2b72129 312 }
tdh50 12:8db1b8fb5866 313
tdh50 12:8db1b8fb5866 314 // txTask() transmits the sensor data
tdh50 12:8db1b8fb5866 315 void txTask(void)
tdh50 11:deecd2b72129 316 {
tdh50 12:8db1b8fb5866 317 while (true) {
tdh50 12:8db1b8fb5866 318 //UpdateSensorData();
tdh50 12:8db1b8fb5866 319 kw40z_device.SendSetApplicationMode(GUI_CURRENT_APP_SENSOR_TAG);
tdh50 12:8db1b8fb5866 320 //Send Accel Data.
tdh50 12:8db1b8fb5866 321 kw40z_device.SendAccel(x,y,z);
tdh50 16:b09f27c2dbe7 322 Thread::wait(1000);
tdh50 7:46729d931f26 323 }
tdh50 16:b09f27c2dbe7 324 }