diff options
Diffstat (limited to 'lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h')
-rw-r--r-- | lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h new file mode 100644 index 000000000..ca9a860b2 --- /dev/null +++ b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the LeafLabs Maple Mini. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_MAPLEMINI_STM32_F103 | ||
28 | #define BOARD_NAME "LeafLabs Maple Mini" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define STM32_LSECLK 32768 | ||
34 | #define STM32_HSECLK 8000000 | ||
35 | |||
36 | /* | ||
37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
38 | */ | ||
39 | #define STM32F103xB | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments | ||
43 | * | ||
44 | * numbering is sorted by onboard/connectors, as from the schematics in | ||
45 | * https://github.com/leaflabs/maplemini | ||
46 | */ | ||
47 | |||
48 | /* on-board */ | ||
49 | |||
50 | #define GPIOB_LED 1 | ||
51 | #define GPIOB_USB_DISC 9 | ||
52 | #define GPIOD_OSC_IN 0 | ||
53 | #define GPIOD_OSC_OUT 1 | ||
54 | |||
55 | /* J1 connector */ | ||
56 | |||
57 | // pin 1: AV+ | ||
58 | // pin 2: AV- | ||
59 | // pin 3: VBAT | ||
60 | #define GPIOC_TAMPER_RTC 13 // pin 4 | ||
61 | #define GPIOC_OSC32_IN 14 // pin 5 | ||
62 | #define GPIOC_OSD32_OUT 15 // pin 6 | ||
63 | // pin 7: RESET | ||
64 | #define GPIOA_USART2_CTS 0 // pin 8 | ||
65 | #define GPIOA_USART2_RTS 1 // pin 9 | ||
66 | #define GPIOA_USART2_TX 2 // pin 10 | ||
67 | #define GPIOA_USART2_RX 3 // pin 11 | ||
68 | #define GPIOA_SPI1_NSS 4 // pin 12 | ||
69 | #define GPIOA_SPI1_SCK 5 // pin 13 | ||
70 | #define GPIOA_SPI1_MISO 6 // pin 14 | ||
71 | #define GPIOA_SPI1_MOSI 7 // pin 15 | ||
72 | #define GPIOB_ADC12_IN8 0 // pin 16 | ||
73 | #define GPIOB_BOOT1 2 // pin 17 | ||
74 | #define GPIOB_I2C2_SCL 10 // pin 18 | ||
75 | #define GPIOB_I2C2_SDA 11 // pin 19 | ||
76 | // pin 20: VIN | ||
77 | |||
78 | /* J2 connector */ | ||
79 | |||
80 | #define GPIOB_SPI2_NSS 12 // pin 1 | ||
81 | #define GPIOB_SPI2_SCK 13 // pin 2 | ||
82 | #define GPIOB_SPI2_MISO 14 // pin 3 | ||
83 | #define GPIOB_SPI2_MOSI 15 // pin 4 | ||
84 | #define GPIOA_USART1_CK 8 // pin 5 | ||
85 | #define GPIOA_USART1_TX 9 // pin 6 | ||
86 | #define GPIOA_USART1_RX 10 // pin 7 | ||
87 | #define GPIOA_USBDM 11 // pin 8 | ||
88 | #define GPIOA_USBDP 12 // pin 9 | ||
89 | #define GPIOA_JTMS 13 // pin 10 | ||
90 | #define GPIOA_JTCK 14 // pin 11 | ||
91 | #define GPIOA_JTDI 15 // pin 12 | ||
92 | #define GPIOB_JTDO 3 // pin 13 | ||
93 | #define GPIOB_JTRST 4 // pin 14 | ||
94 | #define GPIOB_I2C1_SMBA 5 // pin 15 | ||
95 | #define GPIOB_I2C1_SCL 6 // pin 16 | ||
96 | #define GPIOB_I2C1_SDA 7 // pin 17 | ||
97 | #define GPIOB_BOOT0_BUTTON 8 // pin 18 | ||
98 | // pin 19: GND | ||
99 | // pin 20: VCC | ||
100 | |||
101 | /* | ||
102 | * I/O ports initial setup, this configuration is established soon after reset | ||
103 | * in the initialization code. | ||
104 | * | ||
105 | * The digits have the following meaning: | ||
106 | * 0 - Analog input. | ||
107 | * 1 - Push Pull output 10MHz. | ||
108 | * 2 - Push Pull output 2MHz. | ||
109 | * 3 - Push Pull output 50MHz. | ||
110 | * 4 - Digital input. | ||
111 | * 5 - Open Drain output 10MHz. | ||
112 | * 6 - Open Drain output 2MHz. | ||
113 | * 7 - Open Drain output 50MHz. | ||
114 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
115 | * 9 - Alternate Push Pull output 10MHz. | ||
116 | * A - Alternate Push Pull output 2MHz. | ||
117 | * B - Alternate Push Pull output 50MHz. | ||
118 | * C - Reserved. | ||
119 | * D - Alternate Open Drain output 10MHz. | ||
120 | * E - Alternate Open Drain output 2MHz. | ||
121 | * F - Alternate Open Drain output 50MHz. | ||
122 | * Please refer to the STM32 Reference Manual for details. | ||
123 | */ | ||
124 | |||
125 | /* | ||
126 | * Port A setup. | ||
127 | * Everything input with pull-up except: | ||
128 | * PA2 - Alternate output (USART2 TX). | ||
129 | * PA3 - Normal input (USART2 RX). | ||
130 | * PA9 - Alternate output (USART1 TX). | ||
131 | * PA10 - Normal input (USART1 RX). | ||
132 | */ | ||
133 | #define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */ | ||
134 | #define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */ | ||
135 | #define VAL_GPIOAODR 0xFFFFFFFF | ||
136 | |||
137 | /* | ||
138 | * Port B setup. | ||
139 | * Everything input with pull-up except: | ||
140 | * PB1 - Push Pull output (LED). | ||
141 | * PB9 - Push Pull output (USB switch). | ||
142 | */ | ||
143 | #define VAL_GPIOBCRL 0x88888838 /* PB7...PB0 */ | ||
144 | #define VAL_GPIOBCRH 0x88888838 /* PB15...PB8 */ | ||
145 | #define VAL_GPIOBODR 0xFFFFFFFF | ||
146 | |||
147 | /* | ||
148 | * Port C setup. | ||
149 | * Everything input with pull-up except: | ||
150 | */ | ||
151 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ | ||
152 | #define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */ | ||
153 | #define VAL_GPIOCODR 0xFFFFFFFF | ||
154 | |||
155 | /* | ||
156 | * Port D setup. | ||
157 | * Everything input with pull-up except: | ||
158 | * PD0 - Normal input (XTAL). | ||
159 | * PD1 - Normal input (XTAL). | ||
160 | */ | ||
161 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ | ||
162 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ | ||
163 | #define VAL_GPIODODR 0xFFFFFFFF | ||
164 | |||
165 | /* | ||
166 | * Port E setup. | ||
167 | * Everything input with pull-up except: | ||
168 | */ | ||
169 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ | ||
170 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ | ||
171 | #define VAL_GPIOEODR 0xFFFFFFFF | ||
172 | |||
173 | /* | ||
174 | * USB bus activation macro, required by the USB driver. | ||
175 | */ | ||
176 | #define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) | ||
177 | |||
178 | /* | ||
179 | * USB bus de-activation macro, required by the USB driver. | ||
180 | */ | ||
181 | #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) | ||
182 | |||
183 | #if !defined(_FROM_ASM_) | ||
184 | #ifdef __cplusplus | ||
185 | extern "C" { | ||
186 | #endif | ||
187 | void boardInit(void); | ||
188 | #ifdef __cplusplus | ||
189 | } | ||
190 | #endif | ||
191 | #endif /* _FROM_ASM_ */ | ||
192 | |||
193 | #endif /* _BOARD_H_ */ | ||