commit c930aa01925ac14b62fd0d4636797f703c5a339a
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Fri May 17 17:51:16 2019 +0200

    The TLC5947 unit test will now always take the same time, regardless the number of LEDs.
    Added the LIGHT_XLAT signal to LightRing v1.0 and v1.2 modules.

diff --git a/modules/LightRing_1-0/board.h b/modules/LightRing_1-0/board.h
index b9385ea..07ee007 100644
--- a/modules/LightRing_1-0/board.h
+++ b/modules/LightRing_1-0/board.h
@@ -301,7 +301,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * PB4  - PIN4                      (input floating)
  * PB5  - LASER_OC_N                (input floating)
  * PB6  - SYS_UART_DN               (output opendrain high 50MHz)
- * PB7  - PIN7                      (input foating)
+ * PB7  - PIN7                      (input floating)
  * PB8  - WL_GDO2                   (input pullup)
  * PB9  - WL_GDO0                   (input pullup)
  * PB10 - MEM_SCL                   (alternate opendrain 50MHz)
@@ -352,7 +352,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * PC1  - PIN1                      (input floating)
  * PC2  - PIN2                      (input floating)
  * PC3  - PIN3                      (input floating)
- * PC4  - LIGHT_XLAT                (output pushpull high 10MHz)
+ * PC4  - LIGHT_XLAT                (output pushpull low 50MHz)
  * PC5  - PIN5                      (input floating)
  * PC6  - PIN6                      (input floating)
  * PC7  - PIN7                      (input floating)
