Blinky LED example with registers for PoliMI

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
daz
Date:
Fri Mar 18 11:33:16 2016 +0000
Commit message:
Blinky project that makes use of direct register access.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0dd8ec2326be main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Mar 18 11:33:16 2016 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+int main(){
+    volatile int i;
+    
+    /* Enable RCC GPIOA clock */
+    *((uint32_t*)0x40023830) |= (1<<0);
+    
+    /* Set PA5 as digital output */
+    *((uint32_t*)0x40020000) |= (1<<10);
+    
+    while(1) {
+        /* PA5 on */
+        *((uint32_t*)0x40020014) |= (1<<5);
+
+        /* Delay */
+        for(i = 5000000; i; i--);
+        
+        /* PA5 off */
+        *((uint32_t*)0x40020014) &= ~(1<<5);
+        
+        /* Delay */
+        for(i = 5000000; i; i--);
+    }
+}
diff -r 000000000000 -r 0dd8ec2326be mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Mar 18 11:33:16 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5
\ No newline at end of file