diff options
Diffstat (limited to 'lib/chibios/os/hal/boards/ST_INEMO_M1_DISCOVERY/board.h')
-rw-r--r-- | lib/chibios/os/hal/boards/ST_INEMO_M1_DISCOVERY/board.h | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/ST_INEMO_M1_DISCOVERY/board.h b/lib/chibios/os/hal/boards/ST_INEMO_M1_DISCOVERY/board.h new file mode 100644 index 000000000..68b729122 --- /dev/null +++ b/lib/chibios/os/hal/boards/ST_INEMO_M1_DISCOVERY/board.h | |||
@@ -0,0 +1,195 @@ | |||
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 ST INEMO-M1 Discovery board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ST_INEMO_M1_DISCOVERY | ||
28 | #define BOARD_NAME "STMicroelectronics INEMO-M1 Discovery" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define STM32_LSECLK 0 | ||
34 | #define STM32_HSECLK 8000000 | ||
35 | |||
36 | /* | ||
37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
38 | */ | ||
39 | #define STM32F103xE | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments. | ||
43 | */ | ||
44 | #define GPIOA_PRESS_INT 0 | ||
45 | #define GPIOA_LED_BLUE 1 | ||
46 | #define GPIOA_PA2 2 | ||
47 | #define GPIOA_PA3 3 | ||
48 | #define GPIOA_PA4 4 | ||
49 | #define GPIOA_PA5 5 | ||
50 | #define GPIOA_PA6 6 | ||
51 | #define GPIOA_PA7 7 | ||
52 | #define GPIOA_USB_EN 9 | ||
53 | #define GPIOA_BUTTON 10 | ||
54 | #define GPIOA_USB_DM 11 | ||
55 | #define GPIOA_USB_DP 12 | ||
56 | #define GPIOA_SWDIO 13 | ||
57 | #define GPIOA_SWCLK 14 | ||
58 | |||
59 | #define GPIOB_SWO 3 | ||
60 | #define GPIOB_I2C1_SCL 6 | ||
61 | #define GPIOB_I2C1_SDA 7 | ||
62 | #define GPIOB_PB8 8 | ||
63 | #define GPIOB_PB9 9 | ||
64 | #define GPIOB_I2C2_SCL 10 | ||
65 | #define GPIOB_I2C2_SDA 11 | ||
66 | #define GPIOB_SPI2_CS 12 | ||
67 | #define GPIOB_SPI2_SCK 13 | ||
68 | #define GPIOB_SPI2_MISO 14 | ||
69 | #define GPIOB_SPI2_MOSI 15 | ||
70 | |||
71 | #define GPIOC_GYRO_INT1 6 | ||
72 | #define GPIOC_LMS_DRDY 7 | ||
73 | #define GPIOC_LMS_INT1 8 | ||
74 | #define GPIOC_GYRO_DRDY 9 | ||
75 | |||
76 | #define GPIOD_LMS_INT2 2 | ||
77 | |||
78 | /* | ||
79 | * I/O ports initial setup, this configuration is established soon after reset | ||
80 | * in the initialization code. | ||
81 | * | ||
82 | * The digits have the following meaning: | ||
83 | * 0 - Analog input. | ||
84 | * 1 - Push Pull output 10MHz. | ||
85 | * 2 - Push Pull output 2MHz. | ||
86 | * 3 - Push Pull output 50MHz. | ||
87 | * 4 - Digital input. | ||
88 | * 5 - Open Drain output 10MHz. | ||
89 | * 6 - Open Drain output 2MHz. | ||
90 | * 7 - Open Drain output 50MHz. | ||
91 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
92 | * 9 - Alternate Push Pull output 10MHz. | ||
93 | * A - Alternate Push Pull output 2MHz. | ||
94 | * B - Alternate Push Pull output 50MHz. | ||
95 | * C - Reserved. | ||
96 | * D - Alternate Open Drain output 10MHz. | ||
97 | * E - Alternate Open Drain output 2MHz. | ||
98 | * F - Alternate Open Drain output 50MHz. | ||
99 | * Please refer to the STM32 Reference Manual for details. | ||
100 | */ | ||
101 | |||
102 | /* | ||
103 | * Port A setup. | ||
104 | * Everything input with pull-up except: | ||
105 | * PA0 - Push Pull output (GPIOA_PRESS_INT). | ||
106 | * PA1 - Push Pull output (GPIOA_LED_BLUE). | ||
107 | * PA9 - Push Pull output (GPIOA_USB_EN). | ||
108 | * PA10 - Normal input (GPIOA_BUTTON). | ||
109 | * PA11 - Normal input (GPIOA_USB_DM). | ||
110 | * PA12 - Normal input (GPIOA_USB_DP). | ||
111 | * PA13 - Pull-up input (GPIOA_SWDIO). | ||
112 | * PA14 - Pull-down input (GPIOA_SWCLK). | ||
113 | */ | ||
114 | #define VAL_GPIOACRL 0x88888838 /* PA7...PA0 */ | ||
115 | #define VAL_GPIOACRH 0x88844438 /* PA15...PA8 */ | ||
116 | #define VAL_GPIOAODR 0xFFFFBDFD | ||
117 | |||
118 | /* | ||
119 | * Port B setup. | ||
120 | * Everything input with pull-up except: | ||
121 | * PB3 - Pull-up input (GPIOB_SWO). | ||
122 | * PB6,7 - Alternate open drain (I2C1). | ||
123 | * PB10,11 - Alternate open drain (I2C2). | ||
124 | * PB12 - Push Pull output (GPIOB_SPI2_CS). | ||
125 | * PB13 - Alternate output (GPIOB_SPI2_SCK). | ||
126 | * PB14 - Normal input (GPIOB_SPI2_MISO). | ||
127 | * PB15 - Alternate output (GPIOB_SPI2_MOSI). | ||
128 | */ | ||
129 | #define VAL_GPIOBCRL 0xEE888888 /* PB7...PB0 */ | ||
130 | #define VAL_GPIOBCRH 0xB4B3EE88 /* PB15...PB8 */ | ||
131 | #define VAL_GPIOBODR 0xFFFFFFFF | ||
132 | |||
133 | /* | ||
134 | * Port C setup. | ||
135 | * Everything input with pull-up except: | ||
136 | */ | ||
137 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ | ||
138 | #define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */ | ||
139 | #define VAL_GPIOCODR 0xFFFFFFFF | ||
140 | |||
141 | /* | ||
142 | * Port D setup. | ||
143 | * Everything input with pull-up except: | ||
144 | * PD0 - Normal input (XTAL). | ||
145 | * PD1 - Normal input (XTAL). | ||
146 | */ | ||
147 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ | ||
148 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ | ||
149 | #define VAL_GPIODODR 0xFFFFFFFF | ||
150 | |||
151 | /* | ||
152 | * Port E setup. | ||
153 | * Everything input with pull-up except: | ||
154 | */ | ||
155 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ | ||
156 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ | ||
157 | #define VAL_GPIOEODR 0xFFFFFFFF | ||
158 | |||
159 | /* | ||
160 | * Port F setup. | ||
161 | * Everything input with pull-up except: | ||
162 | */ | ||
163 | #define VAL_GPIOFCRL 0x88888888 /* PF7...PF0 */ | ||
164 | #define VAL_GPIOFCRH 0x88888888 /* PF15...PF8 */ | ||
165 | #define VAL_GPIOFODR 0xFFFFFFFF | ||
166 | |||
167 | /* | ||
168 | * Port G setup. | ||
169 | * Everything input with pull-up except: | ||
170 | */ | ||
171 | #define VAL_GPIOGCRL 0x88888888 /* PG7...PG0 */ | ||
172 | #define VAL_GPIOGCRH 0x88888888 /* PG15...PG8 */ | ||
173 | #define VAL_GPIOGODR 0xFFFFFFFF | ||
174 | |||
175 | /* | ||
176 | * USB bus activation macro, required by the USB driver. | ||
177 | */ | ||
178 | #define usb_lld_connect_bus(usbp) palSetPad(GPIOA, GPIOA_USB_EN) | ||
179 | |||
180 | /* | ||
181 | * USB bus de-activation macro, required by the USB driver. | ||
182 | */ | ||
183 | #define usb_lld_disconnect_bus(usbp) palClearPad(GPIOA, GPIOA_USB_EN) | ||
184 | |||
185 | #if !defined(_FROM_ASM_) | ||
186 | #ifdef __cplusplus | ||
187 | extern "C" { | ||
188 | #endif | ||
189 | void boardInit(void); | ||
190 | #ifdef __cplusplus | ||
191 | } | ||
192 | #endif | ||
193 | #endif /* _FROM_ASM_ */ | ||
194 | |||
195 | #endif /* _BOARD_H_ */ | ||