Revision 0b989911

View differences:

modules/LightRing_1-2/Makefile
145 145
                            $(AMIROLLD)/drivers/INA219/v1 \
146 146
                            $(AMIROLLD)/drivers/LED/v1 \
147 147
                            $(AMIROLLD)/drivers/MIC9404x/v1 \
148
                            $(AMIROLLD)/drivers/TLC5947/v1
148
                            $(AMIROLLD)/drivers/TLC5947/v1 \
149
			    $(AMIROLLD)/drivers/DW1000/v1
149 150

  
150 151
# Tests.
151 152
AMIROOS_TEST_INC += $(AMIROOS_TEST_DIR)periphery-lld/AT24C01B_v1 \
152 153
                    $(AMIROOS_TEST_DIR)periphery-lld/INA219_v1 \
153 154
                    $(AMIROOS_TEST_DIR)periphery-lld/LED_v1 \
154 155
                    $(AMIROOS_TEST_DIR)periphery-lld/MIC9404x_v1 \
155
                    $(AMIROOS_TEST_DIR)periphery-lld/TLC5947_v1
156
                    $(AMIROOS_TEST_DIR)periphery-lld/TLC5947_v1 \
157
		    $(AMIROOS_TEST_DIR)periphery-lld/DW1000_v1
156 158

  
157 159
# Module specific inclusion directories
158 160
MODULE_INC = $(MODULEDIR) \
modules/LightRing_1-2/aosconf.h
84 84
 * @note    Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration.
85 85
 */
86 86
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
87
  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK    0
87
//  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK    0
88
  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK      MODULE_OS_IOEVENTFLAGS_DW1000
88 89
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
89 90
  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK    OS_CFG_MAIN_LOOP_IOEVENT_MASK
90 91
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
modules/LightRing_1-2/board.h
61 61
#define STM32F103xE
62 62

  
63 63
/*
64
 * Identifiers for optional peripherals.
65
 */
66
#define BOARD_DW1000_CONNECTED      false
67
#define BOARD_MIC9404x_CONNECTED    true /* Power supply for DW1000 in Light ring */
68

  
69
/*
64 70
 * IO pins assignments.
65 71
 */
66 72
#define GPIOA_USART_CTS             0U
modules/LightRing_1-2/module.c
69 69
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,
70 70
};
71 71

  
72
#if (BOARD_DW1000_CONNECTED == true)
73

  
74
/*! SPI (high speed) configuration for DW1000 */
75
SPIConfig moduleHalSpiUwbHsConfig = {
76
  /* circular buffer mode        */ false,
77
  /* callback function pointer   */ NULL,
78
  /* chip select line port       */ PAL_PORT(LINE_SPI_SS_N),
79
  /* chip select line pad number */ PAL_PAD(LINE_SPI_SS_N),
80
  /* CR1                         */ 0,                                  // 36/2 Mbps
81
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,  // 0
82
};
83
/*! SPI (low speed) configuration for DW1000 */
84
SPIConfig moduleHalSpiUwbLsConfig = {
85
  /* circular buffer mode        */ false,
86
  /* callback function pointer   */ NULL,
87
  /* chip select line port       */ PAL_PORT(LINE_SPI_SS_N),
88
  /* chip select line pad number */ PAL_PAD(LINE_SPI_SS_N),
89
  /* CR1                         */ SPI_CR1_BR_1 | SPI_CR1_BR_0,        // 36/16 Mbps
90
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,  // 0
91
};
92

  
93
#endif /* BOARD_DW1000_CONNECTED == true */
94

  
72 95

  
73 96
/*===========================================================================*/
74 97
/**
......
213 236
  },
214 237
};
215 238

  
239
#if (BOARD_DW1000_CONNECTED == true)
216 240
/**
217
 * @brief   IO_7 breakout signal GPIO.
241
 * @brief   DW1000 interrrupt input signal GPIO.
218 242
 */
