commit a3ac240086bbe541508d40780d163ca7bd476d1e
Author: Cung Sang <csang@techfak.uni-bielefeld.de>
Date:   Fri Aug 9 12:52:21 2019 +0200

    modified the test function to be usable with different modules

diff --git a/test/periphery-lld/DW1000_v1/aos_test_DW1000.c b/test/periphery-lld/DW1000_v1/aos_test_DW1000.c
index 1a958bf..92af998 100644
--- a/test/periphery-lld/DW1000_v1/aos_test_DW1000.c
+++ b/test/periphery-lld/DW1000_v1/aos_test_DW1000.c
@@ -68,21 +68,6 @@ int instance_mode = ANCHOR;
 /* LOCAL FUNCTIONS                                                            */
 /******************************************************************************/
 
-/*! @brief Manually reset the DW1000 module  */
-void reset_DW1000(void){
-
-  // Set the pin as output
-  palSetLineMode(moduleGpioDw1000Reset.gpio->line, APAL_GPIO_DIRECTION_OUTPUT);
-
-  //drive the RSTn pin low
-  apalGpioWrite(moduleGpioDw1000Reset.gpio, APAL_GPIO_LOW);
-
-  //put the pin back to tri-state ... as input
-//  palSetLineMode(moduleGpioDw1000Reset.gpio->line, APAL_GPIO_DIRECTION_INPUT); // TODO:
-
-  aosThdMSleep(2);
-}
-
 /*! @brief Configure instance tag/anchor/etc... addresses */
 void addressconfigure(uint8_t s1switch, uint8_t mode){
   uint16_t instAddress ;
@@ -207,21 +192,53 @@ int UWB_Init(DW1000Driver* drv){
 /* EXPORTED FUNCTIONS                                                         */
 /******************************************************************************/
 
-
 aos_testresult_t aosTestDw1000Func(BaseSequentialStream* stream, const aos_test_t* test) {
 
   aosDbgCheck(test->data != NULL &&
       ((aos_test_dw1000data_t*)test->data)->driver != NULL &&
       ((aos_test_dw1000data_t*)test->data)->evtsource != NULL);
 
+  aos_testresult_t result = {0, 0};  
+
+
+#if (BOARD_MIC9404x_CONNECTED == true)
+  // Enable 3.3V and 1.8V supply voltages for powering up the DW1000 module in AMiRo Light Ring
+  if ((test->data != NULL) && (((aos_test_dw1000data_t*)(test->data))->mic9404xd != NULL)){
+//      && (((aos_test_dw1000data_t*)(test->data))->driver == NULL)){
+    mic9404x_lld_state_t state;
+    uint32_t status = APAL_STATUS_OK;
+
+    chprintf(stream, "reading current status of the Power..\n");
+    status = mic9404x_lld_get(((aos_test_dw1000data_t*)(test->data))->mic9404xd, &state);
+    if (status == APAL_STATUS_OK) {
+      aosTestPassedMsg(stream, &result, "power %s\n", (state == MIC9404x_LLD_STATE_ON) ? "enabled" : "disabled");
+    } else {
+      aosTestFailed(stream, &result);
+    }
+    if (state == MIC9404x_LLD_STATE_OFF) {
+      chprintf(stream, "enabling the power ...\n");
+      status = mic9404x_lld_set(((aos_test_dw1000data_t*)(test->data))->mic9404xd, MIC9404x_LLD_STATE_ON);
+      status |= mic9404x_lld_get(((aos_test_dw1000data_t*)(test->data))->mic9404xd, &state);
+      if (state == MIC9404x_LLD_STATE_ON) {
+        aosThdSSleep(2);
+        status |= mic9404x_lld_get(((aos_test_dw1000data_t*)(test->data))->mic9404xd, &state);
+      }
+      if ((status == APAL_STATUS_OK) && (state == MIC9404x_LLD_STATE_ON)) {
+        aosTestPassed(stream, &result);
+      } else {
+        aosTestFailed(stream, &result);
+      }
+    }
+    aosThdSleep(1);
+    return result;
+  }
+#endif  /* BOARD_MIC9404x_CONNECTED == true */
 
-  aos_testresult_t result = {0, 0};
 
   chprintf(stream, "init DW1000...\n");
   dwt_initialise(DWT_LOADUCODE, ((aos_test_dw1000data_t*)test->data)->driver);
   aosThdMSleep(5);
 
-
 /*! Test snippets for DW1000.
  * @Note: Event IRQ for DW1000 should be tested separately
  */
diff --git a/test/periphery-lld/DW1000_v1/aos_test_DW1000.h b/test/periphery-lld/DW1000_v1/aos_test_DW1000.h
index be0a6db..0fdbcd6 100644
--- a/test/periphery-lld/DW1000_v1/aos_test_DW1000.h
+++ b/test/periphery-lld/DW1000_v1/aos_test_DW1000.h
@@ -44,6 +44,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /**
  * @brief   Custom data structure for the test.
  */
+#if (BOARD_MIC9404x_CONNECTED == true)
 typedef struct {
   /**
    * @brief   Pointer to the driver to use.
@@ -60,8 +61,34 @@ typedef struct {
    */
   eventflags_t evtflags;
 
+  /**
+   * @brief MIC9404x driver to use.
+  */
+  MIC9404xDriver  *mic9404xd;
+
 } aos_test_dw1000data_t;
 
+#else
+typedef struct {
+  /**
+   * @brief   Pointer to the driver to use.
+   */
+  DW1000Driver* driver;
+
+  /**
+   * @brief   Event source to listen to.
+   */
+  event_source_t* evtsource;
+
+  /**
+   * @brief   Event flags to watch.
+   */
+  eventflags_t evtflags;
+
+} aos_test_dw1000data_t;
+
+#endif /* BOARD_MIC9404x_CONNECTED == true  */
+
 /******************************************************************************/
 /* MACROS                                                                     */
 /******************************************************************************/
@@ -85,7 +112,6 @@ extern "C" {
   int32_t inittestapplication(uint8_t s1switch, DW1000Driver* drv);
   int decarangingmode(uint8_t s1switch);
   void addressconfigure(uint8_t s1switch, uint8_t mode);
-  void reset_DW1000(void);
 
 #if defined(__cplusplus)
 }
