This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6255f2a474353cec9188e46ce93eea346670d666
Author: raiden00pl <[email protected]>
AuthorDate: Mon Sep 21 12:15:50 2026 +0200

    stm32l5: Fix nxstyle errors in drivers and board LEDs
    
    Correct switch and declaration indentation, separate declarations from code,
    and wrap a long comment in the SPI driver. Fix the timer driver and both
    STM32L5 board LED implementations checked by the commonization PR.
    
    These are formatting changes only.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/stm32l5/stm32l5_spi.c                 | 100 +++++++++---------
 arch/arm/src/stm32l5/stm32l5_tim.c                 |  15 ++-
 .../arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c | 110 ++++++++++----------
 .../arm/stm32l5/stm32l562e-dk/src/stm32_autoleds.c | 112 ++++++++++-----------
 4 files changed, 172 insertions(+), 165 deletions(-)

diff --git a/arch/arm/src/stm32l5/stm32l5_spi.c 
b/arch/arm/src/stm32l5/stm32l5_spi.c
index 5e08abc7a37..88f25011ead 100644
--- a/arch/arm/src/stm32l5/stm32l5_spi.c
+++ b/arch/arm/src/stm32l5/stm32l5_spi.c
@@ -1101,39 +1101,39 @@ static void spi_setmode(struct spi_dev_s *dev, enum 
spi_mode_e mode)
 
       switch (mode)
         {
-        case SPIDEV_MODE0: /* CPOL=0; CPHA=0 */
-          setbits = 0;
-          clrbits = SPI_CR1_CPOL | SPI_CR1_CPHA;
-          break;
-
-        case SPIDEV_MODE1: /* CPOL=0; CPHA=1 */
-          setbits = SPI_CR1_CPHA;
-          clrbits = SPI_CR1_CPOL;
-          break;
-
-        case SPIDEV_MODE2: /* CPOL=1; CPHA=0 */
-          setbits = SPI_CR1_CPOL;
-          clrbits = SPI_CR1_CPHA;
-          break;
-
-        case SPIDEV_MODE3: /* CPOL=1; CPHA=1 */
-          setbits = SPI_CR1_CPOL | SPI_CR1_CPHA;
-          clrbits = 0;
-          break;
-
-        default:
-          return;
+          case SPIDEV_MODE0: /* CPOL=0; CPHA=0 */
+            setbits = 0;
+            clrbits = SPI_CR1_CPOL | SPI_CR1_CPHA;
+            break;
+
+          case SPIDEV_MODE1: /* CPOL=0; CPHA=1 */
+            setbits = SPI_CR1_CPHA;
+            clrbits = SPI_CR1_CPOL;
+            break;
+
+          case SPIDEV_MODE2: /* CPOL=1; CPHA=0 */
+            setbits = SPI_CR1_CPOL;
+            clrbits = SPI_CR1_CPHA;
+            break;
+
+          case SPIDEV_MODE3: /* CPOL=1; CPHA=1 */
+            setbits = SPI_CR1_CPOL | SPI_CR1_CPHA;
+            clrbits = 0;
+            break;
+
+          default:
+            return;
         }
 
-        spi_modifycr(STM32_SPI_CR1_OFFSET, priv, 0, SPI_CR1_SPE);
-        spi_modifycr(STM32_SPI_CR1_OFFSET, priv, setbits, clrbits);
-        spi_modifycr(STM32_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0);
+      spi_modifycr(STM32_SPI_CR1_OFFSET, priv, 0, SPI_CR1_SPE);
+      spi_modifycr(STM32_SPI_CR1_OFFSET, priv, setbits, clrbits);
+      spi_modifycr(STM32_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0);
 
-        /* Save the mode so that subsequent re-configurations will be
-         * faster
-         */
+      /* Save the mode so that subsequent re-configurations will be
+       * faster
+       */
 
-        priv->mode = mode;
+      priv->mode = mode;
     }
 }
 
@@ -1364,6 +1364,7 @@ static void spi_exchange_nodma(struct spi_dev_s *dev,
 #endif
 {
   struct stm32_spidev_s *priv = (struct stm32_spidev_s *)dev;
+
   DEBUGASSERT(priv && priv->spibase);
 
   spiinfo("txbuffer=%p rxbuffer=%p nwords=%d\n", txbuffer, rxbuffer, nwords);
@@ -1375,8 +1376,8 @@ static void spi_exchange_nodma(struct spi_dev_s *dev,
       /* 16-bit mode */
 
       const uint16_t *src  = (const uint16_t *)txbuffer;
-            uint16_t *dest = (uint16_t *)rxbuffer;
-            uint16_t  word;
+      uint16_t *dest = (uint16_t *)rxbuffer;
+      uint16_t  word;
 
       while (nwords-- > 0)
         {
@@ -1408,8 +1409,8 @@ static void spi_exchange_nodma(struct spi_dev_s *dev,
       /* 8-bit mode */
 
       const uint8_t *src  = (const uint8_t *)txbuffer;
-            uint8_t *dest = (uint8_t *)rxbuffer;
-            uint8_t  word;
+      uint8_t *dest = (uint8_t *)rxbuffer;
+      uint8_t  word;
 
       while (nwords-- > 0)
         {
@@ -1662,30 +1663,31 @@ static int spi_pm_prepare(struct pm_callback_s *cb, int 
domain,
 
   switch (pmstate)
     {
-    case PM_NORMAL:
-    case PM_IDLE:
-      break;
+      case PM_NORMAL:
+      case PM_IDLE:
+        break;
 
-    case PM_STANDBY:
-    case PM_SLEEP:
+      case PM_STANDBY:
+      case PM_SLEEP:
 
-      /* Check if exclusive lock for SPI bus is held. */
+        /* Check if exclusive lock for SPI bus is held. */
 
-      if (nxmutex_is_locked(&priv->lock))
-        {
-          /* Exclusive lock is held, do not allow entry to deeper PM states.
-           */
+        if (nxmutex_is_locked(&priv->lock))
+          {
+            /* Exclusive lock is held, do not allow entry to deeper PM
+             * states.
+             */
 
-          return -EBUSY;
-        }
+            return -EBUSY;
+          }
 
-      break;
+        break;
 
-    default:
+      default:
 
-      /* Should not get here */
+        /* Should not get here */
 
-      break;
+        break;
     }
 
   return OK;
diff --git a/arch/arm/src/stm32l5/stm32l5_tim.c 
b/arch/arm/src/stm32l5/stm32l5_tim.c
index 4e31b52501a..e9f4948ad12 100644
--- a/arch/arm/src/stm32l5/stm32l5_tim.c
+++ b/arch/arm/src/stm32l5/stm32l5_tim.c
@@ -484,6 +484,7 @@ static inline void stm32_putreg32(struct stm32_tim_dev_s 
*dev,
 static void stm32_tim_reload_counter(struct stm32_tim_dev_s *dev)
 {
   uint16_t val = stm32_getreg16(dev, STM32_GTIM_EGR_OFFSET);
+
   val |= GTIM_EGR_UG;
   stm32_putreg16(dev, STM32_GTIM_EGR_OFFSET, val);
 }
@@ -495,6 +496,7 @@ static void stm32_tim_reload_counter(struct stm32_tim_dev_s 
*dev)
 static void stm32_tim_enable(struct stm32_tim_dev_s *dev)
 {
   uint16_t val = stm32_getreg16(dev, STM32_GTIM_CR1_OFFSET);
+
   val |= GTIM_CR1_CEN;
   stm32_tim_reload_counter(dev);
   stm32_putreg16(dev, STM32_GTIM_CR1_OFFSET, val);
@@ -507,6 +509,7 @@ static void stm32_tim_enable(struct stm32_tim_dev_s *dev)
 static void stm32_tim_disable(struct stm32_tim_dev_s *dev)
 {
   uint16_t val = stm32_getreg16(dev, STM32_GTIM_CR1_OFFSET);
+
   val &= ~GTIM_CR1_CEN;
   stm32_putreg16(dev, STM32_GTIM_CR1_OFFSET, val);
 }
@@ -616,11 +619,11 @@ static int stm32_tim_setmode(struct stm32_tim_dev_s *dev,
 #if STM32_NATIM > 0
   /* Advanced registers require Main Output Enable */
 
-    if (((struct stm32_tim_priv_s *)dev)->base == STM32_TIM1_BASE ||
-        ((struct stm32_tim_priv_s *)dev)->base == STM32_TIM8_BASE)
-      {
-        stm32_modifyreg16(dev, STM32_ATIM_BDTR_OFFSET, 0, ATIM_BDTR_MOE);
-      }
+  if (((struct stm32_tim_priv_s *)dev)->base == STM32_TIM1_BASE ||
+      ((struct stm32_tim_priv_s *)dev)->base == STM32_TIM8_BASE)
+    {
+      stm32_modifyreg16(dev, STM32_ATIM_BDTR_OFFSET, 0, ATIM_BDTR_MOE);
+    }
 #endif
 
   return OK;
@@ -759,6 +762,7 @@ static uint32_t stm32_tim_getclock(struct stm32_tim_dev_s 
*dev)
 {
   uint32_t freqin;
   uint32_t clock;
+
   DEBUGASSERT(dev != NULL);
 
   /* Get the input clock frequency for this timer.  These vary with
@@ -1490,6 +1494,7 @@ static int stm32_tim_checkint(struct stm32_tim_dev_s *dev,
                                 int source)
 {
   uint16_t regval = stm32_getreg16(dev, STM32_GTIM_SR_OFFSET);
+
   return (regval & GTIM_SR_UIF) ? 1 : 0;
 }
 
diff --git a/boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c 
b/boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c
index a64b0cfd9aa..67f58602c19 100644
--- a/boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c
+++ b/boards/arm/stm32l5/nucleo-l552ze/src/stm32_autoleds.c
@@ -95,43 +95,43 @@ void board_autoled_on(int led)
 {
   switch (led)
     {
-    default:
-      break;
-
-    case LED_HEAPALLOCATE:
-      phy_set_led(BOARD_LED_BLUE, true);
-      break;
-
-    case LED_IRQSENABLED:
-      phy_set_led(BOARD_LED_BLUE, false);
-      phy_set_led(BOARD_LED_GREEN, true);
-      break;
-
-    case LED_STACKCREATED:
-      phy_set_led(BOARD_LED_GREEN, true);
-      phy_set_led(BOARD_LED_BLUE, true);
-      break;
-
-    case LED_INIRQ:
-      phy_set_led(BOARD_LED_BLUE, true);
-      break;
-
-    case LED_SIGNAL:
-      phy_set_led(BOARD_LED_GREEN, true);
-      break;
-
-    case LED_ASSERTION:
-      phy_set_led(BOARD_LED_RED, true);
-      phy_set_led(BOARD_LED_BLUE, true);
-      break;
-
-    case LED_PANIC:
-      phy_set_led(BOARD_LED_RED, true);
-      break;
-
-    case LED_IDLE:
-      phy_set_led(BOARD_LED_RED, true);
-      break;
+      default:
+        break;
+
+      case LED_HEAPALLOCATE:
+        phy_set_led(BOARD_LED_BLUE, true);
+        break;
+
+      case LED_IRQSENABLED:
+        phy_set_led(BOARD_LED_BLUE, false);
+        phy_set_led(BOARD_LED_GREEN, true);
+        break;
+
+      case LED_STACKCREATED:
+        phy_set_led(BOARD_LED_GREEN, true);
+        phy_set_led(BOARD_LED_BLUE, true);
+        break;
+
+      case LED_INIRQ:
+        phy_set_led(BOARD_LED_BLUE, true);
+        break;
+
+      case LED_SIGNAL:
+        phy_set_led(BOARD_LED_GREEN, true);
+        break;
+
+      case LED_ASSERTION:
+        phy_set_led(BOARD_LED_RED, true);
+        phy_set_led(BOARD_LED_BLUE, true);
+        break;
+
+      case LED_PANIC:
+        phy_set_led(BOARD_LED_RED, true);
+        break;
+
+      case LED_IDLE:
+        phy_set_led(BOARD_LED_RED, true);
+        break;
     }
 }
 
@@ -143,29 +143,29 @@ void board_autoled_off(int led)
 {
   switch (led)
     {
-    default:
-      break;
+      default:
+        break;
 
-    case LED_SIGNAL:
-      phy_set_led(BOARD_LED_GREEN, false);
-      break;
+      case LED_SIGNAL:
+        phy_set_led(BOARD_LED_GREEN, false);
+        break;
 
-    case LED_INIRQ:
-      phy_set_led(BOARD_LED_BLUE, false);
-      break;
+      case LED_INIRQ:
+        phy_set_led(BOARD_LED_BLUE, false);
+        break;
 
-    case LED_ASSERTION:
-      phy_set_led(BOARD_LED_RED, false);
-      phy_set_led(BOARD_LED_BLUE, false);
-      break;
+      case LED_ASSERTION:
+        phy_set_led(BOARD_LED_RED, false);
+        phy_set_led(BOARD_LED_BLUE, false);
+        break;
 
-    case LED_PANIC:
-      phy_set_led(BOARD_LED_RED, false);
-      break;
+      case LED_PANIC:
+        phy_set_led(BOARD_LED_RED, false);
+        break;
 
-    case LED_IDLE:
-      phy_set_led(BOARD_LED_RED, false);
-      break;
+      case LED_IDLE:
+        phy_set_led(BOARD_LED_RED, false);
+        break;
     }
 }
 
diff --git a/boards/arm/stm32l5/stm32l562e-dk/src/stm32_autoleds.c 
b/boards/arm/stm32l5/stm32l562e-dk/src/stm32_autoleds.c
index 9419d7506bd..64914b462ac 100644
--- a/boards/arm/stm32l5/stm32l562e-dk/src/stm32_autoleds.c
+++ b/boards/arm/stm32l5/stm32l562e-dk/src/stm32_autoleds.c
@@ -94,44 +94,44 @@ void board_autoled_on(int led)
 {
   switch (led)
     {
-    default:
-      break;
-
-    case LED_HEAPALLOCATE:
-      phy_set_led(BOARD_LED_RED, true);
-      phy_set_led(BOARD_LED_GREEN, false);
-      break;
-
-    case LED_IRQSENABLED:
-      phy_set_led(BOARD_LED_RED, true);
-      phy_set_led(BOARD_LED_GREEN, true);
-      break;
-
-    case LED_STACKCREATED:
-      phy_set_led(BOARD_LED_RED, false);
-      phy_set_led(BOARD_LED_GREEN, true);
-      break;
-
-    case LED_INIRQ:
-      phy_set_led(BOARD_LED_RED, true);
-      break;
-
-    case LED_SIGNAL:
-      phy_set_led(BOARD_LED_RED, true);
-      break;
-
-    case LED_ASSERTION:
-      phy_set_led(BOARD_LED_RED, true);
-      break;
-
-    case LED_PANIC:
-      phy_set_led(BOARD_LED_RED, true);
-      phy_set_led(BOARD_LED_GREEN, false);
-      break;
-
-    case LED_IDLE:
-      phy_set_led(BOARD_LED_GREEN, true);
-      break;
+      default:
+        break;
+
+      case LED_HEAPALLOCATE:
+        phy_set_led(BOARD_LED_RED, true);
+        phy_set_led(BOARD_LED_GREEN, false);
+        break;
+
+      case LED_IRQSENABLED:
+        phy_set_led(BOARD_LED_RED, true);
+        phy_set_led(BOARD_LED_GREEN, true);
+        break;
+
+      case LED_STACKCREATED:
+        phy_set_led(BOARD_LED_RED, false);
+        phy_set_led(BOARD_LED_GREEN, true);
+        break;
+
+      case LED_INIRQ:
+        phy_set_led(BOARD_LED_RED, true);
+        break;
+
+      case LED_SIGNAL:
+        phy_set_led(BOARD_LED_RED, true);
+        break;
+
+      case LED_ASSERTION:
+        phy_set_led(BOARD_LED_RED, true);
+        break;
+
+      case LED_PANIC:
+        phy_set_led(BOARD_LED_RED, true);
+        phy_set_led(BOARD_LED_GREEN, false);
+        break;
+
+      case LED_IDLE:
+        phy_set_led(BOARD_LED_GREEN, true);
+        break;
     }
 }
 
@@ -143,29 +143,29 @@ void board_autoled_off(int led)
 {
   switch (led)
     {
-    default:
-      break;
+      default:
+        break;
 
-    case LED_SIGNAL:
-      phy_set_led(BOARD_LED_RED, false);
-      break;
+      case LED_SIGNAL:
+        phy_set_led(BOARD_LED_RED, false);
+        break;
 
-    case LED_INIRQ:
-      phy_set_led(BOARD_LED_RED, false);
-      break;
+      case LED_INIRQ:
+        phy_set_led(BOARD_LED_RED, false);
+        break;
 
-    case LED_ASSERTION:
-      phy_set_led(BOARD_LED_RED, false);
-      break;
+      case LED_ASSERTION:
+        phy_set_led(BOARD_LED_RED, false);
+        break;
 
-    case LED_PANIC:
-      phy_set_led(BOARD_LED_RED, false);
-      phy_set_led(BOARD_LED_GREEN, false);
-      break;
+      case LED_PANIC:
+        phy_set_led(BOARD_LED_RED, false);
+        phy_set_led(BOARD_LED_GREEN, false);
+        break;
 
-    case LED_IDLE:
-      phy_set_led(BOARD_LED_GREEN, false);
-      break;
+      case LED_IDLE:
+        phy_set_led(BOARD_LED_GREEN, false);
+        break;
     }
 }
 

Reply via email to