summaryrefslogtreecommitdiff
path: root/software/first/first.c
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2019-07-22 23:04:17 +0200
committerSilvan Jegen <s.jegen@gmail.com>2019-07-22 23:04:17 +0200
commitf5e284223d25ee5beab98de95cd74e3ac72a39a6 (patch)
tree33d6b2b3a0e5fa5b1d0b3094108bac78bd84bda0 /software/first/first.c
parent4bc2e5141c68e82f2f6d7c8f71051fe93dd96d18 (diff)
Implement first superblink version
Diffstat (limited to 'software/first/first.c')
-rw-r--r--software/first/first.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/software/first/first.c b/software/first/first.c
new file mode 100644
index 0000000..ed6e91b
--- /dev/null
+++ b/software/first/first.c
@@ -0,0 +1,33 @@
+/* Copyright 2019 SiFive, Inc */
+/* SPDX-License-Identifier: Apache-2.0 */
+
+#include <stdio.h>
+#include "super_blink.h"
+
+int main() {
+ printf("Hello, cute waffle!\n");
+
+ int error = 0;
+ int ledNum = 0;
+ int colours[NUM_LEDS] = {
+ GREEN_LED,
+ RED_LED,
+ BLUE_LED,
+ };
+
+ setup_GPIO();
+
+ while (!error) {
+ set_LED(colours[ledNum], ON);
+ delay(DELAY);
+
+ error = set_LED(colours[ledNum], OFF);
+ delay(DELAY);
+
+ ledNum++;
+
+ if (ledNum >= NUM_LEDS) {
+ ledNum = 0;
+ }
+ }
+}