aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/boards/ST_STM8L_DISCOVERY/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/boards/ST_STM8L_DISCOVERY/board.h')
-rw-r--r--lib/chibios/os/hal/boards/ST_STM8L_DISCOVERY/board.h167
1 files changed, 167 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/ST_STM8L_DISCOVERY/board.h b/lib/chibios/os/hal/boards/ST_STM8L_DISCOVERY/board.h
new file mode 100644
index 000000000..37a5b476d
--- /dev/null
+++ b/lib/chibios/os/hal/boards/ST_STM8L_DISCOVERY/board.h
@@ -0,0 +1,167 @@
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 STMicroelectronics STM8L-Discovery board.
22 */
23
24/*
25 * Board identifiers.
26 */
27#define BOARD_ST_STM8L_DISCOVERY
28#define BOARD_NAME "ST STM8L-Discovery"
29
30/*
31 * Board frequencies and bypass modes.
32 *
33 * The bypass must be set to TRUE if the chip is driven by an external
34 * oscillator rather than a crystal. Frequency must be set to zero if
35 * the clock source is not used at all.
36 * The following constants are used by the HAL low level driver for
37 * correct clock initialization.
38 */
39#define HSECLK 0
40#define HSEBYPASS FALSE
41#define LSECLK 32768
42#define LSEBYPASS FALSE
43
44/*
45 * MCU model used on the board.
46 */
47#define STM8L152C6
48#define STM8L15X_MD
49
50/*
51 * Pin definitions.
52 */
53#define PA_OSC_IN 2
54#define PA_OSC_OUT 3
55#define PA_LCD_COM0 4
56#define PA_LCD_COM1 5
57#define PA_LCD_COM2 6
58#define PA_LCD_SEG0 7
59
60#define PB_LCD_SEG10 0
61#define PB_LCD_SEG11 1
62#define PB_LCD_SEG12 2
63#define PB_LCD_SEG13 3
64#define PB_LCD_SEG14 4
65#define PB_LCD_SEG15 5
66#define PB_LCD_SEG16 6
67#define PB_LCD_SEG17 7
68
69#define PC_UNUSED 0
70#define PC_BUTTON 1
71#define PC_LCD_SEG22 2
72#define PC_LCD_SEG23 3
73#define PC_IDD_CNT_EN 4
74#define PC_LED4 7
75
76#define PD_LCD_SEG7 0
77#define PD_LCD_COM3 1
78#define PD_LCD_SEG8 2
79#define PD_LCD_SEG9 3
80#define PD_LCD_SEG18 4
81#define PD_LCD_SEG19 5
82#define PD_LCD_SEG20 6
83#define PD_LCD_SEG21 7
84
85#define PE_LCD_SEG1 0
86#define PE_LCD_SEG2 1
87#define PE_LCD_SEG3 2
88#define PE_LCD_SEG4 3
89#define PE_LCD_SEG5 4
90#define PE_LCD_SEG6 5
91#define PE_IDD_WAKEUP 6
92#define PE_LED3 7
93
94#define PF0_IDD_MEASUREMENT 0
95
96/*
97 * Port A initial setup.
98 */
99#define VAL_GPIOAODR 0
100#define VAL_GPIOADDR 0 /* All inputs. */
101#define VAL_GPIOACR1 0xFF /* All pull-up/push-pull. */
102#define VAL_GPIOACR2 0
103
104/*
105 * Port B initial setup.
106 */
107#define VAL_GPIOBODR 0
108#define VAL_GPIOBDDR 0 /* All inputs. */
109#define VAL_GPIOBCR1 0xFF /* All pull-up/push-pull. */
110#define VAL_GPIOBCR2 0
111
112/*
113 * Port C initial setup.
114 */
115#define VAL_GPIOCODR 0
116#define VAL_GPIOCDDR (1 << PC_LED4)
117#define VAL_GPIOCCR1 0xFF /* All pull-up/push-pull. */
118#define VAL_GPIOCCR2 0
119
120/*
121 * Port D initial setup.
122 */
123#define VAL_GPIODODR 0
124#define VAL_GPIODDDR 0 /* All inputs. */
125#define VAL_GPIODCR1 0xFF /* All pull-up/push-pull. */
126#define VAL_GPIODCR2 0
127
128/*
129 * Port E initial setup.
130 */
131#define VAL_GPIOEODR 0
132#define VAL_GPIOEDDR (1 << PE_LED3)
133#define VAL_GPIOECR1 0xFF /* All pull-up/push-pull. */
134#define VAL_GPIOECR2 0
135
136/*
137 * Port F initial setup.
138 */
139#define VAL_GPIOFODR 0
140#define VAL_GPIOFDDR 0 /* All inputs. */
141#define VAL_GPIOFCR1 0xFF /* All pull-up/push-pull. */
142#define VAL_GPIOFCR2 0
143
144/*
145 * TIM2-update ISR segment code. This code is injected into the appropriate
146 * ISR by the HAL.
147 */
148#define _TIM2_UPDATE_ISR() { \
149 if (TIM2->SR1 & TIM_SR1_UIF) { \
150 chSysLockFromIsr(); \
151 chSysTimerHandlerI(); \
152 chSysUnlockFromIsr(); \
153 TIM2->SR1 = 0; \
154 } \
155}
156
157#if !defined(_FROM_ASM_)
158#ifdef __cplusplus
159extern "C" {
160#endif
161 void boardInit(void);
162#ifdef __cplusplus
163}
164#endif
165#endif /* _FROM_ASM_ */
166
167#endif /* _BOARD_H_ */