Skip to content

Commit

Permalink
fixup! drivers/lcd: add init sequence option
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Sep 22, 2023
1 parent 364d10d commit 1466f6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions drivers/include/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,17 @@ void lcd_write_cmd(lcd_t *dev, uint8_t cmd, const uint8_t *data,
* - n bytes the parameters of the command.
*
* If @ref LCD_DELAY is used as the command index, the command is not sent
* to the display controller, but a delay is inserted, where the length
* in the CLP tuple then defines the delay in milliseconds.
* to the display controller, but a delay is inserted, where the length in the
* CLP tuple must be 1 and the value then defines the delay in milliseconds.
*
* The following example shows the initialization sequence for a display
* with a ST7789:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
* static const uint8_t st7789_default_init[] = {
* LCD_CMD_SWRESET, 0, // Soft Reset
* LCD_DELAY, 120, // Soft Reset needs 120 ms if in Sleep In mode
* LCD_DELAY, 1, 120, // Soft Reset needs 120 ms if in Sleep In mode
* LCD_CMD_SLPOUT, 0, // Sleep Out leave Sleep In state after reset
* LCD_DELAY, 120, // Sleep Out needs 120 ms
* LCD_DELAY, 1, 120, // Sleep Out needs 120 ms
* LCD_CMD_VCOMS, 1, 0x20, // VCOM=0.9V
* LCD_CMD_VRHS, 1, 0x0b, // VRH=4.1V
* LCD_CMD_VDVS, 1, 0x20, // VDV=0V
Expand All @@ -404,7 +404,7 @@ void lcd_write_cmd(lcd_t *dev, uint8_t cmd, const uint8_t *data,
* LCD_CMD_DINVON, 0, // enable Inversion, reset default is off
* LCD_CMD_SLPOUT, 0, // Sleep out (turn off sleep mode)
* LCD_CMD_NORON, 0, // Normal display mode on
* LCD_DELAY, 1,
* LCD_DELAY, 1, 1,
* LCD_CMD_DISPON, 0, // Display on
* };
*
Expand Down
6 changes: 3 additions & 3 deletions drivers/lcd/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,9 @@ void lcd_write_cmd_sequence(const lcd_t *dev, const uint8_t *seq, size_t seq_len
uint8_t num = seq[idx++];

if (cmd == LCD_DELAY) {
/* in case of delay command, the number of parameters represents the
* delay in ms */
ztimer_sleep(ZTIMER_MSEC, num);
/* in case of delay command, the number of parameters is 1 */
assert(1);
ztimer_sleep(ZTIMER_MSEC, seq[idx++]);
continue;
}

Expand Down

0 comments on commit 1466f6a

Please sign in to comment.