14 //s/w "BCM"(<== "Binary Code Modulation") timer setup
17 TIMSK0
|= _BV(OCIE0A
);
22 ISR(TIMER0_COMPA_vect
){
29 Q
|= (pwm_val
[0] & pwm_cycle
)?1:0;
30 Q
|= (pwm_val
[1] & pwm_cycle
)?2:0;
31 Q
|= (pwm_val
[2] & pwm_cycle
)?4:0;
32 Q
|= (pwm_val
[3] & pwm_cycle
)?8:0;
33 Q
|= (pwm_val
[4] & pwm_cycle
)?16:0;
34 Q
|= (pwm_val
[5] & pwm_cycle
)?32:0;
35 Q
|= (pwm_val
[6] & pwm_cycle
)?64:0;
36 Q
|= (pwm_val
[7] & pwm_cycle
)?128:0;
42 uint8_t pwm_cycle
= 1;
45 rgb_value_t
hsv_to_rgb(hsv_value_t k
){
46 //The following algorithm is loosely based on http://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB
47 uint16_t c_
= (uint16_t)k
.v
* (uint16_t)k
.s
;
50 rgb_value_t ret
= {0, 0, 0};
80 uint16_t x_
= c
* (uint16_t)h_
;
111 #else//HAS_PWM_SUPPORT
116 #endif//HAS_PWM_SUPPORT