Skip to content

Commit

Permalink
debugging code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kdschlosser committed Dec 3, 2024
1 parent 2bed280 commit 83d710d
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 231 deletions.
75 changes: 30 additions & 45 deletions ext_mod/lcd_bus/esp32_src/dsi_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,20 @@

self->bus_config.pclk_hz = (uint32_t)args[ARG_freq].u_int;

#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("bus_id=%d\n", self->bus_config.bus_id);
printf("num_data_lanes=%d\n", self->bus_config.num_data_lanes);
printf("lane_bit_rate_mbps=%d\n",self->bus_config.lane_bit_rate_mbps);
printf("phy_clk_src=%d\n", self->bus_config.phy_clk_src);
printf("virtual_channel=%d\n", self->panel_io_config.virtual_channel);
printf("dpi_clk_src=%d\n", self->panel_config.dpi_clk_src);
printf("dpi_clock_freq_mhz=%d\n", self->panel_config.dpi_clock_freq_mhz);
printf("hsync_front_porch=%d\n", self->panel_config.video_timing.hsync_front_porch);
printf("hsync_back_porch=%d\n", self->panel_config.video_timing.hsync_back_porch);
printf("hsync_pulse_width=%d\n", self->panel_config.video_timing.hsync_pulse_width);
printf("vsync_front_porch=%d\n", self->panel_config.video_timing.vsync_front_porch);
printf("vsync_back_porch=%d\n", self->panel_config.video_timing.vsync_back_porch);
printf("vsync_pulse_width=%d\n", self->panel_config.video_timing.vsync_pulse_width);
printf("pclk_hz[10]=%d\n", self->bus_config.pclk_hz);
#endif
LCD_DEBUG_PRINT("bus_id=%d\n", self->bus_config.bus_id)
LCD_DEBUG_PRINT("num_data_lanes=%d\n", self->bus_config.num_data_lanes)
LCD_DEBUG_PRINT("lane_bit_rate_mbps=%d\n",self->bus_config.lane_bit_rate_mbps)
LCD_DEBUG_PRINT("phy_clk_src=%d\n", self->bus_config.phy_clk_src)
LCD_DEBUG_PRINT("virtual_channel=%d\n", self->panel_io_config.virtual_channel)
LCD_DEBUG_PRINT("dpi_clk_src=%d\n", self->panel_config.dpi_clk_src)
LCD_DEBUG_PRINT("dpi_clock_freq_mhz=%d\n", self->panel_config.dpi_clock_freq_mhz)
LCD_DEBUG_PRINT("hsync_front_porch=%d\n", self->panel_config.video_timing.hsync_front_porch)
LCD_DEBUG_PRINT("hsync_back_porch=%d\n", self->panel_config.video_timing.hsync_back_porch)
LCD_DEBUG_PRINT("hsync_pulse_width=%d\n", self->panel_config.video_timing.hsync_pulse_width)
LCD_DEBUG_PRINT("vsync_front_porch=%d\n", self->panel_config.video_timing.vsync_front_porch)
LCD_DEBUG_PRINT("vsync_back_porch=%d\n", self->panel_config.video_timing.vsync_back_porch)
LCD_DEBUG_PRINT("vsync_pulse_width=%d\n", self->panel_config.video_timing.vsync_pulse_width)
LCD_DEBUG_PRINT("pclk_hz[10]=%d\n", self->bus_config.pclk_hz)

self->panel_io_handle.get_lane_count = &dsi_get_lane_count;
self->panel_io_handle.del = &dsi_del;
Expand All @@ -157,9 +155,7 @@

