Revision 02c29a8f

View differences:

modules/LightRing_1-0/alldconf.h
17 17
*/
18 18

  
19 19
/**
20
 * @file    
20
 * @file
21 21
 * @brief   AMiRo-LLD Configuration file for the LightRing v1.0 module.
22 22
 * @details Contains the application specific AMiRo-LLD settings.
23 23
 *
......
58 58
 */
59 59
#define AMIROLLD_CFG_USE_TPS2051BDBV
60 60

  
61
/**
62
 * @brief   Enable flag for the DW1000.
63
 */
64
#define AMIROLLD_CFG_USE_DW1000
65

  
66 61
#endif /* _ALLDCONF_H_ */
67 62

  
68 63
/** @} */
modules/LightRing_1-0/halconf.h
17 17
*/
18 18

  
19 19
/**
20
 * @file    
20
 * @file
21 21
 * @brief   HAL configuration header for the LightRing v1.0 module.
22 22
 * @details HAL configuration file, this file allows to enable or disable the
23 23
 *          various device drivers from your application. You may also use
modules/LightRing_1-0/module.c
27 27
 */
28 28
/*===========================================================================*/
29 29

  
30

  
31 30
/** @} */
32 31

  
33 32
/*===========================================================================*/
......
64 63
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,
65 64
};
66 65

  
67
SPIConfig moduleHalSpiUWBConfig = {
66
SPIConfig moduleHalSpiWlConfig = {
68 67
  /* circular buffer mode        */ false,
69 68
  /* callback function pointer   */ NULL,
70 69
  /* chip select line port       */ GPIOB,
71 70
  /* chip select line pad number */ GPIOB_WL_SS_N,
72
  /* CR1                         */ SPI_CR1_BR_0 | SPI_CR1_BR_1,
71
  /* CR1                         */ SPI_CR1_BR_0,
73 72
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,
74 73
};
75 74

  
......
144 143
  },
145 144
};
146 145

  
147
//INFO WL_GDO2,WL_GDO0 /  -> UWB EXTI config.
148

  
149 146
/**
150 147
 * @brief   WL_GDO2 input signal GPIO.
151 148
 */
......
273 270
  /* laser overcurrent GPIO */ &moduleGpioLaserOc,
274 271
};
275 272

  
276

  
277
DW1000Driver moduleLldDW1000 = {
278
  /* SPI driver */ &MODULE_HAL_SPI_UWB,
279
  /* EXTI GPIO  */ &_gpioWlGdo2,
280
  /* RESET GPIO */ &_gpioWlGdo2,
281

  
282
};
283

  
284 273
/** @} */
285 274

  
286 275
/*===========================================================================*/
......
355 344
  /* data           */ &moduleLldPowerSwitchLaser,
356 345
};
357 346

  
358
/* UWB Module */
359
static int _utShellCmdCb_Dw1000(BaseSequentialStream* stream, int argc, char* argv[])
360
{
361
  (void)argc;
362
  (void)argv;
363
  aosUtRun(stream,&moduleUtAlldDw1000, NULL);
364
  return AOS_OK;
365
}
366
aos_unittest_t moduleUtAlldDw1000 = {
367
  /* info           */ "DW1000",
368
  /* name           */ "UWB Module",
369
  /* test function  */ utAlldDw1000Func,
370
  /* shell command  */ {
371
    /* name     */ "unittest:UWB",
372
    /* callback */ _utShellCmdCb_Dw1000,
373
    /* next     */ NULL,
374
  },
375
  /* data           */ &moduleLldDW1000,
376
};
377

  
378 347
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
379 348

  
380 349
/** @} */
modules/LightRing_1-0/module.h
26 26
 */
27 27
/*===========================================================================*/
28 28

  
29
static void _alld_dw1000_callback(void* args);
30

  
31 29
/** @} */
32 30

  
33 31
/*===========================================================================*/
......
74 72
#define MODULE_HAL_SPI_LIGHT                    SPID1
75 73

  
76 74
/**
77
 * @brief   SPI interface driver for UWB Module.
75
 * @brief   SPI interface driver for the wireless transceiver.
78 76
 */
79
#define MODULE_HAL_SPI_UWB                      SPID2
77
#define MODULE_HAL_SPI_WL                       SPID2
80 78

  
81 79
/**
82 80
 * @brief   Configuration for the SPI interface driver to communicate with the LED driver.
......
84 82
extern SPIConfig moduleHalSpiLightConfig;
85 83

  
86 84
/**
87
 * @brief   Configuration for the SPI interface driver to communicate with the LED driver.
85
 * @brief   Configuration for the SPI interface driver to communicate with the wireless transceiver.
88 86
 */
