Revision e05848a6 modules/LightRing_1-0/module.h
| modules/LightRing_1-0/module.h | ||
|---|---|---|
| 16 | 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 |
/** |
|
| 20 |
* @file |
|
| 21 |
* @brief Structures and constant for the LightRing module. |
|
| 22 |
* |
|
| 23 |
* @addtogroup lightring_module |
|
| 24 |
* @{
|
|
| 25 |
*/ |
|
| 26 |
|
|
| 27 | 19 |
#ifndef _AMIROOS_MODULE_H_ |
| 28 | 20 |
#define _AMIROOS_MODULE_H_ |
| 29 | 21 |
|
| ... | ... | |
| 34 | 26 |
*/ |
| 35 | 27 |
/*===========================================================================*/ |
| 36 | 28 |
|
| 29 |
static void _alld_dw1000_callback(void* args); |
|
| 30 |
|
|
| 37 | 31 |
/** @} */ |
| 38 | 32 |
|
| 39 | 33 |
/*===========================================================================*/ |
| ... | ... | |
| 80 | 74 |
#define MODULE_HAL_SPI_LIGHT SPID1 |
| 81 | 75 |
|
| 82 | 76 |
/** |
| 83 |
* @brief Configuration for the SPI interface driver to communicate with the LED driver.
|
|
| 77 |
* @brief SPI interface driver for UWB Module.
|
|
| 84 | 78 |
*/ |
| 85 |
extern SPIConfig moduleHalSpiLightConfig;
|
|
| 79 |
#define MODULE_HAL_SPI_UWB SPID2
|
|
| 86 | 80 |
|
| 87 | 81 |
/** |
| 88 |
* @brief SPI interface driver for the wireless transceiver.
|
|
| 82 |
* @brief Configuration for the SPI interface driver to communicate with the LED driver.
|
|
| 89 | 83 |
*/ |
| 90 |
#define MODULE_HAL_SPI_WL SPID2
|
|
| 84 |
extern SPIConfig moduleHalSpiLightConfig;
|
|
| 91 | 85 |
|
| 92 | 86 |
/** |
| 93 |
* @brief Configuration for the SPI interface driver to communicate with the wireless transceiver.
|
|
| 87 |
* @brief Configuration for the SPI interface driver to communicate with the LED driver.
|
|
| 94 | 88 |
*/ |
| 95 |
extern SPIConfig moduleHalSpiWlConfig;
|
|
| 89 |
extern SPIConfig moduleHalSpiUWBConfig;
|
|
| 96 | 90 |
|
| 97 | 91 |
/** |
| 98 | 92 |
* @brief Real-Time Clock driver. |
| ... | ... | |
| 200 | 194 |
extern const char* moduleShellPrompt; |
| 201 | 195 |
#endif |
| 202 | 196 |
|
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
| 203 | 200 |
/** |
| 204 | 201 |
* @brief Interrupt initialization macro. |
| 205 | 202 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'. |
| ... | ... | |
| 209 | 206 |
palSetPadCallback(moduleGpioLaserOc.gpio->port, moduleGpioLaserOc.gpio->pad, _intCallback, &moduleGpioLaserOc.gpio->pad); \ |
| 210 | 207 |
palEnablePadEvent(moduleGpioLaserOc.gpio->port, moduleGpioLaserOc.gpio->pad, APAL2CH_EDGE(moduleGpioLaserOc.meta.edge)); \ |
| 211 | 208 |
/* WL_GDO2 */ \ |
| 212 |
palSetPadCallback(moduleGpioWlGdo2.gpio->port, moduleGpioWlGdo2.gpio->pad, _intCallback, &moduleGpioWlGdo2.gpio->pad); \
|
|
| 209 |
palSetPadCallback(moduleGpioWlGdo2.gpio->port, moduleGpioWlGdo2.gpio->pad, _alld_dw1000_callback, &moduleGpioWlGdo2.gpio->pad); \
|
|
| 213 | 210 |
palEnablePadEvent(moduleGpioWlGdo2.gpio->port, moduleGpioWlGdo2.gpio->pad, APAL2CH_EDGE(moduleGpioWlGdo2.meta.edge)); \ |
| 214 | 211 |
/* WL_GDO0 */ \ |
| 215 |
palSetPadCallback(moduleGpioWlGdo0.gpio->port, moduleGpioWlGdo0.gpio->pad, _intCallback, &moduleGpioWlGdo0.gpio->pad); \
|
|
| 212 |
palSetPadCallback(moduleGpioWlGdo0.gpio->port, moduleGpioWlGdo0.gpio->pad, _alld_dw1000_callback, &moduleGpioWlGdo0.gpio->pad); \
|
|
| 216 | 213 |
/*palEnablePadEvent(moduleGpioWlGdo0.gpio->port, moduleGpioWlGdo0.gpio->pad, APAL2CH_EDGE(moduleGpioWlGdo0.meta.edge)); // this is broken for some reason*/ \ |
| 217 | 214 |
} |
| 218 | 215 |
|
| ... | ... | |
| 224 | 221 |
aosShellAddCommand(&aos.shell, &moduleUtAlldAt24c01bn.shellcmd); \ |
| 225 | 222 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTlc5947.shellcmd); \ |
| 226 | 223 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTps2051bdbv.shellcmd); \ |
| 224 |
aosShellAddCommand(&aos.shell, &moduleUtAlldDw1000.shellcmd); \ |
|
| 227 | 225 |
} |
| 228 | 226 |
|
| 229 | 227 |
/** |
| ... | ... | |
| 238 | 236 |
i2cStart(&MODULE_HAL_I2C_EEPROM, &moduleHalI2cEepromConfig); \ |
| 239 | 237 |
/* SPI */ \ |
| 240 | 238 |
spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig); \ |
| 241 |
spiStart(&MODULE_HAL_SPI_WL, &moduleHalSpiWlConfig); \
|
|
| 239 |
spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUWBConfig); \
|
|
| 242 | 240 |
} |
| 243 | 241 |
|
| 244 | 242 |
/** |
| ... | ... | |
| 247 | 245 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
| 248 | 246 |
/* SPI */ \ |
| 249 | 247 |
spiStop(&MODULE_HAL_SPI_LIGHT); \ |
| 250 |
spiStop(&MODULE_HAL_SPI_WL); \
|
|
| 248 |
spiStop(&MODULE_HAL_SPI_UWB); \
|
|
| 251 | 249 |
/* I2C */ \ |
| 252 | 250 |
i2cStop(&MODULE_HAL_I2C_EEPROM); \ |
| 253 | 251 |
/* don't stop the serial driver so messages can still be printed */ \ |
| ... | ... | |
| 303 | 301 |
#include <alld_at24c01bn-sh-b.h> |
| 304 | 302 |
#include <alld_tlc5947.h> |
| 305 | 303 |
#include <alld_tps2051bdbv.h> |
| 304 |
#include <alld_dw1000.h> |
|
| 306 | 305 |
|
| 307 | 306 |
/** |
| 308 | 307 |
* @brief EEPROM driver. |
| ... | ... | |
| 319 | 318 |
*/ |
| 320 | 319 |
extern TPS2051BDriver moduleLldPowerSwitchLaser; |
| 321 | 320 |
|
| 321 |
/** |
|
| 322 |
* @brief DW1000 driver for UWB. |
|
| 323 |
*/ |
|
| 324 |
extern DW1000Driver moduleLldDW1000; |
|
| 325 |
|
|
| 326 |
|
|
| 327 |
|
|
| 328 |
|
|
| 329 |
/*! ------------------------------------------------------------------------------------------------------------------ |
|
| 330 |
* Function: _alld_dw1000_callback() |
|
| 331 |
* |
|
| 332 |
* Low level abstract function to handle 'reset' adn 'irq' interrupt from DW1000 |
|
| 333 |
* Expects arg to be of iopadid_t* type, used to distinguish between irq or reset signal |
|
| 334 |
*/ |
|
| 335 |
static void _alld_dw1000_callback(void* args) {
|
|
| 336 |
|
|
| 337 |
aosDbgCheck(true); |
|
| 338 |
|
|
| 339 |
|
|
| 340 |
chSysLockFromISR(); |
|
| 341 |
if ((*(iopadid_t*) args) == moduleLldDW1000.gpio_reset->pad) |
|
| 342 |
{
|
|
| 343 |
// dw1000 external indicate reset done |
|
| 344 |
} |
|
| 345 |
else if ((*(iopadid_t*) args) == moduleLldDW1000.gpio_exti->pad) |
|
| 346 |
{
|
|
| 347 |
dwt_isr(); |
|
| 348 |
} |
|
| 349 |
else |
|
| 350 |
{
|
|
| 351 |
return; |
|
| 352 |
} |
|
| 353 |
chSysUnlockFromISR(); |
|
| 354 |
|
|
| 355 |
} |
|
| 356 |
|
|
| 357 |
|
|
| 322 | 358 |
/** @} */ |
| 323 | 359 |
|
| 324 | 360 |
/*===========================================================================*/ |
| ... | ... | |
| 331 | 367 |
#include <ut_alld_at24c01bn-sh-b.h> |
| 332 | 368 |
#include <ut_alld_tlc5947.h> |
| 333 | 369 |
#include <ut_alld_tps2051bdbv.h> |
| 370 |
#include <ut_alld_dw1000.h> |
|
| 334 | 371 |
|
| 335 | 372 |
/** |
| 336 | 373 |
* @brief EEPROM unit test object. |
| ... | ... | |
| 347 | 384 |
*/ |
| 348 | 385 |
extern aos_unittest_t moduleUtAlldTps2051bdbv; |
| 349 | 386 |
|
| 387 |
/** |
|
| 388 |
* @brief DW1000 unit test object. |
|
| 389 |
*/ |
|
| 390 |
extern aos_unittest_t moduleUtAlldDw1000; |
|
| 391 |
|
|
| 392 |
|
|
| 350 | 393 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
| 351 | 394 |
|
| 352 | 395 |
/** @} */ |
| 353 | 396 |
|
| 354 | 397 |
#endif /* _AMIROOS_MODULE_H_ */ |
| 355 |
|
|
| 356 |
/** @} */ |
|
Also available in: Unified diff