projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cortexelf-v1: Add buttons
[fw/altos]
/
src
/
cortexelf-v1
/
ao_cortexelf.c
diff --git
a/src/cortexelf-v1/ao_cortexelf.c
b/src/cortexelf-v1/ao_cortexelf.c
index f9be59e835a11e7e78be52493f95f2cefac4b8c6..8be7ef151457acd362733157709f0684dd7ff159 100644
(file)
--- a/
src/cortexelf-v1/ao_cortexelf.c
+++ b/
src/cortexelf-v1/ao_cortexelf.c
@@
-28,6
+28,8
@@
#include <ao_sdcard.h>
#include <ao_fat.h>
#include <ao_lisp.h>
#include <ao_sdcard.h>
#include <ao_fat.h>
#include <ao_lisp.h>
+#include <ao_button.h>
+#include <ao_event.h>
struct ao_task ball_task;
struct ao_task ball_task;
@@
-208,6
+210,21
@@
__code struct ao_cmds ao_demo_cmds[] = {
{ 0, NULL }
};
{ 0, NULL }
};
+static struct ao_task event_task;
+
+static void
+ao_event_loop(void)
+{
+ for (;;) {
+ struct ao_event ev;
+
+ ao_event_get(&ev);
+ printf("type %d uint %d tick %d value %d\n",
+ ev.type, ev.unit, ev.tick, ev.value);
+ flush();
+ }
+}
+
int
main(void)
{
int
main(void)
{
@@
-236,9
+253,12
@@
main(void)
ao_usb_init();
ao_usb_init();
+ ao_button_init();
+
ao_config_init();
ao_add_task(&ball_task, ao_ball, "ball");
ao_config_init();
ao_add_task(&ball_task, ao_ball, "ball");
+ ao_add_task(&event_task, ao_event_loop, "events");
ao_cmd_register(&ao_demo_cmds[0]);
ao_start_scheduler();
ao_cmd_register(&ao_demo_cmds[0]);
ao_start_scheduler();