Skip to content

Commit 15d9fce

Browse files
authored
Merge pull request #127 from lukkass222/DisplayST7789_dev_invert
added invertMode and normalMode
2 parents 64aff6b + 937d44a commit 15d9fce

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/v2/lcd/st7789/lcd_st7789.h

+14
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,20 @@ template <class I> class InterfaceST7789: public I
120120
*/
121121
void setOffset(lcdint_t ox, lcdint_t oy);
122122

123+
/**
124+
* @brief Set invert mode off
125+
*
126+
* Switches display to normal the colors of the display
127+
*/
128+
void normalMode();
129+
130+
/**
131+
* @brief Set invert mode on
132+
*
133+
* Invert the colors of the display
134+
*/
135+
void invertMode();
136+
123137
private:
124138
const int8_t m_dc = -1; ///< data/command pin for SPI, -1 for i2c
125139
NanoDisplayBase<InterfaceST7789<I>> &m_base; ///< basic lcd display support interface

src/v2/lcd/st7789/lcd_st7789.inl

+14
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@ template <class I> void InterfaceST7789<I>::setOffset(lcdint_t ox, lcdint_t oy)
159159
}
160160
}
161161

162+
template <class I> void InterfaceST7789<I>::normalMode()
163+
{
164+
commandStart();
165+
this->send(0x20); // Normal display
166+
this->stop();
167+
}
168+
169+
template <class I> void InterfaceST7789<I>::invertMode()
170+
{
171+
commandStart();
172+
this->send(0x21); // Invert display
173+
this->stop();
174+
}
175+
162176
////////////////////////////////////////////////////////////////////////////////
163177
// ST7789 basic 16-bit implementation
164178
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)