2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 #include <ao_lco_func.h>
31 extern uint8_t ao_lco_debug;
32 #define PRINTD(...) do { if (!ao_lco_debug) break; printf ("\r%5lu %s: ", (unsigned long) ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0)
38 extern uint8_t ao_lco_drag_race; /* true when drag race mode enabled */
41 extern uint8_t ao_lco_pad; /* Currently selected pad */
42 extern int16_t ao_lco_box; /* Currently selected box */
44 extern uint8_t ao_lco_armed; /* armed mode active */
45 extern uint8_t ao_lco_firing; /* fire button pressed */
47 extern struct ao_pad_query ao_pad_query; /* Last received QUERY from pad */
49 #ifdef AO_LCO_DRAG_RACE_BOX
50 #define AO_LCO_BOX_DRAG 0 /* Box number to enable drag race mode (old LCO bits) */
51 #define AO_LCO_BOX_FIRST AO_LCO_BOX_DRAG
53 # define AO_LCO_LCO_VOLTAGE 0 /* Box number to show LCO voltage */
54 # ifdef AO_LCO_HAS_INFO
55 # define AO_LCO_INFO -3
56 # ifndef AO_LCO_BOX_FIRST
57 # define AO_LCO_BOX_FIRST AO_LCO_INFO
60 # ifdef AO_LCO_HAS_BACKLIGHT
61 # define AO_LCO_BACKLIGHT -2
62 # ifndef AO_LCO_BOX_FIRST
63 # define AO_LCO_BOX_FIRST AO_LCO_BACKLIGHT
66 # ifdef AO_LCO_HAS_CONTRAST
67 # define AO_LCO_CONTRAST -1
68 # ifndef AO_LCO_BOX_FIRST
69 # define AO_LCO_BOX_FIRST AO_LCO_CONTRAST
72 # ifndef AO_LCO_BOX_FIRST
73 # define AO_LCO_BOX_FIRST AO_LCO_LCO_VOLTAGE
76 #define AO_LCO_PAD_VOLTAGE 0 /* Pad number to show box voltage */
79 ao_lco_box_pseudo(int16_t box)
82 #ifdef AO_LCO_LCO_VOLTAGE
83 case AO_LCO_LCO_VOLTAGE:
86 #ifdef AO_LCO_DRAG_RACE_BOX
90 #ifdef AO_LCO_CONTRAST
94 #ifdef AO_LCO_BACKLIGHT
95 case AO_LCO_BACKLIGHT:
107 extern int16_t ao_lco_min_box, ao_lco_max_box;
109 #define AO_LCO_MASK_SIZE(n) (((n) + 7) >> 3)
110 #define AO_LCO_MASK_ID(n) ((n) >> 3)
111 #define AO_LCO_MASK_SHIFT(n) ((n) & 7)
113 extern uint8_t ao_lco_box_mask[AO_LCO_MASK_SIZE(AO_PAD_MAX_BOXES)];
120 ao_lco_igniter_status(void);
126 ao_lco_pad_present(int16_t box, uint8_t pad);
129 ao_lco_pad_first(int16_t box);
132 ao_lco_set_pad(uint8_t new_pad);
135 ao_lco_step_pad(int8_t dir);
138 ao_lco_set_box(int16_t new_box);
141 ao_lco_step_box(int8_t dir);
144 ao_lco_set_armed(uint8_t armed);
147 ao_lco_set_firing(uint8_t firing);
150 ao_lco_pretend(void);
153 ao_lco_toggle_drag(void);
159 ao_lco_monitor(void);
161 extern uint8_t ao_lco_drag_beep_count;
163 /* enable drag race mode */
165 ao_lco_drag_enable(void);
167 /* disable drag race mode */
169 ao_lco_drag_disable(void);
171 /* Handle drag beeps, return new delay */
173 ao_lco_drag_beep_check(AO_TICK_TYPE now, AO_TICK_TYPE delay);
175 /* Check if it's time to beep during drag race. Return new delay */
177 ao_lco_drag_warn_check(AO_TICK_TYPE now, AO_TICK_TYPE delay);
179 /* Request 'beeps' additional drag race beeps */
181 ao_lco_drag_add_beeps(uint8_t beeps);
183 /* task function for beeping while arm is active */
185 ao_lco_arm_warn(void);
188 * Provided by the hw-specific driver code
192 ao_lco_show_pad(uint8_t pad);
195 ao_lco_show_box(int16_t box);
204 ao_lco_box_present(int16_t box);
206 #ifdef AO_LCO_HAS_CONTRAST
208 ao_lco_set_contrast(int32_t contrast);
211 ao_lco_get_contrast(void);
214 #ifdef AO_LCO_HAS_BACKLIGHT
216 ao_lco_set_backlight(int32_t backlight);
219 ao_lco_get_backlight(void);
222 #ifdef AO_LCO_SEARCH_API
225 ao_lco_search_start(void);
228 ao_lco_search_box_check(int16_t box);
231 ao_lco_search_box_present(int16_t box);
234 ao_lco_search_done(void);
236 #endif /* AO_LCO_SEARCH_API */
238 #endif /* _AO_LCO_H_ */