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