mirror of
https://github.com/apache/nuttx.git
synced 2026-05-11 16:01:03 +08:00
45651ea6e5
Previously, the ST7796 driver required the board to pass a struct st7796_config_s at initialization time, carrying display resolution, color depth, orientation (MADCTL), BGR flag, SPI frequency, and initial rotation. All of these are chip-level properties, not board wiring details. This created an awkward split: board code computed MADCTL values, selected BPP, and derived effective resolution depending on orientation (knowledge that belongs exclusively in the generic driver). This commit removes that split entirely, following the same pattern used by the ST7789 driver in drivers/lcd/Kconfig. It also implements the getpower/setpower interface for standard framebuffer power management. What was changed (per file): drivers/lcd/Kconfig: - Added a full 'if LCD_ST7796' ... 'endif # LCD_ST7796' block containing all chip-level configuration. - Includes LCD_ST7796_XRES/YRES, LCD_ST7796_BPP, LCD_ST7796_FREQUENCY, LCD_ST7796_SPIMODE, LCD_ST7796_BGR, LCD_ST7796_INVCOLOR, and orientation/rotation choices. drivers/lcd/st7796.c: - Removed struct st7796_config_s from struct st7796_dev_s. - Moved struct st7796_cmd_s from public header to Private Types. - Added compile-time macros derived from Kconfig: ST7796_XRES/YRES (swapped for landscape), ST7796_MADCTL_BASE, ST7796_SPIMODE, ST7796_BYTESPP, ST7796_COLORFMT. - Implemented st7796_getpower() and st7796_setpower() using the st7796_board_power() board callback. - Registered power functions in st7796_fbinitialize() vtable. - Updated st7796_init_display() to make INVON/INVOFF conditional on CONFIG_LCD_ST7796_INVCOLOR. - Simplified st7796_fbinitialize() signature to only take 'struct spi_dev_s *spi'. include/nuttx/lcd/st7796.h: - Removed legacy macros (ST7796_XRES_RAW, etc.) and configuration structures. - Updated st7796_fbinitialize() prototype. - Added st7796_board_power() callback prototype. - Removed private implementation details from the public header. boards/arm/stm32h7/nucleo-h753zi/Kconfig: - Removed chip-level menus (settings, orientation) now handled by the generic driver. - Retained only board-specific wiring concerns (pins and SPI bus). boards/.../stm32_st7796.c: - Removed g_st7796_config and associated board-side macros. - Updated st7796_fbinitialize() call to the new signature. - stm32_st7796_flush_fb() now queries effective resolution via g_fb_vtable->getvideoinfo(). Verified on nucleo-h753zi: Orientation: Landscape (480x320), Rotation: 180 deg, BGR: enabled, INVCOLOR: disabled, BPP: RGB565, Frequency: 40 MHz. Making INVCOLOR a Kconfig option (default n) fixes cases where panels previously showed inverted colors due to hardcoded INVON. Signed-off-by: vrmay23 <vmay.sweden@gmail.com>