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

Leandro Lanzieri notifications at github.com
Mon Jun 28 11:09:51 CEST 2021


> In general I think there is a problem with the `ifdef CPU...` approach, it does not allow for example for the `BOARD` to have an sx1276x breakout + subghz, I think this should be handled differently.

+1 for supporting this
 
> 
> So for example for the reset function:
> 
> ```c
> sx126x_hal_status_t sx126x_hal_reset(const void *context)
> {
>     DEBUG("[sx126x_hal] reset\n");
> 
>     sx126x_t *dev = (sx126x_t *)context;
> 
> #ifdef SX126X_SUBGHZ_RADIO
>     if (SX126X_SUBGHZ_RADIO == dev ) {
>         RCC->CSR |= RCC_CSR_RFRST;
>         RCC->CSR &= ~RCC_CSR_RFRST;
>         /* it takes 100us for the radio to be ready after reset */
>         ztimer_sleep(ZTIMER_USEC, 100);
> 
>         /* Wait while reset is done */
>         while (IsRFUnderReset() != 0UL){}
> 
>         /* Asserts the reset signal of the Radio peripheral */
>         PWR->SUBGHZSPICR |= PWR_SUBGHZSPICR_NSS;
> 
>         /* Enable EXTI 44 : Radio IRQ ITs for CPU1 */
>         EXTI_EnableIT_32_63(EXTI_IMR2_IM44);
> 
>         /* Enable wakeup signal of the Radio peripheral */
>         PWR_SetRadioBusyTrigger(PWR_CR3_EWRFBUSY);
> 
>         /* Clear Pending Flag */
>         PWR->SCR = PWR_SCR_CWRFBUSYF;
> 
>         sx126x_radio_sleepstatus = true;
>         return 0;
>     }
> #else
>     gpio_set(dev->params->reset_pin);
>     gpio_clear(dev->params->reset_pin);
>     /* it takes 100us for the radio to be ready after reset */
>     ztimer_sleep(ZTIMER_USEC, 100);
>     gpio_set(dev->params->reset_pin);
> #endif
>     return 0;
> }
> ```

Doesn't this reset implementation also limit either having the integrated version or the GPIO-based one at compile time? We would need a second module for the version that used SPI and GPIOs, so we can `#elif` the second code, right?


-- 
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#issuecomment-869513778
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210628/0ec6b7e0/attachment.htm>


More information about the notifications mailing list