Skip to content

Commit 913ca10

Browse files
authored
Merge pull request #2128 from adafruit/TheKitty-patch-1
Update local color mid-grey to RGB565
2 parents 890431b + 8190139 commit 913ca10

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

FunHouse_Arduino_Demos/selftest/selftest.ino

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#define NUM_DOTSTAR 5
1212
#define BG_COLOR ST77XX_BLACK
13+
#define ST77XX_GREY 0x8410 // Colors are in RGB565 format
1314

1415
// display!
1516
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RESET);
@@ -125,23 +126,23 @@ void loop() {
125126
tft.setTextColor(ST77XX_YELLOW);
126127
tft.print("Buttons: ");
127128
if (! digitalRead(BUTTON_DOWN)) {
128-
tft.setTextColor(0x808080);
129+
tft.setTextColor(ST77XX_GREY);
129130
} else {
130131
Serial.println("DOWN pressed");
131132
tft.setTextColor(ST77XX_WHITE);
132133
}
133134
tft.print("DOWN ");
134135

135136
if (! digitalRead(BUTTON_SELECT)) {
136-
tft.setTextColor(0x808080);
137+
tft.setTextColor(ST77XX_GREY);
137138
} else {
138139
Serial.println("SELECT pressed");
139140
tft.setTextColor(ST77XX_WHITE);
140141
}
141142
tft.print("SEL ");
142143

143144
if (! digitalRead(BUTTON_UP)) {
144-
tft.setTextColor(0x808080);
145+
tft.setTextColor(ST77XX_GREY);
145146
} else {
146147
Serial.println("UP pressed");
147148
tft.setTextColor(ST77XX_WHITE);
@@ -156,7 +157,7 @@ void loop() {
156157
tft.print("Captouch 6: ");
157158
touchread = touchRead(6);
158159
if (touchread < 10000 ) {
159-
tft.setTextColor(0x808080, BG_COLOR);
160+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
160161
} else {
161162
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
162163
}
@@ -169,7 +170,7 @@ void loop() {
169170
tft.print("Captouch 7: ");
170171
touchread = touchRead(7);
171172
if (touchread < 20000 ) {
172-
tft.setTextColor(0x808080, BG_COLOR);
173+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
173174
} else {
174175
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
175176
}
@@ -183,7 +184,7 @@ void loop() {
183184
tft.print("Captouch 8: ");
184185
touchread = touchRead(8);
185186
if (touchread < 20000 ) {
186-
tft.setTextColor(0x808080, BG_COLOR);
187+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
187188
} else {
188189
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
189190
}
@@ -248,10 +249,10 @@ void loop() {
248249
/************************** Beep! */
249250
if (digitalRead(BUTTON_SELECT)) {
250251
Serial.println("** Beep! ***");
251-
tone(SPEAKER, 988, 100); // tone1 - B5
252-
tone(SPEAKER, 1319, 200); // tone2 - E6
252+
fhtone(SPEAKER, 988.0, 100.0); // tone1 - B5
253+
fhtone(SPEAKER, 1319.0, 200.0); // tone2 - E6
253254
delay(100);
254-
//tone(SPEAKER, 2000, 100);
255+
//fhtone(SPEAKER, 2000.0, 100.0);
255256
}
256257

257258
/************************** LEDs */
@@ -269,7 +270,7 @@ void loop() {
269270
}
270271

271272

272-
void tone(uint8_t pin, float frequency, float duration) {
273+
void fhtone(uint8_t pin, float frequency, float duration) {
273274
ledcSetup(1, frequency, 8);
274275
ledcAttachPin(pin, 1);
275276
ledcWrite(1, 128);

FunHouse_Arduino_Demos/shipping_demo/shipping_demo.ino

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#include <Adafruit_AHTX0.h>
1010

1111
#define NUM_DOTSTAR 5
12-
#define BG_COLOR ST77XX_BLACK
12+
#define BG_COLOR ST77XX_BLACK // Set background to black
13+
#define ST77XX_GREY 0x8410 // define mid-grey in RGB565
1314

1415
// display!
1516
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RESET);
@@ -124,23 +125,23 @@ void loop() {
124125
tft.setTextColor(ST77XX_YELLOW);
125126
tft.print("Buttons: ");
126127
if (! digitalRead(BUTTON_DOWN)) {
127-
tft.setTextColor(0x808080);
128+
tft.setTextColor(ST77XX_GREY);
128129
} else {
129130
Serial.println("DOWN pressed");
130131
tft.setTextColor(ST77XX_WHITE);
131132
}
132133
tft.print("DOWN ");
133134

134135
if (! digitalRead(BUTTON_SELECT)) {
135-
tft.setTextColor(0x808080);
136+
tft.setTextColor(ST77XX_GREY);
136137
} else {
137138
Serial.println("SELECT pressed");
138139
tft.setTextColor(ST77XX_WHITE);
139140
}
140141
tft.print("SEL ");
141142

142143
if (! digitalRead(BUTTON_UP)) {
143-
tft.setTextColor(0x808080);
144+
tft.setTextColor(ST77XX_GREY);
144145
} else {
145146
Serial.println("UP pressed");
146147
tft.setTextColor(ST77XX_WHITE);
@@ -155,7 +156,7 @@ void loop() {
155156
tft.print("Captouch 6: ");
156157
touchread = touchRead(6);
157158
if (touchread < 10000 ) {
158-
tft.setTextColor(0x808080, BG_COLOR);
159+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
159160
} else {
160161
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
161162
}
@@ -168,7 +169,7 @@ void loop() {
168169
tft.print("Captouch 7: ");
169170
touchread = touchRead(7);
170171
if (touchread < 20000 ) {
171-
tft.setTextColor(0x808080, BG_COLOR);
172+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
172173
} else {
173174
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
174175
}
@@ -182,7 +183,7 @@ void loop() {
182183
tft.print("Captouch 8: ");
183184
touchread = touchRead(8);
184185
if (touchread < 20000 ) {
185-
tft.setTextColor(0x808080, BG_COLOR);
186+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
186187
} else {
187188
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
188189
}
@@ -247,10 +248,10 @@ void loop() {
247248
/************************** Beep! */
248249
if (digitalRead(BUTTON_SELECT)) {
249250
Serial.println("** Beep! ***");
250-
tone(SPEAKER, 988, 100); // tone1 - B5
251-
tone(SPEAKER, 1319, 200); // tone2 - E6
251+
fhtone(SPEAKER, 988.0, 100.0); // tone1 - B5
252+
fhtone(SPEAKER, 1319.0, 200.0); // tone2 - E6
252253
delay(100);
253-
//tone(SPEAKER, 2000, 100);
254+
//fhtone(SPEAKER, 2000.0, 100.0);
254255
}
255256

256257
/************************** LEDs */
@@ -268,7 +269,7 @@ void loop() {
268269
}
269270

270271

271-
void tone(uint8_t pin, float frequecy, float duration) {
272+
void fhtone(uint8_t pin, float frequecy, float duration) {
272273
ledcSetup(1, frequecy * 80, 8);
273274
ledcAttachPin(pin, 1);
274275
ledcWrite(1, 128);

0 commit comments

Comments
 (0)