diff options
-rw-r--r-- | README.txt | 10 | ||||
-rw-r--r-- | src/lib/timers.c | 1 | ||||
-rw-r--r-- | src/main.cpp | 24 | ||||
-rw-r--r-- | src/wiring/wiring.h | 2 | ||||
-rw-r--r-- | src/wiring/wiring_digital.c | 37 |
5 files changed, 42 insertions, 32 deletions
@@ -7,6 +7,10 @@ * D15 is mapped to pin number 38. This is to retain compatiblity with the * Arduino API, where digitalWrite() on pins 14-19 map to analog A0-A5 * + * TODO: + * Enable all GPIOs for digitalWrite(), analogRead(), digitalRead(), + * Enable all three USARTs + * Documentation * * TODO: * Using OSC32_IN/OSC32_OUT pins as GPIO ports PC14/PC15 152/995 @@ -29,6 +33,12 @@ * PD0 OSC_IN * PD1 OSC_OUT * + + * silkscreen changes: + * check labels + * add revision number + * + * * */ /* Pin STM32 PIN ADC Timer I2C UART SPI F/T * D0/A6 PA3 ADC3 TIM2_CH4 - USART2_RX - - diff --git a/src/lib/timers.c b/src/lib/timers.c index 1e95f41..773ae36 100644 --- a/src/lib/timers.c +++ b/src/lib/timers.c @@ -150,6 +150,7 @@ void timers_disable(void) { for (i = 0; i < 4; i++) { timer = timers[i]; timer->CR1 = 0; + timer->CCER = 0; } } diff --git a/src/main.cpp b/src/main.cpp index 78cdf13..78b0f89 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,34 +4,16 @@ #include "HardwareUsb.h"
#include "usb.h"
-HardwareUsb USB;
-
int ledPin = 13;
void setup() {
- pinMode(ledPin,OUTPUT);
-// Serial2.begin(9600);
- Serial3.begin(9600);
- Serial3.println("hello");
+ pinMode(ledPin, OUTPUT);
}
-volatile int toggle = 1;
-
-char c;
+int toggle = 1;
void loop() {
digitalWrite(ledPin, toggle);
toggle ^= 1;
- delay(500);
-// USB.print(millis());
-// Serial3.println("hello");
-// USB.println("\r");
-// Serial2.print(millis(), DEC);
-// Serial2.print(": ");
-// Serial2.print(USB.available(), DEC);
-// Serial2.println();
- if (Serial3.available()){
- c = Serial3.read();
- Serial3.print(c);
- }
+ delay(100);
}
int main(void) {
diff --git a/src/wiring/wiring.h b/src/wiring/wiring.h index 2a33b75..5333464 100644 --- a/src/wiring/wiring.h +++ b/src/wiring/wiring.h @@ -16,7 +16,7 @@ extern "C"{ #define MAPLE 1 -#define NR_MAPLE_PINS 14 // temporary +#define NR_MAPLE_PINS 39 // temporary #define HIGH 0x1 #define LOW 0x0 diff --git a/src/wiring/wiring_digital.c b/src/wiring/wiring_digital.c index 456f5da..71be17b 100644 --- a/src/wiring/wiring_digital.c +++ b/src/wiring/wiring_digital.c @@ -58,15 +58,33 @@ static const PinGPIOMapping PIN_TO_GPIO[NR_MAPLE_PINS] = { {GPIOA_BASE, 7}, // D11/PA7 {GPIOA_BASE, 6}, // D12/PA6 {GPIOA_BASE, 5}, // D13/PA5 -/* for later */ -#if 0 - {GPIOC_BASE, 0}, // D14/A0/PC0 - {GPIOC_BASE, 1}, // D15/A1/PC1 - {GPIOC_BASE, 2}, // D16/A2/PC2 - {GPIOC_BASE, 3}, // D17/A3/PC3 - {GPIOC_BASE, 4}, // D18/A4/PC4 - {GPIOC_BASE, 5}, // D19/A5/PC5 -#endif + {GPIOB_BASE, 8}, // D14/PB8 + /* Little header */ + {GPIOC_BASE, 0}, // D15/PC0 + {GPIOC_BASE, 1}, // D16/PC1 + {GPIOC_BASE, 2}, // D17/PC2 + {GPIOC_BASE, 3}, // D18/PC3 + {GPIOC_BASE, 4}, // D19/PC4 + {GPIOC_BASE, 5}, // D20/PC5 + /* External header */ + {GPIOC_BASE, 13}, // D21/PC13 + {GPIOC_BASE, 14}, // D22/PC14 + {GPIOC_BASE, 15}, // D23/PC15 + {GPIOB_BASE, 9}, // D24/PB9 + {GPIOD_BASE, 2}, // D25/PD2 + {GPIOC_BASE, 10}, // D26/PC10 + {GPIOB_BASE, 0}, // D27/PB0 + {GPIOB_BASE, 1}, // D28/PB1 + {GPIOB_BASE, 10}, // D29/PB10 + {GPIOB_BASE, 11}, // D30/PB11 + {GPIOB_BASE, 12}, // D31/PB12 + {GPIOB_BASE, 13}, // D32/PB13 + {GPIOB_BASE, 14}, // D33/PB14 + {GPIOB_BASE, 15}, // D34/PB15 + {GPIOC_BASE, 6}, // D35/PC6 + {GPIOC_BASE, 7}, // D36/PC7 + {GPIOC_BASE, 8}, // D37/PC8 + {GPIOC_BASE, 9}, // D38/PC9 }; void pinMode(uint8_t pin, WiringPinMode mode) { @@ -97,7 +115,6 @@ void pinMode(uint8_t pin, WiringPinMode mode) { return; } - gpio_set_mode(PIN_TO_GPIO[pin].port, PIN_TO_GPIO[pin].pin, outputMode); } |