amiro-os / modules / LightRing_1-2 / module.h @ f38aba21
History | View | Annotate | Download (17.144 KB)
1 | 9ae7c4f3 | 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 LightRing module.
|
||
22 | *
|
||
23 | * @addtogroup lightring_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 CAN driver to use.
|
||
50 | */
|
||
51 | #define MODULE_HAL_CAN CAND1
|
||
52 | |||
53 | /**
|
||
54 | * @brief Configuration for the CAN driver.
|
||
55 | */
|
||
56 | extern CANConfig moduleHalCanConfig;
|
||
57 | |||
58 | /**
|
||
59 | ee884101 | Thomas Schöpping | * @brief I2C driver to access the EEPROM, power monitor and the breakout header.
|
60 | 9ae7c4f3 | Thomas Schöpping | */
|
61 | ee884101 | Thomas Schöpping | #define MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT I2CD2
|
62 | 9ae7c4f3 | Thomas Schöpping | |
63 | /**
|
||
64 | ee884101 | Thomas Schöpping | * @brief Configuration for the EEPROM, power monitor and breakout I2C driver.
|
65 | 9ae7c4f3 | Thomas Schöpping | */
|
66 | ee884101 | Thomas Schöpping | extern I2CConfig moduleHalI2cEepromPwrmtrBreakoutConfig;
|
67 | 9ae7c4f3 | Thomas Schöpping | |
68 | /**
|
||
69 | * @brief Serial driver of the programmer interface.
|
||
70 | */
|
||
71 | #define MODULE_HAL_PROGIF SD1
|
||
72 | |||
73 | /**
|
||
74 | * @brief Configuration for the programmer serial interface driver.
|
||
75 | */
|
||
76 | extern SerialConfig moduleHalProgIfConfig;
|
||
77 | |||
78 | /**
|
||
79 | * @brief SPI interface driver for the motion sensors (gyroscope and accelerometer).
|
||
80 | */
|
||
81 | #define MODULE_HAL_SPI_LIGHT SPID1
|
||
82 | |||
83 | /**
|
||
84 | * @brief Configuration for the SPI interface driver to communicate with the LED driver.
|
||
85 | */
|
||
86 | extern SPIConfig moduleHalSpiLightConfig;
|
||
87 | |||
88 | 0b989911 | Cung Sang | /**
|
89 | f606f432 | Thomas Schöpping | * @brief SPI interface driver for the breakout header.
|
90 | 0b989911 | Cung Sang | */
|
91 | f606f432 | Thomas Schöpping | #define MODULE_HAL_SPI_BREAKOUT SPID2
|
92 | 0b989911 | Cung Sang | |
93 | /**
|
||
94 | f606f432 | Thomas Schöpping | * @brief UART interface driver for the breakout header (alternative to serial).
|
95 | 0b989911 | Cung Sang | */
|
96 | f606f432 | Thomas Schöpping | #define MODULE_HAL_UART_BREAKOUT UARTD2
|
97 | 0b989911 | Cung Sang | |
98 | /**
|
||
99 | f606f432 | Thomas Schöpping | * @brief Real-Time Clock driver.
|
100 | 0b989911 | Cung Sang | */
|
101 | f606f432 | Thomas Schöpping | #define MODULE_HAL_RTC RTCD1
|
102 | 0b989911 | Cung Sang | |
103 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
|
104 | 0b989911 | Cung Sang | |
105 | 9ae7c4f3 | Thomas Schöpping | /**
|
106 | f606f432 | Thomas Schöpping | * @brief SPI interface driver for UWB DW1000 module.
|
107 | 9ae7c4f3 | Thomas Schöpping | */
|
108 | f606f432 | Thomas Schöpping | #define MODULE_HAL_SPI_UWB MODULE_HAL_SPI_BREAKOUT
|
109 | 0b989911 | Cung Sang | |
110 | 9ae7c4f3 | Thomas Schöpping | /**
|
111 | f606f432 | Thomas Schöpping | * @brief Configuration for the high-speed SPI interface driver of DW1000 module.
|
112 | 9ae7c4f3 | Thomas Schöpping | */
|
113 | f606f432 | Thomas Schöpping | extern SPIConfig moduleHalSpiUwbHsConfig;
|
114 | 9ae7c4f3 | Thomas Schöpping | |
115 | /**
|
||
116 | f606f432 | Thomas Schöpping | * @brief Configuration for the low-speed SPI interface driver of DW1000 module.
|
117 | 9ae7c4f3 | Thomas Schöpping | */
|
118 | f606f432 | Thomas Schöpping | extern SPIConfig moduleHalSpiUwbLsConfig;
|
119 | |||
120 | #endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */ |
||
121 | 9ae7c4f3 | Thomas Schöpping | |
122 | /** @} */
|
||
123 | |||
124 | /*===========================================================================*/
|
||
125 | /**
|
||
126 | * @name GPIO definitions
|
||
127 | * @{
|
||
128 | */
|
||
129 | /*===========================================================================*/
|
||
130 | |||
131 | /**
|
||
132 | * @brief LIGHT_BANK output signal GPIO.
|
||
133 | */
|
||
134 | extern ROMCONST apalControlGpio_t moduleGpioLightBlank;
|
||
135 | |||
136 | /**
|
||
137 | * @brief RS232_R_EN_N output signal GPIO.
|
||
138 | */
|
||
139 | extern ROMCONST apalControlGpio_t moduleGpioRs232En;
|
||
140 | |||
141 | /**
|
||
142 | * @brief SW_V33_EN output signal GPIO.
|
||
143 | */
|
||
144 | extern ROMCONST apalControlGpio_t moduleGpioSwV33En;
|
||
145 | |||
146 | 9acb8326 | Thomas Schöpping | // The 4.2V switch is disabled due to a hardware bug.
|
147 | ///**
|
||
148 | // * @brief SW_V42_EN output signal GPIO.
|
||
149 | // */
|
||
150 | //extern ROMCONST apalControlGpio_t moduleGpioSwV42En;
|
||
151 | 9ae7c4f3 | Thomas Schöpping | |
152 | /**
|
||
153 | * @brief SW_V50_EN output signal GPIO.
|
||
154 | */
|
||
155 | extern ROMCONST apalControlGpio_t moduleGpioSwV50En;
|
||
156 | |||
157 | /**
|
||
158 | * @brief IO_3 breakout signal GPIO.
|
||
159 | */
|
||
160 | extern apalControlGpio_t moduleGpioBreakoutIo3;
|
||
161 | |||
162 | /**
|
||
163 | * @brief IO_5 breakout signal GPIO.
|
||
164 | */
|
||
165 | extern apalControlGpio_t moduleGpioBreakoutIo5;
|
||
166 | |||
167 | /**
|
||
168 | * @brief IO_6 breakout signal GPIO.
|
||
169 | */
|
||
170 | extern apalControlGpio_t moduleGpioBreakoutIo6;
|
||
171 | |||
172 | /**
|
||
173 | * @brief SYS_UART_DN bidirectional signal GPIO.
|
||
174 | */
|
||
175 | extern ROMCONST apalControlGpio_t moduleGpioSysUartDn;
|
||
176 | |||
177 | /**
|
||
178 | f606f432 | Thomas Schöpping | * @brief IO_7 breakout signal GPIO.
|
179 | */
|
||
180 | extern apalControlGpio_t moduleGpioBreakoutIo7;
|
||
181 | |||
182 | /**
|
||
183 | * @brief IO_8 breakout signal GPIO.
|
||
184 | */
|
||
185 | extern apalControlGpio_t moduleGpioBreakoutIo8;
|
||
186 | |||
187 | /**
|
||
188 | 9ae7c4f3 | Thomas Schöpping | * @brief IO_4 breakout signal GPIO.
|
189 | */
|
||
190 | extern apalControlGpio_t moduleGpioBreakoutIo4;
|
||
191 | |||
192 | /**
|
||
193 | * @brief IO_1 breakout signal GPIO.
|
||
194 | */
|
||
195 | extern apalControlGpio_t moduleGpioBreakoutIo1;
|
||
196 | |||
197 | /**
|
||
198 | f606f432 | Thomas Schöpping | * @brief IO_2 breakout signal GPIO.
|
199 | */
|
||
200 | extern apalControlGpio_t moduleGpioBreakoutIo2;
|
||
201 | |||
202 | /**
|
||
203 | 9ae7c4f3 | Thomas Schöpping | * @brief LED output signal GPIO.
|
204 | */
|
||
205 | extern ROMCONST apalControlGpio_t moduleGpioLed;
|
||
206 | |||
207 | /**
|
||
208 | c930aa01 | Thomas Schöpping | * @brief LIGHT_XLAT output signal.
|
209 | */
|
||
210 | extern ROMCONST apalControlGpio_t moduleGpioLightXlat;
|
||
211 | |||
212 | /**
|
||
213 | 9ae7c4f3 | Thomas Schöpping | * @brief SW_V18_EN output signal GPIO.
|
214 | */
|
||
215 | extern ROMCONST apalControlGpio_t moduleGpioSwV18En;
|
||
216 | |||
217 | /**
|
||
218 | * @brief SW_VSYS_EN output signal GPIO.
|
||
219 | */
|
||
220 | extern ROMCONST apalControlGpio_t moduleGpioSwVsysEn;
|
||
221 | |||
222 | /**
|
||
223 | * @brief SYS_UART_UP bidirectional signal GPIO.
|
||
224 | */
|
||
225 | extern ROMCONST apalControlGpio_t moduleGpioSysUartUp;
|
||
226 | |||
227 | /**
|
||
228 | * @brief SYS_PD bidirectional signal GPIO.
|
||
229 | */
|
||
230 | extern ROMCONST apalControlGpio_t moduleGpioSysPd;
|
||
231 | |||
232 | /**
|
||
233 | * @brief SYS_SYNC bidirectional signal GPIO.
|
||
234 | */
|
||
235 | extern ROMCONST apalControlGpio_t moduleGpioSysSync;
|
||
236 | |||
237 | /** @} */
|
||
238 | |||
239 | /*===========================================================================*/
|
||
240 | /**
|
||
241 | * @name AMiRo-OS core configurations
|
||
242 | * @{
|
||
243 | */
|
||
244 | /*===========================================================================*/
|
||
245 | |||
246 | /**
|
||
247 | * @brief Event flag to be set on a IO_4 (breakout) interrupt.
|
||
248 | */
|
||
249 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO4 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_4))
|
250 | 9ae7c4f3 | Thomas Schöpping | |
251 | /**
|
||
252 | * @brief Event flag to be set on a IO_1 (breakout) interrupt.
|
||
253 | */
|
||
254 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO1 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_1))
|
255 | 9ae7c4f3 | Thomas Schöpping | |
256 | /**
|
||
257 | * @brief Event flag to be set on a SYS_SYNC interrupt.
|
||
258 | */
|
||
259 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_SYSSYNC AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
260 | 9ae7c4f3 | Thomas Schöpping | |
261 | /**
|
||
262 | * @brief Event flag to be set on a IO_3 (breakout) interrupt.
|
||
263 | */
|
||
264 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO3 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_3))
|
265 | 9ae7c4f3 | Thomas Schöpping | |
266 | /**
|
||
267 | * @brief Event flag to be set on a IO_5 (breakout) interrupt.
|
||
268 | */
|
||
269 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO5 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_5))
|
270 | 9ae7c4f3 | Thomas Schöpping | |
271 | /**
|
||
272 | * @brief Event flag to be set on a IO_6 (breakout) interrupt.
|
||
273 | */
|
||
274 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO6 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_6))
|
275 | 9ae7c4f3 | Thomas Schöpping | |
276 | /**
|
||
277 | * @brief Event flag to be set on a SYS_UART_DN interrupt.
|
||
278 | */
|
||
279 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_SYSUARTDN AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
280 | 9ae7c4f3 | Thomas Schöpping | |
281 | /**
|
||
282 | * @brief Event flag to be set on a SYS_UART_UP interrupt.
|
||
283 | */
|
||
284 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_SYSUARTUP AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
285 | 9ae7c4f3 | Thomas Schöpping | |
286 | /**
|
||
287 | * @brief Event flag to be set on a IO_7 (breakout) interrupt.
|
||
288 | */
|
||
289 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO7 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_7))
|
290 | 9ae7c4f3 | Thomas Schöpping | |
291 | /**
|
||
292 | * @brief Event flag to be set on a IO_8 (breakout) interrupt.
|
||
293 | */
|
||
294 | 3106e8cc | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
|
295 | 9ae7c4f3 | Thomas Schöpping | |
296 | /**
|
||
297 | f606f432 | Thomas Schöpping | * @brief Event flag to be set on a SYS_PD interrupt.
|
298 | 0b989911 | Cung Sang | */
|
299 | f606f432 | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_SYSPD AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
300 | |||
301 | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
|
||
302 | 0b989911 | Cung Sang | |
303 | /**
|
||
304 | f606f432 | Thomas Schöpping | * @brief Event flag to be set on a DW1000 interrupt.
|
305 | 9ae7c4f3 | Thomas Schöpping | */
|
306 | f606f432 | Thomas Schöpping | #define MODULE_OS_IOEVENTFLAGS_DW1000 MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8
|
307 | |||
308 | #endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */ |
||
309 | 9ae7c4f3 | Thomas Schöpping | |
310 | #if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
311 | /**
|
||
312 | * @brief Shell prompt text.
|
||
313 | */
|
||
314 | extern ROMCONST char* moduleShellPrompt; |
||
315 | #endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
||
316 | |||
317 | /**
|
||
318 | * @brief Interrupt initialization macro.
|
||
319 | * @note SSSP related interrupt signals are already initialized in 'aos_system.c'.
|
||
320 | */
|
||
321 | #define MODULE_INIT_INTERRUPTS() { \
|
||
322 | /* breakout interrupts must be enabled explicitely */ \
|
||
323 | f606f432 | Thomas Schöpping | MODULE_INIT_INTERRUPTS_BREAKOUT(); \ |
324 | 9ae7c4f3 | Thomas Schöpping | } |
325 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
|
326 | #define MODULE_INIT_INTERRUPTS_BREAKOUT() { \
|
||
327 | palSetLineCallback(moduleLldDw1000.gpio_exti->gpio->line, aosSysGetStdExtiCallback(), &moduleLldDw1000.gpio_exti->gpio->line); \ |
||
328 | palEnableLineEvent(moduleLldDw1000.gpio_exti->gpio->line, APAL2CH_EDGE(moduleLldDw1000.gpio_exti->meta.edge)); \ |
||
329 | 0b989911 | Cung Sang | } |
330 | f606f432 | Thomas Schöpping | #elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
|
331 | #define MODULE_INIT_INTERRUPTS_BREAKOUT() { \
|
||
332 | 0b989911 | Cung Sang | } |
333 | f606f432 | Thomas Schöpping | #endif
|
334 | 9ae7c4f3 | Thomas Schöpping | |
335 | /**
|
||
336 | * @brief Unit test initialization hook.
|
||
337 | */
|
||
338 | #define MODULE_INIT_TESTS() { \
|
||
339 | 4c72a54c | Thomas Schöpping | /* initialize tests and add to shell */ \
|
340 | aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \ |
||
341 | aosShellAddCommand(&aos.shell, &moduleTestIna219ShellCmd); \ |
||
342 | aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd); \ |
||
343 | aosShellAddCommand(&aos.shell, &moduleTestMic9404xShellCmd); \ |
||
344 | aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd); \ |
||
345 | aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd); \ |
||
346 | f606f432 | Thomas Schöpping | MODULE_INIT_TESTS_BREAKOUT(); \ |
347 | 9ae7c4f3 | Thomas Schöpping | } |
348 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
|
349 | #define MODULE_INIT_TESTS_BREAKOUT() { \
|
||
350 | 0b989911 | Cung Sang | aosShellAddCommand(&aos.shell, &moduleTestDw1000ShellCmd); \ |
351 | } |
||
352 | f606f432 | Thomas Schöpping | #elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
|
353 | #define MODULE_INIT_TESTS_BREAKOUT() { \
|
||
354 | 0b989911 | Cung Sang | } |
355 | f606f432 | Thomas Schöpping | #endif
|
356 | 9ae7c4f3 | Thomas Schöpping | |
357 | /**
|
||
358 | * @brief Periphery communication interfaces initialization hook.
|
||
359 | */
|
||
360 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF() { \
|
361 | 9ae7c4f3 | Thomas Schöpping | /* serial driver */ \
|
362 | sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
||
363 | /* I2C */ \
|
||
364 | ee884101 | Thomas Schöpping | moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed = (AT24C01B_LLD_I2C_MAXFREQUENCY < moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed) ? AT24C01B_LLD_I2C_MAXFREQUENCY : moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed; \ |
365 | moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed; \ |
||
366 | moduleHalI2cEepromPwrmtrBreakoutConfig.duty_cycle = (moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \
|
||
367 | i2cStart(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT, &moduleHalI2cEepromPwrmtrBreakoutConfig); \ |
||
368 | 9ae7c4f3 | Thomas Schöpping | /* SPI */ \
|
369 | spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig); \ |
||
370 | f606f432 | Thomas Schöpping | /* breakout module */ \
|
371 | MODULE_INIT_PERIPHERY_COMM_BREAKOUT(); \ |
||
372 | 9ae7c4f3 | Thomas Schöpping | } |
373 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
|
374 | #define MODULE_INIT_PERIPHERY_COMM_BREAKOUT() { \
|
||
375 | spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig); \ |
||
376 | 0b989911 | Cung Sang | } |
377 | f606f432 | Thomas Schöpping | #elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
|
378 | #define MODULE_INIT_PERIPHERY_COMM_BREAKOUT() { \
|
||
379 | 0b989911 | Cung Sang | } |
380 | f606f432 | Thomas Schöpping | #endif
|
381 | 9ae7c4f3 | Thomas Schöpping | |
382 | /**
|
||
383 | * @brief Periphery communication interface deinitialization hook.
|
||
384 | */
|
||
385 | 4c72a54c | Thomas Schöpping | #define MODULE_SHUTDOWN_PERIPHERY_IF() { \
|
386 | 9ae7c4f3 | Thomas Schöpping | /* SPI */ \
|
387 | spiStop(&MODULE_HAL_SPI_LIGHT); \ |
||
388 | /* I2C */ \
|
||
389 | ee884101 | Thomas Schöpping | i2cStop(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT); \ |
390 | f606f432 | Thomas Schöpping | /* breakout module */ \
|
391 | MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT(); \ |
||
392 | 9ae7c4f3 | Thomas Schöpping | /* don't stop the serial driver so messages can still be printed */ \
|
393 | } |
||
394 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
|
395 | #define MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT() { \
|
||
396 | /* SPI */ \
|
||
397 | spiStop(&MODULE_HAL_SPI_UWB); \ |
||
398 | 0b989911 | Cung Sang | } |
399 | f606f432 | Thomas Schöpping | #elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
|
400 | #define MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT() { \
|
||
401 | 0b989911 | Cung Sang | } |
402 | f606f432 | Thomas Schöpping | #endif
|
403 | 9ae7c4f3 | Thomas Schöpping | |
404 | /** @} */
|
||
405 | |||
406 | /*===========================================================================*/
|
||
407 | /**
|
||
408 | * @name Startup Shutdown Synchronization Protocol (SSSP)
|
||
409 | * @{
|
||
410 | */
|
||
411 | /*===========================================================================*/
|
||
412 | |||
413 | /**
|
||
414 | * @brief PD signal GPIO.
|
||
415 | */
|
||
416 | #define moduleSsspGpioPd moduleGpioSysPd
|
||
417 | |||
418 | /**
|
||
419 | * @brief SYNC signal GPIO.
|
||
420 | */
|
||
421 | #define moduleSsspGpioSync moduleGpioSysSync
|
||
422 | |||
423 | /**
|
||
424 | * @brief UP signal GPIO.
|
||
425 | */
|
||
426 | #define moduleSsspGpioUp moduleGpioSysUartUp
|
||
427 | |||
428 | /**
|
||
429 | * @brief DN signal GPIO.
|
||
430 | */
|
||
431 | #define moduleSsspGpioDn moduleGpioSysUartDn
|
||
432 | |||
433 | /**
|
||
434 | * @brief Event flags for PD signal events.
|
||
435 | */
|
||
436 | #define MODULE_SSSP_EVENTFLAGS_PD MODULE_OS_IOEVENTFLAGS_SYSPD
|
||
437 | |||
438 | /**
|
||
439 | * @brief Event flags for SYNC signal events.
|
||
440 | */
|
||
441 | #define MODULE_SSSP_EVENTFLAGS_SYNC MODULE_OS_IOEVENTFLAGS_SYSSYNC
|
||
442 | |||
443 | /**
|
||
444 | * @brief Event flags for UP signal events.
|
||
445 | */
|
||
446 | #define MODULE_SSSP_EVENTFLAGS_UP MODULE_OS_IOEVENTFLAGS_SYSUARTUP
|
||
447 | |||
448 | /**
|
||
449 | * @brief Event flags for DN signal events.
|
||
450 | */
|
||
451 | #define MODULE_SSSP_EVENTFLAGS_DN MODULE_OS_IOEVENTFLAGS_SYSUARTDN
|
||
452 | |||
453 | /** @} */
|
||
454 | |||
455 | /*===========================================================================*/
|
||
456 | /**
|
||
457 | * @name Low-level drivers
|
||
458 | * @{
|
||
459 | */
|
||
460 | /*===========================================================================*/
|
||
461 | #include <alld_AT24C01B.h> |
||
462 | ee884101 | Thomas Schöpping | #include <alld_INA219.h> |
463 | 9ae7c4f3 | Thomas Schöpping | #include <alld_LED.h> |
464 | ee884101 | Thomas Schöpping | #include <alld_MIC9404x.h> |
465 | 4c72a54c | Thomas Schöpping | // TODO: add SNx5C3221E
|
466 | 9ae7c4f3 | Thomas Schöpping | #include <alld_TLC5947.h> |
467 | |||
468 | /**
|
||
469 | * @brief EEPROM driver.
|
||
470 | */
|
||
471 | extern AT24C01BDriver moduleLldEeprom;
|
||
472 | |||
473 | /**
|
||
474 | ee884101 | Thomas Schöpping | * @brief Power monitor (VLED 4.2) driver.
|
475 | */
|
||
476 | extern INA219Driver moduleLldPowerMonitorVled;
|
||
477 | |||
478 | /**
|
||
479 | 9ae7c4f3 | Thomas Schöpping | * @brief Status LED driver.
|
480 | */
|
||
481 | extern LEDDriver moduleLldStatusLed;
|
||
482 | |||
483 | /**
|
||
484 | ee884101 | Thomas Schöpping | * @brief Power switch driver (1.8V).
|
485 | */
|
||
486 | extern MIC9404xDriver moduleLldPowerSwitchV18;
|
||
487 | |||
488 | /**
|
||
489 | * @brief Power switch driver (3.3V).
|
||
490 | */
|
||
491 | extern MIC9404xDriver moduleLldPowerSwitchV33;
|
||
492 | |||
493 | /**
|
||
494 | * @brief Power switch driver (4.2V).
|
||
495 | */
|
||
496 | extern MIC9404xDriver moduleLldPowerSwitchV42;
|
||
497 | |||
498 | /**
|
||
499 | * @brief Power switch driver (5.0V).
|
||
500 | */
|
||
501 | extern MIC9404xDriver moduleLldPowerSwitchV50;
|
||
502 | |||
503 | /**
|
||
504 | * @brief Pseudo power switch driver (VSYS).
|
||
505 | * @details There is no actual MIC9040x device, but the swicthable circuit behaves analogous.
|
||
506 | */
|
||
507 | extern MIC9404xDriver moduleLldPowerSwitchVsys;
|
||
508 | |||
509 | 4c72a54c | Thomas Schöpping | // TODO: add SNx5C3221E
|
510 | |||
511 | ee884101 | Thomas Schöpping | /**
|
512 | 4c72a54c | Thomas Schöpping | * @brief 24 channel PWM LED driver.
|
513 | 9ae7c4f3 | Thomas Schöpping | */
|
514 | extern TLC5947Driver moduleLldLedPwm;
|
||
515 | |||
516 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
|
517 | |||
518 | #include <alld_DW1000.h> |
||
519 | |||
520 | 0b989911 | Cung Sang | /**
|
521 | f606f432 | Thomas Schöpping | * @brief Alias for the DW1000 driver object.
|
522 | * @note The dw1000 struct is defined as external variable (singleton) by the
|
||
523 | * driver, since the Decawave software stacks assumes no more than a
|
||
524 | * single device in a system.
|
||
525 | 0b989911 | Cung Sang | */
|
526 | f606f432 | Thomas Schöpping | #define moduleLldDw1000 dw1000
|
527 | |||
528 | #endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */ |
||
529 | 0b989911 | Cung Sang | |
530 | 9ae7c4f3 | Thomas Schöpping | /** @} */
|
531 | |||
532 | /*===========================================================================*/
|
||
533 | /**
|
||
534 | 4c72a54c | Thomas Schöpping | * @name Tests
|
535 | 9ae7c4f3 | Thomas Schöpping | * @{
|
536 | */
|
||
537 | /*===========================================================================*/
|
||
538 | #if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
539 | |||
540 | /**
|
||
541 | 4c72a54c | Thomas Schöpping | * @brief AT24C01BN-SH-B (EEPROM) test command.
|
542 | 9ae7c4f3 | Thomas Schöpping | */
|
543 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestAt24c01bShellCmd;
|
544 | 9ae7c4f3 | Thomas Schöpping | |
545 | /**
|
||
546 | 4c72a54c | Thomas Schöpping | * @brief INA219 (power monitor) test command.
|
547 | ee884101 | Thomas Schöpping | */
|
548 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestIna219ShellCmd;
|
549 | ee884101 | Thomas Schöpping | |
550 | /**
|
||
551 | 4c72a54c | Thomas Schöpping | * @brief Status LED test command.
|
552 | ee884101 | Thomas Schöpping | */
|
553 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestLedShellCmd;
|
554 | |||
555 | /**
|
||
556 | * @brief MIC9404x (power switch) test command.
|
||
557 | */
|
||
558 | extern aos_shellcommand_t moduleTestMic9404xShellCmd;
|
||
559 | |||
560 | // TODO: add SNx5C3221E
|
||
561 | ee884101 | Thomas Schöpping | |
562 | /**
|
||
563 | 4c72a54c | Thomas Schöpping | * @brief TLC5947 (24 channel PWM LED driver) test command.
|
564 | ee884101 | Thomas Schöpping | */
|
565 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestTlc5947ShellCmd;
|
566 | ee884101 | Thomas Schöpping | |
567 | /**
|
||
568 | 4c72a54c | Thomas Schöpping | * @brief Entire module test command.
|
569 | 9ae7c4f3 | Thomas Schöpping | */
|
570 | 4c72a54c | Thomas Schöpping | extern aos_shellcommand_t moduleTestAllShellCmd;
|
571 | 9ae7c4f3 | Thomas Schöpping | |
572 | 0b989911 | Cung Sang | |
573 | f606f432 | Thomas Schöpping | #if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
|
574 | |||
575 | 0b989911 | Cung Sang | /**
|
576 | * @brief DW1000 (UWB transmitter) test command.
|
||
577 | */
|
||
578 | extern aos_shellcommand_t moduleTestDw1000ShellCmd;
|
||
579 | f606f432 | Thomas Schöpping | |
580 | #endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */ |
||
581 | 0b989911 | Cung Sang | |
582 | 9ae7c4f3 | Thomas Schöpping | #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
583 | |||
584 | /** @} */
|
||
585 | |||
586 | #endif /* AMIROOS_MODULE_H */ |
||
587 | |||
588 | /** @} */ |