summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2015-03-29 22:08:57 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2015-03-29 22:08:57 +0200
commit3bddb71d56d5d556a41779f04b4fefa135f319cd (patch)
tree0465a83ced793b81ee752c94f12d91d3d9431b92 /main.cpp
Blink LED.f0_blink
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..57b1ed0
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,22 @@
+#include <rcc/rcc.h>
+#include <gpio/gpio.h>
+#include <os/time.h>
+
+Pin led_green = GPIOC[8];
+Pin led_blue = GPIOC[9];
+
+int main() {
+ // Initialize system timer.
+ STK.LOAD = 8000000 / 8 / 1000; // 1000 Hz.
+ STK.CTRL = 0x03;
+
+ RCC.enable(RCC.GPIOC);
+
+ led_green.set_mode(Pin::Output);
+
+ while(1) {
+ Time::sleep(500);
+
+ led_green.toggle();
+ }
+}