commit 77a3b16a89f7c2d2042f734c083101c3890049a2
Author: Julia Niermann <jniermann@techfak.uni-bielefeld.de>
Date:   Fri Jul 26 12:22:44 2019 +0200

    Make unittest interactive and add voltage and current readout

diff --git a/unittests/periphery-lld/src/ut_alld_P9221R_v1.c b/unittests/periphery-lld/src/ut_alld_P9221R_v1.c
index 5c82062..11e4f98 100644
--- a/unittests/periphery-lld/src/ut_alld_P9221R_v1.c
+++ b/unittests/periphery-lld/src/ut_alld_P9221R_v1.c
@@ -56,11 +56,10 @@ aos_utresult_t utAlldP9221rFunc(BaseSequentialStream* stream, aos_unittest_t* ut
     aos_utresult_t result = {0, 0};
     uint32_t status;
     uint8_t data[79] = {0xA5};
-    uint8_t alignment[20] = {0xA5};
-    int8_t x_alignment;
-    int8_t y_alignment;
-    int32_t voltage;
-    int32_t current;
+    int8_t x_alignment[2] = {0xA5};
+    int8_t y_alignment[2] = {0xA5};
+    float voltage[1];
+    float current[1];
 
     chprintf(stream, "read all registers...\n");
     status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_PARTNUMBER, data, 79, ((ut_p9221rdata_t*)ut->data)->timeout);
@@ -77,7 +76,7 @@ aos_utresult_t utAlldP9221rFunc(BaseSequentialStream* stream, aos_unittest_t* ut
     status = APAL_STATUS_SUCCESS;
     for (uint32_t i = 0; i <= 5; i++) {
         status |=   p9221r_lld_read_x_alignment(((ut_p9221rdata_t*)ut->data)->PRd, x_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
-        chprintf(stream, "x_alignment %d \n", x_alignment);
+        chprintf(stream, "x_alignment %d \n", x_alignment[0]);
         //aosUtPassed(stream, &result);
         aosThdSSleep(1);
     }
@@ -91,7 +90,7 @@ aos_utresult_t utAlldP9221rFunc(BaseSequentialStream* stream, aos_unittest_t* ut
     status = APAL_STATUS_SUCCESS;
     for (uint32_t i = 0; i <= 5; i++) {
         status |= p9221r_lld_read_y_alignment(((ut_p9221rdata_t*)ut->data)->PRd, y_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
-        chprintf(stream, "y_alignment: %d \n", y_alignment);
+        chprintf(stream, "y_alignment: %d \n", y_alignment[0]);
         //aosUtPassed(stream, &result);
         aosThdSSleep(1);
     }
@@ -101,32 +100,23 @@ aos_utresult_t utAlldP9221rFunc(BaseSequentialStream* stream, aos_unittest_t* ut
       aosUtFailed(stream, &result);
     }
 
-//     chprintf(stream, "read y_alignment... \n");
-//     status =  p9221r_lld_read_y_alignment(((ut_p9221rdata_t*)ut->data)->PRd, y_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
-//     if (status == APAL_STATUS_SUCCESS) {
-//       aosUtPassed(stream, &result);
-//       chprintf(stream, "y_alignment: %d \n", y_alignment);
-//     } else {
-//       aosUtFailed(stream, &result);
-//     }
-
-//     chprintf(stream, "read the voltage... \n");
-//     status =   p9221r_lld_read_voltage(const P9221RDriver* const p9221r, int32_t const voltage, const apalTime_t timeout);
-//     if (status == APAL_STATUS_SUCCESS) {
-//       aosUtPassed(stream, &result);
-//       chprintf(stream, "voltage: %d \n", voltage);
-//     } else {
-//       aosUtFailed(stream, &result);
-//     }
-
-//     chprintf(stream, "read the current... \n");
-//     status =  p9221r_lld_read_current(const P9221RDriver* const p9221r, int32_t const current, const apalTime_t timeout);
-//     if (status == APAL_STATUS_SUCCESS) {
-//       aosUtPassed(stream, &result);
-//       chprintf(stream, "current: %d \n", current);
-//     } else {
-//       aosUtFailed(stream, &result);
-//     }
+     chprintf(stream, "read the voltage... \n");
+     status =   p9221r_lld_read_voltage(((ut_p9221rdata_t*)ut->data)->PRd, voltage, ((ut_p9221rdata_t*)ut->data)->timeout);
+     if (status == APAL_STATUS_SUCCESS) {
+       aosUtPassed(stream, &result);
+       chprintf(stream, "voltage: %.2f \n", *voltage);
+     } else {
+       aosUtFailed(stream, &result);
+     }
+
+     chprintf(stream, "read the current... \n");
+     status =  p9221r_lld_read_current(((ut_p9221rdata_t*)ut->data)->PRd, current, ((ut_p9221rdata_t*)ut->data)->timeout);
+     if (status == APAL_STATUS_SUCCESS) {
+       aosUtPassed(stream, &result);
+       chprintf(stream, "current: %.2f \n", *current);
+     } else {
+       aosUtFailed(stream, &result);
+     }
 
     return result;
 }
