commit c60ee2dd42ef601c9012795103f9780c67fe10ca
Author: Julia Niermann <jniermann@techfak.uni-bielefeld.de>
Date:   Fri Aug 9 10:33:37 2019 +0200

    Improve tests and adjust to new structure

diff --git a/modules/LightRing_1-2/module.c b/modules/LightRing_1-2/module.c
index 4aa0092..ef43352 100644
--- a/modules/LightRing_1-2/module.c
+++ b/modules/LightRing_1-2/module.c
@@ -509,33 +509,12 @@ AOS_SHELL_COMMAND(moduleTestIna219ShellCmd, "test:PowerMonitor", _testIna219Shel
 /*
  * P9221R (qi charger)
  */
-//static int _utShellCmdCb_AlldP9221r(BaseSequentialStream* stream, int argc, char* argv[])
-//{
-//  (void)argc;
-//  (void)argv;
-//  aosTestRun(stream, &moduleTestP9221r, NULL);
-//  return AOS_OK;
-//}
-//static ut_p9221rdata_t _utP9221rData = {
-//  /* driver           */ &moduleQiCharger, // !!!!
-//  /* x alignment      */ 0.0f,
-//  /* y alignment      */ 0.0f,
-//  /* op freq          */ 0.0f,
-//  /* voltage          */ 0.0f,
-//  /* current          */ 0.0f,
-//  /* timeout */ MICROSECONDS_PER_SECOND,
-//};
-//aos_unittest_t moduleTestP9221r = {
-//    /* name           */ "P9221R",
-//    /* info           */ "qi charger",
-//    /* test function  */ aosTestP9221rFunc,
-//    /* shell command  */ {
-//      /* name     */ "unittest:QiCharger",
-//      /* callback */ _utShellCmdCb_AlldP9221r,
-//      /* next     */ NULL,
-//    },
-//    /* data           */ &_utP9221rData,
-//};
+#include <module_test_P9221R.h>
+static int _testP9221rShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
+{
+  return moduleTestP9221rShellCb(stream, argc, argv, NULL);
+}
+AOS_SHELL_COMMAND(moduleTestP9221rShellCmd, "test:QiCharger", _testP9221rShellCmdCb);
 
 /*
  * Status LED
diff --git a/modules/LightRing_1-2/module.h b/modules/LightRing_1-2/module.h
index 90c5fb5..c488da3 100644
--- a/modules/LightRing_1-2/module.h
+++ b/modules/LightRing_1-2/module.h
@@ -303,7 +303,7 @@ extern ROMCONST char* moduleShellPrompt;
   aosShellAddCommand(&aos.shell, &moduleTestIna219ShellCmd);                  \
   aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd);                     \
   aosShellAddCommand(&aos.shell, &moduleTestMic9404xShellCmd);                \
-  /*aosShellAddCommand(&aos.shell, &moduleTestP9221rShellCmd);*/                  \
+  aosShellAddCommand(&aos.shell, &moduleTestP9221rShellCmd);                 \
   aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd);                 \
   aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd);                     \
 }
diff --git a/modules/LightRing_1-2/test/P9221R/module_test_P9221R.c b/modules/LightRing_1-2/test/P9221R/module_test_P9221R.c
index 4a8c075..ac5f095 100644
--- a/modules/LightRing_1-2/test/P9221R/module_test_P9221R.c
+++ b/modules/LightRing_1-2/test/P9221R/module_test_P9221R.c
@@ -39,11 +39,17 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* LOCAL VARIABLES                                                            */
 /******************************************************************************/
 
-//static aos_test_leddata_t _data = {
-//  /* LED  */ &moduleLldStatusLed,
-//};
-
-//static AOS_TEST(_test, "LED", NULL, moduleTestLedShellCb, aosTestLedFunc, &_data);
+static aos_test_p9221rdata_t _data = {
+  /* driver           */ &moduleQiCharger, // !!!!
+  /* x alignment      */ 0.0f,
+  /* y alignment      */ 0.0f,
+  /* op freq          */ 0.0f,
+  /* voltage          */ 0.0f,
+  /* current          */ 0.0f,
+  /* timeout */ MICROSECONDS_PER_SECOND,
+};
+
+static AOS_TEST(_test, "P9221R", "qi charger", moduleTestP9221rShellCb, aosTestP9221rFunc, &_data);
 
 /******************************************************************************/
 /* LOCAL FUNCTIONS                                                            */
