]> www.fi.muni.cz Git - bike-lights.git/blob - lights.h
mcp1701a: typo in name, datasheet added
[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 #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_on(unsigned char n);
32 void pwm_off(unsigned char n);
33 void pwm_set(unsigned char n, unsigned char stride);
34
35 /* tmr.c */
36 extern volatile uint16_t jiffies;
37 void init_tmr();
38
39 /* pwmled.c */
40 void pwmled_init();
41 void pwmled_adc(unsigned char n, uint16_t adcval);
42 void pwmled_set_mode(unsigned char n, unsigned char mode);
43 unsigned char pwmled_needs_adc(unsigned char n);
44 unsigned char pwmled_enabled(unsigned char n);
45
46 /* gpio.c */
47 #define GPIO_LED1 0
48 #define GPIO_LED2 1
49
50 void gpio_init();
51 void gpio_set(unsigned char n, unsigned char on);
52
53 /* ambient.c */
54 void ambient_init();
55 extern volatile unsigned char ambient_zone;
56 void ambient_adc(uint16_t adc_val);
57
58 /* pattern.c */
59 void pattern_init();
60 void patterns_next_tick();
61 void led_set_status(unsigned char status);
62
63 /* buttons.c */
64 void init_buttons();
65 void timer_check_buttons();
66
67 /* init.c */
68 void hw_setup();
69
70 #endif /* !LIGHTS_H__ */
71