219
static apalGpio_t _gpioBreakoutIo7 = {
243
static apalGpio_t _gpioDw1000Irqn = {
244
  /* line */  LINE_IO_8,            // (GPIOB, GPIOB_IO_8),
245
};
246
ROMCONST apalControlGpio_t moduleGpioDw1000Irqn = {
247
  /* GPIO */ &_gpioDw1000Irqn,
248
  /* meta */ {
249
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
250
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
251
    /* interrupt edge */ APAL_GPIO_EDGE_RISING,
252
  },
253
};
254

  
255
/**
256
 * @brief   DW1000 reset output signal GPIO.
257
 */
258
static apalGpio_t _gpioDw1000Reset = {
220 259
  /* line */ LINE_IO_7,
221 260
};
222
apalControlGpio_t moduleGpioBreakoutIo7 = {
223
  /* GPIO */ &_gpioBreakoutIo7,
261
ROMCONST apalControlGpio_t moduleGpioDw1000Reset = {
262
  /* GPIO */ &_gpioDw1000Reset,
224 263
  /* meta */ {
225
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
264
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
226 265
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
227 266
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
228 267
  },
229 268
};
230 269

  
231 270
/**
271
 * @brief   IO_2 breakout signal GPIO.
272
 */
273
static apalGpio_t _gpioDw1000WakeUp = {
274
  /* line */ LINE_IO_2,
275
};
276
ROMCONST apalControlGpio_t moduleGpioDw1000WakeUp = {
277
  /* GPIO */ &_gpioDw1000WakeUp,
278
  /* meta */ {
279
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
280
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
281
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
282
  },
283
};
284

  
285
/**
286
 * @brief   DW1000 SPI chip select output signal GPIO.
287
 */
288
static apalGpio_t _gpioSpiChipSelect = {
289
  /* line */ LINE_SPI_SS_N,
290
};
291
ROMCONST apalControlGpio_t moduleGpioSpiChipSelect = {
292
  /* GPIO */ &_gpioSpiChipSelect,
293
  /* meta */ {
294
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
295
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
296
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
297
  },
298
};
299
#else
300
/**
232 301
 * @brief   IO_8 breakout signal GPIO.
233 302
 */
234 303
static apalGpio_t _gpioBreakoutIo8 = {
......
244 313
};
245 314

  
246 315
/**
316
 * @brief   IO_7 breakout signal GPIO.
317
 */
318
static apalGpio_t _gpioBreakoutIo7 = {
319
  /* line */ LINE_IO_7,
320
};
321
apalControlGpio_t moduleGpioBreakoutIo7 = {
322
  /* GPIO */ &_gpioBreakoutIo7,
323
  /* meta */ {
324
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
325
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
326
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
327
  },
328
};
329

  
330
/**
331
 * @brief   IO_2 breakout signal GPIO.
332
 */
333
static apalGpio_t _gpioBreakoutIo2 = {
334
  /* line */ LINE_IO_2,
335
};
336
apalControlGpio_t moduleGpioBreakoutIo2 = {
337
  /* GPIO */ &_gpioBreakoutIo2,
338
  /* meta */ {
339
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
340
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
341
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
342
  },
343
};
344
#endif  /* BOARD_DW1000_CONNECTED == true */
345

  
346

  
347
/**
247 348
 * @brief   IO_4 breakout signal GPIO.
248 349
 */
249 350
static apalGpio_t _gpioBreakoutIo4 = {
......
273 374
  },
274 375
};
275 376

  
276
/**
277
 * @brief   IO_2 breakout signal GPIO.
278
 */
279
static apalGpio_t _gpioBreakoutIo2 = {
280
  /* line */ LINE_IO_2,
281
};
282
apalControlGpio_t moduleGpioBreakoutIo2 = {
283
  /* GPIO */ &_gpioBreakoutIo2,
284
  /* meta */ {
285
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
286
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
287
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
288
  },
289
};
290 377

  
291 378
/**
292 379
 * @brief   LED output signal GPIO.
......
419 506

  
420 507
/*===========================================================================*/
421 508
/**
509
 * @name Hardware specific wrappers Functions
510
 * @{
511
 */
512
/*===========================================================================*/
513

  
514
#if (BOARD_DW1000_CONNECTED == true)
515
/*! @brief Manually reset the DW1000 module  */
516
void reset_DW1000(void){
517

  
518
  // Set the pin as output
519
  palSetLineMode(moduleGpioDw1000Reset.gpio->line, APAL_GPIO_DIRECTION_OUTPUT);
520

  
521
  //drive the RSTn pin low
522
  apalGpioWrite(moduleGpioDw1000Reset.gpio, APAL_GPIO_LOW);
523

  
524
  //put the pin back to tri-state ... as input
525
//  palSetLineMode(moduleGpioDw1000Reset.gpio->line, APAL_GPIO_DIRECTION_INPUT); // TODO:
526

  
527
  aosThdMSleep(2);
528
}
529

  
530
/*! @brief entry point to the IRQn event in DW1000 module
531
 *
532
 * */
533
void process_deca_irq(void){
534
  do{
535
    dwt_isr();
536
   //while IRS line active (ARM can only do edge sensitive interrupts)
537
  }while(port_CheckEXT_IRQ() == 1);
538
}
539

  
540
/*! @brief Check the current value of GPIO pin and return the value */
541
apalGpioState_t port_CheckEXT_IRQ(void) {
542
  apalGpioState_t  val;
543
  apalGpioRead(moduleGpioDw1000Irqn.gpio, &val);
544
  return val;
545
}
546

  
547
/*! @brief Manually set the chip select pin of the SPI */
548
void set_SPI_chip_select(void){
549
  apalGpioWrite(moduleGpioSpiChipSelect.gpio, APAL_GPIO_HIGH);
550
}
551

  
552
/*! @brief Manually reset the chip select pin of the SPI */
553
void clear_SPI_chip_select(void){
554
  apalGpioWrite(moduleGpioSpiChipSelect.gpio, APAL_GPIO_LOW);
555
}
556

  
557
/*! @brief Change the SPI speed configuration on the fly */
558
void setHighSpeed_SPI(bool speedValue, DW1000Driver* drv){
559

  
560
  spiStop(drv->spid);
561

  
562
  if (speedValue == FALSE){
563
    spiStart(drv->spid, &moduleHalSpiUwbLsConfig);  // low speed spi configuration
564
  }
565
  else{
566
    spiStart(drv->spid, &moduleHalSpiUwbHsConfig); // high speed spi configuration
567
  }
568
}
569
#endif /* (BOARD_DW1000_CONNECTED == true) */
570
/** @} */
571

  
572

  
573
/*===========================================================================*/
574
/**
422 575
 * @name Low-level drivers
423 576
 * @{
424 577
 */
......
469 622
  /* XLAT signal GPIO   */ &moduleGpioLightXlat,
470 623
};
471 624

  
625
#if (BOARD_DW1000_CONNECTED == true)
626
DW1000Driver moduleLldDw1000 = {
627
  /* SPI driver         */ &MODULE_HAL_SPI_UWB,
628
  /* ext interrupt      */ &moduleGpioDw1000Irqn,
629
  /* RESET DW1000       */ &moduleGpioDw1000Reset,
630
};
631

  
632
MIC9404xDriver moduleLldPowerSwitchDw1000 = {
633
  /* power enable GPIO  */ &moduleGpioSwVsysEn,
634
};
635
#endif /* (BOARD_DW1000_CONNECTED == true) */
636

  
472 637
/** @} */
473 638

  
474 639
/*===========================================================================*/
......
531 696
}
532 697
AOS_SHELL_COMMAND(moduleTestTlc5947ShellCmd, "test:Lights", _testTlc5947ShellCmdCb);
533 698

  
699
#if (BOARD_DW1000_CONNECTED == true) || defined(__DOXYGEN__)
700
/*
701
 * UwB Driver (DW1000)
702
 */