mp_lcd_err_t dsi_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)
{
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_init(self, width=%i, height=%i, bpp=%i, buffer_size=%lu, rgb565_byte_swap=%i, cmd_bits=%i, param_bits=%i)\n", width, height, bpp, buffer_size, (uint8_t)rgb565_byte_swap, cmd_bits, param_bits);
#endif
LCD_DEBUG_PRINT("dsi_init(self, width=%i, height=%i, bpp=%i, buffer_size=%lu, rgb565_byte_swap=%i, cmd_bits=%i, param_bits=%i)\n", width, height, bpp, buffer_size, (uint8_t)rgb565_byte_swap, cmd_bits, param_bits)

mp_lcd_dsi_bus_obj_t *self = (mp_lcd_dsi_bus_obj_t *)obj;

Expand Down Expand Up @@ -187,13 +183,12 @@
self->panel_io_config.lcd_cmd_bits = (int)cmd_bits;
self->panel_io_config.lcd_param_bits = (int)param_bits;

#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("lcd_cmd_bits=%d\n", self->panel_io_config.lcd_cmd_bits);
printf("lcd_param_bits=%d\n", self->panel_io_config.lcd_param_bits);
printf("h_size=%d\n", self->panel_config.video_timing.h_size);
printf("v_size=%d\n", self->panel_config.video_timing.v_size);
printf("pixel_format=%d\n", self->panel_config.pixel_format);
#endif
LCD_DEBUG_PRINT("lcd_cmd_bits=%d\n", self->panel_io_config.lcd_cmd_bits)
LCD_DEBUG_PRINT("lcd_param_bits=%d\n", self->panel_io_config.lcd_param_bits)
LCD_DEBUG_PRINT("h_size=%d\n", self->panel_config.video_timing.h_size)
LCD_DEBUG_PRINT("v_size=%d\n", self->panel_config.video_timing.v_size)
LCD_DEBUG_PRINT("pixel_format=%d\n", self->panel_config.pixel_format)

esp_err_t ret = esp_lcd_new_dsi_bus(&self->bus_config, &self->bus_handle);

if (ret != 0) {
Expand Down Expand Up @@ -253,9 +248,7 @@

mp_lcd_err_t dsi_del(mp_obj_t obj)
{
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_del(self)\n");
#endif
LCD_DEBUG_PRINT("dsi_del(self)\n")

mp_lcd_dsi_bus_obj_t *self = (mp_lcd_dsi_bus_obj_t *)obj;

Expand Down Expand Up @@ -286,9 +279,7 @@
mp_lcd_dsi_bus_obj_t *self = (mp_lcd_dsi_bus_obj_t *)obj;
*lane_count = (uint8_t)self->bus_config.num_data_lanes;

#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_get_lane_count(self)-> %d\n", (uint8_t)self->bus_config.num_data_lanes);
#endif
LCD_DEBUG_PRINT("dsi_get_lane_count(self)-> %d\n", (uint8_t)self->bus_config.num_data_lanes)

return LCD_OK;
}
Expand All @@ -309,15 +300,11 @@
if (array_buf == self->view1) {
heap_caps_free(item_buf);
self->view1 = NULL;
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_free_framebuffer(self, buf=1)\n");
#endif
LCD_DEBUG_PRINT("dsi_free_framebuffer(self, buf=1)\n")
} else if (array_buf == self->view2) {
heap_caps_free(item_buf);
self->view2 = NULL;
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_free_framebuffer(self, buf=2)\n");
#endif
LCD_DEBUG_PRINT("dsi_free_framebuffer(self, buf=2)\n")
} else {
mp_raise_msg(&mp_type_MemoryError, MP_ERROR_TEXT("No matching buffer found"));
}
Expand All @@ -327,9 +314,7 @@

mp_obj_t dsi_allocate_framebuffer(mp_obj_t obj, uint32_t size, uint32_t caps)
{
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_allocate_framebuffer(self, size=%lu, caps=%lu)\n", size, caps);
#endif
LCD_DEBUG_PRINT("dsi_allocate_framebuffer(self, size=%lu, caps=%lu)\n", size, caps)

mp_lcd_dsi_bus_obj_t *self = (mp_lcd_dsi_bus_obj_t *)obj;

Expand Down Expand Up @@ -375,7 +360,8 @@
self->panel_config.num_fbs = 2;
} else {
heap_caps_free(buf);
mp_raise_msg(&mp_type_MemoryError, MP_ERROR_TEXT("There is a maximum of 2 frame buffers allowed"));
mp_raise_msg(&mp_type_MemoryError,
MP_ERROR_TEXT("There is a maximum of 2 frame buffers allowed"));
return mp_const_none;
}

Expand All @@ -385,9 +371,8 @@

mp_lcd_err_t dsi_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, uint8_t rotation, bool last_update)
{
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dsi_tx_color(self, lcd_cmd=%d, color, color_size=%d, x_start=%d, y_start=%d, x_end=%d, y_end=%d)\n", lcd_cmd, color_size, x_start, y_start, x_end, y_end);
#endif
LCD_DEBUG_PRINT("dsi_tx_color(self, lcd_cmd=%d, color, color_size=%d, x_start=%d, y_start=%d, x_end=%d, y_end=%d)\n", lcd_cmd, color_size, x_start, y_start, x_end, y_end)

LCD_UNUSED(rotation);
LCD_UNUSED(last_update);

Expand Down
85 changes: 38 additions & 47 deletions ext_mod/lcd_bus/esp32_src/i80_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,39 +149,37 @@
self->panel_io_config.flags.pclk_active_neg = (unsigned int)args[ARG_pclk_active_low].u_bool;
self->panel_io_config.flags.pclk_idle_low = (unsigned int)args[ARG_pclk_idle_low].u_bool;

#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("dc_gpio_num=%d\n", self->bus_config.dc_gpio_num);
printf("wr_gpio_num=%d\n", self->bus_config.wr_gpio_num);
printf("clk_src=%d\n", self->bus_config.clk_src);
printf("data_gpio_nums[0]=%d\n", self->bus_config.data_gpio_nums[0]);
printf("data_gpio_nums[1]=%d\n", self->bus_config.data_gpio_nums[1]);
printf("data_gpio_nums[2]=%d\n", self->bus_config.data_gpio_nums[2]);
printf("data_gpio_nums[3]=%d\n", self->bus_config.data_gpio_nums[3]);
printf("data_gpio_nums[4]=%d\n", self->bus_config.data_gpio_nums[4]);
printf("data_gpio_nums[5]=%d\n", self->bus_config.data_gpio_nums[5]);
printf("data_gpio_nums[6]=%d\n", self->bus_config.data_gpio_nums[6]);
printf("data_gpio_nums[7]=%d\n", self->bus_config.data_gpio_nums[7]);
printf("data_gpio_nums[8]=%d\n", self->bus_config.data_gpio_nums[8]);
printf("data_gpio_nums[9]=%d\n", self->bus_config.data_gpio_nums[9]);
printf("data_gpio_nums[10]=%d\n", self->bus_config.data_gpio_nums[10]);
printf("data_gpio_nums[11]=%d\n", self->bus_config.data_gpio_nums[11]);
printf("data_gpio_nums[12]=%d\n", self->bus_config.data_gpio_nums[12]);
printf("data_gpio_nums[13]=%d\n", self->bus_config.data_gpio_nums[13]);
printf("data_gpio_nums[14]=%d\n", self->bus_config.data_gpio_nums[14]);
printf("data_gpio_nums[15]=%d\n", self->bus_config.data_gpio_nums[15]);
printf("bus_width=%d\n", self->bus_config.bus_width);
printf("cs_gpio_num=%d\n", self->panel_io_config.cs_gpio_num);
printf("pclk_hz=%lu\n", self->panel_io_config.pclk_hz);
printf("trans_queue_depth=%d\n", self->panel_io_config.trans_queue_depth);
printf("dc_idle_level=%d\n", self->panel_io_config.dc_levels.dc_idle_level);
printf("dc_cmd_level=%d\n", self->panel_io_config.dc_levels.dc_cmd_level);
printf("dc_dummy_level=%d\n", self->panel_io_config.dc_levels.dc_dummy_level);
printf("dc_data_level=%d\n", self->panel_io_config.dc_levels.dc_data_level);
printf("cs_active_high=%d\n", self->panel_io_config.flags.cs_active_high);
printf("reverse_color_bits=%d\n", self->panel_io_config.flags.reverse_color_bits);
printf("pclk_active_neg=%d\n", self->panel_io_config.flags.pclk_active_neg);
printf("pclk_idle_low=%d\n", self->panel_io_config.flags.pclk_idle_low);
#endif
LCD_DEBUG_PRINT("dc_gpio_num=%d\n", self->bus_config.dc_gpio_num)
LCD_DEBUG_PRINT("wr_gpio_num=%d\n", self->bus_config.wr_gpio_num)
LCD_DEBUG_PRINT("clk_src=%d\n", self->bus_config.clk_src)
LCD_DEBUG_PRINT("data_gpio_nums[0]=%d\n", self->bus_config.data_gpio_nums[0])
LCD_DEBUG_PRINT("data_gpio_nums[1]=%d\n", self->bus_config.data_gpio_nums[1])
LCD_DEBUG_PRINT("data_gpio_nums[2]=%d\n", self->bus_config.data_gpio_nums[2])
LCD_DEBUG_PRINT("data_gpio_nums[3]=%d\n", self->bus_config.data_gpio_nums[3])
LCD_DEBUG_PRINT("data_gpio_nums[4]=%d\n", self->bus_config.data_gpio_nums[4])
LCD_DEBUG_PRINT("data_gpio_nums[5]=%d\n", self->bus_config.data_gpio_nums[5])
LCD_DEBUG_PRINT("data_gpio_nums[6]=%d\n", self->bus_config.data_gpio_nums[6])
LCD_DEBUG_PRINT("data_gpio_nums[7]=%d\n", self->bus_config.data_gpio_nums[7])
LCD_DEBUG_PRINT("data_gpio_nums[8]=%d\n", self->bus_config.data_gpio_nums[8])
LCD_DEBUG_PRINT("data_gpio_nums[9]=%d\n", self->bus_config.data_gpio_nums[9])
LCD_DEBUG_PRINT("data_gpio_nums[10]=%d\n", self->bus_config.data_gpio_nums[10])
LCD_DEBUG_PRINT("data_gpio_nums[11]=%d\n", self->bus_config.data_gpio_nums[11])
LCD_DEBUG_PRINT("data_gpio_nums[12]=%d\n", self->bus_config.data_gpio_nums[12])
LCD_DEBUG_PRINT("data_gpio_nums[13]=%d\n", self->bus_config.data_gpio_nums[13])
LCD_DEBUG_PRINT("data_gpio_nums[14]=%d\n", self->bus_config.data_gpio_nums[14])
LCD_DEBUG_PRINT("data_gpio_nums[15]=%d\n", self->bus_config.data_gpio_nums[15])
LCD_DEBUG_PRINT("bus_width=%d\n", self->bus_config.bus_width)
LCD_DEBUG_PRINT("cs_gpio_num=%d\n", self->panel_io_config.cs_gpio_num)
LCD_DEBUG_PRINT("pclk_hz=%lu\n", self->panel_io_config.pclk_hz)
LCD_DEBUG_PRINT("trans_queue_depth=%d\n", self->panel_io_config.trans_queue_depth)
LCD_DEBUG_PRINT("dc_idle_level=%d\n", self->panel_io_config.dc_levels.dc_idle_level)
LCD_DEBUG_PRINT("dc_cmd_level=%d\n", self->panel_io_config.dc_levels.dc_cmd_level)
LCD_DEBUG_PRINT("dc_dummy_level=%d\n", self->panel_io_config.dc_levels.dc_dummy_level)
LCD_DEBUG_PRINT("dc_data_level=%d\n", self->panel_io_config.dc_levels.dc_data_level)
LCD_DEBUG_PRINT("cs_active_high=%d\n", self->panel_io_config.flags.cs_active_high)
LCD_DEBUG_PRINT("reverse_color_bits=%d\n", self->panel_io_config.flags.reverse_color_bits)
LCD_DEBUG_PRINT("pclk_active_neg=%d\n", self->panel_io_config.flags.pclk_active_neg)
LCD_DEBUG_PRINT("pclk_idle_low=%d\n", self->panel_io_config.flags.pclk_idle_low)

self->panel_io_handle.init = &i80_init;
self->panel_io_handle.del = &i80_del;
Expand All @@ -193,9 +191,7 @@

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)
{
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("i80_init(self, width=%i, height=%i, bpp=%i, buffer_size=%lu, rgb565_byte_swap=%i, cmd_bits=%i, param_bits=%i)\n", width, height, bpp, buffer_size, (uint8_t)rgb565_byte_swap, cmd_bits, param_bits);
#endif
LCD_DEBUG_PRINT("i80_init(self, width=%i, height=%i, bpp=%i, buffer_size=%lu, rgb565_byte_swap=%i, cmd_bits=%i, param_bits=%i)\n", width, height, bpp, buffer_size, (uint8_t)rgb565_byte_swap, cmd_bits, param_bits)

mp_lcd_i80_bus_obj_t *self = (mp_lcd_i80_bus_obj_t *)obj;
self->rgb565_byte_swap = false;
Expand All @@ -208,11 +204,10 @@
self->panel_io_config.lcd_param_bits = (int)param_bits;
self->bus_config.max_transfer_bytes = (size_t)buffer_size;

#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("lcd_cmd_bits=%d\n", self->panel_io_config.lcd_cmd_bits);
printf("lcd_param_bits=%d\n", self->panel_io_config.lcd_param_bits);
printf("max_transfer_bytes=%d\n", self->bus_config.max_transfer_bytes);
#endif
LCD_DEBUG_PRINT("lcd_cmd_bits=%d\n", self->panel_io_config.lcd_cmd_bits)
LCD_DEBUG_PRINT("lcd_param_bits=%d\n", self->panel_io_config.lcd_param_bits)
LCD_DEBUG_PRINT("max_transfer_bytes=%d\n", self->bus_config.max_transfer_bytes)

esp_err_t ret = esp_lcd_new_i80_bus(&self->bus_config, &self->bus_handle);

if (ret != 0) {
Expand All @@ -231,9 +226,7 @@

mp_lcd_err_t i80_del(mp_obj_t obj)
{
#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("i80_del(self)\n");
#endif
LCD_DEBUG_PRINT("i80_del(self)\n")

mp_lcd_i80_bus_obj_t *self = (mp_lcd_i80_bus_obj_t *)obj;

Expand All @@ -255,9 +248,7 @@
mp_lcd_i80_bus_obj_t *self = (mp_lcd_i80_bus_obj_t *)obj;
*lane_count = (uint8_t)self->bus_config.bus_width;

#if CONFIG_LCD_ENABLE_DEBUG_LOG
printf("i80_get_lane_count(self)-> %d\n", (uint8_t)self->bus_config.bus_width);
#endif
LCD_DEBUG_PRINT("i80_get_lane_count(self)-> %d\n", (uint8_t)self->bus_config.bus_width)

return LCD_OK;
}
Expand Down
Loading

0 comments on commit 83d710d

Please sign in to comment.