RGB LED Driver demo

Dependents:   NJU6063_HelloWorld

Revision:
1:bbc915c814da
Parent:
0:0283db13b7f1
Child:
2:137675ac48ab
--- a/NJU6063.h	Sat Dec 26 13:19:46 2015 +0000
+++ b/NJU6063.h	Sat Jan 09 07:39:52 2016 +0000
@@ -1,5 +1,8 @@
 /** @file NJU6063.h
-* @brief mbed library to use a NJU6063 RGB LED Driver
+* @author k.og
+* @version 0.1
+* @date 26-Dec-2015
+* @brief mbed library to use a NJU6063 RGB LED driver
 * http://www.njr.com/semicon/products/NJU6063.html
 * interface: I2C
 */
@@ -25,37 +28,82 @@
 #define ILED1X05 0x02
 #define ILED1X025 0x01
 #define ILED2OFF 0x00
-#define ILED2X1  0x0C
-#define ILED2X05 0x08
-#define ILED2X025 0x04
+#define ILED2X1  0x03
+#define ILED2X05 0x02
+#define ILED2X025 0x01
 #define ILED3OFF 0x00
-#define ILED3X1  0x30
-#define ILED3X05 0x20
-#define ILED3X025 0x10
+#define ILED3X1  0x03
+#define ILED3X05 0x02
+#define ILED3X025 0x01
 #define ALL 0xff
 
 #define DEFAULTINIT FC800KHZ|FDX8|EN
 
-/**
-* @param sda I2C-bus SDA pin
-* @param scl I2C-bus SCL pin
-* @param rst Digital Out
-*/
 class NJU6063
 {
 private:
     I2C _i2c;
     DigitalOut _rst;
 public:
+    /**
+    * @param sda I2C-bus SDA pin
+    * @param scl I2C-bus SCL pin
+    * @param rst Digital pin
+    */
     NJU6063( PinName sda, PinName scl, PinName rst);
+    /** Destructor of NJU6063
+    */
     ~NJU6063() {};
+    /** NJU6063 Reset
+    */
     void reset(void);
+    /** NJU6063 device addres set
+    * @param n Max number of device. 1 - 254
+    */
     void set_multi_device(uint8_t n);
+    /** NJU6063 Initial setting
+    * @param chip_addr  target chip address
+    * @param d          data
+    *   7   6   5   4   3   2   1   0
+    *  DM  DO FC1 FD0 FD1 FD0 EXT  EN
+    * DM DO1 Function 0: Multi device control, 1: GPO
+    * DO The bit output to DO1
+    * FC OSC Frequency 0:1MHz, 1:1.3MHz, 2:2.2MHz, 3:0.8MHz
+    * FD divider 0:1/256, 1:1/512, 2:1/1024, 3:1/2048
+    * EXT OSC select 0:INT OSC, 1:EXT CLOCK
+    * EN 0:Disable, 1:Enable
+    */
     void init(uint8_t chip_addr, uint8_t d);
+    /** Set LED current
+    * @param chip_addr  target chip address
+    * @param d1         led1 current set
+    * @param d2         led2 current set
+    * @param d3         led3 current set
+    * 0: LED off, 1: 0.25*ILED, 2: 0.5*ILED, 3: 1*ILED
+    */
     void set_iled(uint8_t chip_addr, uint8_t d1, uint8_t d2, uint8_t d3);
+    /** Set PWM Duty
+    * @param chip_addr  target chip address
+    * @param d1         led1 pwm  0 - 0x7f (127/128)
+    * @param d2         led2 pwm  0 - 0x7f (127/128)
+    * @param d3         led3 pwm  0 - 0x7f (127/128)
+    * @param loop       no of loop & no of step
+    * @param son        led3 current set bit0:LED1, bit1:LED2, bit3:LED3
+    * 
+    * STEP[6:4] 2^n , 0:1, 1:2, 2:4, 3:8, 4:16, 5:32, 6:1, 7:1
+    * LOOP[3:0] 4*(n+1) , 0:4 ... 15:64
+    */
     void set_pwm(uint8_t chip_addr, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t loop=0x5f, uint8_t son=0x00);
+    /** Dimming Start
+    * @param chip_addr  target chip address
+    */
     void dim_start(uint8_t chip_addr);
-    uint8_t check_dim(void);
+    /** Dimming stop
+    */
+    void dim_stop(uint8_t chip_addr);
+    /** Dimming check
+    */
+    void check_dim(void);
 };
 
 #endif // MBED_NJU6063_H
\ No newline at end of file