703
#include <module_test_DW1000.h>
704
static int _testDw1000ShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
705
{
706
  return moduleTestDw1000ShellCb(stream, argc, argv, NULL);
707
}
708
AOS_SHELL_COMMAND(moduleTestDw1000ShellCmd, "test:DW1000", _testDw1000ShellCmdCb);
709
#endif /* (BOARD_DW1000_CONNECTED == true) */
710

  
534 711
/*
535 712
 * entire module
536 713
 */
modules/LightRing_1-2/module.h
36 36
 */
37 37
/*===========================================================================*/
38 38

  
39

  
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

  
39 57
/** @} */
40 58

  
41 59
/*===========================================================================*/
......
85 103
 */
86 104
extern SPIConfig moduleHalSpiLightConfig;
87 105

  
106
#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

  
88 124
/**
89 125
 * @brief   SPI interface driver for the breakout header.
90 126
 */
91 127
#define MODULE_HAL_SPI_BREAKOUT                 SPID2
92 128

  
129
#endif /* BOARD_DW1000_CONNECTED == true*/
130

  
131

  
93 132
/**
94 133
 * @brief   UART interface driver for the breakout header (alternative to serial).
95 134
 */
......
156 195
extern ROMCONST apalControlGpio_t moduleGpioSysUartDn;
157 196

  
158 197
/**
159
 * @brief   IO_7 breakout signal GPIO.
160
 */
