commit f606f432933384278331ec7a083bf3a7f01f1adc
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Tue Oct 15 15:05:44 2019 +0200

    Introduced a new (preliminary) test for the new DW1000v2 driver (WIP!).

diff --git a/modules/LightRing_1-2/module.h b/modules/LightRing_1-2/module.h
index 02431f3..d62f6b5 100644
--- a/modules/LightRing_1-2/module.h
+++ b/modules/LightRing_1-2/module.h
@@ -36,24 +36,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 /*===========================================================================*/
 
-
-#if defined(__cplusplus)
-extern "C" {
-#endif /* defined(__cplusplus) */
-
-#if (BOARD_DW1000_CONNECTED == true)
-void process_deca_irq(void);
-apalGpioState_t port_CheckEXT_IRQ(void) ;
-#endif /* (BOARD_DW1000_CONNECTED == true) */
-
-void set_SPI_chip_select(void);
-void clear_SPI_chip_select(void);
-void reset_DW1000(void);
-
-#if defined(__cplusplus)
-}
-#endif /* defined(__cplusplus) */
-
 /** @} */
 
 /*===========================================================================*/
@@ -103,41 +85,39 @@ extern SerialConfig moduleHalProgIfConfig;
  */
 extern SPIConfig moduleHalSpiLightConfig;
 
-#if (BOARD_DW1000_CONNECTED == true)
 /**
- * @brief   SPI interface driver for UWB DW1000 module.
+ * @brief   SPI interface driver for the breakout header.
  */
-#define MODULE_HAL_SPI_UWB                      SPID2
+#define MODULE_HAL_SPI_BREAKOUT                 SPID2
 
 /**
- * @brief   Configuration for the high-speed SPI interface driver of DW1000 module.
+ * @brief   UART interface driver for the breakout header (alternative to serial).
  */
-extern SPIConfig moduleHalSpiUwbHsConfig;
+#define MODULE_HAL_UART_BREAKOUT                UARTD2
 
 /**
- * @brief   Configuration for the low-speed SPI interface driver of DW1000 module.
+ * @brief   Real-Time Clock driver.
  */
-extern SPIConfig moduleHalSpiUwbLsConfig;
+#define MODULE_HAL_RTC                          RTCD1
 
-#else
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
 
 /**
- * @brief   SPI interface driver for the breakout header.
+ * @brief   SPI interface driver for UWB DW1000 module.
  */
-#define MODULE_HAL_SPI_BREAKOUT                 SPID2
-
-#endif /* BOARD_DW1000_CONNECTED == true*/
-
+#define MODULE_HAL_SPI_UWB                      MODULE_HAL_SPI_BREAKOUT
 
 /**
- * @brief   UART interface driver for the breakout header (alternative to serial).
+ * @brief   Configuration for the high-speed SPI interface driver of DW1000 module.
  */
-#define MODULE_HAL_UART_BREAKOUT                UARTD2
+extern SPIConfig moduleHalSpiUwbHsConfig;
 
 /**
- * @brief   Real-Time Clock driver.
+ * @brief   Configuration for the low-speed SPI interface driver of DW1000 module.
  */
-#define MODULE_HAL_RTC                          RTCD1
+extern SPIConfig moduleHalSpiUwbLsConfig;
+
+#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
 
 /** @} */
 
@@ -195,6 +175,16 @@ extern apalControlGpio_t moduleGpioBreakoutIo6;
 extern ROMCONST apalControlGpio_t moduleGpioSysUartDn;
 
 /**
+ * @brief   IO_7 breakout signal GPIO.
+ */
+extern apalControlGpio_t moduleGpioBreakoutIo7;
+
+/**
+ * @brief   IO_8 breakout signal GPIO.
+ */
+extern apalControlGpio_t moduleGpioBreakoutIo8;
+
+/**
  * @brief   IO_4 breakout signal GPIO.
  */
 extern apalControlGpio_t moduleGpioBreakoutIo4;
@@ -205,6 +195,11 @@ extern apalControlGpio_t moduleGpioBreakoutIo4;
 extern apalControlGpio_t moduleGpioBreakoutIo1;
 
 /**
+ * @brief   IO_2 breakout signal GPIO.
+ */
+extern apalControlGpio_t moduleGpioBreakoutIo2;
+
+/**
  * @brief   LED output signal GPIO.
  */
 extern ROMCONST apalControlGpio_t moduleGpioLed;
@@ -239,48 +234,6 @@ extern ROMCONST apalControlGpio_t moduleGpioSysPd;
  */
 extern ROMCONST apalControlGpio_t moduleGpioSysSync;
 
