RadioLib
Universal wireless communication library for Arduino
PicoHal Class Reference
Inheritance diagram for PicoHal:
RadioLibHal

Public Member Functions

 PicoHal (spi_inst_t *spiChannel, uint32_t misoPin, uint32_t mosiPin, uint32_t sckPin, uint32_t spiSpeed=500 *1000)
 
void init () override
 Module initialization method. This will be called by all radio modules at the beginning of startup. Can be used to e.g., initialize SPI interface.
 
void term () override
 Module termination method. This will be called by all radio modules when the destructor is called. Can be used to e.g., stop SPI interface.
 
void pinMode (uint32_t pin, uint32_t mode) override
 GPIO pin mode (input/output/...) configuration method. Must be implemented by the platform-specific hardware abstraction! More...
 
void digitalWrite (uint32_t pin, uint32_t value) override
 Digital write method. Must be implemented by the platform-specific hardware abstraction! More...
 
uint32_t digitalRead (uint32_t pin) override
 Digital read method. Must be implemented by the platform-specific hardware abstraction! More...
 
void attachInterrupt (uint32_t interruptNum, void(*interruptCb)(void), uint32_t mode) override
 Method to attach function to an external interrupt. Must be implemented by the platform-specific hardware abstraction! More...
 
void detachInterrupt (uint32_t interruptNum) override
 Method to detach function from an external interrupt. Must be implemented by the platform-specific hardware abstraction! More...
 
void delay (unsigned long ms) override
 Blocking wait function. Must be implemented by the platform-specific hardware abstraction! More...
 
void delayMicroseconds (unsigned long us) override
 Blocking microsecond wait function. Must be implemented by the platform-specific hardware abstraction! More...
 
unsigned long millis () override
 Get number of milliseconds since start. Must be implemented by the platform-specific hardware abstraction! More...
 
unsigned long micros () override
 Get number of microseconds since start. Must be implemented by the platform-specific hardware abstraction! More...
 
long pulseIn (uint32_t pin, uint32_t state, unsigned long timeout) override
 Measure the length of incoming digital pulse in microseconds. Must be implemented by the platform-specific hardware abstraction! More...
 
void tone (uint32_t pin, unsigned int frequency, unsigned long duration=0) override
 Method to produce a square-wave with 50% duty cycle ("tone") of a given frequency at some pin. More...
 
void noTone (uint32_t pin) override
 Method to stop producing a tone. More...
 
void spiBegin ()
 SPI initialization method.
 
void spiBeginTransaction ()
 Method to start SPI transaction.
 
void spiTransfer (uint8_t *out, size_t len, uint8_t *in)
 Method to transfer buffer over SPI. More...
 
void yield () override
 Yield method, called from long loops in multi-threaded environment (to prevent blocking other threads).
 
void spiEndTransaction ()
 Method to end SPI transaction.
 
void spiEnd ()
 SPI termination method.
 
- Public Member Functions inherited from RadioLibHal
 RadioLibHal (const uint32_t input, const uint32_t output, const uint32_t low, const uint32_t high, const uint32_t rising, const uint32_t falling)
 Default constructor. More...
 
virtual uint32_t pinToInterrupt (uint32_t pin)
 Function to convert from pin number to interrupt number. More...
 

Additional Inherited Members

- Public Attributes inherited from RadioLibHal
const uint32_t GpioModeInput
 Value to be used as the "input" GPIO direction.
 
const uint32_t GpioModeOutput
 Value to be used as the "output" GPIO direction.
 
const uint32_t GpioLevelLow
 Value to be used as the "low" GPIO level.
 
const uint32_t GpioLevelHigh
 Value to be used as the "high" GPIO level.
 
const uint32_t GpioInterruptRising
 Value to be used as the "rising" GPIO level change direction.
 
const uint32_t GpioInterruptFalling
 Value to be used as the "falling" GPIO level change direction.
 

Member Function Documentation

◆ attachInterrupt()

void PicoHal::attachInterrupt ( uint32_t  interruptNum,
void(*)(void)  interruptCb,
uint32_t  mode 
)
inlineoverridevirtual

Method to attach function to an external interrupt. Must be implemented by the platform-specific hardware abstraction!

