amiro-os / modules / NUCLEO-F767ZI / module.h @ 8cbe3240
History | View | Annotate | Download (5.646 KB)
1 | 21e5be0b | 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-F767ZI module.
|
||
22 | *
|
||
23 | * @addtogroup NUCLEO-F767ZI_module
|
||
24 | * @{
|
||
25 | */
|
||
26 | |||
27 | #ifndef AMIROOS_MODULE_H
|
||
28 | #define AMIROOS_MODULE_H
|
||
29 | |||
30 | #include <amiroos.h> |
||
31 | #include <math.h> |
||
32 | |||
33 | /*===========================================================================*/
|
||
34 | /**
|
||
35 | * @name Module specific functions
|
||
36 | * @{
|
||
37 | */
|
||
38 | /*===========================================================================*/
|
||
39 | |||
40 | /** @} */
|
||
41 | |||
42 | /*===========================================================================*/
|
||
43 | /**
|
||
44 | * @name ChibiOS/HAL configuration
|
||
45 | * @{
|
||
46 | */
|
||
47 | /*===========================================================================*/
|
||
48 | |||
49 | /**
|
||
50 | * @brief Serial driver of the programmer interface.
|
||
51 | */
|
||
52 | #define MODULE_HAL_PROGIF SD3
|
||
53 | |||
54 | /**
|
||
55 | * @brief Configuration for the programmer serial interface driver.
|
||
56 | */
|
||
57 | extern SerialConfig moduleHalProgIfConfig;
|
||
58 | |||
59 | /**
|
||
60 | * @brief Real-Time Clock driver.
|
||
61 | */
|
||
62 | #define MODULE_HAL_RTC RTCD1
|
||
63 | |||
64 | /** @} */
|
||
65 | |||
66 | /*===========================================================================*/
|
||
67 | /**
|
||
68 | * @name GPIO definitions
|
||
69 | * @{
|
||
70 | */
|
||
71 | /*===========================================================================*/
|
||
72 | |||
73 | /**
|
||
74 | * @brief LED1 output signal GPIO.
|
||
75 | */
|
||
76 | extern ROMCONST apalControlGpio_t moduleGpioLed1;
|
||
77 | |||
78 | /**
|
||
79 | * @brief LED2 output signal GPIO.
|
||
80 | */
|
||
81 | extern ROMCONST apalControlGpio_t moduleGpioLed2;
|
||
82 | |||
83 | /**
|
||
84 | * @brief LED3 output signal GPIO.
|
||
85 | */
|
||
86 | extern ROMCONST apalControlGpio_t moduleGpioLed3;
|
||
87 | |||
88 | /**
|
||
89 | * @brief User button input signal.
|
||
90 | */
|
||
91 | extern ROMCONST apalControlGpio_t moduleGpioUserButton;
|
||
92 | |||
93 | /** @} */
|
||
94 | |||
95 | /*===========================================================================*/
|
||
96 | /**
|
||
97 | * @name AMiRo-OS core configurations
|
||
98 | * @{
|
||
99 | */
|
||
100 | /*===========================================================================*/
|
||
101 | |||
102 | /**
|
||
103 | * @brief Event flag to be set on a USER_BUTTON interrupt.
|
||
104 | */
|
||
105 | #define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
||
106 | |||
107 | #if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
108 | /**
|
||
109 | * @brief Shell prompt text.
|
||
110 | */
|
||
111 | extern ROMCONST char* moduleShellPrompt; |
||
112 | #endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
||
113 | |||
114 | /**
|
||
115 | * @brief Interrupt initialization macro.
|
||
116 | * @note SSSP related interrupt signals are already initialized in 'aos_system.c'.
|
||
117 | */
|
||
118 | #define MODULE_INIT_INTERRUPTS() { \
|
||
119 | /* user button */ \
|
||
120 | palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdIntCallback(), &moduleGpioUserButton.gpio->line); \ |
||
121 | palEnableLineEvent(moduleGpioUserButton.gpio->line, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
||
122 | } |
||
123 | |||
124 | /**
|
||
125 | * @brief Unit test initialization hook.
|
||
126 | */
|
||
127 | #define MODULE_INIT_TESTS() { \
|
||
128 | /* add unit-test shell commands */ \
|
||
129 | } |
||
130 | |||
131 | /**
|
||
132 | * @brief Periphery communication interfaces initialization hook.
|
||
133 | */
|
||
134 | #define MODULE_INIT_PERIPHERY_COMM() { \
|
||
135 | /* serial driver */ \
|
||
136 | sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
||
137 | } |
||
138 | |||
139 | /**
|
||
140 | * @brief Periphery communication interface deinitialization hook.
|
||
141 | */
|
||
142 | #define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
||
143 | } |
||
144 | |||
145 | /**
|
||
146 | * @brief HOOK to toggle the LEDs when the user button is pressed.
|
||
147 | */
|
||
148 | #define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
||
149 | if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
||
150 | apalControlGpioState_t buttonstate; \ |
||
151 | apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
||
152 | apalControlGpioSet(&moduleGpioLed1, buttonstate); \ |
||
153 | apalControlGpioSet(&moduleGpioLed2, buttonstate); \ |
||
154 | apalControlGpioSet(&moduleGpioLed3, buttonstate); \ |
||
155 | } \ |
||
156 | } |
||
157 | |||
158 | /** @} */
|
||
159 | |||
160 | /*===========================================================================*/
|
||
161 | /**
|
||
162 | * @name Startup Shutdown Synchronization Protocol (SSSP)
|
||
163 | * @{
|
||
164 | */
|
||
165 | /*===========================================================================*/
|
||
166 | |||
167 | /** @} */
|
||
168 | |||
169 | /*===========================================================================*/
|
||
170 | /**
|
||
171 | * @name Low-level drivers
|
||
172 | * @{
|
||
173 | */
|
||
174 | /*===========================================================================*/
|
||
175 | |||
176 | /** @} */
|
||
177 | |||
178 | /*===========================================================================*/
|
||
179 | /**
|
||
180 | * @name Unit tests (UT)
|
||
181 | * @{
|
||
182 | */
|
||
183 | /*===========================================================================*/
|
||
184 | #if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
185 | |||
186 | #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
||
187 | |||
188 | /** @} */
|
||
189 | |||
190 | #endif /* AMIROOS_MODULE_H */ |
||
191 | |||
192 | /** @} */ |