@@ -16,6 +16,9 @@ static constexpr int DC_PIN_NUM = 16;
16
16
#elif CONFIG_HARDWARE_BOX
17
17
#include " st7789.hpp"
18
18
static constexpr int DC_PIN_NUM = 4 ;
19
+ #elif CONFIG_SMARTKNOB_HA
20
+ #include " gc9a01.hpp"
21
+ static constexpr int DC_PIN_NUM = 16 ;
19
22
#else
20
23
#error "Misconfigured hardware!"
21
24
#endif
@@ -118,29 +121,32 @@ void IRAM_ATTR lcd_send_lines(int xs, int ys, int xe, int ye, const uint8_t *dat
118
121
size_t length = (xe - xs + 1 ) * (ye - ys + 1 ) * 2 ;
119
122
#if CONFIG_HARDWARE_WROVER_KIT
120
123
trans[0 ].tx_data [0 ] = (uint8_t )espp::Ili9341::Command::caset;
121
- #endif
122
- #if CONFIG_HARDWARE_TTGO || CONFIG_HARDWARE_BOX
124
+ #elif CONFIG_HARDWARE_TTGO || CONFIG_HARDWARE_BOX
123
125
trans[0 ].tx_data [0 ] = (uint8_t )espp::St7789::Command::caset;
126
+ #elif CONFIG_SMARTKNOB_HA
127
+ trans[0 ].tx_data [0 ] = (uint8_t )espp::Gc9a01::Command::caset;
124
128
#endif
125
129
trans[1 ].tx_data [0 ] = (xs) >> 8 ;
126
130
trans[1 ].tx_data [1 ] = (xs)&0xff ;
127
131
trans[1 ].tx_data [2 ] = (xe) >> 8 ;
128
132
trans[1 ].tx_data [3 ] = (xe)&0xff ;
129
133
#if CONFIG_HARDWARE_WROVER_KIT
130
134
trans[2 ].tx_data [0 ] = (uint8_t )espp::Ili9341::Command::raset;
131
- #endif
132
- #if CONFIG_HARDWARE_TTGO || CONFIG_HARDWARE_BOX
135
+ #elif CONFIG_HARDWARE_TTGO || CONFIG_HARDWARE_BOX
133
136
trans[2 ].tx_data [0 ] = (uint8_t )espp::St7789::Command::raset;
137
+ #elif CONFIG_SMARTKNOB_HA
138
+ trans[2 ].tx_data [0 ] = (uint8_t )espp::Gc9a01::Command::raset;
134
139
#endif
135
140
trans[3 ].tx_data [0 ] = (ys) >> 8 ;
136
141
trans[3 ].tx_data [1 ] = (ys)&0xff ;
137
142
trans[3 ].tx_data [2 ] = (ye) >> 8 ;
138
143
trans[3 ].tx_data [3 ] = (ye)&0xff ;
139
144
#if CONFIG_HARDWARE_WROVER_KIT
140
145
trans[4 ].tx_data [0 ] = (uint8_t )espp::Ili9341::Command::ramwr;
141
- #endif
142
- #if CONFIG_HARDWARE_TTGO || CONFIG_HARDWARE_BOX
146
+ #elif CONFIG_HARDWARE_TTGO || CONFIG_HARDWARE_BOX
143
147
trans[4 ].tx_data [0 ] = (uint8_t )espp::St7789::Command::ramwr;
148
+ #elif CONFIG_SMARTKNOB_HA
149
+ trans[4 ].tx_data [0 ] = (uint8_t )espp::Gc9a01::Command::ramwr;
144
150
#endif
145
151
trans[5 ].tx_buffer = data;
146
152
trans[5 ].length = length * 8 ;
@@ -199,8 +205,7 @@ extern "C" void app_main(void) {
199
205
using DisplayDriver = espp::Ili9341;
200
206
auto rotation = espp::Display::Rotation::LANDSCAPE;
201
207
// ! [wrover_kit_config example]
202
- #endif
203
- #if CONFIG_HARDWARE_TTGO
208
+ #elif CONFIG_HARDWARE_TTGO
204
209
// ! [ttgo_config example]
205
210
static constexpr std::string_view dev_kit = " TTGO T-Display" ;
206
211
int clock_speed = 60 * 1000 * 1000 ;
@@ -224,8 +229,7 @@ extern "C" void app_main(void) {
224
229
using DisplayDriver = espp::St7789;
225
230
auto rotation = espp::Display::Rotation::PORTRAIT;
226
231
// ! [ttgo_config example]
227
- #endif
228
- #if CONFIG_HARDWARE_BOX
232
+ #elif CONFIG_HARDWARE_BOX
229
233
// ! [box_config example]
230
234
static constexpr std::string_view dev_kit = " ESP32-S3-BOX" ;
231
235
int clock_speed = 60 * 1000 * 1000 ;
@@ -249,6 +253,30 @@ extern "C" void app_main(void) {
249
253
using DisplayDriver = espp::St7789;
250
254
auto rotation = espp::Display::Rotation::LANDSCAPE;
251
255
// ! [box_config example]
256
+ #elif CONFIG_SMARTKNOB_HA
257
+ // ! [smartknob_config example]
258
+ static constexpr std::string_view dev_kit = " Smartknob-HA" ;
259
+ int clock_speed = 80 * 1000 * 1000 ;
260
+ auto spi_num = SPI2_HOST;
261
+ gpio_num_t mosi = GPIO_NUM_6;
262
+ gpio_num_t sclk = GPIO_NUM_5;
263
+ gpio_num_t spics = GPIO_NUM_15;
264
+ gpio_num_t reset = GPIO_NUM_4;
265
+ gpio_num_t dc_pin = (gpio_num_t )DC_PIN_NUM;
266
+ gpio_num_t backlight = GPIO_NUM_7;
267
+ size_t width = 240 ;
268
+ size_t height = 240 ;
269
+ size_t pixel_buffer_size = width * 50 ;
270
+ bool backlight_on_value = true ;
271
+ bool reset_value = false ;
272
+ bool invert_colors = true ;
273
+ int offset_x = 0 ;
274
+ int offset_y = 0 ;
275
+ bool mirror_x = true ;
276
+ bool mirror_y = true ;
277
+ using DisplayDriver = espp::Gc9a01;
278
+ auto rotation = espp::Display::Rotation::LANDSCAPE;
279
+ // ! [smartknob_config example]
252
280
#endif
253
281
254
282
fmt::print (" Starting display_drivers example for {}\n " , dev_kit);
0 commit comments