
Show2Me control FW, initial shared version
Dependencies: SDFileSystem_HelloWorld mbed FATFileSystem
Fork of 000_GEO_SHOW2ME_OK_F411RE by
main.cpp@2:bbc3e860fa3d, 2018-02-13 (annotated)
- Committer:
- walter76
- Date:
- Tue Feb 13 08:22:23 2018 +0000
- Revision:
- 2:bbc3e860fa3d
- Parent:
- 0:bdbd3d6fc5d5
Preliminary version used to test all HW sections
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:bdbd3d6fc5d5 | 1 | #include "mbed.h" |
mbed_official | 0:bdbd3d6fc5d5 | 2 | #include "SDFileSystem.h" |
walter76 | 2:bbc3e860fa3d | 3 | #include "ST7565_LCD.h" |
walter76 | 2:bbc3e860fa3d | 4 | #include "QEI.h" |
walter76 | 2:bbc3e860fa3d | 5 | |
walter76 | 2:bbc3e860fa3d | 6 | #define BAT_GAIN 6.80 |
walter76 | 2:bbc3e860fa3d | 7 | #define BAT_OFFS 0.0 |
walter76 | 2:bbc3e860fa3d | 8 | |
walter76 | 2:bbc3e860fa3d | 9 | PwmOut BEEP (D2); // Buzzer/speaker (PWM output) |
walter76 | 2:bbc3e860fa3d | 10 | PwmOut BKL (D3); // LCD backlight control (PMW output) |
walter76 | 2:bbc3e860fa3d | 11 | DigitalOut KAL (D0); // Keep-Alive/turn-off |
walter76 | 2:bbc3e860fa3d | 12 | DigitalOut BTC (D2); // Aux BT module control |
walter76 | 2:bbc3e860fa3d | 13 | DigitalIn Button (D4); // Pushbutton (digital input) |
walter76 | 2:bbc3e860fa3d | 14 | AnalogIn BATT (A0); // Battery monitor |
walter76 | 2:bbc3e860fa3d | 15 | AnalogIn ALS (A1); // Ambient Light sensor |
mbed_official | 0:bdbd3d6fc5d5 | 16 | |
walter76 | 2:bbc3e860fa3d | 17 | SDFileSystem sd(PB_15, PB_14, PB_13, PB_1, "sd"); // MOSI, MISO, SCK, CS |
walter76 | 2:bbc3e860fa3d | 18 | |
walter76 | 2:bbc3e860fa3d | 19 | // Quadrature encoder |
walter76 | 2:bbc3e860fa3d | 20 | QEI Wheel(D5, D6, NC, 16); |
walter76 | 2:bbc3e860fa3d | 21 | |
walter76 | 2:bbc3e860fa3d | 22 | // Tickers |
walter76 | 2:bbc3e860fa3d | 23 | Ticker Sec_Beat; // Timer ticker |
walter76 | 2:bbc3e860fa3d | 24 | Ticker Display_Refresh; // Display refresh ticker |
walter76 | 2:bbc3e860fa3d | 25 | |
walter76 | 2:bbc3e860fa3d | 26 | //Serial ports |
walter76 | 2:bbc3e860fa3d | 27 | Serial PC(USBTX, USBRX); // Virtual COM via USB |
walter76 | 2:bbc3e860fa3d | 28 | //Serial BT_module(D1, D0); // BlueTooth module |
walter76 | 2:bbc3e860fa3d | 29 | |
walter76 | 2:bbc3e860fa3d | 30 | |
walter76 | 2:bbc3e860fa3d | 31 | extern unsigned int buffer[128*64/8]; // RAM buffer used by LCD |
walter76 | 2:bbc3e860fa3d | 32 | time_t seconds; // timestamp |
walter76 | 2:bbc3e860fa3d | 33 | char Text[40]=""; // Text string used by LCD |
walter76 | 2:bbc3e860fa3d | 34 | float Vbatt, ALLevel; // battery votage and ambient light level |
walter76 | 2:bbc3e860fa3d | 35 | |
walter76 | 2:bbc3e860fa3d | 36 | // ------------------- Prototypes ----------------------- |
walter76 | 2:bbc3e860fa3d | 37 | void Timer_tick(void); |
walter76 | 2:bbc3e860fa3d | 38 | void Update_Display(void); |
walter76 | 2:bbc3e860fa3d | 39 | void Set_Time(void); |
walter76 | 2:bbc3e860fa3d | 40 | void Read_Voltages(void); |
walter76 | 2:bbc3e860fa3d | 41 | void PowerOff(void); |
walter76 | 2:bbc3e860fa3d | 42 | |
walter76 | 2:bbc3e860fa3d | 43 | int main() |
walter76 | 2:bbc3e860fa3d | 44 | { |
walter76 | 2:bbc3e860fa3d | 45 | |
walter76 | 2:bbc3e860fa3d | 46 | KAL = 1; // ensure self-sustained power |
walter76 | 2:bbc3e860fa3d | 47 | //Button.mode(PullUp); // enable pushbutton pull-up |
walter76 | 2:bbc3e860fa3d | 48 | BKL.period_ms(3); // set LCD backlight PWM |
walter76 | 2:bbc3e860fa3d | 49 | BKL.write(1.0); |
walter76 | 2:bbc3e860fa3d | 50 | BEEP.period_us(2300); // set initial buzzer period and duty-cycle |
walter76 | 2:bbc3e860fa3d | 51 | BEEP.write(0.2); |
walter76 | 2:bbc3e860fa3d | 52 | Wheel.reset(); // clear encoder |
walter76 | 2:bbc3e860fa3d | 53 | LCD_reset(); |
walter76 | 2:bbc3e860fa3d | 54 | |
walter76 | 2:bbc3e860fa3d | 55 | // splash screen with date and time |
walter76 | 2:bbc3e860fa3d | 56 | sprintf(Text,__DATE__); |
walter76 | 2:bbc3e860fa3d | 57 | LCD_drawstring(buffer, 60, 5, Text); |
walter76 | 2:bbc3e860fa3d | 58 | sprintf(Text,__TIME__); |
walter76 | 2:bbc3e860fa3d | 59 | LCD_drawstring(buffer, 78, 6, Text); |
walter76 | 2:bbc3e860fa3d | 60 | LCD_write_buffer(buffer); |
walter76 | 2:bbc3e860fa3d | 61 | |
walter76 | 2:bbc3e860fa3d | 62 | |
walter76 | 2:bbc3e860fa3d | 63 | // enable LCD refresh ticker |
walter76 | 2:bbc3e860fa3d | 64 | Display_Refresh.attach(&Update_Display, 0.3); |
walter76 | 2:bbc3e860fa3d | 65 | |
walter76 | 2:bbc3e860fa3d | 66 | if(Button) // if pushbutton is pressed |
walter76 | 2:bbc3e860fa3d | 67 | Set_Time(); // set RTC time and date |
walter76 | 2:bbc3e860fa3d | 68 | |
walter76 | 2:bbc3e860fa3d | 69 | wait(2); |
walter76 | 2:bbc3e860fa3d | 70 | Clear_buffer(buffer); |
walter76 | 2:bbc3e860fa3d | 71 | BKL.write(0.5); |
mbed_official | 0:bdbd3d6fc5d5 | 72 | |
walter76 | 2:bbc3e860fa3d | 73 | //PowerOff(); // Power-off test |
walter76 | 2:bbc3e860fa3d | 74 | |
walter76 | 2:bbc3e860fa3d | 75 | |
walter76 | 2:bbc3e860fa3d | 76 | // enable sec-beat ticker |
walter76 | 2:bbc3e860fa3d | 77 | Sec_Beat.attach(&Timer_tick, 1); |
walter76 | 2:bbc3e860fa3d | 78 | |
walter76 | 2:bbc3e860fa3d | 79 | |
walter76 | 2:bbc3e860fa3d | 80 | |
walter76 | 2:bbc3e860fa3d | 81 | printf("Hello World!\n"); |
walter76 | 2:bbc3e860fa3d | 82 | mkdir("/sd/system", 0777); |
walter76 | 2:bbc3e860fa3d | 83 | FILE *fp = fopen("/sd/system/sdlog.txt", "w"); |
mbed_official | 0:bdbd3d6fc5d5 | 84 | if(fp == NULL) { |
mbed_official | 0:bdbd3d6fc5d5 | 85 | error("Could not open file for write\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 86 | } |
mbed_official | 0:bdbd3d6fc5d5 | 87 | fprintf(fp, "Hello fun SD Card World!"); |
mbed_official | 0:bdbd3d6fc5d5 | 88 | fclose(fp); |
mbed_official | 0:bdbd3d6fc5d5 | 89 | printf("Goodbye World!\n"); |
walter76 | 2:bbc3e860fa3d | 90 | |
walter76 | 2:bbc3e860fa3d | 91 | while(1) |
walter76 | 2:bbc3e860fa3d | 92 | { |
walter76 | 2:bbc3e860fa3d | 93 | // dance |
walter76 | 2:bbc3e860fa3d | 94 | } |
walter76 | 2:bbc3e860fa3d | 95 | |
walter76 | 2:bbc3e860fa3d | 96 | |
mbed_official | 0:bdbd3d6fc5d5 | 97 | } |
walter76 | 2:bbc3e860fa3d | 98 | |
walter76 | 2:bbc3e860fa3d | 99 | |
walter76 | 2:bbc3e860fa3d | 100 | //=========================================================================== |
walter76 | 2:bbc3e860fa3d | 101 | |
walter76 | 2:bbc3e860fa3d | 102 | // ------------- Called every second ---------------------- |
walter76 | 2:bbc3e860fa3d | 103 | |
walter76 | 2:bbc3e860fa3d | 104 | void Timer_tick() |
walter76 | 2:bbc3e860fa3d | 105 | { |
walter76 | 2:bbc3e860fa3d | 106 | seconds = time(NULL); |
walter76 | 2:bbc3e860fa3d | 107 | strftime(Text, 50, "%d-%b-%Y %H:%M:%S", localtime(&seconds)); |
walter76 | 2:bbc3e860fa3d | 108 | LCD_drawstring(buffer, 0, 0, Text); |
walter76 | 2:bbc3e860fa3d | 109 | |
walter76 | 2:bbc3e860fa3d | 110 | // read voltages |
walter76 | 2:bbc3e860fa3d | 111 | Read_Voltages(); |
walter76 | 2:bbc3e860fa3d | 112 | |
walter76 | 2:bbc3e860fa3d | 113 | // write values to buffer |
walter76 | 2:bbc3e860fa3d | 114 | sprintf(Text,"VBATT= %4.2f", Vbatt); |
walter76 | 2:bbc3e860fa3d | 115 | LCD_drawstring(buffer, 0, 2, Text); |
walter76 | 2:bbc3e860fa3d | 116 | sprintf(Text,"ALL= %4.2f", ALLevel); |
walter76 | 2:bbc3e860fa3d | 117 | LCD_drawstring(buffer, 0, 3, Text); |
walter76 | 2:bbc3e860fa3d | 118 | |
walter76 | 2:bbc3e860fa3d | 119 | // Send data to COM port |
walter76 | 2:bbc3e860fa3d | 120 | //PC.printf("Tset= %3.0f, Tpit= %3.0f, Tmeat= %3.0f, PWM= %3.0f\n",Tset, Tpit, Tmeat, FanSpeed); |
walter76 | 2:bbc3e860fa3d | 121 | |
walter76 | 2:bbc3e860fa3d | 122 | //LCD_write_buffer(buffer); // LCD update |
walter76 | 2:bbc3e860fa3d | 123 | |
walter76 | 2:bbc3e860fa3d | 124 | return; |
walter76 | 2:bbc3e860fa3d | 125 | } |
walter76 | 2:bbc3e860fa3d | 126 | |
walter76 | 2:bbc3e860fa3d | 127 | |
walter76 | 2:bbc3e860fa3d | 128 | //--------------------------------------------------------------------------- |
walter76 | 2:bbc3e860fa3d | 129 | void Update_Display(void) |
walter76 | 2:bbc3e860fa3d | 130 | { |
walter76 | 2:bbc3e860fa3d | 131 | LCD_write_buffer(buffer); // LCD update |
walter76 | 2:bbc3e860fa3d | 132 | return; |
walter76 | 2:bbc3e860fa3d | 133 | } |
walter76 | 2:bbc3e860fa3d | 134 | |
walter76 | 2:bbc3e860fa3d | 135 | //--------------------------------------------------------------------------- |
walter76 | 2:bbc3e860fa3d | 136 | void Set_Time(void) |
walter76 | 2:bbc3e860fa3d | 137 | { |
walter76 | 2:bbc3e860fa3d | 138 | uint8_t Year=0, Month=0, Day=0, Hours=0, Mins=0, Secs=0; |
walter76 | 2:bbc3e860fa3d | 139 | time_t seconds; |
walter76 | 2:bbc3e860fa3d | 140 | struct tm t; |
walter76 | 2:bbc3e860fa3d | 141 | |
walter76 | 2:bbc3e860fa3d | 142 | sprintf(Text,"TIME & DATE SETTING"); |
walter76 | 2:bbc3e860fa3d | 143 | LCD_drawstring(buffer, 0, 0, Text); |
walter76 | 2:bbc3e860fa3d | 144 | |
walter76 | 2:bbc3e860fa3d | 145 | // Set year |
walter76 | 2:bbc3e860fa3d | 146 | while(Button); |
walter76 | 2:bbc3e860fa3d | 147 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 148 | |
walter76 | 2:bbc3e860fa3d | 149 | while(!Button) |
walter76 | 2:bbc3e860fa3d | 150 | { |
walter76 | 2:bbc3e860fa3d | 151 | if(int(Wheel.getPulses())<0) |
walter76 | 2:bbc3e860fa3d | 152 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 153 | Year = (uint8_t)(Wheel.getPulses()); |
walter76 | 2:bbc3e860fa3d | 154 | |
walter76 | 2:bbc3e860fa3d | 155 | if(Year>99) |
walter76 | 2:bbc3e860fa3d | 156 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 157 | |
walter76 | 2:bbc3e860fa3d | 158 | sprintf(Text, "Year: %2d", Year); |
walter76 | 2:bbc3e860fa3d | 159 | LCD_drawstring(buffer, 0, 2, Text); |
walter76 | 2:bbc3e860fa3d | 160 | |
walter76 | 2:bbc3e860fa3d | 161 | } |
walter76 | 2:bbc3e860fa3d | 162 | |
walter76 | 2:bbc3e860fa3d | 163 | // Set month |
walter76 | 2:bbc3e860fa3d | 164 | while(Button); |
walter76 | 2:bbc3e860fa3d | 165 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 166 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 167 | while(!Button) |
walter76 | 2:bbc3e860fa3d | 168 | { |
walter76 | 2:bbc3e860fa3d | 169 | if(int(Wheel.getPulses())<0) |
walter76 | 2:bbc3e860fa3d | 170 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 171 | Month = (uint8_t)(Wheel.getPulses()/2); |
walter76 | 2:bbc3e860fa3d | 172 | |
walter76 | 2:bbc3e860fa3d | 173 | if(Month>11) |
walter76 | 2:bbc3e860fa3d | 174 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 175 | |
walter76 | 2:bbc3e860fa3d | 176 | sprintf(Text, "Month: %2d", Month+1); |
walter76 | 2:bbc3e860fa3d | 177 | LCD_drawstring(buffer, 0, 3, Text); |
walter76 | 2:bbc3e860fa3d | 178 | |
walter76 | 2:bbc3e860fa3d | 179 | } |
walter76 | 2:bbc3e860fa3d | 180 | |
walter76 | 2:bbc3e860fa3d | 181 | |
walter76 | 2:bbc3e860fa3d | 182 | // Set day |
walter76 | 2:bbc3e860fa3d | 183 | while(Button); |
walter76 | 2:bbc3e860fa3d | 184 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 185 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 186 | while(!Button) |
walter76 | 2:bbc3e860fa3d | 187 | { |
walter76 | 2:bbc3e860fa3d | 188 | if(int(Wheel.getPulses())<0) |
walter76 | 2:bbc3e860fa3d | 189 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 190 | Day = (uint8_t)(Wheel.getPulses()/2); |
walter76 | 2:bbc3e860fa3d | 191 | |
walter76 | 2:bbc3e860fa3d | 192 | if(Day>30) |
walter76 | 2:bbc3e860fa3d | 193 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 194 | |
walter76 | 2:bbc3e860fa3d | 195 | sprintf(Text, "Day: %2d", Day+1); |
walter76 | 2:bbc3e860fa3d | 196 | LCD_drawstring(buffer, 0, 4, Text); |
walter76 | 2:bbc3e860fa3d | 197 | |
walter76 | 2:bbc3e860fa3d | 198 | } |
walter76 | 2:bbc3e860fa3d | 199 | |
walter76 | 2:bbc3e860fa3d | 200 | // Set hours |
walter76 | 2:bbc3e860fa3d | 201 | while(Button); |
walter76 | 2:bbc3e860fa3d | 202 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 203 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 204 | while(!Button) |
walter76 | 2:bbc3e860fa3d | 205 | { |
walter76 | 2:bbc3e860fa3d | 206 | if(int(Wheel.getPulses())<0) |
walter76 | 2:bbc3e860fa3d | 207 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 208 | Hours = (uint8_t)(Wheel.getPulses()/2); |
walter76 | 2:bbc3e860fa3d | 209 | |
walter76 | 2:bbc3e860fa3d | 210 | if(Hours>22) |
walter76 | 2:bbc3e860fa3d | 211 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 212 | |
walter76 | 2:bbc3e860fa3d | 213 | sprintf(Text, "Hours: %2d", Hours+1); |
walter76 | 2:bbc3e860fa3d | 214 | LCD_drawstring(buffer, 0, 5, Text); |
walter76 | 2:bbc3e860fa3d | 215 | |
walter76 | 2:bbc3e860fa3d | 216 | } |
walter76 | 2:bbc3e860fa3d | 217 | Hours++; |
walter76 | 2:bbc3e860fa3d | 218 | |
walter76 | 2:bbc3e860fa3d | 219 | // Set minutes |
walter76 | 2:bbc3e860fa3d | 220 | while(Button); |
walter76 | 2:bbc3e860fa3d | 221 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 222 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 223 | while(!Button) |
walter76 | 2:bbc3e860fa3d | 224 | { |
walter76 | 2:bbc3e860fa3d | 225 | if(int(Wheel.getPulses())<0) |
walter76 | 2:bbc3e860fa3d | 226 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 227 | Mins = (uint8_t)(Wheel.getPulses()/2); |
walter76 | 2:bbc3e860fa3d | 228 | |
walter76 | 2:bbc3e860fa3d | 229 | if(Mins>59) |
walter76 | 2:bbc3e860fa3d | 230 | Wheel.reset(); |
walter76 | 2:bbc3e860fa3d | 231 | |
walter76 | 2:bbc3e860fa3d | 232 | sprintf(Text, "Minutes: %2d", Mins); |
walter76 | 2:bbc3e860fa3d | 233 | LCD_drawstring(buffer, 0, 6, Text); |
walter76 | 2:bbc3e860fa3d | 234 | |
walter76 | 2:bbc3e860fa3d | 235 | } |
walter76 | 2:bbc3e860fa3d | 236 | |
walter76 | 2:bbc3e860fa3d | 237 | t.tm_year = Year + 100; |
walter76 | 2:bbc3e860fa3d | 238 | t.tm_mon = Month; |
walter76 | 2:bbc3e860fa3d | 239 | t.tm_mday = Day + 1; |
walter76 | 2:bbc3e860fa3d | 240 | t.tm_hour = Hours; |
walter76 | 2:bbc3e860fa3d | 241 | t.tm_min = Mins; |
walter76 | 2:bbc3e860fa3d | 242 | t.tm_sec = Secs; |
walter76 | 2:bbc3e860fa3d | 243 | |
walter76 | 2:bbc3e860fa3d | 244 | seconds = mktime(&t); |
walter76 | 2:bbc3e860fa3d | 245 | set_time(seconds); |
walter76 | 2:bbc3e860fa3d | 246 | |
walter76 | 2:bbc3e860fa3d | 247 | return; |
walter76 | 2:bbc3e860fa3d | 248 | } |
walter76 | 2:bbc3e860fa3d | 249 | |
walter76 | 2:bbc3e860fa3d | 250 | |
walter76 | 2:bbc3e860fa3d | 251 | //--------------------------------------------------------------------------- |
walter76 | 2:bbc3e860fa3d | 252 | void Read_Voltages(void) |
walter76 | 2:bbc3e860fa3d | 253 | { |
walter76 | 2:bbc3e860fa3d | 254 | |
walter76 | 2:bbc3e860fa3d | 255 | double ADC_value; |
walter76 | 2:bbc3e860fa3d | 256 | uint8_t smooth = 10; // Number of samples to smooth |
walter76 | 2:bbc3e860fa3d | 257 | uint8_t i; |
walter76 | 2:bbc3e860fa3d | 258 | |
walter76 | 2:bbc3e860fa3d | 259 | // Read battery voltage |
walter76 | 2:bbc3e860fa3d | 260 | |
walter76 | 2:bbc3e860fa3d | 261 | ADC_value = BATT.read(); // cleanup |
walter76 | 2:bbc3e860fa3d | 262 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 263 | ADC_value = 0; |
walter76 | 2:bbc3e860fa3d | 264 | for(i=0;i<smooth;i++) |
walter76 | 2:bbc3e860fa3d | 265 | ADC_value += BATT.read(); |
walter76 | 2:bbc3e860fa3d | 266 | |
walter76 | 2:bbc3e860fa3d | 267 | ADC_value = ADC_value/smooth; |
walter76 | 2:bbc3e860fa3d | 268 | Vbatt = (float)(ADC_value*BAT_GAIN)+BAT_OFFS; |
walter76 | 2:bbc3e860fa3d | 269 | |
walter76 | 2:bbc3e860fa3d | 270 | |
walter76 | 2:bbc3e860fa3d | 271 | // Read Ambient Light Level |
walter76 | 2:bbc3e860fa3d | 272 | |
walter76 | 2:bbc3e860fa3d | 273 | ADC_value = ALS.read(); // cleanup |
walter76 | 2:bbc3e860fa3d | 274 | wait_ms(50); |
walter76 | 2:bbc3e860fa3d | 275 | ADC_value = 0; |
walter76 | 2:bbc3e860fa3d | 276 | for(i=0;i<smooth;i++) |
walter76 | 2:bbc3e860fa3d | 277 | ADC_value += ALS.read(); |
walter76 | 2:bbc3e860fa3d | 278 | |
walter76 | 2:bbc3e860fa3d | 279 | ADC_value = ADC_value/smooth; |
walter76 | 2:bbc3e860fa3d | 280 | ALLevel = (float)(ADC_value); |
walter76 | 2:bbc3e860fa3d | 281 | |
walter76 | 2:bbc3e860fa3d | 282 | return; |
walter76 | 2:bbc3e860fa3d | 283 | } |
walter76 | 2:bbc3e860fa3d | 284 | |
walter76 | 2:bbc3e860fa3d | 285 | |
walter76 | 2:bbc3e860fa3d | 286 | //--------------------------------------------------------------------------- |
walter76 | 2:bbc3e860fa3d | 287 | void PowerOff(void) |
walter76 | 2:bbc3e860fa3d | 288 | { |
walter76 | 2:bbc3e860fa3d | 289 | BKL.write(1); |
walter76 | 2:bbc3e860fa3d | 290 | Clear_buffer(buffer); |
walter76 | 2:bbc3e860fa3d | 291 | sprintf(Text,"POWERING OFF"); |
walter76 | 2:bbc3e860fa3d | 292 | LCD_drawstring(buffer, 20, 3, Text); |
walter76 | 2:bbc3e860fa3d | 293 | LCD_write_buffer(buffer); |
walter76 | 2:bbc3e860fa3d | 294 | wait(2); |
walter76 | 2:bbc3e860fa3d | 295 | |
walter76 | 2:bbc3e860fa3d | 296 | KAL = 0; |
walter76 | 2:bbc3e860fa3d | 297 | } |