3885db4e69e4b37961303358edc0a0d7ffd29b5f
[fw/altos] / src / product / ao_terraui.c
1 /*
2  * Copyright © 2011 Keith Packard <keithp@keithp.com>
3  *
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.
7  *
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.
12  *
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.
16  */
17
18 #include "ao.h"
19
20 static void
21 ao_terraui(void)
22 {
23         for (;;) {
24                 char    b = ao_button_get();
25                 switch (b) {
26                 case 1:
27                         ao_beep_for(AO_BEEP_LOW, AO_MS_TO_TICKS(200));
28                         break;
29                 case 2:
30                         ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
31                         break;
32                 case 3:
33                         ao_beep_for(AO_BEEP_HIGH, AO_MS_TO_TICKS(200));
34                         break;
35                 }
36         }
37 }
38
39 __xdata static struct ao_task ao_terraui_task;
40
41 void
42 ao_terraui_init(void)
43 {
44         ao_add_task(&ao_terraui_task, ao_terraui, "ui");
45 }