amiro-os / modules / NUCLEO-F401RE / module.h @ f606e2bf
History | View | Annotate | Download (5.35 KB)
1 | b93c5d98 | Thomas Schöpping | /*
|
---|---|---|---|
2 | AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
||
3 | Copyright (C) 2016..2019 Thomas Schöpping et al.
|
||
4 | |||
5 | This program is free software: you can redistribute it and/or modify
|
||
6 | it under the terms of the GNU General Public License as published by
|
||
7 | the Free Software Foundation, either version 3 of the License, or
|
||
8 | (at your option) any later version.
|
||
9 | |||
10 | This program is distributed in the hope that it will be useful,
|
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | GNU General Public License for more details.
|
||
14 | |||
15 | You should have received a copy of the GNU General Public License
|
||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
17 | */
|
||
18 | |||
19 | /**
|
||
20 | * @file
|
||
21 | * @brief Structures and constant for the NUCLEO-F401RE module.
|
||
22 | *
|
||
23 | * @addtogroup NUCLEO-F401RE_module
|
||
24 | * @{
|
||
25 | */
|
||
26 | |||
27 | #ifndef AMIROOS_MODULE_H
|
||
28 | #define AMIROOS_MODULE_H
|
||
29 | |||
30 | #include <amiroos.h> |
||
31 | |||
32 | /*===========================================================================*/
|
||
33 | /**
|
||
34 | * @name Module specific functions
|
||
35 | * @{
|
||
36 | */
|
||
37 | /*===========================================================================*/
|
||
38 | |||
39 | /** @} */
|
||
40 | |||
41 | /*===========================================================================*/
|
||
42 | /**
|
||
43 | * @name ChibiOS/HAL configuration
|
||
44 | * @{
|
||
45 | */
|
||
46 | /*===========================================================================*/
|
||
47 | |||
48 | /**
|
||
49 | * @brief Serial driver of the programmer interface.
|
||
50 | */
|
||
51 | #define MODULE_HAL_PROGIF SD2
|
||
52 | |||
53 | /**
|
||
54 | * @brief Configuration for the programmer serial interface driver.
|
||
55 | */
|
||
56 | extern SerialConfig moduleHalProgIfConfig;
|
||
57 | |||
58 | /**
|
||
59 | * @brief Real-Time Clock driver.
|
||
60 | */
|
||
61 | #define MODULE_HAL_RTC RTCD1
|
||
62 | |||
63 | /** @} */
|
||
64 | |||
65 | /*===========================================================================*/
|
||
66 | /**
|
||
67 | * @name GPIO definitions
|
||
68 | * @{
|
||
69 | */
|
||
70 | /*===========================================================================*/
|
||
71 | |||
72 | /**
|
||
73 | * @brief LED output signal GPIO.
|
||
74 | */
|
||
75 | extern ROMCONST apalControlGpio_t moduleGpioLed;
|
||
76 | |||
77 | /**
|
||
78 | * @brief User button input signal.
|
||
79 | */
|
||
80 | extern ROMCONST apalControlGpio_t moduleGpioUserButton;
|
||
81 | |||
82 | /** @} */
|
||
83 | |||
84 | /*===========================================================================*/
|
||
85 | /**
|
||
86 | * @name AMiRo-OS core configurations
|
||
87 | * @{
|
||
88 | */
|
||
89 | /*===========================================================================*/
|
||
90 | |||
91 | /**
|
||
92 | * @brief Event flag to be set on a USER_BUTTON interrupt.
|
||
93 | */
|
||
94 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_USERBUTTON AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
95 | b93c5d98 | Thomas Schöpping | |
96 | cda14729 | Thomas Schöpping | #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
97 | b93c5d98 | Thomas Schöpping | /**
|
98 | * @brief Shell prompt text.
|
||
99 | */
|
||
100 | extern ROMCONST char* moduleShellPrompt; |
||
101 | cda14729 | Thomas Schöpping | #endif /* (AMIROOS_CFG_SHELL_ENABLE == true) */ |
102 | b93c5d98 | Thomas Schöpping | |
103 | /**
|
||
104 | * @brief Interrupt initialization macro.
|
||
105 | */
|
||
106 | #define MODULE_INIT_INTERRUPTS() { \
|
||
107 | /* user button */ \
|
||
108 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioUserButton.gpio->line); \ |
109 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioUserButton.gpio->line, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
110 | b93c5d98 | Thomas Schöpping | } |
111 | |||
112 | /**
|
||
113 | cda14729 | Thomas Schöpping | * @brief Test initialization hook.
|
114 | b93c5d98 | Thomas Schöpping | */
|
115 | #define MODULE_INIT_TESTS() { \
|
||
116 | cda14729 | Thomas Schöpping | /* add test commands to shell */ \
|
117 | b93c5d98 | Thomas Schöpping | } |
118 | |||
119 | /**
|
||
120 | * @brief Periphery communication interfaces initialization hook.
|
||
121 | */
|
||
122 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF() { \
|
123 | b93c5d98 | Thomas Schöpping | /* serial driver */ \
|
124 | sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
||
125 | } |
||
126 | |||
127 | /**
|
||
128 | * @brief Periphery communication interface deinitialization hook.
|
||
129 | */
|
||
130 | 4c72a54c | Thomas Schöpping | #define MODULE_SHUTDOWN_PERIPHERY_IF() { \
|
131 | cda14729 | Thomas Schöpping | /* don't stop the serial driver so messages can still be printed */ \
|
132 | b93c5d98 | Thomas Schöpping | } |
133 | |||
134 | /**
|
||
135 | * @brief HOOK to toggle the LEDs when the user button is pressed.
|
||
136 | */
|
||
137 | cda14729 | Thomas Schöpping | #define MODULE_MAIN_LOOP_GPIOEVENT(eventflags) { \
|
138 | if (eventflags & MODULE_OS_GPIOEVENTFLAG_USERBUTTON) { \
|
||
139 | b93c5d98 | Thomas Schöpping | apalControlGpioState_t buttonstate; \ |
140 | apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
||
141 | apalControlGpioSet(&moduleGpioLed, buttonstate); \ |
||
142 | } \ |
||
143 | } |
||
144 | |||
145 | /** @} */
|
||
146 | |||
147 | /*===========================================================================*/
|
||
148 | /**
|
||
149 | * @name Startup Shutdown Synchronization Protocol (SSSP)
|
||
150 | * @{
|
||
151 | */
|
||
152 | /*===========================================================================*/
|
||
153 | |||
154 | cda14729 | Thomas Schöpping | #if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
155 | c53ef0b1 | Thomas Schöpping | #error "SSSP is not supported on this module." |
156 | cda14729 | Thomas Schöpping | #endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
157 | |||
158 | b93c5d98 | Thomas Schöpping | /** @} */
|
159 | |||
160 | /*===========================================================================*/
|
||
161 | /**
|
||
162 | * @name Low-level drivers
|
||
163 | * @{
|
||
164 | */
|
||
165 | /*===========================================================================*/
|
||
166 | |||
167 | /** @} */
|
||
168 | |||
169 | /*===========================================================================*/
|
||
170 | /**
|
||
171 | 4c72a54c | Thomas Schöpping | * @name Tests
|
172 | b93c5d98 | Thomas Schöpping | * @{
|
173 | */
|
||
174 | /*===========================================================================*/
|
||
175 | #if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
176 | |||
177 | #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
||
178 | |||
179 | /** @} */
|
||
180 | |||
181 | #endif /* AMIROOS_MODULE_H */ |
||
182 | |||
183 | /** @} */ |