mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-03 00:21:44 +01:00
feat(lcd): pre-support rgb and i80 lcd driver on esp32p4
added LL functions for LCD_CAM module, only the LCD part
This commit is contained in:
@@ -7,14 +7,13 @@
|
||||
#include "hal/lcd_hal.h"
|
||||
#include "hal/lcd_ll.h"
|
||||
#include "hal/log.h"
|
||||
#include "hal/hal_utils.h"
|
||||
|
||||
void lcd_hal_init(lcd_hal_context_t *hal, int id)
|
||||
{
|
||||
hal->dev = LCD_LL_GET_HW(id);
|
||||
}
|
||||
|
||||
uint32_t lcd_hal_cal_pclk_freq(lcd_hal_context_t *hal, uint32_t src_freq_hz, uint32_t expect_pclk_freq_hz, int lcd_clk_flags)
|
||||
uint32_t lcd_hal_cal_pclk_freq(lcd_hal_context_t *hal, uint32_t src_freq_hz, uint32_t expect_pclk_freq_hz, int lcd_clk_flags, hal_utils_clk_div_t* lcd_clk_div)
|
||||
{
|
||||
// lcd_clk = module_clock_src / (n + b / a)
|
||||
// pixel_clk = lcd_clk / mo
|
||||
@@ -29,12 +28,9 @@ uint32_t lcd_hal_cal_pclk_freq(lcd_hal_context_t *hal, uint32_t src_freq_hz, uin
|
||||
.min_integ = 2,
|
||||
.max_fract = LCD_LL_CLK_FRAC_DIV_AB_MAX,
|
||||
};
|
||||
hal_utils_clk_div_t lcd_clk_div = {};
|
||||
uint32_t real_freq = hal_utils_calc_clk_div_frac_fast(&lcd_clk_info, &lcd_clk_div);
|
||||
HAL_EARLY_LOGD("lcd_hal", "n=%"PRIu32",a=%"PRIu32",b=%"PRIu32",mo=%"PRIu32, lcd_clk_div.integer, lcd_clk_div.denominator, lcd_clk_div.numerator, mo);
|
||||
uint32_t real_freq = hal_utils_calc_clk_div_frac_fast(&lcd_clk_info, lcd_clk_div);
|
||||
HAL_EARLY_LOGD("lcd_hal", "n=%"PRIu32",a=%"PRIu32",b=%"PRIu32",mo=%"PRIu32, lcd_clk_div->integer, lcd_clk_div->denominator, lcd_clk_div->numerator, mo);
|
||||
|
||||
lcd_ll_set_group_clock_coeff(hal->dev, lcd_clk_div.integer, lcd_clk_div.denominator, lcd_clk_div.numerator);
|
||||
lcd_ll_set_pixel_clock_prescale(hal->dev, mo);
|
||||
|
||||
return real_freq / mo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user