-#if (BOARD_DW1000_CONNECTED == true)
-/**
- * @brief   DW1000 reset output signal
- * @note    the reset pin should be drived as low by MCU to activate.
- *          Then, put back the reset pin as input to MCU (tri-state float on the air
- *          is not supported in AMiRo)
- */
-extern ROMCONST apalControlGpio_t moduleGpioDw1000Reset;
-
-/**
- * @brief   DW1000 wakeup signal
- */
-extern ROMCONST apalControlGpio_t moduleGpioDw1000WakeUp;
-
-/**
- * @brief   DW1000 interrupt IRQn input signal.
- */
-extern ROMCONST apalControlGpio_t moduleGpioDw1000Irqn;
-
-/**
- * @brief   DW1000 SPI chip select  output signal.
- */
-extern ROMCONST apalControlGpio_t moduleGpioSpiChipSelect ;
-
-#else
-/**
- * @brief   IO_2 breakout signal GPIO.
- */
-extern apalControlGpio_t moduleGpioBreakoutIo2;
-
-/**
- * @brief   IO_7 breakout signal GPIO.
- */
-extern apalControlGpio_t moduleGpioBreakoutIo7;
-
-/**
- * @brief   IO_8 breakout signal GPIO.
- */
-extern apalControlGpio_t moduleGpioBreakoutIo8;
-
-#endif /* BOARD_DW1000_CONNECTED == true */
-
 /** @} */
 
 /*===========================================================================*/
@@ -341,14 +294,18 @@ extern apalControlGpio_t moduleGpioBreakoutIo8;
 #define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8      AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
 
 /**
- * @brief   Event flag to be set on a DW1000 interrupt.
+ * @brief   Event flag to be set on a SYS_PD interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_DW1000           AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
+#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
+
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
 
 /**
- * @brief   Event flag to be set on a SYS_PD interrupt.
+ * @brief   Event flag to be set on a DW1000 interrupt.
  */
-#define MODULE_OS_IOEVENTFLAGS_SYSPD            AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
+#define MODULE_OS_IOEVENTFLAGS_DW1000           MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8
+
+#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
 /**
@@ -363,17 +320,17 @@ extern ROMCONST char* moduleShellPrompt;
  */
 #define MODULE_INIT_INTERRUPTS() {                                            \
   /* breakout interrupts must be enabled explicitely */                       \
-  MODULE_INIT_INTERRUPTS_DW1000();                                            \
+  MODULE_INIT_INTERRUPTS_BREAKOUT();                                          \
 }
-#if (BOARD_DW1000_CONNECTED == true)
-  #define MODULE_INIT_INTERRUPTS_DW1000() {                                   \
-    palSetLineCallback(moduleGpioDw1000Irqn.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioDw1000Irqn.gpio->line);  \
-    palEnableLineEvent(moduleGpioDw1000Irqn.gpio->line, APAL2CH_EDGE(moduleGpioDw1000Irqn.meta.edge));                  \
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
+  #define MODULE_INIT_INTERRUPTS_BREAKOUT() {                                 \
+    palSetLineCallback(moduleLldDw1000.gpio_exti->gpio->line, aosSysGetStdExtiCallback(), &moduleLldDw1000.gpio_exti->gpio->line);  \
+    palEnableLineEvent(moduleLldDw1000.gpio_exti->gpio->line, APAL2CH_EDGE(moduleLldDw1000.gpio_exti->meta.edge));                  \
   }
-#else /* (BOARD_DW1000_CONNECTED == true) */
-  #define MODULE_INIT_INTERRUPTS_DW1000() {                                   \
+#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
+  #define MODULE_INIT_INTERRUPTS_BREAKOUT() {                                 \
   }
-#endif /* (BOARD_DW1000_CONNECTED == true) */
+#endif
 
 /**
  * @brief   Unit test initialization hook.
@@ -386,16 +343,16 @@ extern ROMCONST char* moduleShellPrompt;
   aosShellAddCommand(&aos.shell, &moduleTestMic9404xShellCmd);                \
   aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd);                 \
   aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd);                     \
-  MODULE_INIT_TESTS_DW1000();                                                 \
+  MODULE_INIT_TESTS_BREAKOUT();                                               \
 }
-#if (BOARD_DW1000_CONNECTED == true)
-  #define MODULE_INIT_TESTS_DW1000() {                                        \
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
+  #define MODULE_INIT_TESTS_BREAKOUT() {                                      \
     aosShellAddCommand(&aos.shell, &moduleTestDw1000ShellCmd);                \
   }
-#else /* defined(AMIROLLD_CFG_DW1000) */
-  #define MODULE_INIT_TESTS_DW1000() {                                        \
+#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
+  #define MODULE_INIT_TESTS_BREAKOUT() {                                      \
   }
-#endif /* BOARD_DW1000_CONNECTED == true */
+#endif
 
 /**
  * @brief   Periphery communication interfaces initialization hook.
@@ -410,16 +367,17 @@ extern ROMCONST char* moduleShellPrompt;
   i2cStart(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT, &moduleHalI2cEepromPwrmtrBreakoutConfig);  \
   /* SPI */                                                                   \
   spiStart(&MODULE_HAL_SPI_LIGHT, &moduleHalSpiLightConfig);                  \