161
extern apalControlGpio_t moduleGpioBreakoutIo7;
162

  
163
/**
164
 * @brief   IO_8 breakout signal GPIO.
165
 */
166
extern apalControlGpio_t moduleGpioBreakoutIo8;
167

  
168
/**
169 198
 * @brief   IO_4 breakout signal GPIO.
170 199
 */
171 200
extern apalControlGpio_t moduleGpioBreakoutIo4;
......
176 205
extern apalControlGpio_t moduleGpioBreakoutIo1;
177 206

  
178 207
/**
179
 * @brief   IO_2 breakout signal GPIO.
180
 */
181
extern apalControlGpio_t moduleGpioBreakoutIo2;
182

  
183
/**
184 208
 * @brief   LED output signal GPIO.
185 209
 */
186 210
extern ROMCONST apalControlGpio_t moduleGpioLed;
......
215 239
 */
216 240
extern ROMCONST apalControlGpio_t moduleGpioSysSync;
217 241

  
242
#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

  
218 284
/** @} */
219 285

  
220 286
/*===========================================================================*/
......
275 341
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8      AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
276 342

  
277 343
/**
344
 * @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
/**
278 349
 * @brief   Event flag to be set on a SYS_PD interrupt.
279 350
 */
280 351
#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
......
292 363
 */
293 364
#define MODULE_INIT_INTERRUPTS() {                                            \
294 365
  /* breakout interrupts must be enabled explicitely */                       \
366
  MODULE_INIT_INTERRUPTS_DW1000();                                            \
295 367
}
368
#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) */
296 377

  
297 378
/**
298 379
 * @brief   Unit test initialization hook.
......
305 386
  aosShellAddCommand(&aos.shell, &moduleTestMic9404xShellCmd);                \
306 387
  aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd);                 \
307 388
  aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd);                     \
389
  MODULE_INIT_TESTS_DW1000();                                                 \
308 390
}
391
#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 */
309 399

  
310 400
/**
311 401
 * @brief   Periphery communication interfaces initialization hook.
......
320 410
  i2cStart(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT, &moduleHalI2cEepromPwrmtrBreakoutConfig);  \
321 411
  /* SPI */                                                                   \
322 412
  spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig);                  \
413
  MODULE_INIT_PERIPHERY_COMM_DW1000();                                        \
323 414
}
415
#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 */
324 423

  
325 424
/**
326 425
 * @brief   Periphery communication interface deinitialization hook.
......
330 429
  spiStop(&MODULE_HAL_SPI_LIGHT);                                             \
331 430
  /* I2C */                                                                   \
332 431
  i2cStop(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT);                            \
432
  MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000();                                    \
333 433
  /* don't stop the serial driver so messages can still be printed */         \
334 434
}
435
#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 */
335 462

  
336 463
/** @} */
337 464

  
......
396 523
#include <alld_MIC9404x.h>
397 524
// TODO: add SNx5C3221E
398 525
#include <alld_TLC5947.h>
526
#include <alld_DW1000.h>
399 527

  
400 528
/**
401 529
 * @brief   EEPROM driver.
......
445 573
 */
446 574
extern TLC5947Driver moduleLldLedPwm;
447 575

  
576
/**
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

  
448 585
/** @} */
449 586

  
450 587
/*===========================================================================*/
......
487 624
 */