89
extern SPIConfig moduleHalSpiUWBConfig;
87
extern SPIConfig moduleHalSpiWlConfig;
90 88

  
91 89
/**
92 90
 * @brief   Real-Time Clock driver.
......
194 192
extern const char* moduleShellPrompt;
195 193
#endif
196 194

  
197

  
198

  
199

  
200 195
/**
201 196
 * @brief   Interrupt initialization macro.
202 197
 * @note    SSSP related interrupt signals are already initialized in 'aos_system.c'.
......
206 201
  palSetPadCallback(moduleGpioLaserOc.gpio->port, moduleGpioLaserOc.gpio->pad, _intCallback, &moduleGpioLaserOc.gpio->pad); \
207 202
  palEnablePadEvent(moduleGpioLaserOc.gpio->port, moduleGpioLaserOc.gpio->pad, APAL2CH_EDGE(moduleGpioLaserOc.meta.edge));  \
208 203
  /* WL_GDO2 */                                                               \
209
  palSetPadCallback(moduleGpioWlGdo2.gpio->port, moduleGpioWlGdo2.gpio->pad, _alld_dw1000_callback, &moduleGpioWlGdo2.gpio->pad);  \
204
  palSetPadCallback(moduleGpioWlGdo2.gpio->port, moduleGpioWlGdo2.gpio->pad, _intCallback, &moduleGpioWlGdo2.gpio->pad);  \
210 205
  palEnablePadEvent(moduleGpioWlGdo2.gpio->port, moduleGpioWlGdo2.gpio->pad, APAL2CH_EDGE(moduleGpioWlGdo2.meta.edge));   \
211 206
  /* WL_GDO0 */                                                               \
212
  palSetPadCallback(moduleGpioWlGdo0.gpio->port, moduleGpioWlGdo0.gpio->pad, _alld_dw1000_callback, &moduleGpioWlGdo0.gpio->pad);  \
207
  palSetPadCallback(moduleGpioWlGdo0.gpio->port, moduleGpioWlGdo0.gpio->pad, _intCallback, &moduleGpioWlGdo0.gpio->pad);  \
213 208
  /*palEnablePadEvent(moduleGpioWlGdo0.gpio->port, moduleGpioWlGdo0.gpio->pad, APAL2CH_EDGE(moduleGpioWlGdo0.meta.edge)); // this is broken for some reason*/   \
214 209
}
215 210

  
......
221 216
  aosShellAddCommand(&aos.shell, &moduleUtAlldAt24c01bn.shellcmd);            \
222 217
  aosShellAddCommand(&aos.shell, &moduleUtAlldTlc5947.shellcmd);              \
223 218
  aosShellAddCommand(&aos.shell, &moduleUtAlldTps2051bdbv.shellcmd);          \
224
  aosShellAddCommand(&aos.shell, &moduleUtAlldDw1000.shellcmd);                \
225 219
}
226 220

  
227 221
/**
......
236 230
  i2cStart(&MODULE_HAL_I2C_EEPROM, &moduleHalI2cEepromConfig);                \
237 231
  /* SPI */                                                                   \
238 232
  spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig);                  \
239
  spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUWBConfig);                      \
233
  spiStart(&MODULE_HAL_SPI_WL, &moduleHalSpiWlConfig);                        \
240 234
}
241 235

  
242 236
/**
......
245 239
#define MODULE_SHUTDOWN_PERIPHERY_COMM() {                                    \
246 240
  /* SPI */                                                                   \
247 241
  spiStop(&MODULE_HAL_SPI_LIGHT);                                             \
248
  spiStop(&MODULE_HAL_SPI_UWB);                                               \
242
  spiStop(&MODULE_HAL_SPI_WL);                                                \
249 243
  /* I2C */                                                                   \
250 244
  i2cStop(&MODULE_HAL_I2C_EEPROM);                                            \
251 245
  /* don't stop the serial driver so messages can still be printed */         \
......
301 295
#include <alld_at24c01bn-sh-b.h>
302 296
#include <alld_tlc5947.h>
303 297
#include <alld_tps2051bdbv.h>
304
#include <alld_dw1000.h>
305 298

  
306 299
/**
307 300
 * @brief   EEPROM driver.
......
318 311
 */
319 312
extern TPS2051BDriver moduleLldPowerSwitchLaser;
320 313

  
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

  
358 314
/** @} */
359 315

  
360 316
/*===========================================================================*/
......
384 340
 */
385 341
extern aos_unittest_t moduleUtAlldTps2051bdbv;
386 342

  
387
/**
388
 * @brief   DW1000 unit test object.
389
 */
390
extern aos_unittest_t moduleUtAlldDw1000;
391

  
392 343

  
393 344
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
394 345

  

Also available in: Unified diff