Revision f606f432

View differences:

modules/LightRing_1-2/Makefile
146 146
include $(AMIROLLD)/drivers/LED/v1/alld_LED.mk
147 147
include $(AMIROLLD)/drivers/MIC9404x/v1/alld_MIC9404x.mk
148 148
include $(AMIROLLD)/drivers/TLC5947/v1/alld_TLC5947.mk
149
include $(AMIROLLD)/drivers/DW1000/v1/alld_DW1000.mk
149
include $(AMIROLLD)/drivers/DW1000/v2/alld_DW1000.mk
150 150

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

  
159 159
# Module specific inclusion directories
160 160
MODULE_INC = $(MODULE_DIR) \
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
88
  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK      MODULE_OS_IOEVENTFLAGS_DW1000
87
  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK    0
89 88
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
90 89
  #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK    OS_CFG_MAIN_LOOP_IOEVENT_MASK
91 90
#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.
64
 * Identifiers for the several breakout modules, which can be attached to the LightRing v1.2 module.
65 65
 */
66
#define BOARD_DW1000_CONNECTED      false
67
#define BOARD_MIC9404x_CONNECTED    true /* Power supply for DW1000 in Light ring */
66
#define BOARD_BREAKOUT_NONE         0
67
#define BOARD_BREAKOUT_UWBv10       1
68

  
69
/*
70
 * Configuration macro to define which type of sensor ring is attached.
71
 */
72
#if !defined(BOARD_BREAKOUT_MODULE) || defined(__DOXYGEN__)
73
#define BOARD_BREAKOUT_MODULE       BOARD_BREAKOUT_UWBv10
74
#endif
68 75

  
69 76
/*
70 77
 * IO pins assignments.
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)
72
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
73 73

  
74
/*! SPI (high speed) configuration for DW1000 */
75 74
SPIConfig moduleHalSpiUwbHsConfig = {
76 75
  /* circular buffer mode        */ false,
77 76
  /* callback function pointer   */ NULL,
......
80 79
  /* CR1                         */ 0,                                  // 36/2 Mbps
81 80
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,  // 0
82 81
};
83
/*! SPI (low speed) configuration for DW1000 */
82

  
84 83
SPIConfig moduleHalSpiUwbLsConfig = {
85 84
  /* circular buffer mode        */ false,
86 85
  /* callback function pointer   */ NULL,
......
90 89
  /* CR2                         */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN,  // 0
91 90
};
92 91

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

  
92
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
95 93

  
96 94
/*===========================================================================*/
97 95
/**
......
177 175
};
178 176

  
179 177
/**
180
 * @brief   IO_3 breakout signal GPIO.
178
 * @brief   SYS_UART_DN bidirectional signal GPIO.
181 179
 */
