From 29c392d52d0e57e06c3cb098ed1c6e4e0228380b Mon Sep 17 00:00:00 2001 From: Akshai M Date: Fri, 9 Jul 2021 11:10:49 +0200 Subject: [PATCH] drivers/sx126x : Uncrustify --- drivers/sx126x/sx126x.c | 4 +++- drivers/sx126x/sx126x_netdev.c | 2 ++ pkg/driver_sx126x/contrib/driver_sx126x_hal.c | 17 ++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/sx126x/sx126x.c b/drivers/sx126x/sx126x.c index 990e45f80f..c7fefd0fa3 100644 --- a/drivers/sx126x/sx126x.c +++ b/drivers/sx126x/sx126x.c @@ -87,7 +87,9 @@ static const uint16_t _bw_khz[3] = { static uint8_t _compute_ldro(sx126x_t *dev) { - uint32_t symbol_len = (uint32_t)(1 << dev->mod_params.sf) / _bw_khz[dev->mod_params.bw - SX126X_LORA_BW_125]; + uint32_t symbol_len = + (uint32_t)(1 << dev->mod_params.sf) / _bw_khz[dev->mod_params.bw - SX126X_LORA_BW_125]; + if (symbol_len >= 16) { return 0x01; } diff --git a/drivers/sx126x/sx126x_netdev.c b/drivers/sx126x/sx126x_netdev.c index cc11b3f388..ae8f53d94d 100644 --- a/drivers/sx126x/sx126x_netdev.c +++ b/drivers/sx126x/sx126x_netdev.c @@ -63,6 +63,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist) } size_t pos = 0; + /* Write payload buffer */ for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) { if (iol->iol_len > 0) { @@ -125,6 +126,7 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) static int _init(netdev_t *netdev) { sx126x_t *dev = (sx126x_t *)netdev; + if (sx126x_is_stm32wl(dev)) { #if IS_USED(MODULE_SX126X_STM32WL) _dev = netdev; diff --git a/pkg/driver_sx126x/contrib/driver_sx126x_hal.c b/pkg/driver_sx126x/contrib/driver_sx126x_hal.c index d038b87125..4e9c2ea265 100644 --- a/pkg/driver_sx126x/contrib/driver_sx126x_hal.c +++ b/pkg/driver_sx126x/contrib/driver_sx126x_hal.c @@ -46,15 +46,14 @@ #if IS_USED(MODULE_SX126X_STM32WL) static uint8_t sx126x_radio_wait_until_ready(sx126x_t *dev) { - if (dev->radio_sleep == true) - { - DEBUG("[sx126x_radio] : Wakeup radio \n"); - sx126x_hal_wakeup(dev); - } + if (dev->radio_sleep == true) { + DEBUG("[sx126x_radio] : Wakeup radio \n"); + sx126x_hal_wakeup(dev); + } - /* Wait until Busy/ BusyMS signal goes low */ - while (((PWR->SR2 & PWR_SR2_RFBUSYMS) && ((PWR->SR2 & PWR_SR2_RFBUSYS))) == 1) {} - return 0; + /* Wait until Busy/ BusyMS signal goes low */ + while (((PWR->SR2 & PWR_SR2_RFBUSYMS) && ((PWR->SR2 & PWR_SR2_RFBUSYS))) == 1) {} + return 0; } #endif @@ -157,7 +156,7 @@ sx126x_hal_status_t sx126x_hal_reset(const void *context) RCC->CSR &= ~RCC_CSR_RFRST; ztimer_sleep(ZTIMER_USEC, 100); /* Wait while reset is done */ - while((RCC->CSR & RCC_CSR_RFRSTF) != 0UL) {} + while ((RCC->CSR & RCC_CSR_RFRSTF) != 0UL) {} /* Asserts the reset signal of the Radio peripheral */ PWR->SUBGHZSPICR |= PWR_SUBGHZSPICR_NSS;