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

Francisco notifications at github.com
Mon Jun 28 13:14:38 CEST 2021


> 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?

My pseudo code was wrong, it was more something like:

 ```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);
    }
#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;
}
 ```

-- 
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-869596823
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210628/59ad72b7/attachment.htm>


More information about the notifications mailing list