Final project repo for ECE 495
Dependencies: Adafruit_GFX_MBED Adafruit_ILI9341 BurstSPI DS1820 mbed mbed-rtos ltc2991_lib
Diff: main.cpp
- Revision:
- 2:0a07f99e32c9
- Parent:
- 0:7ba4e0775670
- Child:
- 3:a1b5d7541c69
--- a/main.cpp Tue Nov 29 16:57:55 2016 +0000 +++ b/main.cpp Thu Dec 08 20:00:41 2016 +0000 @@ -7,12 +7,12 @@ #include "CurrentScreen.h" #include "Display.h" -#define NUM_DS1820 3 -#define PIN_DS1820 D2 +#define NUM_DS1820 1 +#define PIN_DS1820 PC_0 // DEVICES DS1820* thermometers[NUM_DS1820]; -Adafruit_ILI9341 tft(D6, D7, D8); +Adafruit_ILI9341 tft(PA_13, PA_15, PA_14); Display disp; // IO @@ -47,6 +47,7 @@ // thread drivers void display_cycle(); void slow_data_task(); +void fast_data_task(); // data read functions void read_temps(); // ISRs @@ -113,7 +114,7 @@ return b; } -char buff[5]; +char buff[64]; int loc = 0; void execute_command(char *cmd) { @@ -123,14 +124,20 @@ void parse_command() { buff[loc] = USART2->DR; loc += 1; - if (loc > 3) { + if (buff[loc-1] == '\n') { execute_command(buff); + memset(&buff[0], 0, sizeof(buff)); loc = 0; } } int main() { + + tft.begin(); + tft.fillScreen(RED); + wait_ms(1000); + tft.fillScreen(BLACK); // Setup serial interrupts, temperature sensors pc.attach(&parse_command); ds1820_init();