2 * Copyright © 2011 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_quadrature.h>
23 #include <ao_button.h>
27 struct ao_task ball_task;
34 static int ball_dx, ball_dy;
47 ao_sleep(&ball_enable);
51 ao_vga_fb + ball_y * AO_VGA_STRIDE,
56 ao_delay(AO_MS_TO_TICKS(10));
59 ao_vga_fb + ball_y * AO_VGA_STRIDE,
68 if (ball_x + BALL_WIDTH > AO_VGA_WIDTH) {
69 ball_x = AO_VGA_WIDTH - BALL_WIDTH;
76 if (ball_y + BALL_HEIGHT > AO_VGA_HEIGHT) {
77 ball_y = AO_VGA_HEIGHT - BALL_HEIGHT;
92 ao_vga_enable(ao_cmd_lex_i);
99 ball_enable = ao_cmd_lex_i;
100 ao_wakeup(&ball_enable);
103 __code struct ao_cmds ao_demo_cmds[] = {
104 { ao_video_toggle, "V\0Toggle video" },
105 { ao_ball_toggle, "B\0Toggle ball" },
116 ao_led_init(LEDS_AVAILABLE);
117 ao_led_on(AO_LED_GREEN);
118 ao_led_off(AO_LED_BLUE);
125 ao_add_task(&ball_task, ao_ball, "ball");
126 ao_cmd_register(&ao_demo_cmds[0]);
128 ao_start_scheduler();