Update LED.MD

This commit is contained in:
Frater 2020-10-09 20:55:39 +02:00
commit 29f09200a0

52
LED.MD
View file

@ -1,21 +1,49 @@
LED
All LEDs are in fact 2 LED (one red and one green) and seems to be connected to separated pins from the controller, or at least addressed by the controller like this
All LEDs are in fact 2 LED (one red and one green) and seems to be connected to separated pins from the controller, or at least can be addressed by the controller following this addresses design:
```
LED 1 (r) = 1
LED 1 (g) = 2
```
```
LED 2 (r) = 3
LED 2 (g) = 4
```
```
LED 3 (r) = 5
LED 3 (g) = 6
```
There is no zero LED
the commands to address the LED status is 0x1B 0x4C _STATUS_
_STATUS_ byte is divided in two parts:
4 high bits are used to define the LED id,
1 low bit is used to define the status (on/off)
So Led's can controlled with the following (pseudo-c) code:
```
#define LED_STATUS_ON 0x01
#define LED_STATUS_OFF 0x00
#define LED_1_RED 0x10
#define LED_1_GREEN 0x20
#define LED_2_RED 0x30
#define LED_2_GREEN 0x40
#define LED_3_RED 0x50
#define LED_3_GREEN 0x60
void SetLed(unsigned char ledid,unsigned char status)
{
unsigned char cmd[3];
cmd[0] = "\x1b";
cmd[1] = "\x4c";
cmd[2] = (unsigned char) (ledid + status);
SerialPtr_writebuffer(cmd,3);
}
the commands to address the LED status is 0x1B 0x4C _status_
Status byte was divided in two part 4 high bits define the LED id, and 4 low bits define
SetLed(LED_1_GREEN, LED_STATUS_ON);
```