Manage low-power mode¶
An optional external circuit can manage low-power mode. A dedicated signal drives it to enter and exit low-power mode.
The EXT4 extension board includes a circuit to manage low-power mode.
Configure¶
Ensure the panelPower
signal is set to a value other than NOT_CONNECTED
.
cpp
const pins_t myBoard =
{
// ...
.panelPower = 12, ///< Optional power circuit
// ...
};
Use¶
cpp
myScreen.begin();
begin()
- resets and configures the panel. By default, the panel is powered on.
cpp
myScreen.suspend();
suspend()
- sets all the GPIOs to
LOW
; deactivates the SPI bus; and enters low-power mode by turning off the power of the panel.
cpp
myScreen.resume();
resume()
- restores all the GPIOs; reactivates the SPI bus; exits low-power mode by turning on the power; then resets and configures the panel.
Warning
The functions suspend()
and resume()
should not be used if other devices share the same SPI bus.
Example¶
The example below shows three states: panel is powered on for 4 seconds; panel is refreshed; panel is powered off for 4 seconds.
``` cpp void displayPower() { myScreen.setOrientation(myOrientation);
hV_HAL_Serial_printf("Power on");
hV_HAL_Serial_crlf();
hV_HAL_delayMilliseconds(4000);
hV_HAL_Serial_printf("Refresh");
hV_HAL_Serial_crlf();
myScreen.clear();
myScreen.gText(4, 4, "Refresh");
myScreen.flush();
hV_HAL_Serial_printf("Power off");
hV_HAL_Serial_crlf();
myScreen.suspend();
hV_HAL_delayMilliseconds(4000);
myScreen.resume();
hV_HAL_Serial_printf("End");
hV_HAL_Serial_crlf();
myScreen.regenerate();
} ```