jhd1313m1: add setColor method call to control backlight
authorBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 14 Jul 2014 09:48:55 +0000 (10:48 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 14 Jul 2014 09:48:55 +0000 (10:48 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/lcd/jhd1313m1.cxx
src/lcd/jhd1313m1.h

index 3b251de..d2f3aeb 100644 (file)
@@ -70,6 +70,20 @@ Jhd1313m1::~Jhd1313m1() {
     
 }
 
+mraa_result_t
+Jhd1313m1::setColor(uint8_t r, uint8_t g, uint8_t b)
+{
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0, 0);
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 1, 0);
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x08, 0xAA);
+
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x04, r);
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x03, g);
+    i2cReg (m_i2c_lcd_rgb, m_rgb_address, 0x02, b);
+
+    return MRAA_SUCCESS;
+}
+
 /*
  * **************
  *  virtual area
index bb23f77..5d637ca 100644 (file)
@@ -32,6 +32,7 @@ class Jhd1313m1 : public I2CLcd {
     public:
         Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
         ~Jhd1313m1 ();
+        mraa_result_t setColor(uint8_t r, uint8_t g, uint8_t b);
         mraa_result_t write (std::string msg);
         mraa_result_t setCursor (int row, int column);
         mraa_result_t clear ();