Parameters
interruptNumInterrupt number to attach to (platform-specific).
interruptCbInterrupt service routine to execute.
modeRising/falling mode (platform-specific).

Implements RadioLibHal.

◆ delay()

void PicoHal::delay ( unsigned long  ms)
inlineoverridevirtual

Blocking wait function. Must be implemented by the platform-specific hardware abstraction!

Parameters
msNumber of milliseconds to wait.

Implements RadioLibHal.

◆ delayMicroseconds()

void PicoHal::delayMicroseconds ( unsigned long  us)
inlineoverridevirtual

Blocking microsecond wait function. Must be implemented by the platform-specific hardware abstraction!

Parameters
usNumber of microseconds to wait.

Implements RadioLibHal.

◆ detachInterrupt()

void PicoHal::detachInterrupt ( uint32_t  interruptNum)
inlineoverridevirtual

Method to detach function from an external interrupt. Must be implemented by the platform-specific hardware abstraction!

Parameters
interruptNumInterrupt number to detach from (platform-specific).

Implements RadioLibHal.

◆ digitalRead()

uint32_t PicoHal::digitalRead ( uint32_t  pin)
inlineoverridevirtual

Digital read method. Must be implemented by the platform-specific hardware abstraction!

Parameters
pinPin to be changed (platform-specific).
Returns
Value read on the pin (platform-specific).

Implements RadioLibHal.

◆ digitalWrite()

void PicoHal::digitalWrite ( uint32_t  pin,
uint32_t  value 
)
inlineoverridevirtual

Digital write method. Must be implemented by the platform-specific hardware abstraction!

Parameters
pinPin to be changed (platform-specific).
valueValue to set (platform-specific).

Implements RadioLibHal.

◆ micros()

unsigned long PicoHal::micros ( )
inlineoverridevirtual

Get number of microseconds since start. Must be implemented by the platform-specific hardware abstraction!

Returns
Number of microseconds since start.

Implements RadioLibHal.

◆ millis()

unsigned long PicoHal::millis ( )
inlineoverridevirtual

Get number of milliseconds since start. Must be implemented by the platform-specific hardware abstraction!

Returns
Number of milliseconds since start.

Implements RadioLibHal.

◆ noTone()

void PicoHal::noTone ( uint32_t  pin)
inlineoverridevirtual

Method to stop producing a tone.

Parameters
pinPin which is currently producing the tone.

Reimplemented from RadioLibHal.

◆ pinMode()

void PicoHal::pinMode ( uint32_t  pin,
uint32_t  mode 
)
inlineoverridevirtual

GPIO pin mode (input/output/...) configuration method. Must be implemented by the platform-specific hardware abstraction!

Parameters
pinPin to be changed (platform-specific).
modeMode to be set (platform-specific).

Implements RadioLibHal.

◆ pulseIn()

long PicoHal::pulseIn ( uint32_t  pin,
uint32_t  state,
unsigned long  timeout 
)
inlineoverridevirtual

Measure the length of incoming digital pulse in microseconds. Must be implemented by the platform-specific hardware abstraction!

Parameters
pinPin to measure on (platform-specific).
statePin level to monitor (platform-specific).
timeoutTimeout in microseconds.
Returns
Pulse length in microseconds, or 0 if the pulse did not start before timeout.

Implements RadioLibHal.

◆ spiTransfer()

void PicoHal::spiTransfer ( uint8_t *  out,
size_t  len,
uint8_t *  in 
)
inlinevirtual

Method to transfer buffer over SPI.

Parameters
outBuffer to send.
lenNumber of data to send or receive.
inBuffer to save received data into.

Implements RadioLibHal.

◆ tone()

void PicoHal::tone ( uint32_t  pin,
unsigned int  frequency,
unsigned long  duration = 0 
)
inlineoverridevirtual

Method to produce a square-wave with 50% duty cycle ("tone") of a given frequency at some pin.

Parameters
pinPin to be used as the output.
frequencyFrequency of the square wave.
durationDuration of the tone in ms. When set to 0, the tone will be infinite.

Reimplemented from RadioLibHal.


The documentation for this class was generated from the following file: