<p></p>
<p><b>@jia200x</b> requested changes on this pull request.</p>

<p>Last round of changes.<br>
Also, some commits should be squashed (e.g Kconfig updates should belong to the HW debug commits, and all commits that enable the variant should be one too).</p><hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665156243">boards/nucleo-wl55jc/Makefile.dep</a>:</p>
<pre style='color:#555'>> @@ -1,4 +1,10 @@
 ifneq (,$(filter stdio_uart,$(USEMODULE)))
   FEATURES_REQUIRED += periph_lpuart
 endif
+ifneq (,$(filter netdev_default,$(USEMODULE)))
+  USEMODULE += sx126x_stm32wl
+endif
+ifneq (,$(filter sx126x_stm32wl,$(USEMODULE)))
</pre>
<p>This is not a board dependency but rather periph/driver. Please move it to the corresponding Makefile.dep under <code>drivers</code></p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665157698">drivers/sx126x/sx126x.c</a>:</p>
<pre style='color:#555'>> @@ -182,6 +186,7 @@ int sx126x_init(sx126x_t *dev)
         SX126X_IRQ_TX_DONE |
         SX126X_IRQ_RX_DONE |
         SX126X_IRQ_PREAMBLE_DETECTED |
+        SX126X_IRQ_SYNC_WORD_VALID |
</pre>
<p>This has no other use right now more than printing a DEBUG message (there's no netdev event associated to it).<br>
I'm not sure if we need it here. If so, it should be at least on it's own commit.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665159941">boards/nucleo-wl55jc/board.c</a>:</p>
<pre style='color:#555'>> + *
+ * @file        board.c
+ * @brief       Board specific implementations for the Nucleo-wl55jc board
+ *
+ *
+ * @author      Akshai M <akshai.m@fu-berlin.de>
+ *
+ * @}
+ */
+
+#include <stdio.h>
+
+#include "board.h"
+#include "periph/gpio.h"
+
+#if IS_USED(MODULE_SX126X_RF_SWITCH)
</pre>

⬇️ Suggested change
<pre style="color: #555">-#if IS_USED(MODULE_SX126X_RF_SWITCH)
+#if IS_USED(MODULE_SX126X_STM32WL)
</pre>


<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665176805">boards/nucleo-wl55jc/board.c</a>:</p>
<pre style='color:#555'>> +
+#include <stdio.h>
+
+#include "board.h"
+#include "periph/gpio.h"
+
+#if IS_USED(MODULE_SX126X_RF_SWITCH)
+#include "sx126x.h"
+#endif
+
+void board_init(void)
+{
+    /* initialize the CPU */
+    board_common_nucleo_init();
+
+    if (IS_USED(MODULE_SX126X_RF_SWITCH)) {
</pre>
<p>This is a bit tricky, since the feature actually depends on <code>MODULE_SX126X_RF_SWITCH</code>. But for the scope of the file, I think it would make more sense to depend on <code>MODULE_SX126X_STM32WL</code></p>

⬇️ Suggested change
<pre style="color: #555">-    if (IS_USED(MODULE_SX126X_RF_SWITCH)) {
+    if (IS_USED(MODULE_SX126X_STM32WL)) {
</pre>


<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665177130">boards/nucleo-wl55jc/board.c</a>:</p>
<pre style='color:#555'>> +
+    if (IS_USED(MODULE_SX126X_RF_SWITCH)) {
+        /* Initialize the GPIO control for RF 3-port switch (SP3T) */
+        gpio_init(FE_CTRL1, GPIO_OUT);
+        gpio_init(FE_CTRL2, GPIO_OUT);
+        gpio_init(FE_CTRL3, GPIO_OUT);
+    }
+}
+
+/**
+ * @brief Callback to set RF switch mode
+ *
+ * This function sets the GPIO's wired to the SP3T RF Switch. Nucleo-WL55JC
+ * supports three modes of operation.
+ */
+#if IS_USED(MODULE_SX126X_RF_SWITCH)
</pre>

⬇️ Suggested change
<pre style="color: #555">-#if IS_USED(MODULE_SX126X_RF_SWITCH)
+#if IS_USED(MODULE_SX126X_STM32WL)
</pre>


<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665179273">boards/nucleo-wl55jc/include/board.h</a>:</p>
<pre style='color:#555'>> @@ -31,6 +31,10 @@ extern "C" {
  * @{
  */
 #define SX126X_PARAM_SPI                    (SPI_DEV(0))
+
+#if IS_USED(MODULE_SX126X_RF_SWITCH)
</pre>

⬇️ Suggested change
<pre style="color: #555">-#if IS_USED(MODULE_SX126X_RF_SWITCH)
+#if IS_USED(MODULE_SX126X_STM32WL)
</pre>


<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665181044">drivers/sx126x/include/sx126x_params.h</a>:</p>
<pre style='color:#555'>> +#ifndef SX126X_PARAM_SET_RF_MODE_CB
+#define SX126X_PARAM_SET_RF_MODE_CB         NULL
+#else
+extern void SX126X_PARAM_SET_RF_MODE_CB(sx126x_t *dev, sx126x_rf_mode_t rf_mode);
+#endif
</pre>
<p>I just realized this is not necessary since this file includes <code>board.h</code>.</p>

⬇️ Suggested change
<pre style="color: #555">-#ifndef SX126X_PARAM_SET_RF_MODE_CB
-#define SX126X_PARAM_SET_RF_MODE_CB         NULL
-#else
-extern void SX126X_PARAM_SET_RF_MODE_CB(sx126x_t *dev, sx126x_rf_mode_t rf_mode);
-#endif
+#ifndef SX126X_PARAM_SET_RF_MODE_CB
+#define SX126X_PARAM_SET_RF_MODE_CB         NULL
+#endif
</pre>


<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16579#discussion_r665182022">drivers/sx126x/include/sx126x_params.h</a>:</p>
<pre style='color:#555'>> @@ -79,7 +85,9 @@ extern "C" {
                                     .busy_pin = SX126X_PARAM_BUSY,      \
                                     .dio1_pin = SX126X_PARAM_DIO1,      \
                                     .type     = SX126X_PARAM_TYPE,      \
-                                    .regulator = SX126X_PARAM_REGULATOR }
+                                    .regulator = SX126X_PARAM_REGULATOR, \
+                                    .set_rf_mode = SX126X_PARAM_SET_RF_MODE_CB }
</pre>
<p>this should be guarded:</p>

⬇️ Suggested change
<pre style="color: #555">-                                    .set_rf_mode = SX126X_PARAM_SET_RF_MODE_CB }
+#if IS_USED(MODULE_SX126X_RF_SWITCH)
+                                    .set_rf_mode = SX126X_PARAM_SET_RF_MODE_CB \
+#endif
+                                    }
</pre>


<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16579#pullrequestreview-700721468">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYGN6NPS4ILGEQGX47DTWQJ3XANCNFSM47EMOXQQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYB73YBTQLQBZ6PJQPDTWQJ3XA5CNFSM47EMOXQ2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFHCCSPA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16579#pullrequestreview-700721468",
"url": "https://github.com/RIOT-OS/RIOT/pull/16579#pullrequestreview-700721468",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>