Add .gitignore for ao-bringup
[fw/altos] / ao-bringup / ao_led_blink.c
1 /*
2  * Copyright © 2010 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_bringup.h"
19
20 #define nop()   _asm nop _endasm;
21
22 void
23 delay (unsigned char n)
24 {
25         unsigned char i = 0, j = 0;
26
27         n <<= 1;
28         while (--n != 0)
29                 while (--j != 0)
30                         while (--i != 0)
31                                 nop();
32 }
33
34 main()
35 {
36         ao_init();
37         /* Set p1_0 and p1_1 to output */
38         P1DIR = 0x03;
39         P1INP = 0x00;
40         for (;;) {
41                 P1 = 1;
42                 delay(5);
43                 P1 = 2;
44                 delay(5);
45                 P1 = 3;
46                 delay(5);
47                 P1 = 0;
48                 delay(5);
49         }
50 }