Browse Source

jhd1313m1: add setColor method call to control backlight

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Brendan Le Foll 10 years ago
parent
commit
86a3be4517
2 changed files with 15 additions and 0 deletions
  1. 14
    0
      src/lcd/jhd1313m1.cxx
  2. 1
    0
      src/lcd/jhd1313m1.h

+ 14
- 0
src/lcd/jhd1313m1.cxx View File

@@ -70,6 +70,20 @@ Jhd1313m1::~Jhd1313m1() {
70 70
     
71 71
 }
72 72
 
73
+mraa_result_t
74
+Jhd1313m1::setColor(uint8_t r, uint8_t g, uint8_t b)
75
+{
76
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0, 0);
77
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 1, 0);
78
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x08, 0xAA);
79
+
80
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x04, r);
81
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x03, g);
82
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x02, b);
83
+
84
+    return MRAA_SUCCESS;
85
+}
86
+
73 87
 /*
74 88
  * **************
75 89
  *  virtual area

+ 1
- 0
src/lcd/jhd1313m1.h View File

@@ -32,6 +32,7 @@ class Jhd1313m1 : public I2CLcd {
32 32
     public:
33 33
         Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
34 34
         ~Jhd1313m1 ();
35
+        mraa_result_t setColor(uint8_t r, uint8_t g, uint8_t b);
35 36
         mraa_result_t write (std::string msg);
36 37
         mraa_result_t setCursor (int row, int column);
37 38
         mraa_result_t clear ();