amiro-os / modules / LightRing_1-2 / module.h @ 908b6fb4
History | View | Annotate | Download (17.709 KB)
| 1 |
/*
|
|---|---|
| 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 |
* @brief I2C driver to access the EEPROM, power monitor and the breakout header.
|
| 60 |
*/
|
| 61 |
#define MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT I2CD2
|
| 62 |
|
| 63 |
/**
|
| 64 |
* @brief Configuration for the EEPROM, power monitor and breakout I2C driver.
|
| 65 |
*/
|
| 66 |
extern I2CConfig moduleHalI2cEepromPwrmtrBreakoutConfig;
|
| 67 |
|
| 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 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 89 |
/**
|
| 90 |
* @brief SPI interface driver for UWB DW1000 module.
|
| 91 |
*/
|
| 92 |
#define MODULE_HAL_SPI_UWB SPID2
|
| 93 |
|
| 94 |
/**
|
| 95 |
* @brief Configuration for the high-speed SPI interface driver of DW1000 module.
|
| 96 |
*/
|
| 97 |
extern SPIConfig moduleHalSpiUwbHsConfig;
|
| 98 |
|
| 99 |
/**
|
| 100 |
* @brief Configuration for the low-speed SPI interface driver of DW1000 module.
|
| 101 |
*/
|
| 102 |
extern SPIConfig moduleHalSpiUwbLsConfig;
|
| 103 |
|
| 104 |
#else
|
| 105 |
|
| 106 |
/**
|
| 107 |
* @brief SPI interface driver for the breakout header.
|
| 108 |
*/
|
| 109 |
#define MODULE_HAL_SPI_BREAKOUT SPID2
|
| 110 |
|
| 111 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 112 |
|
| 113 |
/**
|
| 114 |
* @brief UART interface driver for the breakout header (alternative to serial).
|
| 115 |
*/
|
| 116 |
#define MODULE_HAL_UART_BREAKOUT UARTD2
|
| 117 |
|
| 118 |
/**
|
| 119 |
* @brief Real-Time Clock driver.
|
| 120 |
*/
|
| 121 |
#define MODULE_HAL_RTC RTCD1
|
| 122 |
|
| 123 |
/** @} */
|
| 124 |
|
| 125 |
/*===========================================================================*/
|
| 126 |
/**
|
| 127 |
* @name GPIO definitions
|
| 128 |
* @{
|
| 129 |
*/
|
| 130 |
/*===========================================================================*/
|
| 131 |
|
| 132 |
/**
|
| 133 |
* @brief LIGHT_BANK output signal GPIO.
|
| 134 |
*/
|
| 135 |
extern ROMCONST apalControlGpio_t moduleGpioLightBlank;
|
| 136 |
|
| 137 |
/**
|
| 138 |
* @brief RS232_R_EN_N output signal GPIO.
|
| 139 |
*/
|
| 140 |
extern ROMCONST apalControlGpio_t moduleGpioRs232En;
|
| 141 |
|
| 142 |
/**
|
| 143 |
* @brief SW_V33_EN output signal GPIO.
|
| 144 |
*/
|
| 145 |
extern ROMCONST apalControlGpio_t moduleGpioSwV33En;
|
| 146 |
|
| 147 |
/**
|
| 148 |
* @brief SW_V42_EN output signal GPIO.
|
| 149 |
*/
|
| 150 |
extern ROMCONST apalControlGpio_t moduleGpioSwV42En;
|
| 151 |
|
| 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 |
* @brief IO_4 breakout signal GPIO.
|
| 179 |
*/
|
| 180 |
extern apalControlGpio_t moduleGpioBreakoutIo4;
|
| 181 |
|
| 182 |
/**
|
| 183 |
* @brief IO_1 breakout signal GPIO.
|
| 184 |
*/
|
| 185 |
extern apalControlGpio_t moduleGpioBreakoutIo1;
|
| 186 |
|
| 187 |
/**
|
| 188 |
* @brief LED output signal GPIO.
|
| 189 |
*/
|
| 190 |
extern ROMCONST apalControlGpio_t moduleGpioLed;
|
| 191 |
|
| 192 |
/**
|
| 193 |
* @brief SW_V18_EN output signal GPIO.
|
| 194 |
*/
|
| 195 |
extern ROMCONST apalControlGpio_t moduleGpioSwV18En;
|
| 196 |
|
| 197 |
/**
|
| 198 |
* @brief SW_VSYS_EN output signal GPIO.
|
| 199 |
*/
|
| 200 |
extern ROMCONST apalControlGpio_t moduleGpioSwVsysEn;
|
| 201 |
|
| 202 |
/**
|
| 203 |
* @brief SYS_UART_UP bidirectional signal GPIO.
|
| 204 |
*/
|
| 205 |
extern ROMCONST apalControlGpio_t moduleGpioSysUartUp;
|
| 206 |
|
| 207 |
/**
|
| 208 |
* @brief SYS_PD bidirectional signal GPIO.
|
| 209 |
*/
|
| 210 |
extern ROMCONST apalControlGpio_t moduleGpioSysPd;
|
| 211 |
|
| 212 |
/**
|
| 213 |
* @brief SYS_SYNC bidirectional signal GPIO.
|
| 214 |
*/
|
| 215 |
extern ROMCONST apalControlGpio_t moduleGpioSysSync;
|
| 216 |
|
| 217 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 218 |
|
| 219 |
/**
|
| 220 |
* @brief DW1000 reset output signal
|
| 221 |
* @note the reset pin should be drived as low by MCU to activate.
|
| 222 |
* Then, put back the reset pin as input to MCU (tri-state float on the air
|
| 223 |
* is not supported in AMiRo)
|
| 224 |
*/
|
| 225 |
extern ROMCONST apalControlGpio_t moduleGpioDw1000Reset;
|
| 226 |
|
| 227 |
/**
|
| 228 |
* @brief DW1000 wakeup signal
|
| 229 |
*/
|
| 230 |
extern ROMCONST apalControlGpio_t moduleGpioDw1000WakeUp;
|
| 231 |
|
| 232 |
/**
|
| 233 |
* @brief DW1000 interrupt IRQn input signal.
|
| 234 |
*/
|
| 235 |
extern ROMCONST apalControlGpio_t moduleGpioDw1000Irqn;
|
| 236 |
|
| 237 |
/**
|
| 238 |
* @brief DW1000 SPI chip select output signal.
|
| 239 |
*/
|
| 240 |
extern ROMCONST apalControlGpio_t moduleGpioSpiChipSelect ;
|
| 241 |
|
| 242 |
#else
|
| 243 |
/**
|
| 244 |
* @brief IO_2 breakout signal GPIO.
|
| 245 |
*/
|
| 246 |
extern apalControlGpio_t moduleGpioBreakoutIo2;
|
| 247 |
|
| 248 |
/**
|
| 249 |
* @brief IO_7 breakout signal GPIO.
|
| 250 |
*/
|
| 251 |
extern apalControlGpio_t moduleGpioBreakoutIo7;
|
| 252 |
|
| 253 |
/**
|
| 254 |
* @brief IO_8 breakout signal GPIO.
|
| 255 |
*/
|
| 256 |
extern apalControlGpio_t moduleGpioBreakoutIo8;
|
| 257 |
|
| 258 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 259 |
|
| 260 |
/** @} */
|
| 261 |
|
| 262 |
/*===========================================================================*/
|
| 263 |
/**
|
| 264 |
* @name AMiRo-OS core configurations
|
| 265 |
* @{
|
| 266 |
*/
|
| 267 |
/*===========================================================================*/
|
| 268 |
|
| 269 |
/**
|
| 270 |
* @brief Event flag to be set on a IO_4 (breakout) interrupt.
|
| 271 |
*/
|
| 272 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO4 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_4))
|
| 273 |
|
| 274 |
/**
|
| 275 |
* @brief Event flag to be set on a IO_1 (breakout) interrupt.
|
| 276 |
*/
|
| 277 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO1 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_1))
|
| 278 |
|
| 279 |
/**
|
| 280 |
* @brief Event flag to be set on a SYS_SYNC interrupt.
|
| 281 |
*/
|
| 282 |
#define MODULE_OS_IOEVENTFLAGS_SYSSYNC AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
| 283 |
|
| 284 |
/**
|
| 285 |
* @brief Event flag to be set on a IO_3 (breakout) interrupt.
|
| 286 |
*/
|
| 287 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO3 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_3))
|
| 288 |
|
| 289 |
/**
|
| 290 |
* @brief Event flag to be set on a IO_5 (breakout) interrupt.
|
| 291 |
*/
|
| 292 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO5 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_5))
|
| 293 |
|
| 294 |
/**
|
| 295 |
* @brief Event flag to be set on a IO_6 (breakout) interrupt.
|
| 296 |
*/
|
| 297 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO6 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_6))
|
| 298 |
|
| 299 |
/**
|
| 300 |
* @brief Event flag to be set on a SYS_UART_DN interrupt.
|
| 301 |
*/
|
| 302 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
| 303 |
|
| 304 |
/**
|
| 305 |
* @brief Event flag to be set on a SYS_UART_UP interrupt.
|
| 306 |
*/
|
| 307 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
| 308 |
|
| 309 |
/**
|
| 310 |
* @brief Event flag to be set on a IO_7 (breakout) interrupt.
|
| 311 |
*/
|
| 312 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO7 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_7))
|
| 313 |
|
| 314 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 315 |
/**
|
| 316 |
* @brief Event flag to be call dwt_isr() interrupt.
|
| 317 |
*/
|
| 318 |
#define MODULE_OS_IOEVENTFLAGS_DW1000 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
|
| 319 |
#else
|
| 320 |
/**
|
| 321 |
* @brief Event flag to be set on a IO_8 (breakout) interrupt.
|
| 322 |
*/
|
| 323 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
|
| 324 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 325 |
|
| 326 |
/**
|
| 327 |
* @brief Event flag to be set on a SYS_PD interrupt.
|
| 328 |
*/
|
| 329 |
#define MODULE_OS_IOEVENTFLAGS_SYSPD AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
| 330 |
|
| 331 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
| 332 |
/**
|
| 333 |
* @brief Shell prompt text.
|
| 334 |
*/
|
| 335 |
extern ROMCONST char* moduleShellPrompt; |
| 336 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
| 337 |
|
| 338 |
/**
|
| 339 |
* @brief Interrupt initialization macro.
|
| 340 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'.
|
| 341 |
*/
|
| 342 |
#define MODULE_INIT_INTERRUPTS() { \
|
| 343 |
/* breakout interrupts must be enabled explicitely */ \
|
| 344 |
MODULE_INIT_INTERRUPTS_DW1000(); \ |
| 345 |
} |
| 346 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 347 |
#define MODULE_INIT_INTERRUPTS_DW1000() { \
|
| 348 |
palSetLineCallback(moduleGpioDw1000Irqn.gpio->line, aosSysGetStdIntCallback(), &moduleGpioDw1000Irqn.gpio->line); \ |
| 349 |
palEnableLineEvent(moduleGpioDw1000Irqn.gpio->line, APAL2CH_EDGE(moduleGpioDw1000Irqn.meta.edge)); \ |
| 350 |
} |
| 351 |
#else /* defined(AMIROLLD_CFG_DW1000) */ |
| 352 |
#define MODULE_INIT_INTERRUPTS_DW1000() { \
|
| 353 |
} |
| 354 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 355 |
|
| 356 |
/**
|
| 357 |
* @brief Unit test initialization hook.
|
| 358 |
*/
|
| 359 |
#define MODULE_INIT_TESTS() { \
|
| 360 |
/* add unit-test shell commands */ \
|
| 361 |
aosShellAddCommand(&aos.shell, &moduleUtAlldAt24c01b.shellcmd); \ |
| 362 |
aosShellAddCommand(&aos.shell, &moduleUtAlldIna219.shellcmd); \ |
| 363 |
aosShellAddCommand(&aos.shell, &moduleUtAlldLed.shellcmd); \ |
| 364 |
aosShellAddCommand(&aos.shell, &moduleUtAlldMic9404x.shellcmd); \ |
| 365 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTlc5947.shellcmd); \ |
| 366 |
MODULE_INIT_TESTS_DW1000(); \ |
| 367 |
} |
| 368 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 369 |
#define MODULE_INIT_TESTS_DW1000() { \
|
| 370 |
aosShellAddCommand(&aos.shell, &moduleUtAlldDw1000.shellcmd); \ |
| 371 |
} |
| 372 |
#else /* defined(AMIROLLD_CFG_DW1000) */ |
| 373 |
#define MODULE_INIT_TESTS_DW1000() { \
|
| 374 |
} |
| 375 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 376 |
|
| 377 |
/**
|
| 378 |
* @brief Periphery communication interfaces initialization hook.
|
| 379 |
*/
|
| 380 |
#define MODULE_INIT_PERIPHERY_COMM() { \
|
| 381 |
/* serial driver */ \
|
| 382 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
| 383 |
/* I2C */ \
|
| 384 |
moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed = (AT24C01B_LLD_I2C_MAXFREQUENCY < moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed) ? AT24C01B_LLD_I2C_MAXFREQUENCY : moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed; \ |
| 385 |
moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed; \ |
| 386 |
moduleHalI2cEepromPwrmtrBreakoutConfig.duty_cycle = (moduleHalI2cEepromPwrmtrBreakoutConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \
|
| 387 |
i2cStart(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT, &moduleHalI2cEepromPwrmtrBreakoutConfig); \ |
| 388 |
/* SPI */ \
|
| 389 |
spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig); \ |
| 390 |
MODULE_INIT_PERIPHERY_COMM_DW1000(); \ |
| 391 |
} |
| 392 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 393 |
#define MODULE_INIT_PERIPHERY_COMM_DW1000() { \
|
| 394 |
spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig); \ |
| 395 |
} |
| 396 |
#else /* defined(AMIROLLD_CFG_DW1000) */ |
| 397 |
#define MODULE_INIT_PERIPHERY_COMM_DW1000() { \
|
| 398 |
} |
| 399 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 400 |
|
| 401 |
/**
|
| 402 |
* @brief Periphery communication interface deinitialization hook.
|
| 403 |
*/
|
| 404 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
| 405 |
/* SPI */ \
|
| 406 |
spiStop(&MODULE_HAL_SPI_LIGHT); \ |
| 407 |
/* I2C */ \
|
| 408 |
i2cStop(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT); \ |
| 409 |
MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000(); \ |
| 410 |
/* don't stop the serial driver so messages can still be printed */ \
|
| 411 |
} |
| 412 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 413 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000() { \
|
| 414 |
/* SPI */ \
|
| 415 |
spiStop(&MODULE_HAL_SPI_UWB); \ |
| 416 |
} |
| 417 |
#else /* defined(AMIROLLD_CFG_DW1000) */ |
| 418 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000() { \
|
| 419 |
} |
| 420 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 421 |
|
| 422 |
/**
|
| 423 |
* @brief HOOK to call process_deca_irq() func when the dw1000 interrupt pin is activated.
|
| 424 |
*/
|
| 425 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
| 426 |
MODULE_MAIN_LOOP_IO_EVENT_DW1000(); \ |
| 427 |
} |
| 428 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 429 |
#define MODULE_MAIN_LOOP_IO_EVENT_DW1000() { \
|
| 430 |
if(eventflags & MODULE_OS_IOEVENTFLAGS_DW1000) { \
|
| 431 |
process_deca_irq(); \ |
| 432 |
} \ |
| 433 |
} |
| 434 |
#else /* defined(AMIROLLD_CFG_DW1000) */ |
| 435 |
#define MODULE_MAIN_LOOP_IO_EVENT_DW1000() { \
|
| 436 |
} |
| 437 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 438 |
|
| 439 |
/** @} */
|
| 440 |
|
| 441 |
/*===========================================================================*/
|
| 442 |
/**
|
| 443 |
* @name Startup Shutdown Synchronization Protocol (SSSP)
|
| 444 |
* @{
|
| 445 |
*/
|
| 446 |
/*===========================================================================*/
|
| 447 |
|
| 448 |
/**
|
| 449 |
* @brief PD signal GPIO.
|
| 450 |
*/
|
| 451 |
#define moduleSsspGpioPd moduleGpioSysPd
|
| 452 |
|
| 453 |
/**
|
| 454 |
* @brief SYNC signal GPIO.
|
| 455 |
*/
|
| 456 |
#define moduleSsspGpioSync moduleGpioSysSync
|
| 457 |
|
| 458 |
/**
|
| 459 |
* @brief UP signal GPIO.
|
| 460 |
*/
|
| 461 |
#define moduleSsspGpioUp moduleGpioSysUartUp
|
| 462 |
|
| 463 |
/**
|
| 464 |
* @brief DN signal GPIO.
|
| 465 |
*/
|
| 466 |
#define moduleSsspGpioDn moduleGpioSysUartDn
|
| 467 |
|
| 468 |
/**
|
| 469 |
* @brief Event flags for PD signal events.
|
| 470 |
*/
|
| 471 |
#define MODULE_SSSP_EVENTFLAGS_PD MODULE_OS_IOEVENTFLAGS_SYSPD
|
| 472 |
|
| 473 |
/**
|
| 474 |
* @brief Event flags for SYNC signal events.
|
| 475 |
*/
|
| 476 |
#define MODULE_SSSP_EVENTFLAGS_SYNC MODULE_OS_IOEVENTFLAGS_SYSSYNC
|
| 477 |
|
| 478 |
/**
|
| 479 |
* @brief Event flags for UP signal events.
|
| 480 |
*/
|
| 481 |
#define MODULE_SSSP_EVENTFLAGS_UP MODULE_OS_IOEVENTFLAGS_SYSUARTUP
|
| 482 |
|
| 483 |
/**
|
| 484 |
* @brief Event flags for DN signal events.
|
| 485 |
*/
|
| 486 |
#define MODULE_SSSP_EVENTFLAGS_DN MODULE_OS_IOEVENTFLAGS_SYSUARTDN
|
| 487 |
|
| 488 |
/** @} */
|
| 489 |
|
| 490 |
/*===========================================================================*/
|
| 491 |
/**
|
| 492 |
* @name Low-level drivers
|
| 493 |
* @{
|
| 494 |
*/
|
| 495 |
/*===========================================================================*/
|
| 496 |
#include <alld_AT24C01B.h> |
| 497 |
#include <alld_INA219.h> |
| 498 |
#include <alld_LED.h> |
| 499 |
#include <alld_MIC9404x.h> |
| 500 |
//#include <alld_SNx5C3221E.h>
|
| 501 |
#include <alld_TLC5947.h> |
| 502 |
|
| 503 |
#if defined(AMIROLLD_CFG_DW1000)
|
| 504 |
#include <alld_DW1000.h> |
| 505 |
|
| 506 |
extern DW1000Driver moduleLldDw1000;
|
| 507 |
|
| 508 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
| 509 |
|
| 510 |
/**
|
| 511 |
* @brief EEPROM driver.
|
| 512 |
*/
|
| 513 |
extern AT24C01BDriver moduleLldEeprom;
|
| 514 |
|
| 515 |
/**
|
| 516 |
* @brief Power monitor (VLED 4.2) driver.
|
| 517 |
*/
|
| 518 |
extern INA219Driver moduleLldPowerMonitorVled;
|
| 519 |
|
| 520 |
/**
|
| 521 |
* @brief Status LED driver.
|
| 522 |
*/
|
| 523 |
extern LEDDriver moduleLldStatusLed;
|
| 524 |
|
| 525 |
/**
|
| 526 |
* @brief Power switch driver (1.8V).
|
| 527 |
*/
|
| 528 |
extern MIC9404xDriver moduleLldPowerSwitchV18;
|
| 529 |
|
| 530 |
/**
|
| 531 |
* @brief Power switch driver (3.3V).
|
| 532 |
*/
|
| 533 |
extern MIC9404xDriver moduleLldPowerSwitchV33;
|
| 534 |
|
| 535 |
/**
|
| 536 |
* @brief Power switch driver (4.2V).
|
| 537 |
*/
|
| 538 |
extern MIC9404xDriver moduleLldPowerSwitchV42;
|
| 539 |
|
| 540 |
/**
|
| 541 |
* @brief Power switch driver (5.0V).
|
| 542 |
*/
|
| 543 |
extern MIC9404xDriver moduleLldPowerSwitchV50;
|
| 544 |
|
| 545 |
/**
|
| 546 |
* @brief Pseudo power switch driver (VSYS).
|
| 547 |
* @details There is no actual MIC9040x device, but the swicthable circuit behaves analogous.
|
| 548 |
*/
|
| 549 |
extern MIC9404xDriver moduleLldPowerSwitchVsys;
|
| 550 |
|
| 551 |
/**
|
| 552 |
* @brief LED PWM driver.
|
| 553 |
*/
|
| 554 |
extern TLC5947Driver moduleLldLedPwm;
|
| 555 |
|
| 556 |
/** @} */
|
| 557 |
|
| 558 |
/*===========================================================================*/
|
| 559 |
/**
|
| 560 |
* @name Unit tests (UT)
|
| 561 |
* @{
|
| 562 |
*/
|
| 563 |
/*===========================================================================*/
|
| 564 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
| 565 |
#include <ut_alld_AT24C01B_v1.h> |
| 566 |
#include <ut_alld_INA219_v1.h> |
| 567 |
#include <ut_alld_LED_v1.h> |
| 568 |
#include <ut_alld_MIC9404x_v1.h> |
| 569 |
//#include <ut_alld_SNx5C3221E_v1.h>
|
| 570 |
#include <ut_alld_TLC5947_v1.h> |
| 571 |
|
| 572 |
#if defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1) |
| 573 |
#include <ut_alld_DW1000_v1.h> |
| 574 |
|
| 575 |
/**
|
| 576 |
* @brief DW1000 unit test object.
|
| 577 |
*/
|
| 578 |
extern aos_unittest_t moduleUtAlldDw1000;
|
| 579 |
|
| 580 |
#endif /* defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1) */ |
| 581 |
|
| 582 |
/**
|
| 583 |
* @brief EEPROM unit test object.
|
| 584 |
*/
|
| 585 |
extern aos_unittest_t moduleUtAlldAt24c01b;
|
| 586 |
|
| 587 |
/**
|
| 588 |
* @brief INA219 (power monitor) unit test object.
|
| 589 |
*/
|
| 590 |
extern aos_unittest_t moduleUtAlldIna219;
|
| 591 |
|
| 592 |
/**
|
| 593 |
* @brief Status LED unit test object.
|
| 594 |
*/
|
| 595 |
extern aos_unittest_t moduleUtAlldLed;
|
| 596 |
|
| 597 |
/**
|
| 598 |
* @brief Power switch unit test object.
|
| 599 |
*/
|
| 600 |
extern aos_unittest_t moduleUtAlldMic9404x;
|
| 601 |
|
| 602 |
/**
|
| 603 |
* @brief LED PWM driver unit test object.
|
| 604 |
*/
|
| 605 |
extern aos_unittest_t moduleUtAlldTlc5947;
|
| 606 |
|
| 607 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
| 608 |
|
| 609 |
/** @} */
|
| 610 |
|
| 611 |
#endif /* AMIROOS_MODULE_H */ |
| 612 |
|
| 613 |
/** @} */
|