From dc764ae192c0b77b71fbe365c4a9ab12d8032997 Mon Sep 17 00:00:00 2001 From: Porter Fencl Date: Mon, 29 Sep 2025 20:44:38 -0500 Subject: [PATCH] finished task 2 --- include/display.h | 2 -- src/display.cpp | 19 ++++++++++++++++--- src/main.cpp | 7 +++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/display.h b/include/display.h index f6c15af..650fa79 100644 --- a/include/display.h +++ b/include/display.h @@ -5,8 +5,6 @@ #include #include -TFT_eSPI tft; - void initDisplay(); void setDisplayColor(uint16_t color); void cycleDisplayColor(); diff --git a/src/display.cpp b/src/display.cpp index 56ead69..81e77e1 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -3,8 +3,21 @@ //Initialize the display such that: //It is horizontally oriented //The display color is initialized to orange -void initDisplay(){} +TFT_eSPI tft = TFT_eSPI(); +void initDisplay(){ + tft.begin(); + tft.setRotation(1); + tft.fillScreen(0xFD20); +} -void setDisplayColor(uint16_t color){} +void setDisplayColor(uint16_t color){ + tft.fillScreen(color); +} +uint16_t colors[] = {TFT_RED, TFT_GREEN, TFT_BLUE, TFT_YELLOW, TFT_CYAN, TFT_MAGENTA}; +void cycleDisplayColor(){ -void cycleDisplayColor(){} + static uint8_t colorIndex = 0; + + tft.fillScreen(colors[colorIndex]); + colorIndex = (colorIndex + 1) % (sizeof(colors) / sizeof(colors[0])); +} diff --git a/src/main.cpp b/src/main.cpp index d1222e4..1459120 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,20 @@ #include #include "display.h" + void setup() { Serial.begin(115200); Serial.println("Hello World"); //Other setup code to initialize everything relevant + initDisplay(); + setDisplayColor(0x07E0); + delay(3000); } void loop() { + cycleDisplayColor(); + delay(3000); + } \ No newline at end of file