aboutsummaryrefslogtreecommitdiffstats
path: root/examples/test-fsmc.cpp
diff options
context:
space:
mode:
authorPerry Hung <iperry@gmail.com>2011-03-09 23:25:03 -0500
committerPerry Hung <iperry@gmail.com>2011-03-09 23:25:03 -0500
commit4651227fa9f7dece1dd24d2170db16c2e35dc04e (patch)
tree7e05d637bdca69811f04d6d55b8cc24b8c9e8cc5 /examples/test-fsmc.cpp
parent07536e9a1a92af2b1bad8f32b1b0f6b868957d26 (diff)
downloadlibrambutan-4651227fa9f7dece1dd24d2170db16c2e35dc04e.tar.gz
librambutan-4651227fa9f7dece1dd24d2170db16c2e35dc04e.zip
Merge refactor into i2c-wip:
Squashed commit of the following: commit 4d6662dadfda7f2fd55107535165dc98a0638a3c Merge: 174d9ab 7ddc844 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 23:18:29 2011 -0500 Merge remote branch 'origin/refactor' into refactor commit 174d9ab73cc3387a3812e6f3d3e97519bf5b2150 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 23:16:53 2011 -0500 USBSerial docs fix. commit f217acb73d94f0a88bf33a42684e6e988dcb3685 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 20:25:26 2011 -0500 Brought examples/ up to date; PIN_MAP bugfix for D24. commit c4ba3ba05fc39ef260cd80d91759966952df74ae Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 19:16:42 2011 -0500 Cosmetic/documentation changes to adc.c commit e7747b4eb831621951deef6d31629f55cb5c3500 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 19:16:07 2011 -0500 Cosmetic changes to wirish/main.cxx commit e2f9d4116e59d8487c936989384228ea084a3501 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 19:15:24 2011 -0500 Untabifying docs/source/conf.py commit 7ddc84481b4eebe337065a0219e3d8dc000791e5 Author: Perry Hung <iperry@gmail.com> Date: Wed Mar 2 00:30:19 2011 -0500 cscope: Find .S instead of .s files commit 62cb09ed6357eae58b0234fbc074c44e9c0aa5e5 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Wed Mar 2 00:07:10 2011 -0500 Fixing typo in main.cpp.example.
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);