Revision 8543d0d9 modules/RT-STM32L476RG-NUCLEO64/module.h
modules/RT-STM32L476RG-NUCLEO64/module.h | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
3 |
Copyright (C) 2016..2018 Thomas Schöpping et al.
|
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
|
4 | 4 |
|
5 | 5 |
This program is free software: you can redistribute it and/or modify |
6 | 6 |
it under the terms of the GNU General Public License as published by |
... | ... | |
27 | 27 |
#ifndef _AMIROOS_MODULE_H_ |
28 | 28 |
#define _AMIROOS_MODULE_H_ |
29 | 29 |
|
30 |
#include <amiroos.h> |
|
31 |
|
|
30 | 32 |
/*===========================================================================*/ |
31 | 33 |
/** |
32 | 34 |
* @name Module specific functions |
... | ... | |
34 | 36 |
*/ |
35 | 37 |
/*===========================================================================*/ |
36 | 38 |
|
37 |
/* |
|
38 |
* @brief Makro to store data in the core coupled memory (ccm). |
|
39 |
* Example: |
|
40 |
* int compute_buffer[128] CCM_RAM; |
|
41 |
* |
|
42 |
* @note The ccm is not connected to any bus system. |
|
43 |
*/ |
|
44 |
#define CCM_RAM __attribute__((section(".ram4"), aligned(4)))moduleHalCanConfig |
|
45 |
|
|
46 |
/* |
|
47 |
* @brief Makro to store data in the ethernet memory (eth). |
|
48 |
* Example: |
|
49 |
* int dma_buffer[128] ETH_RAM; |
|
50 |
* |
|
51 |
* @note The eth is a dedicated memory block with its own DMA controller. |
|
52 |
*/ |
|
53 |
#define ETH_RAM __attribute__((section(".ram2"), aligned(4))) |
|
54 |
|
|
55 |
/* |
|
56 |
* @brief Makro to store data in the backup memory (bckp). |
|
57 |
* Example: |
|
58 |
* int backup_buffer[128] BCKP_RAM; |
|
59 |
* |
|
60 |
* @note The eth is a dedicated memory block with its own DMA controller. |
|
61 |
*/ |
|
62 |
#define BCKP_RAM __attribute__((section(".ram5"), aligned(4))) |
|
63 |
|
|
64 | 39 |
/** @} */ |
65 | 40 |
|
66 | 41 |
/*===========================================================================*/ |
... | ... | |
69 | 44 |
* @{ |
70 | 45 |
*/ |
71 | 46 |
/*===========================================================================*/ |
72 |
#include <hal.h> |
|
73 |
|
|
74 |
/** |
|
75 |
* @brief CAN driver to use. |
|
76 |
*/ |
|
77 |
#define MODULE_HAL_CAN CAND1 |
|
78 | 47 |
|
79 | 48 |
/** |
80 |
* @brief Configuration for the CAN driver.
|
|
49 |
* @brief Serial driver of the programmer interface.
|
|
81 | 50 |
*/ |
82 |
extern CANConfig moduleHalCanConfig;
|
|
51 |
#define MODULE_HAL_PROGIF SD2
|
|
83 | 52 |
|
84 | 53 |
/** |
85 |
* @brief Serial driver of the programmer interface.
|
|
54 |
* @brief Configuration for the programmer serial interface driver.
|
|
86 | 55 |
*/ |
87 |
#define MODULE_HAL_PROGIF SD2
|
|
56 |
extern SerialConfig moduleHalProgIfConfig;
|
|
88 | 57 |
|
89 | 58 |
/** |
90 | 59 |
* @brief I2C driver to access multiplexer, proximity sensors 5 to 8, power monitors for VSYS4.2, VIO 5.0 and VDD, EEPROM, touch sensor, and fuel gauge (front battery). |
91 | 60 |
*/ |
92 |
#define MODULE_HAL_I2C_MPU6050 I2CD3 |
|
61 |
#define MODULE_HAL_I2C_MPU6050 I2CD3
|
|
93 | 62 |
|
94 | 63 |
/** |
95 | 64 |
* @brief Configuration for the multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery) I2C driver. |
... | ... | |
97 | 66 |
extern I2CConfig moduleHalI2cMpu6050Config; |
98 | 67 |
|
99 | 68 |
/** |
100 |
* @brief Configuration for the programmer serial interface driver. |
|
101 |
*/ |
|
102 |
extern SerialConfig moduleHalProgIfConfig; |
|
103 |
|
|
104 |
/** |
|
105 | 69 |
* @brief Real-Time Clock driver. |
106 | 70 |
*/ |
107 | 71 |
#define MODULE_HAL_RTC RTCD1 |
108 | 72 |
|
109 | 73 |
/** @} */ |
110 | 74 |
|
111 |
/** |
|
112 |
* @brief Periphery communication interfaces initialization hook. |
|
113 |
*/ |
|
114 |
#define MODULE_INIT_PERIPHERY_COMM() { \ |
|
115 |
/* serial driver */ \ |
|
116 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
|
117 |
} |
|
118 |
|
|
119 | 75 |
/*===========================================================================*/ |
120 | 76 |
/** |
121 | 77 |
* @name GPIO definitions |
122 | 78 |
* @{ |
123 | 79 |
*/ |
124 | 80 |
/*===========================================================================*/ |
125 |
#include <amiro-lld.h> |
|
126 |
|
|
127 |
/** |
|
128 |
* @brief SYS_REG_EN output signal GPIO. |
|
129 |
*/ |
|
130 |
extern ROMCONST apalControlGpio_t moduleGpioSysRegEn; |
|
131 |
|
|
132 |
/** |
|
133 |
* @brief IR_INT1 input signal GPIO. |
|
134 |
*/ |
|
135 |
extern ROMCONST apalControlGpio_t moduleGpioIrInt1; |
|
136 |
|
|
137 |
/** |
|
138 |
* @brief POWER_EN output signal GPIO. |
|
139 |
*/ |
|
140 |
extern ROMCONST apalControlGpio_t moduleGpioPowerEn; |
|
141 |
|
|
142 |
/** |
|
143 |
* @brief SYS_UART_DN bidirectional signal GPIO. |
|
144 |
*/ |
|
145 |
extern ROMCONST apalControlGpio_t moduleGpioSysUartDn; |
|
146 | 81 |
|
147 | 82 |
/** |
148 | 83 |
* @brief LED output signal GPIO. |
... | ... | |
150 | 85 |
extern ROMCONST apalControlGpio_t moduleGpioLed; |
151 | 86 |
|
152 | 87 |
/** |
153 |
* @brief SYS_UART_UP bidirectional signal GPIO.
|
|
88 |
* @brief User button input signal.
|
|
154 | 89 |
*/ |
155 |
extern ROMCONST apalControlGpio_t moduleGpioSysUartUp;
|
|
90 |
extern ROMCONST apalControlGpio_t moduleGpioUserButton;
|
|
156 | 91 |
|
157 |
/** |
|
158 |
* @brief IR_INT2 input signal GPIO. |
|
159 |
*/ |
|
160 |
extern ROMCONST apalControlGpio_t moduleGpioIrInt2; |
|
161 |
|
|
162 |
/** |
|
163 |
* @brief TOUCH_INT input signal GPIO. |
|
164 |
*/ |
|
165 |
extern ROMCONST apalControlGpio_t moduleGpioTouchInt; |
|
92 |
/** @} */ |
|
166 | 93 |
|
94 |
/*===========================================================================*/ |
|
167 | 95 |
/** |
168 |
* @brief SYS_DONE input signal GPIO. |
|
96 |
* @name AMiRo-OS core configurations |
|
97 |
* @{ |
|
169 | 98 |
*/ |
170 |
extern ROMCONST apalControlGpio_t moduleGpioSysDone;
|
|
99 |
/*===========================================================================*/
|
|
171 | 100 |
|
172 | 101 |
/** |
173 |
* @brief SYS_PROG output signal GPIO.
|
|
102 |
* @brief Event flag to be set on a USER_BUTTON interrupt.
|
|
174 | 103 |
*/ |
175 |
extern ROMCONST apalControlGpio_t moduleGpioSysProg;
|
|
104 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(GPIOC_BUTTON)
|
|
176 | 105 |
|
106 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
|
177 | 107 |
/** |
178 |
* @brief PATH_DC input signal GPIO.
|
|
108 |
* @brief Shell prompt text.
|
|
179 | 109 |
*/ |
180 |
extern ROMCONST apalControlGpio_t moduleGpioPathDc; |
|
110 |
extern ROMCONST char* moduleShellPrompt; |
|
111 |
#endif |
|
181 | 112 |
|
182 | 113 |
/** |
183 |
* @brief SYS_SPI_DIR bidirectional signal GPIO. |
|
114 |
* @brief Interrupt initialization macro. |
|
115 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'. |
|
184 | 116 |
*/ |
185 |
extern ROMCONST apalControlGpio_t moduleGpioSysSpiDir; |
|
117 |
#define MODULE_INIT_INTERRUPTS() { \ |
|
118 |
/* user button */ \ |
|
119 |
palSetPadCallback(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, _intCallback, &moduleGpioUserButton.gpio->pad); \ |
|
120 |
palEnablePadEvent(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
|
121 |
} |
|
186 | 122 |
|
187 | 123 |
/** |
188 |
* @brief SYS_SYNC bidirectional signal GPIO.
|
|
124 |
* @brief Unit test initialization hook.
|
|
189 | 125 |
*/ |
190 |
extern ROMCONST apalControlGpio_t moduleGpioSysSync; |
|
126 |
#define MODULE_INIT_TESTS() { \ |
|
127 |
/* add unit-test shell commands */ \ |
|
128 |
aosShellAddCommand(&aos.shell, &moduleUtAlldMpu6050.shellcmd); \ |
|
129 |
} |
|
191 | 130 |
|
192 | 131 |
/** |
193 |
* @brief SYS_PD bidirectional signal GPIO.
|
|
132 |
* @brief Periphery communication interfaces initialization hook.
|
|
194 | 133 |
*/ |
195 |
extern ROMCONST apalControlGpio_t moduleGpioSysPd; |
|
134 |
#define MODULE_INIT_PERIPHERY_COMM() { \ |
|
135 |
/* serial driver */ \ |
|
136 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
|
137 |
} |
|
196 | 138 |
|
197 | 139 |
/** |
198 |
* @brief SYS_WARMRST bidirectional signal GPIO.
|
|
140 |
* @brief Periphery communication interface deinitialization hook.
|
|
199 | 141 |
*/ |
200 |
extern ROMCONST apalControlGpio_t moduleGpioSysWarmrst; |
|
142 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \ |
|
143 |
} |
|
201 | 144 |
|
202 | 145 |
/** |
203 |
* @brief BT_RST output signal GPIO.
|
|
146 |
* @brief HOOK to toggle the LEDs when the user button is pressed.
|
|
204 | 147 |
*/ |
205 |
extern ROMCONST apalControlGpio_t moduleGpioBtRst; |
|
206 |
|
|
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(&moduleGpioLed, buttonstate); \ |
|
153 |
} \ |
|
154 |
} |
|
207 | 155 |
|
208 | 156 |
/** @} */ |
209 | 157 |
|
210 |
|
|
211 | 158 |
/*===========================================================================*/ |
212 | 159 |
/** |
213 |
* @name AMiRo-OS core configurations
|
|
160 |
* @name Startup Shutdown Synchronization Protocol (SSSP)
|
|
214 | 161 |
* @{ |
215 | 162 |
*/ |
216 | 163 |
/*===========================================================================*/ |
217 | 164 |
|
218 |
/** |
|
219 |
* @brief Event flag to be set on a IR_INT1 / CHARGE_STAT1A interrupt. |
|
220 |
*/ |
|
221 |
#define MODULE_OS_IOEVENTFLAGS_IRINT1 ((eventflags_t)1 << GPIOB_IR_INT1_N) |
|
222 |
|
|
223 |
|
|
224 |
/** |
|
225 |
* @brief Event flag to be set on a SYS_UART_DN interrupt. |
|
226 |
*/ |
|
227 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN ((eventflags_t)1 << GPIOB_SYS_UART_DN) |
|
228 |
|
|
229 |
|
|
230 |
/** |
|
231 |
* @brief Event flag to be set on a TOUCH_INT interrupt. |
|
232 |
*/ |
|
233 |
#define MODULE_OS_IOEVENTFLAGS_TOUCHINT ((eventflags_t)1 << GPIOC_TOUCH_INT_N) |
|
234 |
|
|
235 |
|
|
236 |
/** |
|
237 |
* @brief Event flag to be set on a PATH_DC interrupt. |
|
238 |
*/ |
|
239 |
#define MODULE_OS_IOEVENTFLAGS_PATHDC ((eventflags_t)1 << GPIOC_PATH_DC) |
|
240 |
|
|
241 |
/** |
|
242 |
* @brief Event flag to be set on a SYS_SPI_DIR interrupt. |
|
243 |
*/ |
|
244 |
#define MODULE_OS_IOEVENTFLAGS_SYSSPIDIR ((eventflags_t)1 << GPIOC_SYS_SPI_DIR) |
|
245 |
|
|
246 |
/** |
|
247 |
* @brief Event flag to be set on a SYS_SYNC interrupt. |
|
248 |
*/ |
|
249 |
#define MODULE_OS_IOEVENTFLAGS_SYSSYNC ((eventflags_t)1 << GPIOC_SYS_INT_N) |
|
250 |
|
|
251 |
/** |
|
252 |
* @brief Event flag to be set on a SYS_PD interrupt. |
|
253 |
*/ |
|
254 |
#define MODULE_OS_IOEVENTFLAGS_SYSPD ((eventflags_t)1 << GPIOC_SYS_PD_N) |
|
165 |
/** @} */ |
|
255 | 166 |
|
167 |
/*===========================================================================*/ |
|
256 | 168 |
/** |
257 |
* @brief Event flag to be set on a SYS_WARMRST interrupt. |
|
169 |
* @name Low-level drivers |
|
170 |
* @{ |
|
258 | 171 |
*/ |
259 |
#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST ((eventflags_t)1 << GPIOC_SYS_WARMRST_N)
|
|
172 |
/*===========================================================================*/
|
|
260 | 173 |
|
261 |
/** |
|
262 |
* @brief Event flag to be set on a SYS_UART_UP interrupt. |
|
263 |
*/ |
|
264 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP ((eventflags_t)1 << GPIOB_SYS_UART_UP) |
|
174 |
//#include <alld_mpu6050.h> |
|
265 | 175 |
|
266 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
|
267 | 176 |
/** |
268 |
* @brief Shell prompt text. |
|
269 |
*/ |
|
270 |
extern ROMCONST char* moduleShellPrompt; |
|
271 |
#endif |
|
272 |
|
|
273 |
/** |
|
274 |
* @brief Unit test initialization hook. |
|
177 |
* @brief Accelerometer (MPU6050) driver. |
|
275 | 178 |
*/ |
276 |
#define MODULE_INIT_TESTS() { \ |
|
277 |
/* add unit-test shell commands */ \ |
|
278 |
aosShellAddCommand(&aos.shell, &moduleUtAlldMpu6050.shellcmd); \ |
|
279 |
} |
|
179 |
//extern MPU6050Driver moduleLldMpu6050; |
|
280 | 180 |
|
281 |
#include <alld_mpu6050.h>
|
|
181 |
/** @} */
|
|
282 | 182 |
|
183 |
/*===========================================================================*/ |
|
283 | 184 |
/** |
284 |
* @brief Accelerometer (MPU6050) driver. |
|
185 |
* @name Unit tests (UT) |
|
186 |
* @{ |
|
285 | 187 |
*/ |
286 |
extern MPU6050Driver moduleLldMpu6050; |
|
188 |
/*===========================================================================*/ |
|
189 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
|
287 | 190 |
|
288 | 191 |
#include <ut_alld_mpu6050.h> |
289 | 192 |
|
... | ... | |
292 | 195 |
*/ |
293 | 196 |
extern aos_unittest_t moduleUtAlldMpu6050; |
294 | 197 |
|
198 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
|
199 |
|
|
200 |
/** @} */ |
|
201 |
|
|
295 | 202 |
#endif /* _AMIROOS_MODULE_H_ */ |
296 | 203 |
|
297 | 204 |
/** @} */ |
Also available in: Unified diff