vrmay23 opened a new pull request, #18505:
URL: https://github.com/apache/nuttx/pull/18505

   ## Summary
   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.
   
   ## Impact
   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.
   
   ## Testing
   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.
   
   <img width="438" height="640" alt="image" 
src="https://github.com/user-attachments/assets/df07078a-35e1-4788-8ec1-e66a38bc38cb";
 />
   
   <img width="1335" height="749" alt="image" 
src="https://github.com/user-attachments/assets/d7e3499c-bd87-4f91-a822-a13b4014e6a5";
 />
   
   <img width="1748" height="641" alt="image" 
src="https://github.com/user-attachments/assets/d916c9bf-be95-482e-ad34-7ac9ee446028";
 />
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to