]> www.fi.muni.cz Git - bike-lights.git/blob - lights.h
feedback loop with some testing code
[bike-lights.git] / lights.h
1 #ifndef LIGHTS_H__
2 #define LIGHTS_H__ 1
3
4 #define N_LEDS 5
5 #define N_PWMLEDS 3
6 #define N_PWMLED_MODES 4
7
8 /* logging.c */
9 #ifdef USE_LOGGING
10 void log_set_state(unsigned char val);
11 void log_init();
12 void log_flush();
13 void log_byte(unsigned char byte);
14 void log_word(uint16_t word);
15 #else
16 void inline log_set_state(unsigned char val) { }
17 void inline log_init() { }
18 void inline log_flush() { }
19 void inline log_byte(unsigned char byte) { }
20 void inline log_word(uint16_t word) { }
21 #endif
22
23 /* adc.c */
24 void init_adc();
25 void timer_start_adcs();
26
27 /* pwm.c */
28 void init_pwm();
29 void pwm_on(unsigned char n);
30 void pwm_off(unsigned char n);
31 void pwm_set(unsigned char n, unsigned char stride);
32
33 /* tmr.c */
34 extern volatile uint16_t jiffies;
35 void init_tmr();
36
37 /* pwmled.c */
38 void pwmled_init();
39 void pwmled_adc(unsigned char n, uint16_t adcval);
40 void pwmled_set_mode(unsigned char n, unsigned char mode);
41 unsigned char pwmled_needs_adc(unsigned char n);
42 unsigned char pwmled_enabled(unsigned char n);
43
44 /* gpio.c */
45 #define GPIO_LED1 0
46 #define GPIO_LED2 1
47
48 void gpio_init();
49 void gpio_set(unsigned char n, unsigned char on);
50
51 /* ambient.c */
52 void ambient_init();
53 extern volatile unsigned char ambient_zone;
54 void ambient_adc(uint16_t adc_val);
55
56 /* pattern.c */
57 void pattern_init();
58 void patterns_next_tick();
59
60 #endif /* !LIGHTS_H__ */
61