summaryrefslogtreecommitdiff
path: root/software/first/first.c
blob: ede96db96a4b6fb323489d6f04b0f30ce5cf1085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Copyright 2019 SiFive, Inc */
/* SPDX-License-Identifier: Apache-2.0 */

#include <stdio.h>
#include "super_blink.h"

int main() {
		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;
			}
		}
}