void ledCtrlShowNavBack(){ ClearAllShiftRegData(); #ifdef BASIC_LED_MODE SetRGB(1,1023,0,0); SetRGB(2,1023,0,0); SetRGB(3,1023,0,0); SetRGB(4,1023,0,0); #else //TODO FULL LED MODE #endif }
void ledCtrlShowNavLeft(int dist){ ClearAllShiftRegData(); #ifdef BASIC_LED_MODE if(dist<SHORT_DIST){ SetRGB(2,0,1023,0); }else if(dist<LONG_DIST){ SetRGB(2,0,1023,1023); }else{ SetRGB(2,0,0,1023); } #else //TODO FULL LED MODE #endif }
// Test function for scaling and unscaling luminance void TargetPixel::TestScaleLum() { const int red = 50; const int green = 128; const int blue = 203; qDebug() << endl << "TestScaleLum()"; qDebug() << "RGB:" << red << green << blue; RGB color(red, green, blue); SetRGB(color); TransformRGB2LAB(); CalcRelativeLum(); qDebug() << "Relative luminance =" << GetRelativeLum(); const double scaleFactor = 1.243; qDebug() << "Scale Factor =" << scaleFactor; ScaleRelLum(scaleFactor); qDebug() << "Relative luminance after scale =" << GetRelativeLum(); RestoreRelLum(); qDebug() << "Relative luminance after restore =" << GetRelativeLum(); }
void BreathingLight(u8 dir,u8 height,u8 color,u8 time) { u8 i; u8 grad,light; u8 rgb[3]; u8 time_id = 4*(dir-1)+height; if(TIME_TASK[time_id]>=time) { if(PWM[dir-1][height-1]>PWM_MAX) { PWM[dir-1][height-1]-=128; } grad = PWM[dir-1][height-1]++; light= SIN_TABLE[grad]; for(i=0;i<3;i++) { rgb[i] = COLOR_TABLE[color][i]&light; } SetRGB(dir,height,rgb); EA=0; switch(dir) { case 1:Display_N();break; case 2:Display_S();break; case 3:Display_W();break; case 4:Display_E();break; } EA=1; TIME_TASK[time_id]=0; } }
void ledCtrlShowNavStraight(){ //Serial.println("EIta"); //set the leds in the forward position as green ClearAllShiftRegData(); #ifdef BASIC_LED_MODE SetRGB(1,0,1023,0); //Serial.println("basic led straight"); #else //Serial.println("full led straight"); int i; for (int i = 2; i < 10; ++i) { SetRGB(i,0,1023,0); } #endif }
void ledCtrlShowNavRight(int dist){ //Serial.print("Dist "); //Serial.println(dist); ClearAllShiftRegData(); #ifdef BASIC_LED_MODE if(dist<SHORT_DIST){ SetRGB(0,0,1023,0); }else if(dist<LONG_DIST){ SetRGB(0,0,1023,1023); }else{ SetRGB(0,0,0,1023); } #else //TODO FULL LED MODE #endif }
FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX_FLOAT k) const { if (v_SetCMYK(pBuf, c, m, y, k)) { return TRUE; } FX_FLOAT R, G, B; AdobeCMYK_to_sRGB(c, m, y, k, R, G, B); return SetRGB(pBuf, R, G, B); }
EXPORT CColourPicker::CColourPicker(HWND hParentWindow) { SetRGB(0, 0, 0); SetAlpha(100); OldCol = CurrCol; UseAlpha = CP_USE_ALPHA; hParent = hParentWindow; }
void CColour::SetHSL(int h,int s,int l) { double hd = (h / 240.0); double sd = (s / 240.0); double ld = (l / 240.0); double r,g,b; HSLToRGB(hd,sd,ld,r,g,b); SetRGB((int)(r*255.0),(int)(g*255.0),(int)(b*255.0)); }
// Transform pixel to grey color // @input: // - RGB - unnull color // @output: void TargetPixel::ToGrey(const RGB &t_color) { bool pixelIsGrey = t_color.IsGreyColor(); if ( true == pixelIsGrey ) { SetRGB(t_color); } else { int red = t_color.GetRed(); int green = t_color.GetGreen(); int blue = t_color.GetBlue(); RGB greyColor(red, green, blue); greyColor.ToGrey(); SetRGB(greyColor); } }
EXPORT CColourPicker::CColourPicker(HWND hParentWindow, unsigned short r, unsigned short g, unsigned short b, unsigned short a, bool IsRGB) { if (IsRGB) SetRGB(r, g, b); else SetHSV(r, g, b); SetAlpha(a); OldCol = CurrCol; hParent = hParentWindow; }
void LED_rainbow_all(void) { unsigned char red, green, blue; // hsv2rgb(LED_Loop, 255, 255, &red, &green, &blue, MAX_BRIGHTNESS); // convert hsv to rgb values lookup_hsv2rgb(LED_Loop, &red, &green, &blue, MAX_BRIGHTNESS); // convert hsv to rgb values for(int led=0;led<RGBS;led++){ // loop over all LED's SetRGB(led, red, green, blue); // write rgb values } calulateLEDMIBAMBits(); LED_Loop++; if(LED_Loop==360) LED_Loop=0; }
void CColour::Invert() { // Invert the RGB values int red(0),green(0),blue(0); // RGB values have a range of 255 red = ~(GetRed()); green = ~(GetGreen()); blue = ~(GetBlue()); SetRGB(red,green,blue); }
void LED_rotating_rainbow(void) { int hue; unsigned char red, green, blue; LED_Loop++; // colour shift if(LED_Loop==360) LED_Loop=0; for(int led=0;led<RGBS;led++){ // loop over all LED's hue = ((led)*360/(RGBS-1)+LED_Loop)%360; // hsv2rgb(hue, 255, 255, &red, &green, &blue, MAX_BRIGHTNESS); // convert hsv to rgb values lookup_hsv2rgb(hue, &red, &green, &blue, MAX_BRIGHTNESS); // convert hsv to rgb values SetRGB(led, red, green, blue); // write rgb values } calulateLEDMIBAMBits(); }
void ReadRGB_EEPORM_ByID(u16 addr,u8 id) { u16 begin_addr = 0; u8 i = 0; u8 temp[3]; u8 dir,height; begin_addr = addr+(id-1)*48; for(i=0;i<48;i=i+3) { temp[0] =IAP_ReafByte(begin_addr+i); temp[1] =IAP_ReafByte(begin_addr+i+1); temp[2] =IAP_ReafByte(begin_addr+i+2); dir=i/12+1; height=i%12+1; SetRGB(dir,height,temp); } }
RGB(){ SetRGB(0);}
void SetRGBALL(uint8_t r, uint8_t g, uint8_t b){ for(uint32_t t=0; t<RGBS; t++){ SetRGB(t, r, g, b); } }
//LED Patterns void LED_time(){ resetLeds(); uint8_t HH = GetHH(); uint8_t MM = GetMM(); uint8_t SS = GetSS(); HH>11 ? HH-=12 : 0; #ifdef SetLED // Remove the tails SS<5 ? SetLED((SS+60)*3-13,0) : SetLED(SS*3-13,0); MM<4 ? SetLED((MM+60)*3-11,0) : SetLED(MM*3-11,0); HH<2 ? SetLED((HH+11)*3*5,0) : SetLED((HH-1)*3*5,0); HH<2 ? SetLED((HH+11)*3*5-3,0) : SetLED((HH-1)*3*5-3,0); HH<2 ? SetLED((HH+11)*3*5-6,0) : SetLED((HH-1)*3*5-6,0); // Seconds Blue // for (SS=0;SS<60;SS++){ SetLED(SS*3+2,MAX_BRIGHTNESS); SS<1 ? SetLED((SS+60)*3-1,MAX_BRIGHTNESS/5*4) : SetLED(SS*3-1,MAX_BRIGHTNESS/5*4); SS<2 ? SetLED((SS+60)*3-4,MAX_BRIGHTNESS/5*3) : SetLED(SS*3-4,MAX_BRIGHTNESS/5*3); SS<3 ? SetLED((SS+60)*3-7,MAX_BRIGHTNESS/5*2) : SetLED(SS*3-7,MAX_BRIGHTNESS/5*2); SS<4 ? SetLED((SS+60)*3-10,MAX_BRIGHTNESS/5) : SetLED(SS*3-10,MAX_BRIGHTNESS/5); // calulateLEDMIBAMBits(); // delay_ms(100); // SetLED(SS*3+2,0); // SS<1 ? SetLED((SS+60)*3-1,0) : SetLED(SS*3-1,0); // SS<2 ? SetLED((SS+60)*3-4,0) : SetLED(SS*3-4,0); // SS<3 ? SetLED((SS+60)*3-7,0) : SetLED(SS*3-7,0); // SS<4 ? SetLED((SS+60)*3-10,0) : SetLED(SS*3-10,0); // calulateLEDMIBAMBits(); // } // Minutes Green // for (MM=0;MM<60;MM++){ SetLED(MM*3+1,MAX_BRIGHTNESS); MM<1 ? SetLED((MM+60)*3-2,MAX_BRIGHTNESS/4*3) : SetLED(MM*3-2,MAX_BRIGHTNESS/4*3); MM<2 ? SetLED((MM+60)*3-5,MAX_BRIGHTNESS/4*2) : SetLED(MM*3-5,MAX_BRIGHTNESS/4*2); MM<3 ? SetLED((MM+60)*3-8,MAX_BRIGHTNESS/4*1) : SetLED(MM*3-8,MAX_BRIGHTNESS/4*1); // MM<4 ? SetLED((MM+60)*3-11,0x19/5) : SetLED(MM*3-11,0x19/5); // calulateLEDMIBAMBits(); // delay_ms(100); // SetLED(MM*3+1,0); // MM<1 ? SetLED((MM+60)*3-2,0) : SetLED(MM*3-2,0); // MM<2 ? SetLED((MM+60)*3-5,0) : SetLED(MM*3-5,0); // MM<3 ? SetLED((MM+60)*3-8,0) : SetLED(MM*3-8,0); // MM<4 ? SetLED((MM+60)*3-11,0) : SetLED(MM*3-11,0); // calulateLEDMIBAMBits(); // } //Hours red // for (HH=0;HH<12;HH++){ SetLED(HH*3*5,MAX_BRIGHTNESS); HH<1 ? SetLED((HH+12)*3*5-3,MAX_BRIGHTNESS/3*2) : SetLED(HH*3*5-3,MAX_BRIGHTNESS/3*2); HH<1 ? SetLED((HH+12)*3*5-6,MAX_BRIGHTNESS/3*1) : SetLED(HH*3*5-6,MAX_BRIGHTNESS/3*1); // HH<1 ? SetLED((HH+12)*3*5-9,0x33/5*2) : SetLED(HH*3*5-9,0x33/5*2); // HH<1 ? SetLED((HH+12)*3*5-12,0x19/5) : SetLED(HH*3*5-12,0x19/5); // calulateLEDMIBAMBits(); // delay_ms(1000); // SetLED(HH*3*5,0); // HH<1 ? SetLED((HH+12)*3*5-3,0) : SetLED(HH*3*5-3,0); // HH<1 ? SetLED((HH+12)*3*5-6,0) : SetLED(HH*3*5-6,0); // HH<1 ? SetLED((HH+12)*3*5-9,0) : SetLED(HH*3*5-9,0); // HH<1 ? SetLED((HH+12)*3*5-12,0) : SetLED(HH*3*5-12,0); // } #endif //SetLED // Remove the tails // SS<5 ? SetRGB((SS+60)-5,0,0,0) : SetRGB(SS-5,0,0,0); // MM<4 ? SetRGB((MM+60)-4,0,0,0) : SetRGB(MM-4,0,0,0); // HH<2 ? SetRGB((HH+11)*5,0,0,0) : SetRGB((HH-1)*5,0,0,0); // HH<2 ? SetRGB((HH+11)*5-2,0,0,0) : SetRGB((HH-1)*5-2,0,0,0); // HH<2 ? SetRGB((HH+11)*5-3,0,0,0) : SetRGB((HH-1)*5-3,0,0,0); for(uint8_t i=0;i<RGBS;i++) SetRGBALL(BC_R,BC_G,BC_B); // Seconds Blue // for (SS=0;SS<60;SS++){ SetRGB(SS,SC_R,SC_G,SC_B); SS<1 ? SetRGB((SS+60)-1,SC_R/5*4,SC_G/5*4,SC_B/5*4) : SetRGB(SS-1,SC_R/5*4,SC_G/5*4,SC_B/5*4); SS<2 ? SetRGB((SS+60)-2,SC_R/5*3,SC_G/5*3,SC_B/5*3) : SetRGB(SS-2,SC_R/5*3,SC_G/5*3,SC_B/5*3); SS<3 ? SetRGB((SS+60)-3,SC_R/5*2,SC_G/5*2,SC_B/5*2) : SetRGB(SS-3,SC_R/5*2,SC_G/5*2,SC_B/5*2); SS<4 ? SetRGB((SS+60)-4,SC_R/5*1,SC_G/5*1,SC_B/5*1) : SetRGB(SS-4,SC_R/5*1,SC_G/5*1,SC_B/5*1); // } // Minutes Green // for (MM=0;MM<60;MM++){ SetRGB(MM,MC_R,MC_G,MC_B); MM<1 ? SetRGB((MM+60)-1,MC_R/5*4,MC_G/5*4,MC_B/5*4) : SetRGB(MM-1,MC_R/5*4,MC_G/5*4,MC_B/5*4); MM<2 ? SetRGB((MM+60)-2,MC_R/5*3,MC_G/5*3,MC_B/5*3) : SetRGB(MM-2,MC_R/5*3,MC_G/5*3,MC_B/5*3); MM<3 ? SetRGB((MM+60)-3,MC_R/5*2,MC_G/5*2,MC_B/5*2) : SetRGB(MM-3,MC_R/5*2,MC_G/5*2,MC_B/5*2); // MM<4 ? SetRGB((MM+60)-4,0,0x19/,05) : SetRGB(MM-4,0,0x19/5,0); // } //Hours red // for (HH=0;HH<12;HH++){ SetRGB((HH+12)*5,HC_R,HC_G,HC_B); HH<1 ? SetRGB((HH+12)*5-1,HC_R/5*4,HC_G/5*4,HC_B/5*4) : SetRGB(HH*5-1,HC_R/5*4,HC_G/5*4,HC_B/5*4); HH<1 ? SetRGB((HH+12)*5-2,HC_R/5*3,HC_G/5*3,HC_B/5*3) : SetRGB(HH*5-2,HC_R/5*3,HC_G/5*3,HC_B/5*3); // HH<1 ? SetRGB((HH+12)*5-3,0x33/5*2,0,0) : SetRGB(HH*5-3,0x33/5*2,0,0); // HH<1 ? SetRGB((HH+12)*5-4,0x19/5,0,0) : SetRGB(HH*5-4,0x19/5,0,0); // } calulateLEDMIBAMBits(); }
void wxColourExt::RgbRed(float r) { RgbRed(); SetRGB(r,G,B); }
void SetHue(uint32_t led, uint32_t hue){ unsigned char red, green, blue; // hsv2rgb(hue, 255, 255, &red, &green, &blue, MAX_BRIGHTNESS); // convert hsv to rgb values lookup_hsv2rgb(hue, &red, &green, &blue, MAX_BRIGHTNESS); // convert hsv to rgb values SetRGB(led, red, green, blue); // write rgb values }
RGB(int color){ SetRGB(color) ; }
void wxColourExt::RgbGreen(float g) { RgbGreen(); SetRGB(R,g,B); }
ON_Color::ON_Color(int r, int g, int b) : m_color(0) { SetRGB(r,g,b); }
void wxColourExt::RgbBlue(float b) { RgbBlue(); SetRGB(R,G,b); }