]> www.fi.muni.cz Git - bike-lights.git/blob - firmware/lights.h
power-off function
[bike-lights.git] / firmware / lights.h
1 #ifndef LIGHTS_H__
2 #define LIGHTS_H__ 1
3
4 #define N_LEDS 7
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 susp_adc();
28 void timer_start_adcs();
29
30 /* pwm.c */
31 void init_pwm();
32 void susp_pwm();
33 void pwm_off(unsigned char n);
34 void pwm_set(unsigned char n, uint16_t stride);
35
36 /* tmr.c */
37 extern volatile uint16_t jiffies;
38 void init_tmr();
39 void susp_tmr();
40
41 /* pwmled.c */
42 void pwmled_init();
43 void pwmled_adc(unsigned char n, uint16_t adcval);
44 void pwmled_set_mode(unsigned char n, unsigned char mode);
45 unsigned char pwmled_needs_adc(unsigned char n);
46 unsigned char pwmled_enabled(unsigned char n);
47
48 /* gpio.c */
49 void gpio_init();
50 void susp_gpio();
51 void gpio_set(unsigned char n, unsigned char on);
52 void gpio_before_poweroff();
53
54 /* ambient.c */
55 void ambient_init();
56 extern volatile unsigned char ambient_zone;
57 void ambient_adc(uint16_t adc_val);
58
59 /* pattern.c */
60 void pattern_init();
61 void patterns_next_tick();
62 void led_set_status(unsigned char status);
63
64 /* buttons.c */
65 void init_buttons();
66 void timer_check_buttons();
67
68 /* main.c */
69 void hw_setup();
70 void hw_suspend();
71 void power_down();
72
73 #endif /* !LIGHTS_H__ */
74