aboutsummaryrefslogtreecommitdiffstats
path: root/examples/test-fsmc.cpp
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-03-04 20:25:26 -0500
committerMarti Bolivar <mbolivar@leaflabs.com>2011-03-04 23:16:32 -0500
commit02e76ec27b5737bce836a5460427b538076f01ef (patch)
tree30fb1f21caba0504ff414edc853474f0d365f790 /examples/test-fsmc.cpp
parent7973deea3908f4f865f59c5e2df1eef6810cc70e (diff)
downloadlibrambutan-02e76ec27b5737bce836a5460427b538076f01ef.tar.gz
librambutan-02e76ec27b5737bce836a5460427b538076f01ef.zip
Brought examples/ up to date; PIN_MAP bugfix for D24.
Diffstat (limited to 'examples/test-fsmc.cpp')
-rw-r--r--examples/test-fsmc.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/examples/test-fsmc.cpp b/examples/test-fsmc.cpp
index f4fd068..4211e4d 100644
--- a/examples/test-fsmc.cpp
+++ b/examples/test-fsmc.cpp
@@ -1,14 +1,12 @@
-
#include "wirish.h"
#include "fsmc.h"
-#define LED_PIN 23 // hack for maple native
-#define DISC_PIN 14 // hack for USB on native
+#define LED_PIN BOARD_LED_PIN
// System control block registers
#define SCB_BASE (SCB_Reg*)(0xE000ED00)
-// This stuff should ultimately get moved to util.h or scb.h or w/e.
+// This stuff should ultimately get moved to util.h or scb.h or w/e.
// Also in interactive test program and the HardFault IRQ handler.
typedef struct {
volatile uint32 CPUID;
@@ -23,15 +21,14 @@ typedef struct {
volatile uint32 SHCRS;
volatile uint32 CFSR;
volatile uint32 HFSR;
- uint32 pad1;
+ uint32 pad1;
volatile uint32 MMAR;
volatile uint32 BFAR;
} SCB_Reg;
-SCB_Reg *scb;
+SCB_Reg *scb;
uint16 *ptr;
-int toggle = 0;
int count = 0;
void setup() {
@@ -39,8 +36,6 @@ void setup() {
scb = (SCB_Reg*)SCB_BASE;
pinMode(LED_PIN, OUTPUT);
- pinMode(DISC_PIN, OUTPUT);
- digitalWrite(DISC_PIN,1);
digitalWrite(LED_PIN,1);
Serial1.begin(9600);
@@ -82,15 +77,14 @@ void setup() {
Serial1.print("BFAR: ");
id = scb->BFAR;
Serial1.println(id,BIN);
-
+
Serial1.println("Now testing all memory addresses... (will hardfault at the end)");
delay(3000);
}
void loop() {
- digitalWrite(LED_PIN, toggle);
- toggle ^= 1;
- delay(1);
+ toggleLED();
+ delay(1);
for(int i = 0; i<100; i++) { // modify this to speed things up
count++;
@@ -102,7 +96,7 @@ void loop() {
while(1) { }
}
}
-
+
Serial1.print((uint32)(ptr),HEX);
Serial1.print(": ");
Serial1.println(*ptr,BIN);