]>
git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/fnordlicht-firmware/pwm.h
1 /* vim:ts=4 sts=4 et tw=80
5 * for additional information please
6 * see http://lochraster.org/fnordlichtmini
8 * (c) by Alexander Neumann <alexander@bumpern.de>
9 * Lars Noschinski <lars@public.noschinski.de>
11 * This program is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as published by
13 * the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * You should have received a copy of the GNU General Public License along with
21 * this program. If not, see <http://www.gnu.org/licenses/>.
31 #error "PWM_CHANNELS is not 3, this is unsupported!"
34 #define PWM_HSV_SIZE sizeof(struct hsv_color_t)
39 struct rgb_color_t current
;
41 /* target for fading engine */
42 struct dual_color_t target
;
44 /* delay and step for fading engine */
45 uint8_t fade_delay
[PWM_CHANNELS
];
46 uint8_t fade_step
[PWM_CHANNELS
];
49 extern struct global_pwm_t global_pwm
;
54 void pwm_poll_fading(void);
56 void pwm_fade_rgb(struct rgb_color_t
*color
, uint8_t step
, uint8_t delay
);
57 void pwm_fade_hsv(struct hsv_color_t
*color
, uint8_t step
, uint8_t delay
);
59 /* return true if fading process is complete */
60 bool pwm_target_reached(void);
62 /* convert hsv to rgb color */
63 void pwm_hsv2rgb(struct dual_color_t
*color
);
64 /* convert rgb to hsv color */
65 void pwm_rgb2hsv(struct dual_color_t
*color
);
67 /* stop fading, hold current color */
68 void pwm_stop_fading(void);
71 void pwm_modify_rgb(struct rgb_color_offset_t
*color
, uint8_t step
, uint8_t delay
);
72 void pwm_modify_hsv(struct hsv_color_offset_t
*color
, uint8_t step
, uint8_t delay
);