|
STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
|
← STM32duino documentation
|
Singleton class to manage the SubGHZ ISR and internal signals. More...
#include <SubGhz.h>
Public Types | |
| using | callback_function_t = std::function< void(void)> |
| Type of the callback called from ISR context when the radio IRQ triggers. | |
Public Member Functions | |
| void | attachInterrupt (callback_function_t callback) |
| Attach the handler called from ISR context when the radio IRQ triggers, then clear any pending IRQs and enable the IRQ. | |
| void | detachInterrupt () |
| Detach the interrupt handler, disabling the IRQ too. | |
| bool | hasInterrupt () |
| Check whether an interrupt callback is attached, regardless of whether it is enabled. | |
| void | enableInterrupt () |
| Enable the interrupt again if it was previously disabled using disableInterrupt(). | |
| void | disableInterrupt () |
| Temporarily disable interrupt processing by disabling the IRQ in the NVIC. | |
| void | clearPendingInterrupt () |
| Clear the interrupt pending flag, suppressing IRQs that happened while the interrupt was disabled. | |
| bool | isInterruptPending () |
| Check whether the interrupt is pending. | |
| void | setNssActive (bool value) |
| Update the NSS signal internally connected to the radio SPI block. | |
| bool | isNssActive () |
| Read back the value written to NSS with setNssActive(). | |
| void | setResetActive (bool value) |
| Update the RESET signal internally connected to the radio. | |
| bool | isResetActive () |
| Read back the value written to RESET with setResetActive(). | |
| bool | isBusy () |
| Get the busy signal exported by the radio module. | |
Public Attributes | |
| SUBGHZSPIClass | SPI |
| SPI object used to talk to the radio. | |
Static Public Attributes | |
| static constexpr SPISettings | spi_settings = {16000000, MSBFIRST, SPI_MODE0} |
| SPI settings to use for the radio, at the maximum speed supported by the radio. | |
Protected Member Functions | |
| void | handleIrq () |
| Call the attached callback. | |
Friends | |
| void | SUBGHZ_Radio_IRQHandler () |
| ISR entry point for the SubGHz radio IRQ. | |
Singleton class to manage the SubGHZ ISR and internal signals.
| void SubGhzClass::attachInterrupt | ( | callback_function_t | callback | ) |
Attach the handler called from ISR context when the radio IRQ triggers, then clear any pending IRQs and enable the IRQ.
The radio IRQ is level triggered, so the callback must either process the IRQ and clear the IRQ flags in the radio (so the radio clears its DIO lines before the ISR returns), or disable the IRQ to prevent it from being triggered over and over again.
| callback | Function called from ISR context when the radio IRQ triggers. |
| void SubGhzClass::enableInterrupt | ( | ) |
Enable the interrupt again if it was previously disabled using disableInterrupt().
This does not clear pending interrupts: if the IRQ triggered while it was disabled, the callback registered with attachInterrupt() fires directly.
|
protected |
Call the attached callback.
Invoked from the ISR, not meant to be called directly.
| bool SubGhzClass::hasInterrupt | ( | ) |
Check whether an interrupt callback is attached, regardless of whether it is enabled.
| bool SubGhzClass::isBusy | ( | ) |
Get the busy signal exported by the radio module.
Uses the RFBUSYS flag, which returns the radio busy signal directly, not the RFBUSYMS flag that also returns an extra busy period after every SPI transaction.
| bool SubGhzClass::isInterruptPending | ( | ) |
Check whether the interrupt is pending.
Only really useful when the interrupt is disabled, or while a higher priority interrupt is running.
| bool SubGhzClass::isNssActive | ( | ) |
Read back the value written to NSS with setNssActive().
| bool SubGhzClass::isResetActive | ( | ) |
Read back the value written to RESET with setResetActive().
| void SubGhzClass::setNssActive | ( | bool | value | ) |
Update the NSS signal internally connected to the radio SPI block.
The NSS signal is active-low: passing true activates the block (NSS driven LOW), passing false deactivates it (NSS HIGH).
| value | true to activate the NSS signal, false to deactivate it. |
| void SubGhzClass::setResetActive | ( | bool | value | ) |
Update the RESET signal internally connected to the radio.
| value | true to put the module in reset, false to enable the module. |
|
friend |
ISR entry point for the SubGHz radio IRQ.
Forwards the event to the attached callback.
| SUBGHZSPIClass SubGhzClass::SPI |
SPI object used to talk to the radio.
Works like a regular SPI object, except that setNssActive() must be used to control the (internal) NSS signal.
|
staticconstexpr |
SPI settings to use for the radio, at the maximum speed supported by the radio.
Pass this value to SubGhz.SPI.beginTransaction().