488 625
extern aos_shellcommand_t moduleTestAllShellCmd;
489 626

  
627

  
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

  
490 635
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
491 636

  
492 637
/** @} */
modules/LightRing_1-2/test/DW1000/module_test_DW1000.c
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
#include <amiroos.h>
20

  
21
#if (AMIROOS_CFG_TESTS_ENABLE == true) && (BOARD_DW1000_CONNECTED == true) || defined(__DOXYGEN__)
22

  
23

  
24
#include <module_test_DW1000.h>
25
#include <aos_test_DW1000.h>
26
//#include <aos_test_MIC9404x.h>
27
#include <module_test_MIC9404x.h>
28

  
29
/******************************************************************************/
30
/* LOCAL DEFINITIONS                                                          */
31
/******************************************************************************/
32

  
33
/******************************************************************************/
34
/* EXPORTED VARIABLES                                                         */
35
/******************************************************************************/
36

  
37
/******************************************************************************/
38
/* LOCAL TYPES                                                                */
39
/******************************************************************************/
40

  
41
/******************************************************************************/
42
/* LOCAL VARIABLES                                                            */
43
/******************************************************************************/
44

  
45
static aos_test_dw1000data_t _data = {
46
  /* UWB data     */ &moduleLldDw1000,
47
  /* event source */ &aos.events.io,
48
  /* event flags  */ MODULE_OS_IOEVENTFLAGS_DW1000,
49
  /* Power supply */ &moduleLldPowerSwitchDw1000,
50
};
51

  
52
static AOS_TEST(_test, "DW1000", NULL, moduleTestDw1000ShellCb, aosTestDw1000Func, &_data);
53

  
54
/******************************************************************************/
55
/* LOCAL FUNCTIONS                                                            */
56
/******************************************************************************/
57

  
58
/******************************************************************************/
59
/* EXPORTED FUNCTIONS                                                         */
60
/******************************************************************************/
61

  
62
int moduleTestDw1000ShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
63
{
64
  (void)argc;
65
  (void)argv;
66

  
67
  /* MIC9404x (power switch) */
68
  // Enable 1.8V for DW1000 module on Light Ring
69
  _data.mic9404xd = &moduleLldPowerSwitchV18;
70
  aosTestRun(stream, &_test, "1.8V");
71
  _data.mic9404xd = NULL;
72

  
73
  // Enable 3.3V for DW1000 module on Light Ring
74
  _data.mic9404xd = &moduleLldPowerSwitchV33;
75
  aosTestRun(stream, &_test, "3.3V");
76
  _data.mic9404xd = NULL;
77

  
78

  
79
  /* DW1000 (test) */
80
  if (result != NULL) {
81
    *result = aosTestRun(stream, &_test, NULL);
82

  
83
  } else {
84
    aosTestRun(stream, &_test, NULL);
85
  }
86
  return AOS_OK;
87
}
88

  
89
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
modules/LightRing_1-2/test/DW1000/module_test_DW1000.h
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
#ifndef MODULE_TEST_DW1000_H
21
#define MODULE_TEST_DW1000_H
22

  
23
#include <amiroos.h>
24

  
25
#if (AMIROOS_CFG_TESTS_ENABLE == true) && (BOARD_DW1000_CONNECTED == true) || defined(__DOXYGEN__)
26

  
27
/******************************************************************************/
28
/* CONSTANTS                                                                  */
29
/******************************************************************************/
30

  
31
/******************************************************************************/
32
/* SETTINGS                                                                   */
33
/******************************************************************************/
34

  
35
/******************************************************************************/
36
/* CHECKS                                                                     */
37
/******************************************************************************/
38

  
39
/******************************************************************************/
40
/* DATA STRUCTURES AND TYPES                                                  */
41
/******************************************************************************/
42

  
43
/******************************************************************************/
44
/* MACROS                                                                     */
45
/******************************************************************************/
46

  
47
/******************************************************************************/
48
/* EXTERN DECLARATIONS                                                        */
49
/******************************************************************************/
50

  
51
#if defined(__cplusplus)
52
extern "C" {
53
#endif /* defined(__cplusplus) */
54
  int moduleTestDw1000ShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result);
55
#if defined(__cplusplus)
56
}
57
#endif /* defined(__cplusplus) */
58

  
59
/******************************************************************************/
60
/* INLINE FUNCTIONS                                                           */
61
/******************************************************************************/
62

  
63
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
64

  
65
#endif /* MODULE_TEST_DW1000_H */
66

  

Also available in: Unified diff