mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-01 14:34:31 +00:00
feat(esp_lcd): replace periph_module func with new ll func
Update periph_ctrl.h
This commit is contained in:
@@ -144,7 +144,12 @@ esp_err_t esp_lcd_new_i80_bus(const esp_lcd_i80_bus_config_t *bus_config, esp_lc
|
||||
ESP_GOTO_ON_FALSE(bus_id >= 0, ESP_ERR_NOT_FOUND, err, TAG, "no free i80 bus slot");
|
||||
bus->bus_id = bus_id;
|
||||
// enable APB to access LCD registers
|
||||
periph_module_enable(lcd_periph_signals.buses[bus_id].module);
|
||||
PERIPH_RCC_ACQUIRE_ATOMIC(lcd_periph_signals.panels[bus_id].module, ref_count) {
|
||||
if (ref_count == 0) {
|
||||
lcd_ll_enable_bus_clock(bus_id, true);
|
||||
lcd_ll_reset_register(bus_id);
|
||||
}
|
||||
}
|
||||
// initialize HAL layer, so we can call LL APIs later
|
||||
lcd_hal_init(&bus->hal, bus_id);
|
||||
// reset peripheral and FIFO
|
||||
@@ -199,7 +204,11 @@ err:
|
||||
gdma_del_channel(bus->dma_chan);
|
||||
}
|
||||
if (bus->bus_id >= 0) {
|
||||
periph_module_disable(lcd_periph_signals.buses[bus->bus_id].module);
|
||||
PERIPH_RCC_RELEASE_ATOMIC(lcd_periph_signals.panels[bus->bus_id].module, ref_count) {
|
||||
if (ref_count == 0) {
|
||||
lcd_ll_enable_bus_clock(bus->bus_id, false);
|
||||
}
|
||||
}
|
||||
lcd_com_remove_device(LCD_COM_DEVICE_TYPE_I80, bus->bus_id);
|
||||
}
|
||||
if (bus->format_buffer) {
|
||||
@@ -220,7 +229,11 @@ esp_err_t esp_lcd_del_i80_bus(esp_lcd_i80_bus_handle_t bus)
|
||||
ESP_GOTO_ON_FALSE(LIST_EMPTY(&bus->device_list), ESP_ERR_INVALID_STATE, err, TAG, "device list not empty");
|
||||
int bus_id = bus->bus_id;
|
||||
lcd_com_remove_device(LCD_COM_DEVICE_TYPE_I80, bus_id);
|
||||
periph_module_disable(lcd_periph_signals.buses[bus_id].module);
|
||||
PERIPH_RCC_RELEASE_ATOMIC(lcd_periph_signals.panels[bus_id].module, ref_count) {
|
||||
if (ref_count == 0) {
|
||||
lcd_ll_enable_bus_clock(bus_id, false);
|
||||
}
|
||||
}
|
||||
gdma_disconnect(bus->dma_chan);
|
||||
gdma_del_channel(bus->dma_chan);
|
||||
esp_intr_free(bus->intr);
|
||||
|
@@ -178,7 +178,11 @@ static esp_err_t lcd_rgb_panel_destory(esp_rgb_panel_t *rgb_panel)
|
||||
{
|
||||
lcd_ll_enable_clock(rgb_panel->hal.dev, false);
|
||||
if (rgb_panel->panel_id >= 0) {
|
||||
periph_module_disable(lcd_periph_signals.panels[rgb_panel->panel_id].module);
|
||||
PERIPH_RCC_RELEASE_ATOMIC(lcd_periph_signals.panels[rgb_panel->panel_id].module, ref_count) {
|
||||
if (ref_count == 0) {
|
||||
lcd_ll_enable_bus_clock(rgb_panel->panel_id, false);
|
||||
}
|
||||
}
|
||||
lcd_com_remove_device(LCD_COM_DEVICE_TYPE_RGB, rgb_panel->panel_id);
|
||||
}
|
||||
for (size_t i = 0; i < rgb_panel->num_fbs; i++) {
|
||||
@@ -283,8 +287,12 @@ esp_err_t esp_lcd_new_rgb_panel(const esp_lcd_rgb_panel_config_t *rgb_panel_conf
|
||||
rgb_panel->panel_id = panel_id;
|
||||
|
||||
// enable APB to access LCD registers
|
||||
periph_module_enable(lcd_periph_signals.panels[panel_id].module);
|
||||
periph_module_reset(lcd_periph_signals.panels[panel_id].module);
|
||||
PERIPH_RCC_ACQUIRE_ATOMIC(lcd_periph_signals.panels[panel_id].module, ref_count) {
|
||||
if (ref_count == 0) {
|
||||
lcd_ll_enable_bus_clock(panel_id, true);
|
||||
lcd_ll_reset_register(panel_id);
|
||||
}
|
||||
}
|
||||
|
||||
// allocate frame buffers + bounce buffers
|
||||
ESP_GOTO_ON_ERROR(lcd_rgb_panel_alloc_frame_buffers(rgb_panel_config, rgb_panel), err, TAG, "alloc frame buffers failed");
|
||||
|
Reference in New Issue
Block a user