-  MODULE_INIT_PERIPHERY_COMM_DW1000();                                        \
+  /* breakout module */                                                       \
+  MODULE_INIT_PERIPHERY_COMM_BREAKOUT();                                      \
 }
-#if (BOARD_DW1000_CONNECTED == true)
-  #define MODULE_INIT_PERIPHERY_COMM_DW1000() {                               \
-  spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig);                    \
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
+  #define MODULE_INIT_PERIPHERY_COMM_BREAKOUT() {                             \
+    spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig);                  \
   }
-#else /* defined(AMIROLLD_CFG_DW1000) */
-  #define MODULE_INIT_PERIPHERY_COMM_DW1000() {                               \
+#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
+  #define MODULE_INIT_PERIPHERY_COMM_BREAKOUT() {                             \
   }
-#endif /* BOARD_DW1000_CONNECTED == true */
+#endif
 
 /**
  * @brief   Periphery communication interface deinitialization hook.
@@ -429,36 +387,19 @@ extern ROMCONST char* moduleShellPrompt;
   spiStop(&MODULE_HAL_SPI_LIGHT);                                             \
   /* I2C */                                                                   \
   i2cStop(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT);                            \
-  MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000();                                    \
+  /* breakout module */                                                       \
+  MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT();                                  \
   /* don't stop the serial driver so messages can still be printed */         \
 }
-#if (BOARD_DW1000_CONNECTED == true)
-#define MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000() {                             \
-  /* SPI */                                                                   \
-  spiStop(&MODULE_HAL_SPI_UWB);                                               \
-}
-#else /* defined(AMIROLLD_CFG_DW1000) */
-  #define MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000() {                           \
-  }
-#endif /* BOARD_DW1000_CONNECTED == true */
-
-
-/**
- * @brief   HOOK to call process_deca_irq() func when the dw1000 interrupt pin is activated.
- */
-#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) {                               \
-  MODULE_MAIN_LOOP_IO_EVENT_DW1000();                                         \
-}
-#if (BOARD_DW1000_CONNECTED == true)
-  #define MODULE_MAIN_LOOP_IO_EVENT_DW1000() {                                \
-    if(eventflags & MODULE_OS_IOEVENTFLAGS_DW1000) {                          \
-      process_deca_irq();                                                     \
-    }                                                                         \
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10)
+  #define MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT() {                         \
+    /* SPI */                                                                 \
+    spiStop(&MODULE_HAL_SPI_UWB);                                             \
   }
-#else /* defined(AMIROLLD_CFG_DW1000) */
-  #define MODULE_MAIN_LOOP_IO_EVENT_DW1000() {                                \
+#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE)
+  #define MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT() {                         \
   }
-#endif /* BOARD_DW1000_CONNECTED == true */
+#endif
 
 /** @} */
 
@@ -523,7 +464,6 @@ extern ROMCONST char* moduleShellPrompt;
 #include <alld_MIC9404x.h>
 // TODO: add SNx5C3221E
 #include <alld_TLC5947.h>
-#include <alld_DW1000.h>
 
 /**
  * @brief   EEPROM driver.
@@ -573,14 +513,19 @@ extern MIC9404xDriver moduleLldPowerSwitchVsys;
  */
 extern TLC5947Driver moduleLldLedPwm;
 
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
+
+#include <alld_DW1000.h>
+
 /**
- * @brief   DW1000 driver.
+ * @brief   Alias for the DW1000 driver object.
+ * @note    The dw1000 struct is defined as external variable (singleton) by the
+ *          driver, since the Decawave software stacks assumes no more than a
+ *          single device in a system.
  */
-void setHighSpeed_SPI(bool speedValue, DW1000Driver* drv);
-#if (BOARD_DW1000_CONNECTED == true)
-extern DW1000Driver moduleLldDw1000;
-extern MIC9404xDriver moduleLldPowerSwitchDw1000;
-#endif /* (BOARD_DW1000_CONNECTED == true) */
+#define moduleLldDw1000                         dw1000
+
+#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
 
 /** @} */
 
@@ -625,12 +570,14 @@ extern aos_shellcommand_t moduleTestTlc5947ShellCmd;
 extern aos_shellcommand_t moduleTestAllShellCmd;
 
 
-#if (BOARD_DW1000_CONNECTED == true)
+#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__)
+
 /**
  * @brief   DW1000 (UWB transmitter) test command.
  */
 extern aos_shellcommand_t moduleTestDw1000ShellCmd;
-#endif /* (BOARD_DW1000_CONNECTED == true) */
+
+#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */
 
 #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
 
