aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/boards
diff options
context:
space:
mode:
Diffstat (limited to 'wirish/boards')
-rw-r--r--wirish/boards/maple.cpp14
-rw-r--r--wirish/boards/maple.h16
-rw-r--r--wirish/boards/maple_RET6.cpp14
-rw-r--r--wirish/boards/maple_RET6.h8
-rw-r--r--wirish/boards/maple_mini.cpp17
-rw-r--r--wirish/boards/maple_mini.h8
-rw-r--r--wirish/boards/maple_native.cpp16
-rw-r--r--wirish/boards/maple_native.h15
8 files changed, 90 insertions, 18 deletions
diff --git a/wirish/boards/maple.cpp b/wirish/boards/maple.cpp
index ba2261b..5122290 100644
--- a/wirish/boards/maple.cpp
+++ b/wirish/boards/maple.cpp
@@ -40,7 +40,7 @@
void boardInit(void) {
}
-stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
+extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
/* Top header */
@@ -91,4 +91,16 @@ stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
{GPIOC, NULL, NULL, 9, 0, ADCx} /* D38/PC9 (BUT) */
};
+extern const uint8 boardPWMPins[] __FLASH__ = {
+ 0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 14, 24, 25, 27, 28
+};
+
+extern const uint8 boardADCPins[] __FLASH__ = {
+ 0, 1, 2, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 27, 28
+};
+
+extern const uint8 boardUsedPins[] __FLASH__ = {
+ BOARD_LED_PIN, BOARD_BUTTON_PIN
+};
+
#endif
diff --git a/wirish/boards/maple.h b/wirish/boards/maple.h
index 519698b..1867de8 100644
--- a/wirish/boards/maple.h
+++ b/wirish/boards/maple.h
@@ -42,7 +42,7 @@
#define BOARD_LED_PIN 13
/* Number of USARTs/UARTs whose pins are broken out to headers */
-#define NR_USARTS 3
+#define BOARD_NR_USARTS 3
/* Default USART pin numbers (not considering AFIO remap) */
#define BOARD_USART1_TX_PIN 7
@@ -53,7 +53,17 @@
#define BOARD_USART3_RX_PIN 30
/* Total number of GPIO pins that are broken out to headers and
- intended for general use. */
-#define NR_GPIO_PINS 39
+ * intended for general use. */
+#define BOARD_NR_GPIO_PINS 39
+
+/* Number of pins capable of PWM output */
+#define BOARD_NR_PWM_PINS 16
+
+/* Number of pins capable of ADC conversion */
+#define BOARD_NR_ADC_PINS 15
+
+/* Number of pins already connected to external hardware. For Maple,
+ * these are just BOARD_LED_PIN and BOARD_BUTTON_PIN. */
+#define BOARD_NR_USED_PINS 2
#endif
diff --git a/wirish/boards/maple_RET6.cpp b/wirish/boards/maple_RET6.cpp
index 962affc..fd67459 100644
--- a/wirish/boards/maple_RET6.cpp
+++ b/wirish/boards/maple_RET6.cpp
@@ -37,7 +37,7 @@
void boardInit(void) {
}
-stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
+extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
/* Top header */
@@ -88,4 +88,16 @@ stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
{GPIOC, TIMER8, NULL, 9, 4, ADCx} /* D38/PC9 (BUT) */
};
+extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
+ 0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 14, 24, 25, 27, 28
+};
+
+extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
+ 0, 1, 2, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 27, 28
+};
+
+extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
+ BOARD_LED_PIN, BOARD_BUTTON_PIN
+};
+
#endif
diff --git a/wirish/boards/maple_RET6.h b/wirish/boards/maple_RET6.h
index 63510c0..d91a4de 100644
--- a/wirish/boards/maple_RET6.h
+++ b/wirish/boards/maple_RET6.h
@@ -47,8 +47,7 @@
#define BOARD_LED_PIN 13
/* Note: UART4 and UART5 have pins which aren't broken out :( */
-#define NR_USARTS 3
-
+#define BOARD_NR_USARTS 3
#define BOARD_USART1_TX_PIN 7
#define BOARD_USART1_RX_PIN 8
#define BOARD_USART2_TX_PIN 1
@@ -56,6 +55,9 @@
#define BOARD_USART3_TX_PIN 29
#define BOARD_USART3_RX_PIN 30
-#define NR_GPIO_PINS 39
+#define BOARD_NR_GPIO_PINS 39
+#define BOARD_NR_PWM_PINS 16
+#define BOARD_NR_ADC_PINS 15
+#define BOARD_NR_USED_PINS 2
#endif
diff --git a/wirish/boards/maple_mini.cpp b/wirish/boards/maple_mini.cpp
index 66a0997..cd2827d 100644
--- a/wirish/boards/maple_mini.cpp
+++ b/wirish/boards/maple_mini.cpp
@@ -41,7 +41,7 @@ void boardInit(void) {
afio_mapr_swj_config(AFIO_MAPR_SWJ_NO_JTAG_NO_SW);
}
-stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
+extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
/* Top header */
@@ -84,4 +84,19 @@ stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
{GPIOB, TIMER3, ADC1, 1, 4, 9}, /* D33/PB1 */
};
+extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
+ 3, 4, 5, 8, 9, 10, 11, 15, 16, 25, 26, 27
+};
+
+extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 33 // NB 33 is LED
+};
+
+#define USB_DP 23
+#define USB_DM 24
+
+extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
+ BOARD_LED_PIN, BOARD_BUTTON_PIN, USB_DP, USB_DM
+};
+
#endif
diff --git a/wirish/boards/maple_mini.h b/wirish/boards/maple_mini.h
index bfb92a5..8b7ae64 100644
--- a/wirish/boards/maple_mini.h
+++ b/wirish/boards/maple_mini.h
@@ -46,8 +46,7 @@
#define BOARD_BUTTON_PIN 32
#define BOARD_LED_PIN 33
-#define NR_USARTS 3
-
+#define BOARD_NR_USARTS 3
#define BOARD_USART1_TX_PIN 26
#define BOARD_USART1_RX_PIN 25
#define BOARD_USART2_TX_PIN 9
@@ -55,6 +54,9 @@
#define BOARD_USART3_TX_PIN 1
#define BOARD_USART3_RX_PIN 0
-#define NR_GPIO_PINS 34
+#define BOARD_NR_GPIO_PINS 34
+#define BOARD_NR_PWM_PINS 12
+#define BOARD_NR_ADC_PINS 10
+#define BOARD_NR_USED_PINS 4
#endif
diff --git a/wirish/boards/maple_native.cpp b/wirish/boards/maple_native.cpp
index 75c6a2d..2813e91 100644
--- a/wirish/boards/maple_native.cpp
+++ b/wirish/boards/maple_native.cpp
@@ -39,7 +39,7 @@ void boardInit(void) {
initNativeSRAM();
}
-stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
+extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
/* Top header */
@@ -152,4 +152,18 @@ stm32_pin_info PIN_MAP[NR_GPIO_PINS] = {
{GPIOD, NULL, NULL, 10, 0, ADCx} /* D99/PD10 */
};
+extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
+ 12, 13, 14, 15, 22, 23, 24, 25, 37, 38, 45, 46, 47, 48, 49, 50, 53, 54
+};
+
+extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
+ 6, 7, 8, 9, 10, 11, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54
+};
+
+/* FIXME! see comment by BOARD_NR_USED_PINS in maple_native.h */
+extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
+ BOARD_LED_PIN, BOARD_BUTTON_PIN
+};
+
#endif
diff --git a/wirish/boards/maple_native.h b/wirish/boards/maple_native.h
index 21fc480..4e3ee82 100644
--- a/wirish/boards/maple_native.h
+++ b/wirish/boards/maple_native.h
@@ -43,11 +43,10 @@
#define CYCLES_PER_MICROSECOND 72
#define SYSTICK_RELOAD_VAL 71999
-#define BOARD_LED_PIN D21
-#define BOARD_BUTTON_PIN D18
-
-#define NR_USARTS 5
+#define BOARD_LED_PIN 21
+#define BOARD_BUTTON_PIN 18
+#define BOARD_NR_USARTS 5
#define BOARD_USART1_TX_PIN 25
#define BOARD_USART1_RX_PIN 26
#define BOARD_USART2_TX_PIN 51
@@ -59,6 +58,12 @@
#define BOARD_UART5_TX_PIN 20
#define BOARD_UART5_RX_PIN 28
-#define NR_GPIO_PINS 100
+#define BOARD_NR_GPIO_PINS 100
+#define BOARD_NR_PWM_PINS 18
+#define BOARD_NR_ADC_PINS 21
+/* FIXME! this isn't true at all; almost all of the triple header pins
+ * are used by the FSMC by default. Fix this (and the corresponding
+ * boardUsedPins definition in maple_native.cpp) by QA time. */
+#define BOARD_NR_USED_PINS 2
#endif