Skip to content

Commit

Permalink
Merge pull request #127 from lukkass222/DisplayST7789_dev_invert
Browse files Browse the repository at this point in the history
added invertMode and normalMode
  • Loading branch information
lexus2k authored Oct 20, 2024
2 parents 64aff6b + 937d44a commit 15d9fce
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/v2/lcd/st7789/lcd_st7789.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ template <class I> class InterfaceST7789: public I
*/
void setOffset(lcdint_t ox, lcdint_t oy);

/**
* @brief Set invert mode off
*
* Switches display to normal the colors of the display
*/
void normalMode();

/**
* @brief Set invert mode on
*
* Invert the colors of the display
*/
void invertMode();

private:
const int8_t m_dc = -1; ///< data/command pin for SPI, -1 for i2c
NanoDisplayBase<InterfaceST7789<I>> &m_base; ///< basic lcd display support interface
Expand Down
14 changes: 14 additions & 0 deletions src/v2/lcd/st7789/lcd_st7789.inl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ template <class I> void InterfaceST7789<I>::setOffset(lcdint_t ox, lcdint_t oy)
}
}

template <class I> void InterfaceST7789<I>::normalMode()
{
commandStart();
this->send(0x20); // Normal display
this->stop();
}

template <class I> void InterfaceST7789<I>::invertMode()
{
commandStart();
this->send(0x21); // Invert display
this->stop();
}

////////////////////////////////////////////////////////////////////////////////
// ST7789 basic 16-bit implementation
////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 15d9fce

Please sign in to comment.