Here
Dependencies: Hexi_KW40Z Hexi_OLED_SSD1351 nRF24L01 FXOS8700
main.cpp@10:3a13cb84e64f, 2017-03-13 (annotated)
- Committer:
- tdh50
- Date:
- Mon Mar 13 19:25:19 2017 +0000
- Revision:
- 10:3a13cb84e64f
- Parent:
- 7:46729d931f26
Fixing Acc
Who changed what in which revision?
User | Revision | Line number | New 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 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 11 | #define NAME "RB" |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 12 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 13 | #define LED_ON 0 |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 14 | #define LED_OFF 1 |
tdh50 | 3:065e8a7824d4 | 15 | #define NUM_OF_SCREENS 4 |
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); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 20 | void txTask(void); |
tdh50 | 3:065e8a7824d4 | 21 | void displayHome(); |
tdh50 | 3:065e8a7824d4 | 22 | void screenHandler(uint8_t screen); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 23 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 24 | DigitalOut redLed(LED1,1); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 25 | DigitalOut greenLed(LED2,1); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 26 | DigitalOut blueLed(LED3,1); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 27 | DigitalOut haptic(PTB9); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 28 | |
tdh50 | 10:3a13cb84e64f | 29 | // Define timer for haptic feedback |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 30 | RtosTimer hapticTimer(StopHaptic, osTimerOnce); |
tdh50 | 10:3a13cb84e64f | 31 | // |
tdh50 | 5:09837d22b28f | 32 | FXOS8700 accel(PTC11, PTC10); |
tdh50 | 10:3a13cb84e64f | 33 | // Instantiate the Hexi KW40Z Driver (UART TX, UART RX) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 34 | KW40Z kw40z_device(PTE24, PTE25); |
tdh50 | 5:09837d22b28f | 35 | Serial pc(USBTX, USBRX); // Serial interface |
tdh50 | 10:3a13cb84e64f | 36 | // Instantiate the SSD1351 OLED Driver |
tdh50 | 10:3a13cb84e64f | 37 | SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // (MOSI,SCLK,POWER,CS,RST,DC) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 38 | oled_text_properties_t textProperties = {0}; |
tdh50 | 10:3a13cb84e64f | 39 | // Instantiate the nRF24L01P Driver |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 40 | nRF24L01P my_nrf24l01p(PTC6,PTC7,PTC5,PTC4,PTB2,NC); // mosi, miso, sck, csn, ce, irq |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 41 | |
tdh50 | 10:3a13cb84e64f | 42 | // Text Buffer |
tdh50 | 5:09837d22b28f | 43 | char text1[20]; // Text Buffer for dynamic value displayed |
tdh50 | 5:09837d22b28f | 44 | char text2[20]; // Text Buffer for dynamic value displayed |
tdh50 | 5:09837d22b28f | 45 | char text3[20]; // Text Buffer for dynamic value displayed |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 46 | |
tdh50 | 5:09837d22b28f | 47 | float accel_data[3]; // Storage for the data from the sensor |
tdh50 | 5:09837d22b28f | 48 | float accel_rms=0.0; // RMS value from the sensor |
tdh50 | 5:09837d22b28f | 49 | float ax, ay, az; // Integer value from the sensor to be displayed |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 50 | uint8_t screenNum=0; |
tdh50 | 3:065e8a7824d4 | 51 | bool prefix=0; |
tdh50 | 5:09837d22b28f | 52 | bool accelerometer = false; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 53 | bool sentMessageDisplayedFlag=0; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 54 | char rxData[TRANSFER_SIZE]; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 55 | char txData[TRANSFER_SIZE]; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 56 | |
tdh50 | 10:3a13cb84e64f | 57 | // Pointer for the image to be displayed |
DeanBritt | 2:172492c41c48 | 58 | const uint8_t *SafeBMP = HexiSafe96_bmp; |
tdh50 | 3:065e8a7824d4 | 59 | const uint8_t *HeartBMP = HeartRate_bmp; |
tdh50 | 3:065e8a7824d4 | 60 | const uint8_t *FallBMP = FallDet_bmp; |
tdh50 | 3:065e8a7824d4 | 61 | const uint8_t *FallPageBMP = FallDetPage_bmp; |
tdh50 | 3:065e8a7824d4 | 62 | const uint8_t *HomeBMP = Home_bmp; |
tdh50 | 3:065e8a7824d4 | 63 | const uint8_t *HeartPageBMP = HeartRatePage_bmp; |
DeanBritt | 2:172492c41c48 | 64 | |
tdh50 | 3:065e8a7824d4 | 65 | |
tdh50 | 10:3a13cb84e64f | 66 | //***************************Call Back Functions****************************** |
tdh50 | 10:3a13cb84e64f | 67 | //Enter Button |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 68 | void ButtonRight(void) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 69 | { |
tdh50 | 7:46729d931f26 | 70 | // All screens other than 1 have either and enter button |
tdh50 | 7:46729d931f26 | 71 | // or a home buttom. |
tdh50 | 3:065e8a7824d4 | 72 | if(screenNum != 1) { |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 73 | StartHaptic(); |
tdh50 | 3:065e8a7824d4 | 74 | switch(screenNum) { |
tdh50 | 3:065e8a7824d4 | 75 | case 0: { |
tdh50 | 3:065e8a7824d4 | 76 | screenNum++; |
tdh50 | 3:065e8a7824d4 | 77 | screenHandler(screenNum); |
tdh50 | 3:065e8a7824d4 | 78 | break; |
tdh50 | 3:065e8a7824d4 | 79 | } |
tdh50 | 3:065e8a7824d4 | 80 | case 2: { |
tdh50 | 3:065e8a7824d4 | 81 | screenNum = screenNum + 2; |
tdh50 | 3:065e8a7824d4 | 82 | screenHandler(screenNum); |
tdh50 | 3:065e8a7824d4 | 83 | break; |
tdh50 | 3:065e8a7824d4 | 84 | } |
tdh50 | 3:065e8a7824d4 | 85 | case 3: { |
tdh50 | 3:065e8a7824d4 | 86 | screenNum = screenNum + 2; |
tdh50 | 3:065e8a7824d4 | 87 | screenHandler(screenNum); |
tdh50 | 3:065e8a7824d4 | 88 | break; |
tdh50 | 3:065e8a7824d4 | 89 | } |
tdh50 | 3:065e8a7824d4 | 90 | case 4: |
tdh50 | 3:065e8a7824d4 | 91 | case 5: { |
tdh50 | 5:09837d22b28f | 92 | accelerometer = false; |
tdh50 | 3:065e8a7824d4 | 93 | screenNum = 0; |
tdh50 | 3:065e8a7824d4 | 94 | break; |
tdh50 | 3:065e8a7824d4 | 95 | } |
tdh50 | 3:065e8a7824d4 | 96 | default: { |
tdh50 | 3:065e8a7824d4 | 97 | break; |
tdh50 | 3:065e8a7824d4 | 98 | } |
tdh50 | 3:065e8a7824d4 | 99 | } |
tdh50 | 5:09837d22b28f | 100 | screenHandler(screenNum); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 101 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 102 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 103 | |
tdh50 | 10:3a13cb84e64f | 104 | //Back Button |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 105 | void ButtonLeft(void) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 106 | { |
tdh50 | 3:065e8a7824d4 | 107 | if(screenNum > 0) { |
tdh50 | 3:065e8a7824d4 | 108 | StartHaptic(); |
tdh50 | 3:065e8a7824d4 | 109 | //Allow user to go back to correct screen based on srceen number |
tdh50 | 3:065e8a7824d4 | 110 | //Refer to screenHandler for screen numbers |
tdh50 | 3:065e8a7824d4 | 111 | if(screenNum == 3 || screenNum == 4 || screenNum == 5) { |
tdh50 | 3:065e8a7824d4 | 112 | screenNum = screenNum - 2; |
tdh50 | 5:09837d22b28f | 113 | accelerometer = false; |
tdh50 | 7:46729d931f26 | 114 | } else { |
tdh50 | 3:065e8a7824d4 | 115 | screenNum--; |
tdh50 | 3:065e8a7824d4 | 116 | } |
tdh50 | 3:065e8a7824d4 | 117 | screenHandler(screenNum); |
tdh50 | 3:065e8a7824d4 | 118 | } |
tdh50 | 3:065e8a7824d4 | 119 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 120 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 121 | |
tdh50 | 7:46729d931f26 | 122 | //Advances to Heartrate only when user |
tdh50 | 10:3a13cb84e64f | 123 | //is on Hexisafe screen |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 124 | void ButtonUp(void) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 125 | { |
tdh50 | 3:065e8a7824d4 | 126 | if (screenNum == 1) { |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 127 | StartHaptic(); |
tdh50 | 3:065e8a7824d4 | 128 | screenNum++; |
tdh50 | 3:065e8a7824d4 | 129 | screenHandler(screenNum); |
tdh50 | 3:065e8a7824d4 | 130 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 131 | |
tdh50 | 3:065e8a7824d4 | 132 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 133 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 134 | |
tdh50 | 7:46729d931f26 | 135 | //Advances to Fall Detection only when user |
tdh50 | 10:3a13cb84e64f | 136 | //is on Hexisafe screen |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 137 | void ButtonDown(void) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 138 | { |
tdh50 | 3:065e8a7824d4 | 139 | if (screenNum == 1) { |
tdh50 | 3:065e8a7824d4 | 140 | StartHaptic(); |
tdh50 | 3:065e8a7824d4 | 141 | screenNum= screenNum + 2; |
tdh50 | 3:065e8a7824d4 | 142 | screenHandler(screenNum); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 143 | } |
tdh50 | 3:065e8a7824d4 | 144 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 145 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 146 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 147 | |
tdh50 | 10:3a13cb84e64f | 148 | //**********************End of Call Back Functions**************************** |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 149 | |
tdh50 | 10:3a13cb84e64f | 150 | //*******************************Main***************************************** |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 151 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 152 | int main() |
tdh50 | 3:065e8a7824d4 | 153 | { |
tdh50 | 10:3a13cb84e64f | 154 | // Wait Sequence in the beginning for board to be reset then placed in mini docking station |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 155 | blueLed=1; |
tdh50 | 3:065e8a7824d4 | 156 | |
tdh50 | 10:3a13cb84e64f | 157 | accel.accel_config(); |
tdh50 | 10:3a13cb84e64f | 158 | //oled.DrawImage(FallPageBMP,0,0); |
tdh50 | 10:3a13cb84e64f | 159 | int count = 0;// count data reading for accelerometer |
tdh50 | 10:3a13cb84e64f | 160 | // Fill 96px by 96px Screen with 96px by 96px Image starting at x=0,y= |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 161 | |
tdh50 | 3:065e8a7824d4 | 162 | |
tdh50 | 10:3a13cb84e64f | 163 | // Get OLED Class Default Text Properties |
tdh50 | 3:065e8a7824d4 | 164 | oled.GetTextProperties(&textProperties); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 165 | |
tdh50 | 10:3a13cb84e64f | 166 | // Register callbacks to application functions |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 167 | kw40z_device.attach_buttonLeft(&ButtonLeft); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 168 | kw40z_device.attach_buttonRight(&ButtonRight); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 169 | kw40z_device.attach_buttonUp(&ButtonUp); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 170 | kw40z_device.attach_buttonDown(&ButtonDown); |
tdh50 | 3:065e8a7824d4 | 171 | |
tdh50 | 10:3a13cb84e64f | 172 | // Change font color to white |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 173 | textProperties.fontColor = COLOR_WHITE; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 174 | textProperties.alignParam = OLED_TEXT_ALIGN_CENTER; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 175 | oled.SetTextProperties(&textProperties); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 176 | |
tdh50 | 10:3a13cb84e64f | 177 | //Displays the Home Screen |
tdh50 | 3:065e8a7824d4 | 178 | displayHome(); |
tdh50 | 3:065e8a7824d4 | 179 | |
tdh50 | 3:065e8a7824d4 | 180 | while (true) { |
tdh50 | 10:3a13cb84e64f | 181 | accel.acquire_accel_data_g(accel_data); |
tdh50 | 10:3a13cb84e64f | 182 | accel_rms = sqrt(((accel_data[0]*accel_data[0])+(accel_data[1]*accel_data[1])+(accel_data[2]*accel_data[2]))/3); |
tdh50 | 10:3a13cb84e64f | 183 | printf("%4.2f\n\r",accel_rms); |
tdh50 | 10:3a13cb84e64f | 184 | wait(0.01); |
tdh50 | 10:3a13cb84e64f | 185 | greenLed = !greenLed ; |
tdh50 | 10:3a13cb84e64f | 186 | if(screenNum == 5) { |
tdh50 | 10:3a13cb84e64f | 187 | oled.DrawImage(FallPageBMP,0,0); |
tdh50 | 10:3a13cb84e64f | 188 | while(screenNum == 5) { |
tdh50 | 10:3a13cb84e64f | 189 | ax = accel_data[0]; |
tdh50 | 10:3a13cb84e64f | 190 | ay = accel_data[1]; |
tdh50 | 10:3a13cb84e64f | 191 | az = accel_data[2]; |
tdh50 | 10:3a13cb84e64f | 192 | // Get OLED Class Default Text Properties |
tdh50 | 10:3a13cb84e64f | 193 | oled_text_properties_t textProperties = {0}; |
tdh50 | 10:3a13cb84e64f | 194 | oled.GetTextProperties(&textProperties); |
tdh50 | 10:3a13cb84e64f | 195 | |
tdh50 | 10:3a13cb84e64f | 196 | // Set text properties to white and right aligned for the dynamic text |
tdh50 | 10:3a13cb84e64f | 197 | textProperties.fontColor = COLOR_BLUE; |
tdh50 | 10:3a13cb84e64f | 198 | textProperties.alignParam = OLED_TEXT_ALIGN_LEFT; |
tdh50 | 10:3a13cb84e64f | 199 | oled.SetTextProperties(&textProperties); |
tdh50 | 10:3a13cb84e64f | 200 | |
tdh50 | 10:3a13cb84e64f | 201 | // Display Legends |
tdh50 | 10:3a13cb84e64f | 202 | strcpy((char *) text1,"X-Axis (g):"); |
tdh50 | 10:3a13cb84e64f | 203 | oled.Label((uint8_t *)text1,5,26); |
tdh50 | 10:3a13cb84e64f | 204 | |
tdh50 | 10:3a13cb84e64f | 205 | // Format the value |
tdh50 | 10:3a13cb84e64f | 206 | sprintf(text1,"%4.2f",ax); |
tdh50 | 10:3a13cb84e64f | 207 | // Display time reading in 35px by 15px textbox at(x=55, y=40) |
tdh50 | 10:3a13cb84e64f | 208 | oled.TextBox((uint8_t *)text1,70,26,20,15); //Increase textbox for more digits |
tdh50 | 10:3a13cb84e64f | 209 | |
tdh50 | 10:3a13cb84e64f | 210 | // Set text properties to white and right aligned for the dynamic text |
tdh50 | 10:3a13cb84e64f | 211 | textProperties.fontColor = COLOR_GREEN; |
tdh50 | 10:3a13cb84e64f | 212 | textProperties.alignParam = OLED_TEXT_ALIGN_LEFT; |
tdh50 | 10:3a13cb84e64f | 213 | oled.SetTextProperties(&textProperties); |
tdh50 | 10:3a13cb84e64f | 214 | |
tdh50 | 10:3a13cb84e64f | 215 | // Display Legends |
tdh50 | 10:3a13cb84e64f | 216 | strcpy((char *) text2,"Y-Axis (g):"); |
tdh50 | 10:3a13cb84e64f | 217 | oled.Label((uint8_t *)text2,5,43); |
tdh50 | 10:3a13cb84e64f | 218 | |
tdh50 | 10:3a13cb84e64f | 219 | // Format the value |
tdh50 | 10:3a13cb84e64f | 220 | sprintf(text2,"%4.2f",ay); |
tdh50 | 10:3a13cb84e64f | 221 | // Display time reading in 35px by 15px textbox at(x=55, y=40) |
tdh50 | 10:3a13cb84e64f | 222 | oled.TextBox((uint8_t *)text2,70,43,20,15); //Increase textbox for more digits |
tdh50 | 10:3a13cb84e64f | 223 | |
tdh50 | 10:3a13cb84e64f | 224 | // Set text properties to white and right aligned for the dynamic text |
tdh50 | 10:3a13cb84e64f | 225 | textProperties.fontColor = COLOR_RED; |
tdh50 | 10:3a13cb84e64f | 226 | textProperties.alignParam = OLED_TEXT_ALIGN_LEFT; |
tdh50 | 10:3a13cb84e64f | 227 | oled.SetTextProperties(&textProperties); |
tdh50 | 10:3a13cb84e64f | 228 | |
tdh50 | 10:3a13cb84e64f | 229 | // Display Legends |
tdh50 | 10:3a13cb84e64f | 230 | strcpy((char *) text3,"Z-Axis (g):"); |
tdh50 | 10:3a13cb84e64f | 231 | oled.Label((uint8_t *)text3,5,60); |
tdh50 | 10:3a13cb84e64f | 232 | |
tdh50 | 10:3a13cb84e64f | 233 | // Format the value |
tdh50 | 10:3a13cb84e64f | 234 | sprintf(text3,"%4.2f",az); |
tdh50 | 10:3a13cb84e64f | 235 | // Display time reading in 35px by 15px textbox at(x=55, y=40) |
tdh50 | 10:3a13cb84e64f | 236 | oled.TextBox((uint8_t *)text3,70,60,20,15); //Increase textbox for more digits |
tdh50 | 10:3a13cb84e64f | 237 | |
tdh50 | 10:3a13cb84e64f | 238 | } |
tdh50 | 10:3a13cb84e64f | 239 | } |
tdh50 | 10:3a13cb84e64f | 240 | //accelero(screenNum); |
tdh50 | 10:3a13cb84e64f | 241 | printf("Here\n"); |
tdh50 | 10:3a13cb84e64f | 242 | Thread::wait(100); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 243 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 244 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 245 | |
tdh50 | 10:3a13cb84e64f | 246 | //*****************************End of Main************************************ |
tdh50 | 3:065e8a7824d4 | 247 | //Intiates Vibration |
tdh50 | 3:065e8a7824d4 | 248 | void StartHaptic(void) |
tdh50 | 3:065e8a7824d4 | 249 | { |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 250 | hapticTimer.start(50); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 251 | haptic = 1; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 252 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 253 | |
tdh50 | 3:065e8a7824d4 | 254 | void StopHaptic(void const *n) |
tdh50 | 3:065e8a7824d4 | 255 | { |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 256 | haptic = 0; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 257 | hapticTimer.stop(); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 258 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 259 | |
tdh50 | 3:065e8a7824d4 | 260 | void displayHome(void) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 261 | { |
tdh50 | 3:065e8a7824d4 | 262 | oled.DrawImage(HomeBMP,0,0); |
tdh50 | 3:065e8a7824d4 | 263 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 264 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 265 | |
tdh50 | 3:065e8a7824d4 | 266 | void screenHandler(uint8_t screen) |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 267 | { |
tdh50 | 3:065e8a7824d4 | 268 | //Switching screens |
tdh50 | 3:065e8a7824d4 | 269 | switch(screen) { |
tdh50 | 3:065e8a7824d4 | 270 | case 0: { |
tdh50 | 3:065e8a7824d4 | 271 | displayHome(); |
tdh50 | 3:065e8a7824d4 | 272 | break; |
tdh50 | 3:065e8a7824d4 | 273 | } |
tdh50 | 3:065e8a7824d4 | 274 | case 1: { |
tdh50 | 3:065e8a7824d4 | 275 | //Switching to SafeBMP |
tdh50 | 3:065e8a7824d4 | 276 | oled.DrawImage(SafeBMP,0,0); |
tdh50 | 3:065e8a7824d4 | 277 | break; |
tdh50 | 3:065e8a7824d4 | 278 | } |
tdh50 | 3:065e8a7824d4 | 279 | case 2: { |
tdh50 | 3:065e8a7824d4 | 280 | //Switching to HeartBMP |
tdh50 | 3:065e8a7824d4 | 281 | oled.DrawImage(HeartBMP,0,0); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 282 | break; |
tdh50 | 3:065e8a7824d4 | 283 | } |
tdh50 | 3:065e8a7824d4 | 284 | case 3: { |
tdh50 | 3:065e8a7824d4 | 285 | //Switching to FallBMP |
tdh50 | 3:065e8a7824d4 | 286 | oled.DrawImage(FallBMP,0,0); |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 287 | break; |
tdh50 | 3:065e8a7824d4 | 288 | } |
tdh50 | 3:065e8a7824d4 | 289 | case 4: { |
tdh50 | 3:065e8a7824d4 | 290 | //Switching to HeartPageBMP |
tdh50 | 3:065e8a7824d4 | 291 | oled.DrawImage(HeartPageBMP,0,0); |
tdh50 | 3:065e8a7824d4 | 292 | break; |
tdh50 | 3:065e8a7824d4 | 293 | } |
tdh50 | 3:065e8a7824d4 | 294 | case 5: { |
tdh50 | 3:065e8a7824d4 | 295 | //Switching to FallPageBMP |
tdh50 | 10:3a13cb84e64f | 296 | //oled.DrawImage(FallPageBMP,0,0); |
tdh50 | 10:3a13cb84e64f | 297 | |
tdh50 | 3:065e8a7824d4 | 298 | break; |
tdh50 | 3:065e8a7824d4 | 299 | } |
tdh50 | 3:065e8a7824d4 | 300 | default: { |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 301 | break; |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 302 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 303 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 304 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 305 | |
tdh50 | 3:065e8a7824d4 | 306 | //Append Initials to txData[2:3]. |
tdh50 | 3:065e8a7824d4 | 307 | //strcat(txData,NAME); |
tdh50 | 3:065e8a7824d4 | 308 | |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 309 | } |
group-Hexiwear-Alert-System | 0:6384ad26fe6c | 310 | |
tdh50 | 5:09837d22b28f | 311 |