[riot-notifications] [RIOT-OS/RIOT] drivers/sx126x: Add support for Nucleo -WL55JC (#16579)

José Alamos notifications at github.com
Fri Jul 2 11:54:01 CEST 2021


@jia200x requested changes on this pull request.

another quick round

> + * @author      Akshai M <akshai.m at fu-berlin.de>
+ *
+ * @}
+ */
+
+#include <stdio.h>
+
+#include "board.h"
+#include "periph/gpio.h"
+
+#include "sx126x.h"
+
+void board_init(void)
+{
+    /* initialize the CPU */
+    cpu_init();

```suggestion
    board_common_nucleo_init();
```

Otherwise the LED macros won't work. This function also takes care of `cpu_init()`

> @@ -487,17 +487,16 @@ void stmclk_init_sysclk(void)
              ~100 kHz and the MSI clock to be based on MSISRANGE in RCC_CSR
              (instead of MSIRANGE in the RCC_CR) */
     RCC->CR = (RCC_CR_HSION);
-
+    /* Use VDDTCXO regulator, required always by Radio */

```suggestion
    /* Use VDDTCXO regulator, required by the radio and HSE */
```

> @@ -32,6 +32,20 @@
 extern "C" {
 #endif
 
+/**
+ * @note Forward declare the device descriptor, used by `set_rf_mode`

```suggestion
 * @note Forward declaration of the SX126x device descriptor
```

> +    void(*set_rf_mode)(sx126x_t *dev, sx126x_rf_mode_t rf_mode); /**< Interface
+    to set RF switch parameters */

```suggestion
    /**
     * @ brief  Interface to set RF switch parameters
     */
    void(*set_rf_mode)(sx126x_t *dev, sx126x_rf_mode_t rf_mode);
```

>      netdev_t netdev;                        /**< Netdev parent struct */
     sx126x_params_t *params;                /**< Initialization parameters */
     sx126x_pkt_params_lora_t pkt_params;    /**< Lora packet parameters */
     sx126x_mod_params_lora_t mod_params;    /**< Lora modulation parameters */
     uint32_t channel;                       /**< Current channel frequency (in Hz) */
     uint32_t rx_timeout;                    /**< RX timeout in ms */
-} sx126x_t;
+    bool radio_sleep;                       /**< Sub-GHz radio sleep status */

```suggestion
    bool radio_sleep;                       /**< radio sleep status */
```

This will be also required by NETOPT_STATE_SLEEP

> @@ -130,10 +130,12 @@ static void sx126x_init_default_config(sx126x_t *dev)
     sx126x_set_lora_pkt_params(dev, &dev->pkt_params);
 }
 
+#if IS_USED(MODULE_SX126X_SPI)

this module is not required anymore

> @@ -148,6 +150,7 @@ int sx126x_init(sx126x_t *dev)
 
     DEBUG("[sx126x] init: SPI_%i initialized with success\n", dev->params->spi);
 
+#if IS_USED(MODULE_SX126X_SPI)

ditto

>  }
 
 static int _init(netdev_t *netdev)
 {
     sx126x_t *dev = (sx126x_t *)netdev;
+    _dev = netdev;

if we are getting #16597 in, this should be adapted.

> +{
+    assert(dev && (dev->mod_params.bw <= SX126X_LORA_BW_500) && \
+           (dev->mod_params.bw >= SX126X_LORA_BW_125));
+
+    /* Refer section 4.1.1.7  Time on air in SX1276/77/78/79 datasheet */
+    return (symbols * (1 << (dev->mod_params.sf + 7 - dev->mod_params.bw)) / 1000);
+}
+
+/**
+ * @brief   Check if onboard SUBGHZ Radio is being used
+ *
+ * @param[in] dev                      Device descriptor of the driver
+ *
+ * @return True, if onboard SUBGHZ Radio is being used
+ */
+static inline bool IS_SUBGHZ(sx126x_t *dev)

ping

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16579#pullrequestreview-698013513
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210702/5a48be3b/attachment.htm>


More information about the notifications mailing list