Skip to content

Commit 6ea0dff

Browse files
committed
working on being able to share the SPI Bus
1 parent f87b886 commit 6ea0dff

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

ext_mod/lcd_bus/common_src/i80_bus.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
mp_lcd_err_t i80_tx_param(mp_obj_t obj, int lcd_cmd, void *param, size_t param_size);
7979
mp_lcd_err_t i80_tx_color(mp_obj_t obj, int lcd_cmd, void *color, size_t color_size, int x_start, int y_start, int x_end, int y_end);
8080
mp_lcd_err_t i80_del(mp_obj_t obj);
81-
mp_lcd_err_t i80_init(mp_obj_t obj, uint16_t width, uint16_t height, uint8_t bpp, uint32_t buffer_size, bool rgb565_byte_swap);
81+
mp_lcd_err_t i80_init(mp_obj_t obj, uint16_t width, uint16_t height, uint8_t bpp, uint32_t buffer_size, bool rgb565_byte_swap, uint8_t cmd_bits, uint8_t param_bits);
8282
mp_lcd_err_t i80_get_lane_count(mp_obj_t obj, uint8_t *lane_count);
8383

8484
void write_color8(mp_lcd_i80_bus_obj_t *self, void *color, size_t color_size);
@@ -173,8 +173,6 @@
173173
{ MP_QSTR_dc_cmd_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
174174
{ MP_QSTR_dc_dummy_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
175175
{ MP_QSTR_dc_data_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = true } },
176-
{ MP_QSTR_cmd_bits, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 8 } },
177-
{ MP_QSTR_param_bits, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 8 } },
178176
{ MP_QSTR_cs_active_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
179177
{ MP_QSTR_reverse_color_bits, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
180178
{ MP_QSTR_swap_color_bytes, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
@@ -202,8 +200,6 @@
202200
mp_raise_msg(&mp_type_NotImplementedError, MP_ERROR_TEXT("LCD I80 but is not available for this MCU"));
203201
#else
204202
self->panel_io_config.user_ctx = self;
205-
self->panel_io_config.lcd_cmd_bits = (int)args[ARG_cmd_bits].u_int;
206-
self->panel_io_config.lcd_param_bits = (int)args[ARG_param_bits].u_int;
207203
self->panel_io_config.dc_levels.dc_cmd_level = (unsigned int)args[ARG_dc_cmd_high].u_bool;
208204
self->panel_io_config.dc_levels.dc_data_level = (unsigned int)args[ARG_dc_data_high].u_bool;
209205
self->panel_io_config.flags.cs_active_high = (unsigned int)args[ARG_cs_active_high].u_bool;
@@ -398,13 +394,15 @@
398394

399395
}
400396

401-
mp_lcd_err_t i80_init(mp_obj_t obj, uint16_t width, uint16_t height, uint8_t bpp, uint32_t buffer_size, bool rgb565_byte_swap)
397+
mp_lcd_err_t i80_init(mp_obj_t obj, uint16_t width, uint16_t height, uint8_t bpp, uint32_t buffer_size, bool rgb565_byte_swap, uint8_t cmd_bits, uint8_t param_bits)
402398
{
403399
mp_lcd_i80_bus_obj_t *self = MP_OBJ_TO_PTR(obj);
404400
LCD_UNUSED(rgb565_byte_swap);
405401

406402
self->buffer_size = buffer_size;
407403
self->bpp = bpp;
404+
self->panel_io_config.lcd_cmd_bits = (int)cmd_bits;
405+
self->panel_io_config.lcd_param_bits = (int)param_bits;
408406

409407
if (self->rgb565_byte_swap) {
410408
if (self->bus_config.bus_width == 8) {

ext_mod/lcd_bus/common_src/spi_bus.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
mp_lcd_spi_bus_obj_t *self = m_new_obj(mp_lcd_spi_bus_obj_t);
130130
self->base.type = &mp_lcd_spi_bus_type;
131131

132-
self->spi_bus = (machine_hw_spi_obj_t *)MP_OBJ_TO_PTR(args[ARG_spi_bus].u_obj)
132+
self->spi_bus = (machine_hw_spi_obj_t *)MP_OBJ_TO_PTR(args[ARG_spi_bus].u_obj);
133133

134134
#if !defined(IDF_VER)
135135
self->callback = mp_const_none;
@@ -186,9 +186,6 @@
186186

187187
mp_lcd_spi_bus_obj_t *self = MP_OBJ_TO_PTR(obj);
188188

189-
self->panel_io_config.lcd_cmd_bits = cmd_bits;
190-
self->panel_io_config.lcd_param_bits = param_bits;
191-
192189
uint8_t bits;
193190

194191
if (cmd_bits == 16) {

0 commit comments

Comments
 (0)