182
static apalGpio_t _gpioBreakoutIo3 = {
183
  /* line */ LINE_IO_3,
180
static apalGpio_t _gpioSysUartDn = {
181
  /* line */ LINE_SYS_UART_DN,
184 182
};
185
apalControlGpio_t moduleGpioBreakoutIo3 = {
186
  /* GPIO */ &_gpioBreakoutIo3,
183
ROMCONST apalControlGpio_t moduleGpioSysUartDn = {
184
  /* GPIO */ &_gpioSysUartDn,
187 185
  /* meta */ {
188
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
186
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
189 187
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
190
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
188
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
191 189
  },
192 190
};
193 191

  
194 192
/**
195
 * @brief   IO_5 breakout signal GPIO.
193
 * @brief   LED output signal GPIO.
196 194
 */
197
static apalGpio_t _gpioBreakoutIo5 = {
198
  /* line */ LINE_IO_5,
195
static apalGpio_t _gpioLed = {
196
  /* line */ LINE_LED,
199 197
};
200
apalControlGpio_t moduleGpioBreakoutIo5 = {
201
  /* GPIO */ &_gpioBreakoutIo5,
198
ROMCONST apalControlGpio_t moduleGpioLed = {
199
  /* GPIO */ &_gpioLed,
202 200
  /* meta */ {
203
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
201
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
204 202
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
205 203
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
206 204
  },
207 205
};
208 206

  
209 207
/**
210
 * @brief   IO_6 breakout signal GPIO.
208
 * @brief   LIGHT_XLAT output signal GPIO.
211 209
 */
212
static apalGpio_t _gpioBreakoutIo6 = {
213
  /* line */ LINE_IO_6,
210
static apalGpio_t _gpioLightXlat = {
211
  /* line */ LINE_LIGHT_XLAT,
214 212
};
215
apalControlGpio_t moduleGpioBreakoutIo6 = {
216
  /* GPIO */ &_gpioBreakoutIo6,
213
ROMCONST apalControlGpio_t moduleGpioLightXlat = {
214
  /* GPIO */ &_gpioLightXlat,
217 215
  /* meta */ {
218
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
219
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
216
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
217
    /* active state   */ (TLC5947_LLD_XLAT_UPDATE_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
220 218
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
221 219
  },
222 220
};
223 221

  
224 222
/**
225
 * @brief   SYS_UART_DN bidirectional signal GPIO.
223
 * @brief   SW_V18_EN output signal GPIO.
226 224
 */
227
static apalGpio_t _gpioSysUartDn = {
228
  /* line */ LINE_SYS_UART_DN,
225
static apalGpio_t _gpioSwV18En = {
226
  /* line */ LINE_SW_V18_EN,
229 227
};
230
ROMCONST apalControlGpio_t moduleGpioSysUartDn = {
231
  /* GPIO */ &_gpioSysUartDn,
228
ROMCONST apalControlGpio_t moduleGpioSwV18En = {
229
  /* GPIO */ &_gpioSwV18En,
232 230
  /* meta */ {
233
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
234
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
235
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
231
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
232
    /* active state   */ MIC9404x_LLD_EN_ACTIVE_STATE,
233
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
236 234
  },
237 235
};
238 236

  
239
#if (BOARD_DW1000_CONNECTED == true)
240 237
/**
241
 * @brief   DW1000 interrrupt input signal GPIO.
238
 * @brief   SW_VSYS_EN output signal GPIO.
242 239
 */
243
static apalGpio_t _gpioDw1000Irqn = {
244
  /* line */  LINE_IO_8,            // (GPIOB, GPIOB_IO_8),
240
static apalGpio_t _gpioSwVsysEn = {
241
  /* line */ LINE_SW_VSYS_EN,
245 242
};
246
ROMCONST apalControlGpio_t moduleGpioDw1000Irqn = {
247
  /* GPIO */ &_gpioDw1000Irqn,
243
ROMCONST apalControlGpio_t moduleGpioSwVsysEn = {
244
  /* GPIO */ &_gpioSwVsysEn,
248 245
  /* meta */ {
249
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
250
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
251
    /* interrupt edge */ APAL_GPIO_EDGE_RISING,
246
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
247
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
248
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
252 249
  },
253 250
};
254 251

  
255 252
/**
256
 * @brief   DW1000 reset output signal GPIO.
253
 * @brief   SYS_UART_UP bidirectional signal GPIO.
257 254
 */
258
static apalGpio_t _gpioDw1000Reset = {
259
  /* line */ LINE_IO_7,
255
static apalGpio_t _gpioSysUartUp = {
256
  /* line */ LINE_SYS_UART_UP,
260 257
};
261
ROMCONST apalControlGpio_t moduleGpioDw1000Reset = {
262
  /* GPIO */ &_gpioDw1000Reset,
258
ROMCONST apalControlGpio_t moduleGpioSysUartUp = {
259
  /* GPIO */ &_gpioSysUartUp,
263 260
  /* meta */ {
264 261
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
265 262
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
266
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
263
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
267 264
  },
268 265
};
269 266

  
270 267
/**
271
 * @brief   IO_2 breakout signal GPIO.
268
 * @brief   SYS_PD bidirectional signal GPIO.
272 269
 */
273
static apalGpio_t _gpioDw1000WakeUp = {
274
  /* line */ LINE_IO_2,
270
static apalGpio_t _gpioSysPd = {
271
  /* line */ LINE_SYS_PD_N,
275 272
};
276
ROMCONST apalControlGpio_t moduleGpioDw1000WakeUp = {
277
  /* GPIO */ &_gpioDw1000WakeUp,
273
ROMCONST apalControlGpio_t moduleGpioSysPd = {
274
  /* GPIO */ &_gpioSysPd,
278 275
  /* meta */ {
279
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
280
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
281
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
276
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
277
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
278
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
282 279
  },
283 280
};
284 281

  
285 282
/**
286
 * @brief   DW1000 SPI chip select output signal GPIO.
283
 * @brief   SYS_SYNC bidirectional signal GPIO.
287 284
 */
288
static apalGpio_t _gpioSpiChipSelect = {
289
  /* line */ LINE_SPI_SS_N,
285
static apalGpio_t _gpioSysSync = {
286
  /* line */ LINE_SYS_INT_N,
290 287
};
291
ROMCONST apalControlGpio_t moduleGpioSpiChipSelect = {
292
  /* GPIO */ &_gpioSpiChipSelect,
288
ROMCONST apalControlGpio_t moduleGpioSysSync = {
289
  /* GPIO */ &_gpioSysSync,
293 290
  /* meta */ {
294
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
291
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
295 292
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
296
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
293
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
297 294
  },
298 295
};
299
#else
296

  
300 297
/**
301
 * @brief   IO_8 breakout signal GPIO.
298
 * @brief   IO_1 breakout signal GPIO.
302 299
 */
303
static apalGpio_t _gpioBreakoutIo8 = {
304
  /* line */ LINE_IO_8,
300
static apalGpio_t _gpioBreakoutIo1 = {
301
  /* line */ LINE_IO_1,
305 302
};
306
apalControlGpio_t moduleGpioBreakoutIo8 = {
307
  /* GPIO */ &_gpioBreakoutIo8,
308
  /* meta */ {
309
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
310
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
311
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
312
  },
303

  
304
/**
305
 * @brief   IO_2 breakout signal GPIO.
306
 */
307
static apalGpio_t _gpioBreakoutIo2 = {
308
  /* line */ LINE_IO_2,
309
};
310

  
311
/**
312
 * @brief   IO_3 breakout signal GPIO.
313
 */
314
static apalGpio_t _gpioBreakoutIo3 = {
315
  /* line */ LINE_IO_3,
316
};
317

  
318
/**
319
 * @brief   IO_4 breakout signal GPIO.
320
 */
321
static apalGpio_t _gpioBreakoutIo4 = {
322
  /* line */ LINE_IO_4,
323
};
324

  
325
/**
326
 * @brief   IO_5 breakout signal GPIO.
327
 */
328
static apalGpio_t _gpioBreakoutIo5 = {
329
  /* line */ LINE_IO_5,
330
};
331

  
332
/**
333
 * @brief   IO_6 breakout signal GPIO.
334
 */
335
static apalGpio_t _gpioBreakoutIo6 = {
336
  /* line */ LINE_IO_6,
313 337
};
314 338

  
315 339
/**
......
318 342
static apalGpio_t _gpioBreakoutIo7 = {
319 343
  /* line */ LINE_IO_7,
320 344
};
321
apalControlGpio_t moduleGpioBreakoutIo7 = {
322
  /* GPIO */ &_gpioBreakoutIo7,
345

  
346
/**
347
 * @brief   IO_8 breakout signal GPIO.
348
 */
349
static apalGpio_t _gpioBreakoutIo8 = {
350
  /* line */ LINE_IO_8,
351
};
352

  
353
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
354

  
355
apalControlGpio_t moduleGpioBreakoutIo1 = {
356
  /* GPIO */ &_gpioBreakoutIo1,
323 357
  /* meta */ {
324 358
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
325
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
359
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
326 360
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
327 361
  },
328 362
};
329 363

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

  
346

  
347
/**
348
 * @brief   IO_4 breakout signal GPIO.
349
 */
350
static apalGpio_t _gpioBreakoutIo4 = {
351
  /* line */ LINE_IO_4,
373
apalControlGpio_t moduleGpioBreakoutIo3 = {
374
  /* GPIO */ &_gpioBreakoutIo3,
375
  /* meta */ {
376
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
377
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
378
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
379
  },
352 380
};
381

  
353 382
apalControlGpio_t moduleGpioBreakoutIo4 = {
354 383
  /* GPIO */ &_gpioBreakoutIo4,
355 384
  /* meta */ {
356 385
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
357
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
386
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
358 387
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
359 388
  },
360 389
};
361 390

  
362
/**
363
 * @brief   IO_1 breakout signal GPIO.
364
 */
365
static apalGpio_t _gpioBreakoutIo1 = {
366
  /* line */ LINE_IO_1,
367
};
368
apalControlGpio_t moduleGpioBreakoutIo1 = {
369
  /* GPIO */ &_gpioBreakoutIo1,
391
apalControlGpio_t moduleGpioBreakoutIo5 = {
392
  /* GPIO */ &_gpioBreakoutIo5,
370 393
  /* meta */ {
371 394
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
372
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
395
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
373 396
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
374 397
  },
375 398
};
376 399

  
377

  
378
/**
379
 * @brief   LED output signal GPIO.
380
 */
381
static apalGpio_t _gpioLed = {
382
  /* line */ LINE_LED,
383
};
384
ROMCONST apalControlGpio_t moduleGpioLed = {
385
  /* GPIO */ &_gpioLed,
400
apalControlGpio_t moduleGpioBreakoutIo6 = {
401
  /* GPIO */ &_gpioBreakoutIo6,
386 402
  /* meta */ {
387
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
388
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
403
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
404
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
389 405
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
390 406
  },
391 407
};
392 408

  
393
/**
394
 * @brief   LIGHT_XLAT output signal GPIO.
395
 */
396
static apalGpio_t _gpioLightXlat = {
397
  /* line */ LINE_LIGHT_XLAT,
398
};
399
ROMCONST apalControlGpio_t moduleGpioLightXlat = {
400
  /* GPIO */ &_gpioLightXlat,
409
apalControlGpio_t moduleGpioBreakoutIo7 = {
410
  /* GPIO */ &_gpioBreakoutIo7,
401 411
  /* meta */ {
402
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
403
    /* active state   */ (TLC5947_LLD_XLAT_UPDATE_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
412
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
413
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
404 414
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
405 415
  },
406 416
};
407 417

  
408
/**
409
 * @brief   SW_V18_EN output signal GPIO.
410
 */
411
static apalGpio_t _gpioSwV18En = {
412
  /* line */ LINE_SW_V18_EN,
413
};
414
ROMCONST apalControlGpio_t moduleGpioSwV18En = {
415
  /* GPIO */ &_gpioSwV18En,
418
apalControlGpio_t moduleGpioBreakoutIo8 = {
419
  /* GPIO */ &_gpioBreakoutIo8,
416 420
  /* meta */ {
417
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
418
    /* active state   */ MIC9404x_LLD_EN_ACTIVE_STATE,
421
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
422
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
419 423
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
420 424
  },
421 425
};
422 426

  
423
/**
424
 * @brief   SW_VSYS_EN output signal GPIO.
425
 */
426
static apalGpio_t _gpioSwVsysEn = {
427
  /* line */ LINE_SW_VSYS_EN,
427
#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
428

  
429
apalControlGpio_t moduleGpioBreakoutIo1 = {
430
  /* GPIO */ &_gpioBreakoutIo1,
431
  /* meta */ {
432
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
433
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
434
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
435
  },
428 436
};
429
ROMCONST apalControlGpio_t moduleGpioSwVsysEn = {
430
  /* GPIO */ &_gpioSwVsysEn,
437

  
438
apalControlGpio_t moduleGpioBreakoutIo2 = {
439
  /* GPIO */ &_gpioBreakoutIo2,
431 440
  /* meta */ {
432 441
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
433 442
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
......
435 444
  },
436 445
};
437 446

  
438
/**
439
 * @brief   SYS_UART_UP bidirectional signal GPIO.
440
 */
441
static apalGpio_t _gpioSysUartUp = {
442
  /* line */ LINE_SYS_UART_UP,
447
apalControlGpio_t moduleGpioBreakoutIo3 = {
448
  /* GPIO */ &_gpioBreakoutIo3,
449
  /* meta */ {
450
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
451
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
452
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
453
  },
443 454
};
444
ROMCONST apalControlGpio_t moduleGpioSysUartUp = {
445
  /* GPIO */ &_gpioSysUartUp,
455

  
456
apalControlGpio_t moduleGpioBreakoutIo4 = {
457
  /* GPIO */ &_gpioBreakoutIo4,
446 458
  /* meta */ {
447
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
448
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
449
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
459
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
460
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
461
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
450 462
  },
451 463
};
452 464

  
453
/**
454
 * @brief   SYS_PD bidirectional signal GPIO.
455
 */
456
static apalGpio_t _gpioSysPd = {
457
  /* line */ LINE_SYS_PD_N,
465
apalControlGpio_t moduleGpioBreakoutIo5 = {
466
  /* GPIO */ &_gpioBreakoutIo5,
467
  /* meta */ {
468
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
469
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
470
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
471
  },
458 472
};
459
ROMCONST apalControlGpio_t moduleGpioSysPd = {
460
  /* GPIO */ &_gpioSysPd,
473

  
474
apalControlGpio_t moduleGpioBreakoutIo6 = {
475
  /* GPIO */ &_gpioBreakoutIo6,
476
  /* meta */ {
477
    /* direction      */ APAL_GPIO_DIRECTION_UNDEFINED,
478
    /* active state   */ APAL_GPIO_ACTIVE_NONE,
479
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
480
  },
481
};
482

  
483
apalControlGpio_t moduleGpioBreakoutIo7 = {
484
  /* GPIO */ &_gpioBreakoutIo7,
461 485
  /* meta */ {
462 486
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
463 487
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
464
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
488
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
465 489
  },
466 490
};
467 491

  
468
/**
469
 * @brief   SYS_SYNC bidirectional signal GPIO.
470
 */
471
static apalGpio_t _gpioSysSync = {
472
  /* line */ LINE_SYS_INT_N,
473
};
474
ROMCONST apalControlGpio_t moduleGpioSysSync = {
475
  /* GPIO */ &_gpioSysSync,
492
apalControlGpio_t moduleGpioBreakoutIo8 = {
493
  /* GPIO */ &_gpioBreakoutIo8,
476 494
  /* meta */ {
477
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
495
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
478 496
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
479
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
497
    /* interrupt edge */ APAL_GPIO_EDGE_RISING,
480 498
  },
481 499
};
482 500

  
501
#endif
502

  
483 503
/** @} */
484 504

  
485 505
/*===========================================================================*/
......
506 526

  
507 527
/*===========================================================================*/
508 528
/**
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
/**
575 529
 * @name Low-level drivers
576 530
 * @{
577 531
 */
......
622 576
  /* XLAT signal GPIO   */ &moduleGpioLightXlat,
623 577
};
624 578

  
625
#if (BOARD_DW1000_CONNECTED == true)
579
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
580

  
626 581
DW1000Driver moduleLldDw1000 = {
627
  /* SPI driver         */ &MODULE_HAL_SPI_UWB,
628
  /* ext interrupt      */ &moduleGpioDw1000Irqn,
629
  /* RESET DW1000       */ &moduleGpioDw1000Reset,
582
  /* SPI driver     */ &MODULE_HAL_SPI_UWB,
583
  /* interrupt GPIO */ &moduleGpioBreakoutIo8,
584
  /* reset GPIO     */ &moduleGpioBreakoutIo7,
630 585
};
631 586

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

  
637 589
/** @} */
638 590

  
......
696 648
}
697 649
AOS_SHELL_COMMAND(moduleTestTlc5947ShellCmd, "test:Lights", _testTlc5947ShellCmdCb);
698 650

  
699
#if (BOARD_DW1000_CONNECTED == true) || defined(__DOXYGEN__)
651
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
652

  
700 653
/*
701 654
 * UwB Driver (DW1000)
702 655
 */
......
706 659
  return moduleTestDw1000ShellCb(stream, argc, argv, NULL);
707 660
}
708 661
AOS_SHELL_COMMAND(moduleTestDw1000ShellCmd, "test:DW1000", _testDw1000ShellCmdCb);
709
#endif /* (BOARD_DW1000_CONNECTED == true) */
662

  
663
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
710 664

  
711 665
/*
712 666
 * entire module
......
763 717
  status |= moduleTestTlc5947ShellCb(stream, 0, targv, &result_test);
764 718
  result_total = aosTestResultAdd(result_total, result_test);
765 719

  
720
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
721
  /* DW1000 (UWB transceiver) */
722
  status |= moduleTestDw1000ShellCb(stream, 0, targv, &result_test);
723
  result_total = aosTestResultAdd(result_total, result_test);
724
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
725

  
766 726
  // print total result
767 727
  chprintf(stream, "\n");
768 728
  aosTestResultPrintSummary(stream, &result_total, "entire module");
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

  
57 39
/** @} */
58 40

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

  
106
#if (BOARD_DW1000_CONNECTED == true)
107 88
/**
108
 * @brief   SPI interface driver for UWB DW1000 module.
89
 * @brief   SPI interface driver for the breakout header.
109 90
 */
110
#define MODULE_HAL_SPI_UWB                      SPID2
91
#define MODULE_HAL_SPI_BREAKOUT                 SPID2
111 92

  
112 93
/**
113
 * @brief   Configuration for the high-speed SPI interface driver of DW1000 module.
94
 * @brief   UART interface driver for the breakout header (alternative to serial).
114 95
 */
115
extern SPIConfig moduleHalSpiUwbHsConfig;
96
#define MODULE_HAL_UART_BREAKOUT                UARTD2
116 97

  
117 98
/**
118
 * @brief   Configuration for the low-speed SPI interface driver of DW1000 module.
99
 * @brief   Real-Time Clock driver.
119 100
 */
120
extern SPIConfig moduleHalSpiUwbLsConfig;
101
#define MODULE_HAL_RTC                          RTCD1
121 102

  
122
#else
103
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
123 104

  
124 105
/**
125
 * @brief   SPI interface driver for the breakout header.
106
 * @brief   SPI interface driver for UWB DW1000 module.
126 107
 */
127
#define MODULE_HAL_SPI_BREAKOUT                 SPID2
128

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

  
108
#define MODULE_HAL_SPI_UWB                      MODULE_HAL_SPI_BREAKOUT
131 109

  
132 110
/**
133
 * @brief   UART interface driver for the breakout header (alternative to serial).
111
 * @brief   Configuration for the high-speed SPI interface driver of DW1000 module.
134 112
 */
135
#define MODULE_HAL_UART_BREAKOUT                UARTD2
113
extern SPIConfig moduleHalSpiUwbHsConfig;
136 114

  
137 115
/**
138
 * @brief   Real-Time Clock driver.
116
 * @brief   Configuration for the low-speed SPI interface driver of DW1000 module.
139 117
 */
140
#define MODULE_HAL_RTC                          RTCD1
118
extern SPIConfig moduleHalSpiUwbLsConfig;
119

  
120
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
141 121

  
142 122
/** @} */
143 123

  
......
195 175
extern ROMCONST apalControlGpio_t moduleGpioSysUartDn;
196 176

  
197 177
/**
178
 * @brief   IO_7 breakout signal GPIO.
179
 */
180
extern apalControlGpio_t moduleGpioBreakoutIo7;
181

  
182
/**
183
 * @brief   IO_8 breakout signal GPIO.
184
 */
185
extern apalControlGpio_t moduleGpioBreakoutIo8;
186

  
187
/**
198 188
 * @brief   IO_4 breakout signal GPIO.
199 189
 */
200 190
extern apalControlGpio_t moduleGpioBreakoutIo4;
......
205 195
extern apalControlGpio_t moduleGpioBreakoutIo1;
206 196

  
207 197
/**
198
 * @brief   IO_2 breakout signal GPIO.
199
 */
200
extern apalControlGpio_t moduleGpioBreakoutIo2;
201

  
202
/**
208 203
 * @brief   LED output signal GPIO.
209 204
 */
210 205
extern ROMCONST apalControlGpio_t moduleGpioLed;
......
239 234
 */
240 235
extern ROMCONST apalControlGpio_t moduleGpioSysSync;
241 236

  
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

  
284 237
/** @} */
285 238

  
286 239
/*===========================================================================*/
......
341 294
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8      AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
342 295

  
343 296
/**
344
 * @brief   Event flag to be set on a DW1000 interrupt.
297
 * @brief   Event flag to be set on a SYS_PD interrupt.
345 298
 */
346
#define MODULE_OS_IOEVENTFLAGS_DW1000           AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
299
#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
300

  
301
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
347 302

  
348 303
/**
349
 * @brief   Event flag to be set on a SYS_PD interrupt.
304
 * @brief   Event flag to be set on a DW1000 interrupt.
350 305
 */
351
#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
306
#define MODULE_OS_IOEVENTFLAGS_DW1000           MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8
307

  
308
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
352 309

  
353 310
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
354 311
/**
......
363 320
 */
364 321
#define MODULE_INIT_INTERRUPTS() {                                            \
365 322
  /* breakout interrupts must be enabled explicitely */                       \
366
  MODULE_INIT_INTERRUPTS_DW1000();                                            \
323
  MODULE_INIT_INTERRUPTS_BREAKOUT();                                          \
367 324
}
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));                  \
325
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
326
  #define MODULE_INIT_INTERRUPTS_BREAKOUT() {                                 \
327
    palSetLineCallback(moduleLldDw1000.gpio_exti->gpio->line, aosSysGetStdExtiCallback(), &moduleLldDw1000.gpio_exti->gpio->line);  \
328
    palEnableLineEvent(moduleLldDw1000.gpio_exti->gpio->line, APAL2CH_EDGE(moduleLldDw1000.gpio_exti->meta.edge));                  \
372 329
  }
373
#else /* (BOARD_DW1000_CONNECTED == true) */
374
  #define MODULE_INIT_INTERRUPTS_DW1000() {                                   \
330
#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
331
  #define MODULE_INIT_INTERRUPTS_BREAKOUT() {                                 \
375 332
  }
376
#endif /* (BOARD_DW1000_CONNECTED == true) */
333
#endif
377 334

  
378 335
/**
379 336
 * @brief   Unit test initialization hook.
......
386 343
  aosShellAddCommand(&aos.shell, &moduleTestMic9404xShellCmd);                \
387 344
  aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd);                 \
388 345
  aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd);                     \
389
  MODULE_INIT_TESTS_DW1000();                                                 \
346
  MODULE_INIT_TESTS_BREAKOUT();                                               \
390 347
}
391
#if (BOARD_DW1000_CONNECTED == true)
392
  #define MODULE_INIT_TESTS_DW1000() {                                        \
348
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
349
  #define MODULE_INIT_TESTS_BREAKOUT() {                                      \
393 350
    aosShellAddCommand(&aos.shell, &moduleTestDw1000ShellCmd);                \
394 351
  }
395
#else /* defined(AMIROLLD_CFG_DW1000) */
396
  #define MODULE_INIT_TESTS_DW1000() {                                        \
352
#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
353
  #define MODULE_INIT_TESTS_BREAKOUT() {                                      \
397 354
  }
398
#endif /* BOARD_DW1000_CONNECTED == true */
355
#endif
399 356

  
400 357
/**
401 358
 * @brief   Periphery communication interfaces initialization hook.
......
410 367
  i2cStart(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT, &moduleHalI2cEepromPwrmtrBreakoutConfig);  \
411 368
  /* SPI */                                                                   \
412 369
  spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig);                  \
413
  MODULE_INIT_PERIPHERY_COMM_DW1000();                                        \
370
  /* breakout module */                                                       \
371
  MODULE_INIT_PERIPHERY_COMM_BREAKOUT();                                      \
414 372
}
415
#if (BOARD_DW1000_CONNECTED == true)
416
  #define MODULE_INIT_PERIPHERY_COMM_DW1000() {                               \
417
  spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig);                    \
373
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
374
  #define MODULE_INIT_PERIPHERY_COMM_BREAKOUT() {                             \
375
    spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig);                  \
418 376
  }
419
#else /* defined(AMIROLLD_CFG_DW1000) */
420
  #define MODULE_INIT_PERIPHERY_COMM_DW1000() {                               \
377
#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
378
  #define MODULE_INIT_PERIPHERY_COMM_BREAKOUT() {                             \
421 379
  }
422
#endif /* BOARD_DW1000_CONNECTED == true */
380
#endif
423 381

  
424 382
/**
425 383
 * @brief   Periphery communication interface deinitialization hook.
......
429 387
  spiStop(&MODULE_HAL_SPI_LIGHT);                                             \
430 388
  /* I2C */                                                                   \
431 389
  i2cStop(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT);                            \
432
  MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000();                                    \
390
  /* breakout module */                                                       \
391
  MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT();                                  \
433 392
  /* don't stop the serial driver so messages can still be printed */         \
434 393
}
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
    }                                                                         \
394
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
395
  #define MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT() {                         \
396
    /* SPI */                                                                 \
397
    spiStop(&MODULE_HAL_SPI_UWB);                                             \
457 398
  }
458
#else /* defined(AMIROLLD_CFG_DW1000) */
459
  #define MODULE_MAIN_LOOP_IO_EVENT_DW1000() {                                \
399
#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
400
  #define MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT() {                         \
460 401
  }
461
#endif /* BOARD_DW1000_CONNECTED == true */
402
#endif
462 403

  
463 404
/** @} */
464 405

  
......
523 464
#include <alld_MIC9404x.h>
524 465
// TODO: add SNx5C3221E
525 466
#include <alld_TLC5947.h>
526
#include <alld_DW1000.h>
527 467

  
528 468
/**
529 469
 * @brief   EEPROM driver.
......
573 513
 */
574 514
extern TLC5947Driver moduleLldLedPwm;
575 515

  
516
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
517

  
518
#include <alld_DW1000.h>
519

  
576 520
/**
577
 * @brief   DW1000 driver.
521
 * @brief   Alias for the DW1000 driver object.
522
 * @note    The dw1000 struct is defined as external variable (singleton) by the
523
 *          driver, since the Decawave software stacks assumes no more than a
524
 *          single device in a system.
578 525
 */
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) */
526
#define moduleLldDw1000                         dw1000
527

  
528
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
584 529

  
585 530
/** @} */
586 531

  
......
625 570
extern aos_shellcommand_t moduleTestAllShellCmd;
626 571

  
627 572

  
628
#if (BOARD_DW1000_CONNECTED == true)
573
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
574

  
629 575
/**
630 576
 * @brief   DW1000 (UWB transmitter) test command.
631 577
 */
632 578
extern aos_shellcommand_t moduleTestDw1000ShellCmd;
633
#endif /* (BOARD_DW1000_CONNECTED == true) */
579

  
580
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
634 581

  
635 582
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
636 583

  
modules/LightRing_1-2/test/DW1000/module_test_DW1000.c
18 18

  
19 19
#include <amiroos.h>
20 20

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

  
21
#if ((AMIROOS_CFG_TESTS_ENABLE == true) && (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)) || defined(__DOXYGEN__)
23 22

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

  
29 28
/******************************************************************************/
30 29
/* LOCAL DEFINITIONS                                                          */
......
43 42
/******************************************************************************/
44 43

  
45 44
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,
45
  /* driver */ &moduleLldDw1000,
50 46
};
51 47

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

  
54 50
/******************************************************************************/
55 51
/* LOCAL FUNCTIONS                                                            */
......
64 60
  (void)argc;
65 61
  (void)argv;
66 62

  
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;
63
  // enable power
64
  mic9404x_lld_set(&moduleLldPowerSwitchV18, MIC9404x_LLD_STATE_ON);
65
  mic9404x_lld_set(&moduleLldPowerSwitchV33, MIC9404x_LLD_STATE_ON);
77 66

  
78

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

  
83 69
  } else {
84 70
    aosTestRun(stream, &_test, NULL);
85 71
  }
72

  
73
  chprintf(stream, "TODO: turn off the device\n");
74
  if (result) {
75
    aosTestFailed(stream, result);
76
  }
77

  
86 78
  return AOS_OK;
87 79
}
88 80

  
89
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
81
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
modules/LightRing_1-2/test/DW1000/module_test_DW1000.h
22 22

  
23 23
#include <amiroos.h>
24 24

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

  
27 27
/******************************************************************************/
28 28
/* CONSTANTS                                                                  */
......
60 60
/* INLINE FUNCTIONS                                                           */
61 61
/******************************************************************************/
62 62

  
63
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
63
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
64 64

  
65 65
#endif /* MODULE_TEST_DW1000_H */
66 66

  
test/periphery-lld/AT24C01B_v1/aos_test_AT24C01B.c
73 73
/**
74 74
 * @brief   AT24C01B test function.
75 75
 *
76
 * @param[in] stream  Stream for inout/outout.
76
 * @param[in] stream  Stream for input/output.
77 77
 * @param[in] test    Test object.
78 78
 *
79 79
 * @return            Test result value.
test/periphery-lld/DW1000_v2/aos_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
#include <aos_test_DW1000.h>
21

  
22
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
23

  
24
/******************************************************************************/
25
/* LOCAL DEFINITIONS                                                          */
26
/******************************************************************************/
27

  
28
/******************************************************************************/
29
/* EXPORTED VARIABLES                                                         */
30
/******************************************************************************/
31

  
32
/******************************************************************************/
33
/* LOCAL TYPES                                                                */
34
/******************************************************************************/
35

  
36
/******************************************************************************/
37
/* LOCAL VARIABLES                                                            */
38
/******************************************************************************/
39

  
40
/******************************************************************************/
41
/* LOCAL FUNCTIONS                                                            */
42
/******************************************************************************/
43

  
44
/******************************************************************************/
45
/* EXPORTED FUNCTIONS                                                         */
46
/******************************************************************************/
47

  
48
/**
49
 * @brief   DW1000 test function.
50
 *
51
 * @param[in] stream  Stream for input/output.
52
 * @param[in] test    Test object.
53
 *
54
 * @return            Test result value.
55
 */
56
aos_testresult_t aosTestDw1000Func(BaseSequentialStream* stream, const aos_test_t* test) {
57

  
58
  aosDbgCheck(test->data != NULL &&
59
      ((aos_test_dw1000data_t*)test->data)->driver != NULL);
60

  
61
  // local variables
62
  aos_testresult_t result;
63

  
64
  aosTestResultInit(&result);
65

  
66
  chprintf(stream, "TODO (%s): reimplement test routine\n", __FILE__);
67
  chprintf(stream, "  - Implement EVERYTHING in the test/periphery-lld/DW1000/v2/ folder!\n");
68
  chprintf(stream, "  - Preferably only use the two files aos_test_DW1000.h/.c!\n");
69
  chprintf(stream, "  - The test shall assume that any other involved periphery has been setup correctly before!\n");
70
  chprintf(stream, "  - Any module-specific code (e.g. initialization of voltages) belongs to the according <module>/test/DW1000/ folder!\n");
71
  chprintf(stream, "\n");
72

  
73
  return result;
74
}
75

  
76

  
77
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
test/periphery-lld/DW1000_v2/aos_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
#ifndef AMIROOS_TEST_DW1000_H
20
#define AMIROOS_TEST_DW1000_H
21

  
22
#include <amiroos.h>
23

  
24
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
25

  
26
#include <alld_DW1000.h>
27

  
28
/******************************************************************************/
29
/* CONSTANTS                                                                  */
30
/******************************************************************************/
31

  
32
/******************************************************************************/
33
/* SETTINGS                                                                   */
34
/******************************************************************************/
35

  
36
/******************************************************************************/
37
/* CHECKS                                                                     */
38
/******************************************************************************/
39

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

  
44
/**
45
 * @brief   Custom data structure for the test.
46
 */
47
typedef struct {
48
  /**
49
   * @brief   Pointer to the driver to use.
50
   */
51
  DW1000Driver* driver;
52

  
53
} aos_test_dw1000data_t;
54

  
55

  
56
/******************************************************************************/
57
/* MACROS                                                                     */
58
/******************************************************************************/
59

  
60
/******************************************************************************/
61
/* EXTERN DECLARATIONS                                                        */
62
/******************************************************************************/
63

  
64
#if defined(__cplusplus)
65
extern "C" {
66
#endif /* defined(__cplusplus) */
67
  aos_testresult_t aosTestDw1000Func(BaseSequentialStream* stream, const aos_test_t* test);
68
#if defined(__cplusplus)
69
}
70
#endif /* defined(__cplusplus) */
71

  
72
/******************************************************************************/
73
/* INLINE FUNCTIONS                                                           */
74
/******************************************************************************/
75

  
76
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
77

  
78
#endif /* AMIROOS_TEST_DW1000_H */

Also available in: Unified diff