@@ -53,18 +59,18 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* EXPORTED FUNCTIONS                                                         */
 /******************************************************************************/
 
-//int moduleTestLedShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
-//{
-//  (void)argc;
-//  (void)argv;
-//
-//  if (result != NULL) {
-//    *result = aosTestRun(stream, &_test, NULL);
-//  } else {
-//    aosTestRun(stream, &_test, NULL);
-//  }
-//
-//  return AOS_OK;
-//}
+ int moduleTestP9221rShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result)
+{
+  (void)argc;
+  (void)argv;
+
+  if (result != NULL) {
+    *result = aosTestRun(stream, &_test, NULL);
+  } else {
+    aosTestRun(stream, &_test, NULL);
+  }
+
+  return AOS_OK;
+}
 
 #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */
diff --git a/modules/LightRing_1-2/test/P9221R/module_test_P9221R.h b/modules/LightRing_1-2/test/P9221R/module_test_P9221R.h
index 93de5de..590ebba 100644
--- a/modules/LightRing_1-2/test/P9221R/module_test_P9221R.h
+++ b/modules/LightRing_1-2/test/P9221R/module_test_P9221R.h
@@ -51,7 +51,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #if defined(__cplusplus)
 extern "C" {
 #endif /* defined(__cplusplus) */
-//  int moduleTestLedShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result);
+    int moduleTestP9221rShellCb(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result);
 #if defined(__cplusplus)
 }
 #endif /* defined(__cplusplus) */
diff --git a/test/periphery-lld/P9221R_v1/aos_test_P9221R.c b/test/periphery-lld/P9221R_v1/aos_test_P9221R.c
index 2d80407..1f1c8c3 100644
--- a/test/periphery-lld/P9221R_v1/aos_test_P9221R.c
+++ b/test/periphery-lld/P9221R_v1/aos_test_P9221R.c
@@ -56,8 +56,7 @@ aos_testresult_t aosTestP9221rFunc(BaseSequentialStream* stream, const aos_test_
     aos_testresult_t result = {0, 0};
     uint32_t status;
     uint8_t data[79] = {0xA5};
-    int8_t x_alignment[2] = {0xA5};
-    int8_t y_alignment[2] = {0xA5};
+    int8_t alignment[2] = {0xA5};
     float voltage[1];
     float current[1];
 
@@ -72,25 +71,12 @@ aos_testresult_t aosTestP9221rFunc(BaseSequentialStream* stream, const aos_test_
       aosTestFailed(stream, &result);
     }
 
-    chprintf(stream, "read x_alignment for five seconds, move receiver ... \n");
+    chprintf(stream, "read alignment for five seconds, move receiver ... \n");
     status = APAL_STATUS_SUCCESS;
     for (uint32_t i = 0; i <= 5; i++) {
-        status |=   p9221r_lld_read_x_alignment(((aos_test_p9221rdata_t*)test->data)->PRd, x_alignment, ((aos_test_p9221rdata_t*)test->data)->timeout);
-        chprintf(stream, "x_alignment %d \n", x_alignment[0]);
-        //aosTestPassed(stream, &result);
-        aosThdSSleep(1);
-    }
-    if(status == APAL_STATUS_SUCCESS) {
-      aosTestPassed(stream, &result);
-    } else {
-      aosTestFailed(stream, &result);
-    }
-
-    chprintf(stream, "read y_alignment for five seconds, move receiver ... \n");
-    status = APAL_STATUS_SUCCESS;
-    for (uint32_t i = 0; i <= 5; i++) {
-        status |= p9221r_lld_read_y_alignment(((aos_test_p9221rdata_t*)test->data)->PRd, y_alignment, ((aos_test_p9221rdata_t*)test->data)->timeout);
-        chprintf(stream, "y_alignment: %d \n", y_alignment[0]);
+        status |=   p9221r_lld_read_alignment(((aos_test_p9221rdata_t*)test->data)->PRd, alignment, ((aos_test_p9221rdata_t*)test->data)->timeout);
+        chprintf(stream, "x_alignment %2d \n", alignment[0]);
+        chprintf(stream, "y_alignment %2d \n", alignment[1]);
         //aosTestPassed(stream, &result);
         aosThdSSleep(1);
     }
