#include "system.h"
/* WS2812 library */
#define nLED 3
unsigned char bufLED[nLED*8];
void setLED(unsigned short n, unsigned char r, unsigned char g, unsigned char b) {
if (n < nLED) {
unsigned short offset = 8*n;
bufLED[offset++] = (((g&0x80)>>7)|((g&0x40)>>3)|((g&0x20)<<1))^0xdb;
bufLED[offset++] = (((g&0x10)>>4)| (g&0x08) |((g&0x04)<<4))^0xdb;
bufLED[offset++] = (((g&0x02)>>1)|((g&0x01)<<3)|((r&0x80)>>1))^0xdb;
bufLED[offset++] = (((r&0x40)>>6)|((r&0x20)>>2)|((r&0x10)<<2))^0xdb;
bufLED[offset++] = (((r&0x08)>>3)|((r&0x04)<<1)|((r&0x02)<<5))^0xdb;
bufLED[offset++] = ( (r&0x01) |((b&0x80)>>4)| (b&0x40) )^0xdb;
bufLED[offset++] = (((b&0x20)>>5)|((b&0x10)>>1)|((b&0x08)<<3))^0xdb;
bufLED[offset++] = (((b&0x04)>>2)|((b&0x02)<<2)|((b&0x01)<<6))^0xdb;
TestValSet( bufLED[8*n] );
}
}
void sendLED() {
ChangeBaud(2100000);
SendBuffer(bufLED, sizeof(bufLED));
}
/* end of RGB-LED library */
short r=0,g=0,b=0;
if (armed())
{
setLED(0,170,0,0);
setLED(2,170,0,0);
} else
{
setLED(0,0,170,0);
setLED(2,0,170,0);
}
setLED(1,170,0,0);
sendLED();
delay(500);