aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/test-session.cpp32
-rw-r--r--main.cpp.example28
-rw-r--r--support/ld/maple_native/flash.ld2
-rw-r--r--support/ld/maple_native/jtag.ld4
4 files changed, 33 insertions, 33 deletions
diff --git a/examples/test-session.cpp b/examples/test-session.cpp
index d856067..845547d 100644
--- a/examples/test-session.cpp
+++ b/examples/test-session.cpp
@@ -15,6 +15,9 @@
//#define COMM Serial2
//#define COMM Serial3
+
+#define ESC ((uint8)27)
+
int rate = 0;
#if defined(BOARD_maple)
@@ -27,8 +30,13 @@ const uint8 adc_pins[] =
const uint8 pwm_pins[] = {3, 4, 5, 8, 9, 10, 11, 15, 16, 25, 26, 27};
const uint8 adc_pins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 33}; // NB: 33 is LED
-#elif defined(BOARD_maple_native) // TODO maple native
-#error "No Maple Native support here yet"
+#elif defined(BOARD_maple_native)
+const uint8 pwm_pins[] = {12, 13, 14, 15, 22, 23, 24, 25, 37, 38, 45,
+ 46, 47, 48, 49, 50, 53, 54};
+const uint8 adc_pins[] = {6, 7, 8, 9, 10, 11,
+ /* the following are on ADC3, which lacks support:
+ 39, 40, 41, 42, 43, 45, */
+ 46, 47, 48, 49, 50, 51, 52, 53, 54};
#else
#error "Board type has not been selected correctly"
@@ -37,10 +45,8 @@ const uint8 adc_pins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 33}; // NB: 33 is LED
uint8 gpio_state[NR_GPIO_PINS];
-#define DUMMY_DAT ("qwertyuiopasdfghjklzxcvbnmmmmmm,./1234567890-=" \
- "qwertyuiopasdfghjklzxcvbnm,./1234567890")
-
-#define ESC ((uint8)27)
+const char* const dummy_dat = ("qwertyuiopasdfghjklzxcvbnmmmmmm,./1234567890-="
+ "qwertyuiopasdfghjklzxcvbnm,./1234567890");
void cmd_print_help(void);
void cmd_adc_stats(void);
@@ -145,16 +151,16 @@ void loop () {
case 'W':
while(!COMM.available()) {
- Serial1.print(DUMMY_DAT);
- Serial2.print(DUMMY_DAT);
- Serial3.print(DUMMY_DAT);
+ Serial1.print(dummy_dat);
+ Serial2.print(dummy_dat);
+ Serial3.print(dummy_dat);
}
break;
case 'U':
COMM.println("Dumping data to USB. Press any key.");
while(!COMM.available()) {
- SerialUSB.print(DUMMY_DAT);
+ SerialUSB.print(dummy_dat);
}
break;
@@ -324,8 +330,8 @@ void cmd_stressful_adc_stats(void) {
pwmWrite(pwm_pins[j], 1000 + i);
}
}
- SerialUSB.print(DUMMY_DAT);
- SerialUSB.print(DUMMY_DAT);
+ SerialUSB.print(dummy_dat);
+ SerialUSB.print(dummy_dat);
measure_adc_noise(adc_pins[i]);
for(uint32 j = 2; j<(uint32)sizeof(pwm_pins); j++) {
if(adc_pins[i] != pwm_pins[j]) {
@@ -389,7 +395,7 @@ void do_serials(HardwareSerial **serials, int n, unsigned baud) {
}
while (!COMM.available()) {
for (int i = 0; i < n; i++) {
- serials[i]->println(DUMMY_DAT);
+ serials[i]->println(dummy_dat);
if (serials[i]->available()) {
serials[i]->println(serials[i]->read());
delay(1000);
diff --git a/main.cpp.example b/main.cpp.example
index 1032733..8fc522a 100644
--- a/main.cpp.example
+++ b/main.cpp.example
@@ -1,15 +1,17 @@
-// Sample main.cpp file. Blinks an LED, sends a message out USART2
-// and turns on PWM on pin 2
+// Sample main.cpp file. Blinks the built-in LED, sends a message out
+// USART2, and turns on PWM on pin 2.
#include "wirish.h"
-#define LED_PIN 13
#define PWM_PIN 2
-void setup()
-{
+void setup() {
/* Set up the LED to blink */
- pinMode(LED_PIN, OUTPUT);
+ pinMode(BOARD_LED_PIN, OUTPUT);
+
+ /* Turn on PWM on pin PWM_PIN */
+ pinMode(PWM_PIN, PWM);
+ pwmWrite(PWM_PIN, 0x8000);
/* Send a message out USART2 */
Serial2.begin(9600);
@@ -17,28 +19,20 @@ void setup()
/* Send a message out the usb virtual serial port */
SerialUSB.println("Hello!");
-
- /* Turn on PWM on pin PWM_PIN */
- pinMode(PWM_PIN, PWM);
- pwmWrite(PWM_PIN, 0x8000);
}
-int toggle = 0;
-
void loop() {
- toggle ^= 1;
- digitalWrite(LED_PIN, toggle);
+ toggleLED();
delay(100);
}
// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated object that need libmaple may fail.
- __attribute__(( constructor )) void premain() {
+__attribute__(( constructor )) void premain() {
init();
}
-int main(void)
-{
+int main(void) {
setup();
while (1) {
diff --git a/support/ld/maple_native/flash.ld b/support/ld/maple_native/flash.ld
index 7e1e453..4e820d2 100644
--- a/support/ld/maple_native/flash.ld
+++ b/support/ld/maple_native/flash.ld
@@ -26,7 +26,7 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 500K
+ rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K
}
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
diff --git a/support/ld/maple_native/jtag.ld b/support/ld/maple_native/jtag.ld
index 85aae53..90a0a3f 100644
--- a/support/ld/maple_native/jtag.ld
+++ b/support/ld/maple_native/jtag.ld
@@ -8,8 +8,8 @@
/* Define memory spaces. */
MEMORY
{
- ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
- rom (rx) : ORIGIN = 0x08005000, LENGTH = 500K
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
}
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")