aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/boards/OLIMEX_STM32_103STK/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/boards/OLIMEX_STM32_103STK/board.h')
-rw-r--r--lib/chibios/os/hal/boards/OLIMEX_STM32_103STK/board.h168
1 files changed, 168 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_103STK/board.h b/lib/chibios/os/hal/boards/OLIMEX_STM32_103STK/board.h
new file mode 100644
index 000000000..6135eeb8d
--- /dev/null
+++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_103STK/board.h
@@ -0,0 +1,168 @@
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 Olimex STM32-103STK proto board.
22 */
23
24/*
25 * Board identifier.
26 */
27#define BOARD_OLIMEX_STM32_103STK
28#define BOARD_NAME "Olimex STM32-103STK"
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#define GPIOA_BUTTON_WAKEUP 0
45#define GPIOC_BUTTON_TAMPER 13
46#define GPIOC_JOY 5
47#define GPIOC_JOY_CENTER_BUT 6
48
49#define GPIOA_SPI1NSS 4
50#define GPIOB_SPI2NSS 12
51
52#define GPIOC_MMCWP 2
53#define GPIOC_MMCCP 1
54
55#define GPIOC_USB_P 4
56#define GPIOC_LCD_RES 7
57#define GPIOC_NRF_CE 8
58#define GPIOC_NRF_IRQ 9
59#define GPIOC_LCD_E 10
60
61#define GPIOC_USB_DISC 11
62#define GPIOC_LED 12
63
64#define GPIOB_ACCEL_IRQ 5
65
66/*
67 * I/O ports initial setup, this configuration is established soon after reset
68 * in the initialization code.
69 *
70 * The digits have the following meaning:
71 * 0 - Analog input.
72 * 1 - Push Pull output 10MHz.
73 * 2 - Push Pull output 2MHz.
74 * 3 - Push Pull output 50MHz.
75 * 4 - Digital input.
76 * 5 - Open Drain output 10MHz.
77 * 6 - Open Drain output 2MHz.
78 * 7 - Open Drain output 50MHz.
79 * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
80 * 9 - Alternate Push Pull output 10MHz.
81 * A - Alternate Push Pull output 2MHz.
82 * B - Alternate Push Pull output 50MHz.
83 * C - Reserved.
84 * D - Alternate Open Drain output 10MHz.
85 * E - Alternate Open Drain output 2MHz.
86 * F - Alternate Open Drain output 50MHz.
87 * Please refer to the STM32 Reference Manual for details.
88 */
89
90/*
91 * Port A setup.
92 * Everything input with pull-up except:
93 * PA0 - Normal input (BUTTON).
94 * PA2 - Alternate output (USART2 TX).
95 * PA3 - Normal input (USART2 RX).
96 */
97#define VAL_GPIOACRL 0x88884B84 /* PA7...PA0 */
98#define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */
99#define VAL_GPIOAODR 0xFFFFFFFF
100
101/*
102 * Port B setup.
103 * Everything input with pull-up except:
104 * PB6,7 - Alternate open drain (I2C1).
105 * PB10,11 - Alternate open drain (I2C2).
106 * PB12 - Push Pull output (MMC SPI2 NSS).
107 * PB13 - Alternate output (MMC SPI2 SCK).
108 * PB14 - Normal input (MMC SPI2 MISO).
109 * PB15 - Alternate output (MMC SPI2 MOSI).
110 */
111#define VAL_GPIOBCRL 0xEE888888 /* PB7...PB0 */
112#define VAL_GPIOBCRH 0xB4B3EE88 /* PB15...PB8 */
113#define VAL_GPIOBODR 0xFFFFFFFF
114
115/*
116 * Port C setup.
117 * Everything input with pull-up except:
118 * PC4 - Normal input because there is an external resistor.
119 * PC5 - Analog input (joystick).
120 * PC6 - Normal input because there is an external resistor.
121 * PC7 - Normal input because there is an external resistor.
122 * PC10 - Push Pull output (CAN CNTRL).
123 * PC11 - Push Pull output (USB DISC).
124 * PC12 - Open Drain output (LED).
125 */
126#define VAL_GPIOCCRL 0x44048888 /* PC7...PC0 */
127#define VAL_GPIOCCRH 0x88863388 /* PC15...PC8 */
128#define VAL_GPIOCODR 0xFFFFFFFF
129
130/*
131 * Port D setup.
132 * Everything input with pull-up except:
133 * PD0 - Normal input (XTAL).
134 * PD1 - Normal input (XTAL).
135 */
136#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
137#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
138#define VAL_GPIODODR 0xFFFFFFFF
139
140/*
141 * Port E setup.
142 * Everything input with pull-up except:
143 */
144#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
145#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
146#define VAL_GPIOEODR 0xFFFFFFFF
147
148/*
149 * USB bus activation macro, required by the USB driver.
150 */
151#define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC)
152
153/*
154 * USB bus de-activation macro, required by the USB driver.
155 */
156#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC)
157
158#if !defined(_FROM_ASM_)
159#ifdef __cplusplus
160extern "C" {
161#endif
162 void boardInit(void);
163#ifdef __cplusplus
164}
165#endif
166#endif /* _FROM_ASM_ */
167
168#endif /* _BOARD_H_ */