2 * Copyright © 2014 Bdale Garbee <bdale@gag.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; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 // switch relay to selected output, turn correct LED on as a side effect
24 ao_relay_control(uint8_t output)
28 ao_led_on(AO_LED_RED);
29 ao_led_off(AO_LED_GREEN);
32 ao_led_off(AO_LED_RED);
33 ao_led_on(AO_LED_GREEN);
38 ao_relay_select(void) __reentrant
43 if (ao_cmd_status != ao_cmd_success)
45 output = ao_cmd_lex_i;
47 printf ("Relay control not implemented yet, %u selected\n", output);
48 ao_relay_control(output);
51 static __code struct ao_cmds ao_relay_cmds[] = {
52 { ao_relay_select, "R <output>\0Select relay output" },
67 ao_led_init(LEDS_AVAILABLE);
69 // initialize to default output
71 ao_relay_control(relay_output);
75 ao_cmd_register(ao_relay_cmds);