Skip to content

Commit f43d07e

Browse files
authored
Add files via upload
1 parent dcfe2ae commit f43d07e

File tree

12 files changed

+1275
-0
lines changed

12 files changed

+1275
-0
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2011 LeafLabs, LLC.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* @file wirish/boards/maple_mini/board.cpp
29+
* @author Marti Bolivar <[email protected]>
30+
* @brief Maple Mini board file.
31+
*/
32+
33+
#include <board/board.h>
34+
35+
#include <libmaple/gpio.h>
36+
#include <libmaple/timer.h>
37+
38+
/* Roger Clark. Added next to includes for changes to Serial */
39+
#include <libmaple/usart.h>
40+
#include <HardwareSerial.h>
41+
42+
#include <wirish_debug.h>
43+
#include <wirish_types.h>
44+
45+
/* Since we want the Serial Wire/JTAG pins as GPIOs, disable both SW
46+
* and JTAG debug support, unless configured otherwise. */
47+
void boardInit(void) {
48+
#ifndef CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
49+
disableDebugPorts();
50+
#endif
51+
}
52+
53+
// Note. See the enum of pin names in board.h
54+
55+
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
56+
57+
58+
{&gpioa, &timer2, &adc1, 0, 1, 0}, /* PA0 */
59+
{&gpioa, &timer2, &adc1, 1, 2, 1}, /* PA1 */
60+
{&gpioa, &timer2, &adc1, 2, 3, 2}, /* PA2 */
61+
{&gpioa, &timer2, &adc1, 3, 4, 3}, /* PA3 */
62+
{&gpioa, NULL, &adc1, 4, 0, 4}, /* PA4 */
63+
{&gpioa, NULL, &adc1, 5, 0, 5}, /* PA5 */
64+
{&gpioa, &timer3, &adc1, 6, 1, 6}, /* PA6 */
65+
{&gpioa, &timer3, &adc1, 7, 2, 7}, /* PA7 */
66+
{&gpioa, &timer1, NULL, 8, 1, ADCx}, /* PA8 */
67+
{&gpioa, &timer1, NULL, 9, 2, ADCx}, /* PA9 */
68+
{&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */
69+
{&gpioa, NULL, NULL, 11, 0, ADCx}, /* PA11 */
70+
{&gpioa, NULL, NULL, 12, 0, ADCx}, /* PA12 */
71+
{&gpioa, NULL, NULL, 13, 0, ADCx}, /* PA13 */
72+
{&gpioa, NULL, NULL, 14, 0, ADCx}, /* PA14 */
73+
{&gpioa, NULL, NULL, 15, 0, ADCx}, /* PA15 */
74+
75+
{&gpiob, &timer3, &adc1, 0, 3, 8}, /* PB0 */
76+
{&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */
77+
{&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
78+
{&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */
79+
{&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */
80+
{&gpiob, NULL, NULL, 5, 0, ADCx}, /* PB5 */
81+
{&gpiob, &timer4, NULL, 6, 1, ADCx}, /* PB6 */
82+
{&gpiob, &timer4, NULL, 7, 2, ADCx}, /* PB7 */
83+
{&gpiob, &timer4, NULL, 8, 3, ADCx}, /* PB8 */
84+
{&gpiob, &timer4, NULL, 9, 4, ADCx}, /* PB9 */
85+
{&gpiob, NULL, NULL, 10, 0, ADCx}, /* PB10 */
86+
{&gpiob, NULL, NULL, 11, 0, ADCx}, /* PB11 */
87+
{&gpiob, NULL, NULL, 12, 0, ADCx}, /* PB12 */
88+
{&gpiob, NULL, NULL, 13, 0, ADCx}, /* PB13 */
89+
{&gpiob, NULL, NULL, 14, 0, ADCx}, /* PB14 */
90+
{&gpiob, NULL, NULL, 15, 0, ADCx}, /* PB15 */
91+
92+
/* Andy Hull - the R8 is similar to the C8 but exposes more GPIO as follows */
93+
{&gpioc, NULL, &adc1, 0, 0, 10}, /* PC0 */
94+
{&gpioc, NULL, &adc1, 1, 0, 11}, /* PC1 */
95+
{&gpioc, NULL, &adc1, 2, 0, 12}, /* PC2 */
96+
{&gpioc, NULL, &adc1, 3, 0, 13}, /* PC3 */
97+
{&gpioc, NULL, &adc1, 4, 0, 14}, /* PC4 */
98+
{&gpioc, NULL, &adc1, 5, 0, 15}, /* PC5 */
99+
100+
{&gpioc, NULL, NULL, 6, 0, ADCx}, /* PC6 */
101+
{&gpioc, NULL, NULL, 7, 0, ADCx}, /* PC7 */
102+
{&gpioc, NULL, NULL, 8, 0, ADCx}, /* PC8 */
103+
{&gpioc, NULL, NULL, 9, 0, ADCx}, /* PC9 */
104+
105+
{&gpioc, NULL, NULL, 10, 0, ADCx}, /* PC10 */
106+
{&gpioc, NULL, NULL, 11, 0, ADCx}, /* PC11 */
107+
{&gpioc, NULL, NULL, 12, 0, ADCx}, /* PC12 */
108+
{&gpioc, NULL, NULL, 13, 0, ADCx}, /* PC13 */
109+
{&gpioc, NULL, NULL, 14, 0, ADCx}, /* PC14 */
110+
{&gpioc, NULL, NULL, 15, 0, ADCx}, /* PC15 */
111+
112+
{&gpiod, NULL, NULL, 0, 0, ADCx}, /* PD2 */
113+
{&gpiod, NULL, NULL, 1, 0, ADCx}, /* PD2 */
114+
{&gpiod, NULL, NULL, 2, 0, ADCx}, /* PD2 */
115+
};
116+
117+
extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
118+
PA0, PA1, PA2, PA3, PA6, PA7, PA8, PA9, PA10, PB0, PB1, PB6, PB7, PB8, PB9
119+
};
120+
121+
extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
122+
PA0, PA1, PA2 , PA3 , PA4 , PA5 , PA6 , PA7 , PB0 , PB1, PC0, PC1, PC2, PC3, PC4, PC5
123+
};
124+
125+
// Note. These defines are not really used by generic boards. They are for Maple Serial USB
126+
//#define USB_DP PA12
127+
//#define USB_DM PA11
128+
129+
// NOte. These definitions are not really used for generic boards, they only relate to boards modified to behave like Maple boards
130+
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
131+
BOARD_LED_PIN, BOARD_BUTTON_PIN, BOARD_JTMS_SWDIO_PIN,
132+
BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN
133+
//USB_DP, USB_DM
134+
};
135+
136+
137+
/*
138+
* Roger Clark
139+
*
140+
* 2015/05/28
141+
*
142+
* Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance
143+
* Maps to which hardware serial port on the microprocessor
144+
*/
145+
146+
#ifdef SERIAL_USB
147+
DEFINE_HWSERIAL(Serial1, 1);
148+
149+
DEFINE_HWSERIAL(Serial2, 2);
150+
151+
DEFINE_HWSERIAL(Serial3, 3);
152+
153+
#else
154+
DEFINE_HWSERIAL(Serial, 1);
155+
156+
DEFINE_HWSERIAL(Serial1, 2);
157+
158+
DEFINE_HWSERIAL(Serial2, 3);
159+
160+
161+
#endif
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2011 LeafLabs, LLC.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* @file wirish/boards/maple_mini/include/board/board.h
29+
* @author Marti Bolivar <[email protected]>
30+
* @brief Maple Mini board header.
31+
*
32+
* See wirish/boards/maple/include/board/board.h for more information
33+
* on these definitions.
34+
*/
35+
36+
#ifndef _BOARD_STM32VLD_H_
37+
#define _BOARD_STM32VLD_H_
38+
39+
40+
41+
#define CYCLES_PER_MICROSECOND 24
42+
//#define SYSTICK_RELOAD_VAL (F_CPU/1000) - 1 /* takes a cycle to reload */
43+
#define SYSTICK_RELOAD_VAL 23999 /* takes a cycle to reload */
44+
45+
#define BOARD_LED_PIN PC8 /* BlueLED(PC8) */
46+
#define BOARD_BUTTON_PIN PA0 /* USR SW(PA0) */
47+
48+
#define LED_G PC9
49+
#define LED_B PC8
50+
51+
#define BOARD_NR_USARTS 3
52+
#define BOARD_USART1_TX_PIN PA9
53+
#define BOARD_USART1_RX_PIN PA10
54+
#define BOARD_USART2_TX_PIN PA2
55+
#define BOARD_USART2_RX_PIN PA3
56+
#define BOARD_USART3_TX_PIN PB10
57+
#define BOARD_USART3_RX_PIN PB11
58+
59+
#define BOARD_NR_SPI 2
60+
#define BOARD_SPI1_NSS_PIN PA4
61+
#define BOARD_SPI1_MOSI_PIN PA7
62+
#define BOARD_SPI1_MISO_PIN PA6
63+
#define BOARD_SPI1_SCK_PIN PA5
64+
#define BOARD_SPI2_NSS_PIN PB12
65+
#define BOARD_SPI2_MOSI_PIN PB15
66+
#define BOARD_SPI2_MISO_PIN PB14
67+
#define BOARD_SPI2_SCK_PIN PB13
68+
69+
#define BOARD_NR_GPIO_PINS 51
70+
#define BOARD_NR_PWM_PINS 15
71+
#define BOARD_NR_ADC_PINS 16
72+
#define BOARD_NR_USED_PINS 7
73+
74+
#define BOARD_JTMS_SWDIO_PIN PA13
75+
#define BOARD_JTCK_SWCLK_PIN PA14
76+
#define BOARD_JTDI_PIN PA15
77+
#define BOARD_JTDO_PIN PB3
78+
#define BOARD_NJTRST_PIN PB4
79+
80+
81+
#define BOARD_USB_DISC_DEV GPIOB
82+
#define BOARD_USB_DISC_BIT 10
83+
84+
// Note this needs to match with the PIN_MAP array in board.cpp
85+
enum {
86+
PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13, PA14, PA15,
87+
PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15,
88+
PC0, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14, PC15,
89+
PD0, PD1, PD2
90+
};
91+
92+
#endif

0 commit comments

Comments
 (0)