Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <TFT_eSPI.h>
#include <Arduino.h>

TFT_eSPI tft;

void initDisplay();
void setDisplayColor(uint16_t color);
void cycleDisplayColor();
Expand Down
19 changes: 16 additions & 3 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
7 changes: 7 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#include <Arduino.h>
#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);

}