]> www.fi.muni.cz Git - bike-lights.git/blob - firmware/lights.h
delete pwm_off(), use pwm_set instead
[bike-lights.git] / firmware / 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 #define N_BUTTONS 2
9
10 /* logging.c */
11 #ifdef USE_LOGGING
12 void log_set_state(unsigned char val);
13 void log_init();
14 void log_flush();
15 void log_byte(unsigned char byte);
16 void log_word(uint16_t word);
17 #else
18 void inline log_set_state(unsigned char val) { }
19 void inline log_init() { }
20 void inline log_flush() { }
21 void inline log_byte(unsigned char byte) { }
22 void inline log_word(uint16_t word) { }
23 #endif
24
25 /* adc.c */
26 void init_adc();
27 void timer_start_adcs();
28
29 /* pwm.c */
30 void init_pwm();
31 void pwm_off(unsigned char n);
32 void pwm_set(unsigned char n, unsigned char stride);
33
34 /* tmr.c */
35 extern volatile uint16_t jiffies;
36 void init_tmr();
37
38 /* pwmled.c */
39 void pwmled_init();
40 void pwmled_adc(unsigned char n, uint16_t adcval);
41 void pwmled_set_mode(unsigned char n, unsigned char mode);
42 unsigned char pwmled_needs_adc(unsigned char n);
43 unsigned char pwmled_enabled(unsigned char n);
44
45 /* gpio.c */
46 #define GPIO_LED1 0
47 #define GPIO_LED2 1
48
49 void gpio_init();
50 void gpio_set(unsigned char n, unsigned char on);
51
52 /* ambient.c */
53 void ambient_init();
54 extern volatile unsigned char ambient_zone;
55 void ambient_adc(uint16_t adc_val);
56
57 /* pattern.c */
58 void pattern_init();
59 void patterns_next_tick();
60 void led_set_status(unsigned char status);
61
62 /* buttons.c */
63 void init_buttons();
64 void timer_check_buttons();
65
66 /* init.c */
67 void hw_setup();
68
69 #endif /* !LIGHTS_H__ */
70