Skip to content

Commit

Permalink
drivers/st7735: add MCU 8080 8-/16-bit parallel mode support
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Sep 20, 2023
1 parent 10122a7 commit b0ec24b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
14 changes: 12 additions & 2 deletions drivers/include/st77xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@
* @ref lcd_params_t::cntrl or as macro @ref ST77XX_PARAM_CNTRL if the
* default parameter set @ref ST77XX_PARAMS is used.
*
* The driver uses the SPI serial interface to communicate with the display
* controller.
* The driver communicates with the device either via an
*
* - SPI serial interface (if module `lcd_spi` enabled) or an
* - MCU 8080 8-/16-bit parallel interface (if module `lcd_parallel` or
* module `lcd_parallel_16` is enabled).
*
* Usually the device driver is used either for a single display with SPI serial
* interface or for a display with parallel MCU 8080 8-/16-bit parallel
* interface. However, the device driver can also be used simultaneously for
* multiple displays with different interfaces if several of the `lcd_spi`,
* `lcd_parallel` and `lcd_parallel_16bit` modules are enabled at the same time.
* In this case, please refer to the notes in @ref lcd_params_t.
*
* The device requires colors to be send in big endian RGB-565 format. The
* @ref CONFIG_LCD_LE_MODE compile time option can switch this, but only use this
Expand Down
40 changes: 36 additions & 4 deletions drivers/st77xx/include/st77xx_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,46 @@ extern "C" {
#define ST77XX_PARAM_OFFSET_Y 0 /**< Vertival offset */
#endif

#if MODULE_LCD_SPI || DOXYGEN
/** Default interface params if SPI serial interface is enabled */
#define ST77XX_PARAM_IF_SPI .spi = ST77XX_PARAM_SPI, \
.spi_clk = ST77XX_PARAM_SPI_CLK, \
.spi_mode = ST77XX_PARAM_SPI_MODE,
#else
#define ST77XX_PARAM_IF_SPI
#endif

#if MODULE_LCD_PARALLEL || DOXYGEN
/** Default interface params if MCU 8080 8-bit parallel interface is enabled */
#define ST77XX_PARAM_IF_PAR .d0_pin = ST77XX_PARAM_D0, \
.d1_pin = ST77XX_PARAM_D1, \
.d2_pin = ST77XX_PARAM_D2, \
.d3_pin = ST77XX_PARAM_D3, \
.d4_pin = ST77XX_PARAM_D4, \
.d5_pin = ST77XX_PARAM_D5, \
.d6_pin = ST77XX_PARAM_D6, \
.d7_pin = ST77XX_PARAM_D7, \
.wrx_pin = ST77XX_PARAM_WRX, \
.rdx_pin = ST77XX_PARAM_RDX,
#else
#define ST77XX_PARAM_IF_PAR
#endif

/**
* @brief Default params
*
* @note The default parameter set defined here can only be used if a single
* ST77xx display and only one interface mode is used. If multiple
* ST77xx displays are used or if multiple interface modes are enabled
* by the modules `lcd_spi`, lcd_parallel and `lcd_parallel_16bit`, a user
* defined parameter set @ref ST77XX_PARAMS has to be defined. In the
* latter case @ref lcd_params_t::spi must then be set to @ref SPI_UNDEF
* for displays with MCU 8080 8-/16-bit parallel interfaces.
*/
#ifndef ST77XX_PARAMS
#define ST77XX_PARAMS { .cntrl = ST77XX_PARAM_CNTRL, \
.spi = ST77XX_PARAM_SPI, \
.spi_clk = ST77XX_PARAM_SPI_CLK, \
.spi_mode = ST77XX_PARAM_SPI_MODE, \
ST77XX_PARAM_IF_SPI \
ST77XX_PARAM_IF_PAR \
.cs_pin = ST77XX_PARAM_CS, \
.dcx_pin = ST77XX_PARAM_DCX, \
.rst_pin = ST77XX_PARAM_RST, \
Expand All @@ -156,7 +188,7 @@ extern "C" {
.offset_x = ST77XX_PARAM_OFFSET_X, \
.offset_y = ST77XX_PARAM_OFFSET_Y, \
}
#endif
#endif /* ST77XX_PARAMS */
/** @} */

/**
Expand Down

0 comments on commit b0ec24b

Please sign in to comment.