Skip to content

Commit a5ad76c

Browse files
committed
ugfx: drivers: add CUBE0414 rev 2 support
1 parent 5aed492 commit a5ad76c

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#ifndef _CUBE0414_H
22
#define _CUBE0414_H
33

4-
#define CUBE0414_CONF_WR 0x2A
5-
#define CUBE0414_ADDR_WR 0x2B
6-
#define CUBE0414_DATA_WR 0x2C
4+
#ifdef CONFIG_CUBE0414_REV_3
5+
#define CUBE0414_CONF_WR 0x2A
6+
#define CUBE0414_ADDR_WR 0x2B
7+
#define CUBE0414_DATA_WR 0x2C
8+
#else
9+
#define CUBE0414_ADDR_WR 0xCC
10+
#define CUBE0414_DATA_WR 0xDA
11+
#endif
712

813
#endif

components/ugfx/drivers/gdisp/CUBE0414/gdisp_lld_CUBE0414.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static const uint8_t ram_addr_table[64] = {
5555
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x2f,
5656
0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
5757
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x3f,
58-
0x00, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
58+
0x00, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e
5959
#else
6060
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
6161
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
@@ -64,7 +64,7 @@ static const uint8_t ram_addr_table[64] = {
6464
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
6565
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
6666
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
67-
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x00,
67+
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x00
6868
#endif
6969
};
7070

@@ -79,6 +79,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
7979
// initialise the board interface
8080
init_board(g);
8181

82+
#ifdef CONFIG_CUBE0414_REV_3
8283
// hardware reset
8384
setpin_reset(g, 0);
8485
gfxSleepMilliseconds(120);
@@ -90,6 +91,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
9091
write_data(g, CONFIG_CUBE0414_LED_T0L); // T0L Time: val * 10 ns
9192
write_data(g, CONFIG_CUBE0414_LED_T1H); // T1H Time: val * 10 ns
9293
write_data(g, CONFIG_CUBE0414_LED_T1L); // T1L Time: val * 10 ns
94+
#endif
9395
write_cmd(g, CUBE0414_ADDR_WR); // 2: set write ram addr, 64 args, no delay:
9496
write_buff(g, (uint8_t *)ram_addr_table, sizeof(ram_addr_table));
9597
write_cmd(g, CUBE0414_DATA_WR); // 3: set write ram data, N args, no delay:

main/Kconfig.projbuild

+20-7
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,19 @@ config LED_COLOR_GRB
242242
bool "GRB"
243243
endchoice
244244

245+
choice CUBE0414_REVISION
246+
prompt "CUBE0414 Revision"
247+
default CUBE0414_REV_3
248+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
249+
help
250+
Select CUBE0414 revision.
251+
252+
config CUBE0414_REV_2
253+
bool "Rev 2"
254+
config CUBE0414_REV_3
255+
bool "Rev 3"
256+
endchoice
257+
245258
choice CUBE0414_LINE_TYPE
246259
prompt "CUBE0414 Line Type"
247260
default CUBE0414_LINE_S_CURVE
@@ -256,34 +269,34 @@ config CUBE0414_LINE_S_CURVE
256269
endchoice
257270

258271
comment "Limit: T0H + T0L <= 257"
259-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
272+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
260273

261274
config CUBE0414_LED_T0H
262275
int "CUBE0414 LED T0H Time (10 ns)"
263276
default 35
264277
range 1 255
265-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
278+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
266279

267280
config CUBE0414_LED_T0L
268281
int "CUBE0414 LED T0L Time (10 ns)"
269282
default 136
270283
range 1 255
271-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
284+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
272285

273286
comment "Limit: T1H + T1L <= 257"
274-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
287+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
275288

276289
config CUBE0414_LED_T1H
277290
int "CUBE0414 LED T1H Time (10 ns)"
278291
default 136
279292
range 1 255
280-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
293+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
281294

282295
config CUBE0414_LED_T1L
283296
int "CUBE0414 LED T1L Time (10 ns)"
284297
default 35
285298
range 1 255
286-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
299+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
287300

288301
config WS2812_DIN_PIN
289302
int "WS2812 DIN Pin"
@@ -293,7 +306,7 @@ config WS2812_DIN_PIN
293306
config DEV_RST_PIN
294307
int "DEV RST Pin"
295308
default 14
296-
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
309+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414 && CUBE0414_REV_3
297310

298311
config DEV_DC_PIN
299312
int "DEV DC Pin"

main/src/board/cube0414.c

+10
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,36 @@ void cube0414_init_board(void)
2828
memset(hspi_trans, 0x00, sizeof(hspi_trans));
2929

3030
gpio_config_t io_conf = {
31+
#ifdef CONFIG_CUBE0414_REV_3
3132
.pin_bit_mask = BIT64(CONFIG_DEV_DC_PIN) | BIT64(CONFIG_DEV_RST_PIN),
33+
#else
34+
.pin_bit_mask = BIT64(CONFIG_DEV_DC_PIN),
35+
#endif
3236
.mode = GPIO_MODE_OUTPUT,
3337
.pull_up_en = false,
3438
.pull_down_en = false,
3539
.intr_type = GPIO_INTR_DISABLE
3640
};
3741
gpio_config(&io_conf);
3842

43+
#ifdef CONFIG_CUBE0414_REV_3
3944
ESP_LOGI(TAG, "initialized, dc: %d, rst: %d", CONFIG_DEV_DC_PIN, CONFIG_DEV_RST_PIN);
45+
#else
46+
ESP_LOGI(TAG, "initialized, dc: %d", CONFIG_DEV_DC_PIN);
47+
#endif
4048
}
4149

4250
void cube0414_setpin_dc(spi_transaction_t *t)
4351
{
4452
gpio_set_level(CONFIG_DEV_DC_PIN, (int)t->user);
4553
}
4654

55+
#ifdef CONFIG_CUBE0414_REV_3
4756
void cube0414_setpin_reset(uint8_t val)
4857
{
4958
gpio_set_level(CONFIG_DEV_RST_PIN, val);
5059
}
60+
#endif
5161

5262
void cube0414_write_cmd(uint8_t cmd)
5363
{

0 commit comments

Comments
 (0)