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_button.h>
23 #include <ao_lco_func.h>
24 #include <ao_radio_cmac.h>
26 static uint8_t ao_lco_suspended;
31 if (!ao_lco_suspended) {
35 ao_wakeup(&ao_pad_query);
42 if (ao_lco_suspended) {
44 ao_wakeup(&ao_lco_suspended);
49 ao_lco_show_display(void)
56 static struct ao_event event;
60 if (ao_config.pad_idle && !ao_lco_suspended) {
61 timeout = ao_event_get_for(&event, AO_SEC_TO_TICKS(ao_config.pad_idle));
70 PRINTD("event type %d unit %d value %d\n",
71 event.type, event.unit, event.value);
76 ao_lco_set_box(event.value);
80 ao_lco_set_armed(event.value);
84 ao_lco_set_firing(event.value);
92 static struct ao_task ao_lco_input_task;
93 static struct ao_task ao_lco_monitor_task;
94 static struct ao_task ao_lco_arm_warn_task;
95 static struct ao_task ao_lco_igniter_status_task;
101 ao_lco_set_box(ao_button_get(AO_BUTTON_BOX));
102 ao_add_task(&ao_lco_input_task, ao_lco_input, "lco input");
103 ao_add_task(&ao_lco_arm_warn_task, ao_lco_arm_warn, "lco arm warn");
104 ao_add_task(&ao_lco_igniter_status_task, ao_lco_igniter_status, "lco igniter status");
106 ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
113 ao_lco_set_debug(void)
116 if (ao_cmd_status == ao_cmd_success)
117 ao_lco_debug = ao_cmd_lex_i;
120 __code struct ao_cmds ao_lco_cmds[] = {
121 { ao_lco_set_debug, "D <0 off, 1 on>\0Debug" },
129 ao_add_task(&ao_lco_monitor_task, ao_lco_main, "lco monitor");
131 ao_cmd_register(&ao_lco_cmds[0]);