]> rtime.felk.cvut.cz Git - sysless.git/blob - app/ledblink/ledblink.c
Make ledblink not depend on boot_fn library
[sysless.git] / app / ledblink / ledblink.c
1 /* procesor H8S/2638 ver 1.1  */
2 #include <types.h>
3 #include <cpu_def.h>
4 #include <mcu_regs.h>
5 #include <system_def.h>
6 #include <string.h>
7 #include <boot_fn.h>
8
9 static void deb_led_out(char val)
10 {
11   if (val&1)
12     DEB_LED_ON(0);
13   else
14     DEB_LED_OFF(0);
15   if (val&2)
16     DEB_LED_ON(1);
17   else
18     DEB_LED_OFF(1);
19   if (val&4)
20     DEB_LED_ON(2);
21   else
22     DEB_LED_OFF(2);
23   if (val&8)
24     DEB_LED_ON(3);
25   else
26     DEB_LED_OFF(3);
27 }
28
29 void wait(long n)
30 {
31   long i=0;
32   volatile long x;
33   while (i<n*2){
34     i++;
35     x+=i;
36   }     
37 }
38
39 int main()
40 {
41     DEB_LED_INIT(); /* Init port with LEDs */
42     int i = 0;
43     while (1) {
44         i = (i + 1) & 7;
45         deb_led_out(i);
46         wait(1*100000);
47     }
48 };