1 #if !defined(_RADIOLIB_HAL_H)
2 #define _RADIOLIB_HAL_H
10 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_TABLE_VERSION_ID (0)
11 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_MAGIC_ID (1)
12 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_VERSION_ID (2)
13 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_TXDR_RX2DR_ID (3)
14 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_TXPWR_CUR_ID (4)
15 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_RX1_DROFF_DEL_ID (5)
16 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_RX2FREQ_ID (6)
17 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_ADR_LIM_DEL_ID (7)
18 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_NBTRANS_ID (8)
19 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_DEV_ADDR_ID (9)
20 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_APP_S_KEY_ID (10)
21 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_FNWK_SINT_KEY_ID (11)
22 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_SNWK_SINT_KEY_ID (12)
23 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_NWK_SENC_KEY_ID (13)
24 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_HOME_NET_ID (14)
25 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_DEV_NONCE_ID (15)
26 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_JOIN_NONCE_ID (16)
27 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_A_FCNT_DOWN_ID (17)
28 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_N_FCNT_DOWN_ID (18)
29 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_CONF_FCNT_UP_ID (19)
30 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_CONF_FCNT_DOWN_ID (20)
31 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_ADR_FCNT_ID (21)
32 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_FCNT_UP_ID (22)
33 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_FOPTS_ID (23)
34 #define RADIOLIB_PERSISTENT_PARAM_LORAWAN_FREQS_ID (24)
36 static const uint32_t RadioLibPersistentParamTable[] = {
114 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);
124 virtual void pinMode(uint32_t pin, uint32_t mode) = 0;
149 virtual void attachInterrupt(uint32_t interruptNum,
void (*interruptCb)(
void), uint32_t mode) = 0;
163 virtual void delay(
unsigned long ms) = 0;
194 virtual long pulseIn(uint32_t pin, uint32_t state,
unsigned long timeout) = 0;
212 virtual void spiTransfer(uint8_t* out,
size_t len, uint8_t* in) = 0;
247 virtual void tone(uint32_t pin,
unsigned int frequency,
unsigned long duration = 0);
253 virtual void noTone(uint32_t pin);
258 virtual void yield();
Hardware abstraction library base interface.
Definition: Hal.h:69
const uint32_t GpioInterruptFalling
Value to be used as the "falling" GPIO level change direction.
Definition: Hal.h:103
virtual uint32_t digitalRead(uint32_t pin)=0
Digital read method. Must be implemented by the platform-specific hardware abstraction!
const uint32_t GpioModeOutput
Value to be used as the "output" GPIO direction.
Definition: Hal.h:83
virtual void yield()
Yield method, called from long loops in multi-threaded environment (to prevent blocking other threads...
Definition: Hal.cpp:29
T getPersistentParameter(uint32_t id)
Method to get arbitrary parameter from persistent storage. This method DOES NOT perform any endiannes...
Definition: Hal.cpp:73
void setPersistentParameter(uint32_t id, T val, uint32_t offset=0)
Method to set arbitrary parameter to persistent storage. This method DOES NOT perform any endianness ...
Definition: Hal.cpp:63
virtual unsigned long millis()=0
Get number of milliseconds since start. Must be implemented by the platform-specific hardware abstrac...
const uint32_t GpioModeInput
Value to be used as the "input" GPIO direction.
Definition: Hal.h:78
virtual void detachInterrupt(uint32_t interruptNum)=0
Method to detach function from an external interrupt. Must be implemented by the platform-specific ha...
virtual uint32_t pinToInterrupt(uint32_t pin)
Function to convert from pin number to interrupt number.
Definition: Hal.cpp:33
virtual long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout)=0
Measure the length of incoming digital pulse in microseconds. Must be implemented by the platform-spe...
const uint32_t GpioLevelLow
Value to be used as the "low" GPIO level.
Definition: Hal.h:88
const uint32_t GpioLevelHigh
Value to be used as the "high" GPIO level.
Definition: Hal.h:93
virtual void spiEnd()=0
SPI termination method.
virtual void init()
Module initialization method. This will be called by all radio modules at the beginning of startup....
Definition: Hal.cpp:11
virtual void readPersistentStorage(uint32_t addr, uint8_t *buff, size_t len)
Method to read from persistent storage (e.g. EEPROM).
Definition: Hal.cpp:37
virtual void digitalWrite(uint32_t pin, uint32_t value)=0
Digital write method. Must be implemented by the platform-specific hardware abstraction!
virtual void spiEndTransaction()=0
Method to end SPI transaction.
virtual void noTone(uint32_t pin)
Method to stop producing a tone.
Definition: Hal.cpp:25
const uint32_t GpioInterruptRising
Value to be used as the "rising" GPIO level change direction.
Definition: Hal.h:98
virtual void delay(unsigned long ms)=0
Blocking wait function. Must be implemented by the platform-specific hardware abstraction!
virtual void writePersistentStorage(uint32_t addr, uint8_t *buff, size_t len)
Method to write to persistent storage (e.g. EEPROM).
Definition: Hal.cpp:44
virtual void spiBegin()=0
SPI initialization method.
virtual void term()
Module termination method. This will be called by all radio modules when the destructor is called....
Definition: Hal.cpp:15
virtual void tone(uint32_t pin, unsigned int frequency, unsigned long duration=0)
Method to produce a square-wave with 50% duty cycle ("tone") of a given frequency at some pin.
Definition: Hal.cpp:19
virtual void spiBeginTransaction()=0
Method to start SPI transaction.
void wipePersistentStorage()
Method to wipe the persistent storage by writing to 0. Will write at most RADIOLIB_HAL_PERSISTENT_STO...
Definition: Hal.cpp:51
virtual void delayMicroseconds(unsigned long us)=0
Blocking microsecond wait function. Must be implemented by the platform-specific hardware abstraction...
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.
Definition: Hal.cpp:3
uint32_t getPersistentAddr(uint32_t id)
Method to convert from persistent parameter ID to its physical address.
Definition: Hal.cpp:58
virtual void spiTransfer(uint8_t *out, size_t len, uint8_t *in)=0
Method to transfer buffer over SPI.
virtual unsigned long micros()=0
Get number of microseconds since start. Must be implemented by the platform-specific hardware abstrac...
virtual void pinMode(uint32_t pin, uint32_t mode)=0
GPIO pin mode (input/output/...) configuration method. Must be implemented by the platform-specific h...
virtual void attachInterrupt(uint32_t interruptNum, void(*interruptCb)(void), uint32_t mode)=0
Method to attach function to an external interrupt. Must be implemented by the platform-specific hard...