Add documentation to SM2135 driver

Add documentation to SM2135 driver
This commit is contained in:
Theo Arends 2019-10-04 17:15:41 +02:00
parent 2d194f427f
commit 6997626077
1 changed files with 27 additions and 10 deletions

View File

@ -20,21 +20,38 @@
#ifdef USE_LIGHT
#ifdef USE_SM2135
/*********************************************************************************************\
* SM2135 RGBCW Led bulbs like Action LSC SmartLed
* SM2135 RGBCW Led bulbs like some Action LSC SmartLed
*
* {"NAME":"LSC RGBCW LED","GPIO":[0,0,0,0,0,0,0,0,181,0,180,0,0],"FLAG":0,"BASE":18}
\*********************************************************************************************/
#define XDRV_26 26
#define SM2135_ADDR 0xC0
#define SM2135_ADDR_MC 0xC0 // Max current register
#define SM2135_ADDR_CH 0xC1 // RGB or CW channel select register
#define SM2135_ADDR_R 0xC2 // Red color
#define SM2135_ADDR_G 0xC3 // Green color
#define SM2135_ADDR_B 0xC4 // Blue color
#define SM2135_ADDR_C 0xC5 // Cold
#define SM2135_ADDR_W 0xC6 // Warm
//#define SM2135_CURRENT 0x12 // 3 x 15mA for RGB, 2 x 20mA for CW - Get really hot
//#define SM2135_CURRENT 0x11 // 3 x 15mA for RGB, 2 x 15mA for CW
#define SM2135_CURRENT 0x20 // 3 x 20mA for RGB, 2 x 10mA for CW
#define SM2135_RGB 0x00 // RGB channel
#define SM2135_CW 0x80 // CW channel (Chip default)
#define SM2135_RGB 0x00
#define SM2135_CW 0x80
#define SM2135_10MA 0x00
#define SM2135_15MA 0x01
#define SM2135_20MA 0x02 // RGB max current (Chip default)
#define SM2135_25MA 0x03
#define SM2135_30MA 0x04 // CW max current (Chip default)
#define SM2135_35MA 0x05
#define SM2135_40MA 0x06
#define SM2135_45MA 0x07 // Max value for RGB
#define SM2135_50MA 0x08
#define SM2135_55MA 0x09
#define SM2135_60MA 0x0A
// RGB current CW current
const uint8_t SM2135_CURRENT = (SM2135_20MA << 4) | SM2135_10MA;
struct SM2135 {
uint8_t clk = 0;
@ -85,12 +102,12 @@ bool Sm2135SetChannels(void)
// buffer[4] >>= 1; // Divide by 2
}
*/
data[0] = SM2135_ADDR;
data[0] = SM2135_ADDR_MC;
data[1] = SM2135_CURRENT;
data[2] = SM2135_CW;
Sm2135Send(data, 3);
delay(1);
data[0] = SM2135_ADDR +5;
data[0] = SM2135_ADDR_C;
data[1] = buffer[4]; // Warm
data[2] = buffer[3]; // Cold
Sm2135Send(data, 3);
@ -102,7 +119,7 @@ bool Sm2135SetChannels(void)
// Currently not needed with setting 3 x 15mA = 45mA = 11W = 765
}
*/
data[0] = SM2135_ADDR;
data[0] = SM2135_ADDR_MC;
data[1] = SM2135_CURRENT;
data[2] = SM2135_RGB;
data[3] = buffer[1]; // Green