@@ -370,7 +370,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                                      PIN_CR(GPIOC_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
                                      PIN_CR(GPIOC_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
                                      PIN_CR(GPIOC_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
-                                     PIN_CR(GPIOC_LIGHT_XLAT, PIN_MODE_OUTPUT_10M, PIN_CNF_OUTPUT_PUSHPULL) |    \
+                                     PIN_CR(GPIOC_LIGHT_XLAT, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |    \
                                      PIN_CR(GPIOC_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
                                      PIN_CR(GPIOC_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
                                      PIN_CR(GPIOC_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
diff --git a/modules/LightRing_1-0/module.c b/modules/LightRing_1-0/module.c
index f67548a..553c8ea 100644
--- a/modules/LightRing_1-0/module.c
+++ b/modules/LightRing_1-0/module.c
@@ -176,6 +176,21 @@ ROMCONST apalControlGpio_t moduleGpioWlGdo0 = {
 };
 
 /**
+ * @brief   LIGHT_XLAT output signal GPIO.
+ */
+static apalGpio_t _gpioLightXlat = {
+  /* line */ LINE_LIGHT_XLAT,
+};
+ROMCONST apalControlGpio_t moduleGpioLightXlat = {
+  /* GPIO */ &_gpioLightXlat,
+  /* meta */ {
+    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
+    /* active state   */ (TLC5947_LLD_XLAT_UPDATE_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
+    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
+  },
+};
+
+/**
  * @brief   SYS_PD bidirectional signal GPIO.
  */
 static apalGpio_t _gpioSysPd = {
@@ -244,7 +259,7 @@ AT24C01BDriver moduleLldEeprom = {
 TLC5947Driver moduleLldLedPwm = {
   /* SPI driver         */ &MODULE_HAL_SPI_LIGHT,
   /* BLANK signal GPIO  */ &moduleGpioLightBlank,
-  /* XLAT signal GPIO   */ NULL,
+  /* XLAT signal GPIO   */ &moduleGpioLightXlat,
 };
 
 TPS20xxBDriver moduleLldPowerSwitchLaser = {
diff --git a/modules/LightRing_1-0/module.h b/modules/LightRing_1-0/module.h
index fbcbb64..9031297 100644
--- a/modules/LightRing_1-0/module.h
+++ b/modules/LightRing_1-0/module.h
@@ -140,6 +140,11 @@ extern ROMCONST apalControlGpio_t moduleGpioWlGdo2;
 extern ROMCONST apalControlGpio_t moduleGpioWlGdo0;
 
 /**
+ * @brief   LIGHT_XLAT output signal.
+ */
+extern ROMCONST apalControlGpio_t moduleGpioLightXlat;
+
+/**
  * @brief   SYS_PD bidirectional signal GPIO.
  */
 extern ROMCONST apalControlGpio_t moduleGpioSysPd;
@@ -208,7 +213,7 @@ extern ROMCONST char* moduleShellPrompt;
   palEnableLineEvent(moduleGpioWlGdo2.gpio->line, APAL2CH_EDGE(moduleGpioWlGdo2.meta.edge));                \
   /* WL_GDO0 */                                                               \
   palSetLineCallback(moduleGpioWlGdo0.gpio->line, aosSysGetStdIntCallback(), &moduleGpioWlGdo0.gpio->line); \
-  palEnableLineEvent(moduleGpioWlGdo0.gpio->line, APAL2CH_EDGE(moduleGpioWlGdo0.meta.edge));                \
+  /*palEnableLineEvent(moduleGpioWlGdo0.gpio->line, APAL2CH_EDGE(moduleGpioWlGdo0.meta.edge)); // this is broken for some reason*/  \
 }
 
 /**
diff --git a/modules/LightRing_1-2/module.c b/modules/LightRing_1-2/module.c
index f0f3dbc..3338011 100644
--- a/modules/LightRing_1-2/module.c
+++ b/modules/LightRing_1-2/module.c
@@ -303,6 +303,21 @@ ROMCONST apalControlGpio_t moduleGpioLed = {
 };
 
 /**
+ * @brief   LIGHT_XLAT output signal GPIO.
+ */
+static apalGpio_t _gpioLightXlat = {
+  /* line */ LINE_LIGHT_XLAT,
+};
+ROMCONST apalControlGpio_t moduleGpioLightXlat = {
+  /* GPIO */ &_gpioLightXlat,
+  /* meta */ {
+    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
+    /* active state   */ (TLC5947_LLD_XLAT_UPDATE_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
+    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
+  },
+};
+
+/**
  * @brief   SW_V18_EN output signal GPIO.
  */
 static apalGpio_t _gpioSwV18En = {
@@ -447,7 +462,7 @@ MIC9404xDriver moduleLldPowerSwitchVsys = {
 TLC5947Driver moduleLldLedPwm = {
   /* SPI driver         */ &MODULE_HAL_SPI_LIGHT,
   /* BLANK signal GPIO  */ &moduleGpioLightBlank,
-  /* XLAT signal GPIO   */ NULL,
+  /* XLAT signal GPIO   */ &moduleGpioLightXlat,
 };
 
 /** @} */
diff --git a/modules/LightRing_1-2/module.h b/modules/LightRing_1-2/module.h
index f239269..6d0b19c 100644
--- a/modules/LightRing_1-2/module.h
+++ b/modules/LightRing_1-2/module.h
@@ -185,6 +185,11 @@ extern apalControlGpio_t moduleGpioBreakoutIo2;
 extern ROMCONST apalControlGpio_t moduleGpioLed;
 
 /**
+ * @brief   LIGHT_XLAT output signal.
+ */
+extern ROMCONST apalControlGpio_t moduleGpioLightXlat;
+
+/**
  * @brief   SW_V18_EN output signal GPIO.
  */
 extern ROMCONST apalControlGpio_t moduleGpioSwV18En;
diff --git a/unittests/periphery-lld/src/ut_alld_TLC5947_v1.c b/unittests/periphery-lld/src/ut_alld_TLC5947_v1.c
index e303d45..bf931e2 100644
--- a/unittests/periphery-lld/src/ut_alld_TLC5947_v1.c
+++ b/unittests/periphery-lld/src/ut_alld_TLC5947_v1.c
@@ -61,7 +61,7 @@ aos_utresult_t utAlldTlc5947Func(BaseSequentialStream *stream, aos_unittest_t *u
 
   // local variables
   aos_utresult_t result = {0, 0};
-  uint32_t status = 0;
+  int32_t status = 0;
   tlc5947_lld_blank_t blank;
   tlc5947_lld_buffer_t buffer;
 
@@ -150,7 +150,7 @@ aos_utresult_t utAlldTlc5947Func(BaseSequentialStream *stream, aos_unittest_t *u
       tlc5947_lld_setBuffer(&buffer, channel, value);
       status |= tlc5947_lld_write((TLC5947Driver*)ut->data, &buffer);
       status |= tlc5947_lld_update((TLC5947Driver*)ut->data);
-      aosThdSleep(1.0f / 3.0f);
+      aosThdSleep(10.0f / TLC5947_LLD_NUM_CHANNELS / 3.0f);
       tlc5947_lld_setBuffer(&buffer, channel, 0);
     }
   }
@@ -162,17 +162,17 @@ aos_utresult_t utAlldTlc5947Func(BaseSequentialStream *stream, aos_unittest_t *u
 
   chprintf(stream, "setting one color after another...\n");
   status = APAL_STATUS_OK;
-  for (int8_t color = 0; color < 3; ++color) {
+  for (uint8_t color = 0; color < 3; ++color) {
     for (uint8_t channel = color; channel < TLC5947_LLD_NUM_CHANNELS; channel += 3) {
       const uint16_t val = 0xAF5u; // some deterministic value with high entropy
       tlc5947_lld_setBuffer(&buffer, channel, val);
       status |= tlc5947_lld_write((TLC5947Driver*)ut->data, &buffer);
       status |= tlc5947_lld_update((TLC5947Driver*)ut->data);
-      status |= (tlc5947_lld_getBuffer(&buffer, channel) != val) ? (1 << 31) : 0;
+      status |= (tlc5947_lld_getBuffer(&buffer, channel) != val) ? ((int32_t)1 << 30) : 0;
       if (status != APAL_STATUS_OK) {
         break;
       } else {
-        aosThdSleep(1.0f / 8.0f);
+        aosThdSleep(10.0f / TLC5947_LLD_NUM_CHANNELS / 3.0f);
       }
     }
     for (uint8_t channel = 0; channel < TLC5947_LLD_NUM_CHANNELS; ++channel) {
