File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,20 @@ void M5_STAMPLC::io_expander_a_init()
6262 ioe.setDirection (5 , true );
6363 ioe.setPullMode (5 , false );
6464 ioe.setHighImpedance (5 , true );
65-
65+
6666 ioe.setDirection (6 , true );
6767 ioe.setPullMode (6 , false );
6868 ioe.setHighImpedance (6 , true );
6969}
7070
71+ void M5_STAMPLC::setBacklight (bool on)
72+ {
73+ auto & ioe = M5.getIOExpander (0 );
74+
75+ ioe.setHighImpedance (7 , !on);
76+ ioe.digitalWrite (7 , !on); // backlight is active low
77+ }
78+
7179void M5_STAMPLC::setStatusLight (const uint8_t & r, const uint8_t & g, const uint8_t & b)
7280{
7381 auto & ioe = M5.getIOExpander (0 );
Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ class M5_STAMPLC {
5858 */
5959 void setStatusLight (const uint8_t & r, const uint8_t & g, const uint8_t & b);
6060
61+ /* *
62+ * @brief Control the LCD backlight
63+ *
64+ * @param on true to turn backlight ON, false to turn it OFF
65+ */
66+ void setBacklight (bool on);
67+
6168 /* *
6269 * @brief Read PLC Input
6370 *
You can’t perform that action at this time.
0 commit comments