Skip to content

Commit 64cdb32

Browse files
committed
It compiles now...
1 parent 986dcd6 commit 64cdb32

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

driver/frozen/display/display_driver_framework.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def __init__(
200200
try:
201201
frame_buffer1 = data_bus.allocate_framebuffer(buf_size, flags)
202202

203-
if flags | lcd_bus.MEMORY_DMA == flags:
203+
if (flags | lcd_bus.MEMORY_DMA) == flags:
204204
frame_buffer2 = data_bus.allocate_framebuffer(buf_size, flags)
205205

206206
break
@@ -210,12 +210,11 @@ def __init__(
210210

211211
if frame_buffer1 is None:
212212
raise MemoryError(
213-
f'Unable to allocate memory for '
214-
f'frame buffer ({buf_size})'
213+
f'Unable to allocate memory for frame buffer ({buf_size})'
215214
)
216215

217216
if frame_buffer2 is None and isinstance(data_bus, lcd_bus.SPIBus):
218-
buffer_size = data_bus.MAXIMUM_BUFFER_SIZE
217+
buffer_size = data_bus.SPI_MAXIMUM_BUFFER_SIZE
219218

220219
elif isinstance(data_bus, lcd_bus.RGBBus):
221220
buffer_size = int(

ext_mod/lcd_bus/esp32_include/rgb_bus.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
esp_lcd_panel_handle_t panel_handle;
3939
uint32_t buffer_size;
40-
mp_obj_array_t *view1
41-
mp_obj_array_t *view2
40+
mp_obj_array_t *view1;
41+
mp_obj_array_t *view2;
4242
} mp_lcd_rgb_bus_obj_t;
4343

4444

ext_mod/lcd_bus/esp32_src/rgb_bus.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010
// esp-idf includes
1111
#include "hal/lcd_hal.h"
12-
#include "esp_lcd_common.h"
1312
#include "esp_pm.h"
13+
#include "esp_intr_alloc.h"
14+
#include "esp_heap_caps.h"
1415

1516
#include "esp_lcd_panel_io.h"
1617
#include "esp_lcd_panel_ops.h"
@@ -28,7 +29,7 @@
2829
#include <string.h>
2930

3031

31-
struct rgb_panel_t {
32+
typedef struct {
3233
esp_lcd_panel_t base; // Base class of generic lcd panel
3334
int panel_id; // LCD panel ID
3435
lcd_hal_context_t hal; // Hal layer object
@@ -43,7 +44,7 @@
4344
esp_pm_lock_handle_t pm_lock; // Power management lock
4445
size_t num_dma_nodes; // Number of DMA descriptors that used to carry the frame buffer
4546
uint8_t *fbs[3]; // Frame buffers
46-
};
47+
} rgb_panel_t;
4748

4849
bool rgb_bus_trans_done_cb(esp_lcd_panel_handle_t panel_io, const esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx)
4950
{
@@ -252,28 +253,25 @@
252253
mp_lcd_rgb_bus_obj_t *self = (mp_lcd_rgb_bus_obj_t *)obj;
253254

254255
if (self->panel_handle != NULL) {
255-
mp_raise_msg(
256-
&mp_type_ValueError,
257-
MP_ERROR_TEXT("Frame buffers can not be freed once the display has been initilized"),
258-
);
256+
mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("Unable to free buffer"));
259257
return mp_const_none;
260258
}
261259

262260
mp_obj_array_t *array_buf = (mp_obj_array_t *)MP_OBJ_TO_PTR(buf);
263-
void *buf = array_buf->items;
261+
void *item_buf = array_buf->items;
264262

265263
if (array_buf == self->view1) {
266-
heap_caps_free(buf);
264+
heap_caps_free(item_buf);
267265
self->view1 = NULL;
268266
} else if (array_buf == self->view2) {
269-
heap_caps_free(buf);
267+
heap_caps_free(item_buf);
270268
self->view2 = NULL;
271269
} else {
272270
mp_raise_msg(&mp_type_MemoryError, MP_ERROR_TEXT("No matching buffer found"));
273271
}
274272
return mp_const_none;
275273
}
276-
274+
277275
mp_obj_t rgb_allocate_framebuffer(mp_obj_t obj, uint32_t size, uint32_t caps)
278276
{
279277
mp_lcd_rgb_bus_obj_t *self = (mp_lcd_rgb_bus_obj_t *)obj;
@@ -305,10 +303,7 @@
305303
self->view2 = view;
306304
return MP_OBJ_FROM_PTR(view);
307305
} else {
308-
mp_raise_msg(
309-
&mp_type_ValueError,
310-
MP_ERROR_TEXT("There is a maximum of 2 frame buffers allowed"),
311-
);
306+
mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("There is a maximum of 2 frame buffers allowed"));
312307
return mp_const_none;
313308
}
314309
}
@@ -353,7 +348,7 @@
353348
return ret;
354349
}
355350

356-
rgb_panel_t *rgb_panel = __containerof(self->panel_handle, rgb_panel_t, base);
351+
rgb_panel_t *rgb_panel = __containerof((esp_lcd_panel_t *)self->panel_handle, rgb_panel_t, base);
357352

358353
void *buf1 = self->view1->items;
359354
self->view1->items = (void *)rgb_panel->fbs[0];

ext_mod/lcd_bus/esp32_src/spi_bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ STATIC const mp_rom_map_elem_t mp_lcd_spi_bus_locals_dict_table[] = {
448448
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&mp_lcd_bus_init_obj) },
449449
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&mp_lcd_bus_deinit_obj) },
450450
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_lcd_bus_deinit_obj) },
451-
{ MP_ROM_QSTR(MP_QSTR_MAXIMUM_BUFFER_SIZE), MP_ROM_INT(SOC_SPI_MAXIMUM_BUFFER_SIZE) },
451+
{ MP_ROM_QSTR(MP_QSTR_SPI_MAXIMUM_BUFFER_SIZE), MP_ROM_INT(SOC_SPI_MAXIMUM_BUFFER_SIZE) },
452452
};
453453

454454
STATIC MP_DEFINE_CONST_DICT(mp_lcd_spi_bus_locals_dict, mp_lcd_spi_bus_locals_dict_table);

ext_mod/lcd_bus/lcd_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
mp_lcd_err_t lcd_panel_io_init(mp_obj_t obj, uint16_t width, uint16_t height, uint8_t bpp, uint32_t buffer_size, bool rgb565_byte_swap);
6464
mp_lcd_err_t lcd_panel_io_rx_param(mp_obj_t obj, int lcd_cmd, void *param, size_t param_size);
6565
mp_lcd_err_t lcd_panel_io_tx_param(mp_obj_t obj, int lcd_cmd, void *param, size_t param_size);
66-
mp_lcd_err_t lcd_panel_io_tx_color(mp_obj_t obj, int lcd_cmd, void *color, size_t color_size);
66+
mp_lcd_err_t lcd_panel_io_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);
6767
mp_obj_t lcd_panel_io_allocate_framebuffer(mp_obj_t obj, uint32_t size, uint32_t caps);
6868
mp_obj_t lcd_panel_io_free_framebuffer(mp_obj_t obj, mp_obj_t buf);
6969

0 commit comments

Comments
 (0)