slower LED animation for execution on FPGA
Stefan Schuermans

Stefan Schuermans commited on 2012-02-11 00:31:59
Showing 1 changed files, with 18 additions and 5 deletions.

... ...
@@ -1,16 +1,29 @@
1 1
 #include "leds.h"
2 2
 
3
-int data[10];
3
+volatile int data[100];
4 4
 
5
-int main()
5
+void delay()
6 6
 {
7
-  unsigned int i;
8
-
7
+  unsigned int i, j;
8
+  for (j = 0; j < 1000; ++j)
9 9
     for (i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
10 10
       data[i] = i;
11
+}
12
+
13
+int main()
14
+{
15
+  unsigned int i;
11 16
 
12
-  for (i = 0x1; i < 0x100; i <<= 1)
17
+  while (1) {
18
+    for (i = 0x1; i < 0x80; i <<= 1) {
19
+      leds_set_state(i);
20
+      delay();
21
+    }
22
+    for (i = 0x80; i > 0x1; i >>= 1) {
13 23
       leds_set_state(i);
24
+      delay();
25
+    }
26
+  }
14 27
 
15 28
   return 0;
16 29
 }
17 30