lupyuen commented on issue #5810:
URL: 
https://github.com/apache/incubator-nuttx/issues/5810#issuecomment-1076904990


   Perhaps we should take the required BL602 GPIOs and wrap them as Device 
Drivers, then expose them via `ioctl()`.
   
   I'm taking this approach for the ST7789 Display Pins on BL602: 
[bl602_bringup.c](https://github.com/lupyuen/incubator-nuttx/blob/st7789/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c#L719-L749)
   
   ```c
   int board_lcd_initialize(void) {
     ...
     //  Configure Reset Pin
     bl602_configgpio(BOARD_LCD_RST);
     //  Set Reset Pin to Low
     bl602_gpiowrite(BOARD_LCD_RST, false);
   ```
   
   The ST7789 Pins are defined in 
[board.h](https://github.com/lupyuen/incubator-nuttx/blob/st7789/boards/risc-v/bl602/bl602evb/include/board.h#L99-L104)
   
   ```c
   #ifdef CONFIG_LCD_ST7789
   /* ST7789 Configuration: Reset and Backlight Pins */
   #define BOARD_LCD_RST (GPIO_OUTPUT | GPIO_PULLUP | GPIO_FUNC_SWGPIO | 
GPIO_PIN4)
   #define BOARD_LCD_BL  (GPIO_OUTPUT | GPIO_PULLUP | GPIO_FUNC_SWGPIO | 
GPIO_PIN5)
   #endif  /* CONFIG_LCD_ST7789 */
   ```
   
   I don't think we're breaking NuttX design because that's how ESP32 handles 
the ST7789 pins: 
[esp32c3_st7789.c](https://github.com/lupyuen/incubator-nuttx/blob/st7789/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7789.c#L79-L107)
   
   ```c
   int board_lcd_initialize(void) {
     ...
     //  Configure Reset Pin
     esp32c3_configgpio(LCD_RST, OUTPUT);
     //  Set Reset Pin to Low
     esp32c3_gpiowrite(LCD_RST, false);
   ```
   
   These articles explain how I created my own Device Drivers for NuttX:
   -   ["SPI on Apache NuttX OS"](https://lupyuen.github.io/articles/spi2)
   -   ["Apache NuttX Driver for BME280 Sensor: Ported from Zephyr 
OS"](https://lupyuen.github.io/articles/bme280)
   
   


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to