]> www.fi.muni.cz Git - bike-lights.git/blob - lights.h
9e3a43b5bc6f964f9c6aa3910900b2adcb9beed1
[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
43 /* gpio.c */
44 #define GPIO_LED1 0
45 #define GPIO_LED2 1
46
47 void gpio_init();
48 void gpio_set(unsigned char n, unsigned char on);
49
50 /* ambient.c */
51 void ambient_init();
52 extern volatile unsigned char ambient_zone;
53 void ambient_adc(uint16_t adc_val);
54
55 /* pattern.c */
56 void pattern_init();
57 void patterns_next_tick();
58
59 #endif /* !LIGHTS_H__ */
60