Update LED.MD

This commit is contained in:
Frater 2020-10-09 20:58:50 +02:00
commit 343ce44094

31
LED.MD
View file

@ -46,4 +46,35 @@ void SetLed(unsigned char ledid,unsigned char status)
SetLed(LED_1_GREEN, LED_STATUS_ON); SetLed(LED_1_GREEN, LED_STATUS_ON);
```
Notes:
In the CP's drivers, the LED were addressed in a funny ways:
```
int _SetLedState(int led,int state)
{
char led_id;
int ret;
char cmdRed [3];
char cmdGreen [3];
ret = -1;
if (led - 1U < 3)
{
led_id = (char)led * '\x02';
cmdRed[2] = (led_id + -1) * '\x10' | (byte)state & 1;
cmdGreen[2] = (led_id + -2) * '\x10' | (byte)((uint)state >> 1) & 1;
cmdGreen[0] = '\x1b';
cmdGreen[1] = 'L';
cmdRed[0] = '\x1b';
cmdRed[1] = 'L';
SendCommand(fd,cmdGreen,3);
SendCommand(fd,cmdRed,3);
ret = 0;
}
return ret;
}
``` ```