diff --git a/_pi_hal_8h_source.html b/_pi_hal_8h_source.html
index 7708e5cc..f113a1b1 100644
--- a/_pi_hal_8h_source.html
+++ b/_pi_hal_8h_source.html
@@ -120,249 +120,254 @@ $(document).ready(function(){initNavTree('_pi_hal_8h_source.html',''); initResiz
-
- 36 if((_gpioHandle = lgGpiochipOpen(_gpioDevice)) < 0) {
- 37 fprintf(stderr,
"Could not open GPIO chip: %s\n", lguErrorText(_gpioHandle));
-
-
-
-
-
-
+ 35 if(_gpioHandle != -1) {
+
+
+
+
+ 40 if((_gpioHandle = lgGpiochipOpen(_gpioDevice)) < 0) {
+ 41 fprintf(stderr,
"Could not open GPIO chip: %s\n", lguErrorText(_gpioHandle));
+
+
-
-
-
+
+
+
-
- 50 lgGpiochipClose(_gpioHandle);
-
+
+
+
-
-
- 55 void pinMode(uint32_t pin, uint32_t mode)
override {
- 56 if(pin == RADIOLIB_NC) {
-
-
-
-
-
-
-
- 64 result = lgGpioClaimInput(_gpioHandle, 0, pin);
-
-
- 67 result = lgGpioClaimOutput(_gpioHandle, flags, pin, LG_HIGH);
-
-
- 70 fprintf(stderr,
"Unknown pinMode mode %" PRIu32
"\n", mode);
-
-
-
-
- 75 fprintf(stderr,
"Could not claim pin %" PRIu32
" for mode %" PRIu32
": %s\n",
- 76 pin, mode, lguErrorText(result));
+
+ 54 lgGpiochipClose(_gpioHandle);
+
+
+
+
+
+ 60 void pinMode(uint32_t pin, uint32_t mode)
override {
+ 61 if(pin == RADIOLIB_NC) {
+
+
+
+
+
+
+
+ 69 result = lgGpioClaimInput(_gpioHandle, 0, pin);
+
+
+ 72 result = lgGpioClaimOutput(_gpioHandle, flags, pin, LG_HIGH);
+
+
+ 75 fprintf(stderr,
"Unknown pinMode mode %" PRIu32
"\n", mode);
+
-
-
-
- 81 if(pin == RADIOLIB_NC) {
-
-
+
+
+ 80 fprintf(stderr,
"Could not claim pin %" PRIu32
" for mode %" PRIu32
": %s\n",
+ 81 pin, mode, lguErrorText(result));
+
+
- 85 int result = lgGpioWrite(_gpioHandle, pin, value);
-
- 87 fprintf(stderr,
"Error writing value to pin %" PRIu32
": %s\n", pin, lguErrorText(result));
+
+ 86 if(pin == RADIOLIB_NC) {
+
-
-
-
- 92 if(pin == RADIOLIB_NC) {
-
-
+
+ 90 int result = lgGpioWrite(_gpioHandle, pin, value);
+
+ 92 fprintf(stderr,
"Error writing value to pin %" PRIu32
": %s\n", pin, lguErrorText(result));
+
+
- 96 int result = lgGpioRead(_gpioHandle, pin);
-
- 98 fprintf(stderr,
"Error writing reading from pin %" PRIu32
": %s\n", pin, lguErrorText(result));
+
+ 97 if(pin == RADIOLIB_NC) {
+
-
-
-
- 103 void attachInterrupt(uint32_t interruptNum,
void (*interruptCb)(
void), uint32_t mode)
override {
- 104 if((interruptNum == RADIOLIB_NC) || (interruptNum > PI_MAX_USER_GPIO)) {
-
-
+
+ 101 int result = lgGpioRead(_gpioHandle, pin);
+
+ 103 fprintf(stderr,
"Error writing reading from pin %" PRIu32
": %s\n", pin, lguErrorText(result));
+
+
+
-
- 109 int result = lgGpioClaimAlert(_gpioHandle, 0, mode, interruptNum, -1);
-
- 111 fprintf(stderr,
"Could not claim pin %" PRIu32
" for alert: %s\n", interruptNum, lguErrorText(result));
-
-
-
-
- 116 interruptEnabled[interruptNum] =
true;
- 117 interruptModes[interruptNum] = mode;
- 118 interruptCallbacks[interruptNum] = interruptCb;
+ 108 void attachInterrupt(uint32_t interruptNum,
void (*interruptCb)(
void), uint32_t mode)
override {
+ 109 if((interruptNum == RADIOLIB_NC) || (interruptNum > PI_MAX_USER_GPIO)) {
+
+
+
+
+ 114 int result = lgGpioClaimAlert(_gpioHandle, 0, mode, interruptNum, -1);
+
+ 116 fprintf(stderr,
"Could not claim pin %" PRIu32
" for alert: %s\n", interruptNum, lguErrorText(result));
+
+
- 120 lgGpioSetAlertsFunc(_gpioHandle, interruptNum, lgpioAlertHandler, (
void *)
this);
-
-
-
- 124 if((interruptNum == RADIOLIB_NC) || (interruptNum > PI_MAX_USER_GPIO)) {
-
-
+
+ 121 interruptEnabled[interruptNum] =
true;
+ 122 interruptModes[interruptNum] = mode;
+ 123 interruptCallbacks[interruptNum] = interruptCb;
+
+ 125 lgGpioSetAlertsFunc(_gpioHandle, interruptNum, lgpioAlertHandler, (
void *)
this);
+
-
- 129 interruptEnabled[interruptNum] =
false;
- 130 interruptModes[interruptNum] = 0;
- 131 interruptCallbacks[interruptNum] = NULL;
+
+ 129 if((interruptNum == RADIOLIB_NC) || (interruptNum > PI_MAX_USER_GPIO)) {
+
+
-
- 134 lgGpioFree(_gpioHandle, interruptNum);
- 135 lgGpioSetAlertsFunc(_gpioHandle, interruptNum, NULL, NULL);
-
+
+ 134 interruptEnabled[interruptNum] =
false;
+ 135 interruptModes[interruptNum] = 0;
+ 136 interruptCallbacks[interruptNum] = NULL;
- 138 void delay(
unsigned long ms)
override {
-
-
-
-
-
- 144 lguSleep(ms / 1000.0);
-
-
-
-
-
-
-
-
- 153 lguSleep(us / 1000000.0);
-
-
-
-
-
-
-
- 161 uint32_t time = lguTimestamp() / 1000000UL;
-
+
+ 139 lgGpioFree(_gpioHandle, interruptNum);
+ 140 lgGpioSetAlertsFunc(_gpioHandle, interruptNum, NULL, NULL);
+
+
+ 143 void delay(
unsigned long ms)
override {
+
+
+
+
+
+ 149 lguSleep(ms / 1000.0);
+
+
+
+
+
+
+
+
+ 158 lguSleep(us / 1000000.0);
+
+
+
+
-
- 166 uint32_t time = lguTimestamp() / 1000UL;
+
+ 166 uint32_t time = lguTimestamp() / 1000000UL;
- 170 long pulseIn(uint32_t pin, uint32_t state,
unsigned long timeout)
override {
- 171 if(pin == RADIOLIB_NC) {
-
-
+
+ 171 uint32_t time = lguTimestamp() / 1000UL;
+
+
-
- 176 uint32_t start = this->
micros();
- 177 uint32_t curtick = this->
micros();
-
-
- 180 if((this->
micros() - curtick) > timeout) {
-
-
-
-
- 185 return(this->
micros() - start);
-
-
-
-
- 190 if((_spiHandle = lgSpiOpen(_spiDevice, _spiChannel, _spiSpeed, 0)) < 0) {
- 191 fprintf(stderr,
"Could not open SPI handle on 0: %s\n", lguErrorText(_spiHandle));
-
-
-
-
-
-
-
- 199 int result = lgSpiXfer(_spiHandle, (
char *)out, (
char*)in, len);
-
- 201 fprintf(stderr,
"Could not perform SPI transfer: %s\n", lguErrorText(result));
-
-
-
-
-
-
- 208 if(_spiHandle >= 0) {
- 209 lgSpiClose(_spiHandle);
-
-
-
-
- 214 void tone(uint32_t pin,
unsigned int frequency,
unsigned long duration = 0) {
- 215 lgTxPwm(_gpioHandle, pin, frequency, 50, 0, duration);
-
-
-
- 219 lgTxPwm(_gpioHandle, pin, 0, 0, 0, 0);
-
-
-
- 223 bool interruptEnabled[PI_MAX_USER_GPIO + 1];
- 224 uint32_t interruptModes[PI_MAX_USER_GPIO + 1];
- 225 typedef void (*RadioLibISR)(void);
- 226 RadioLibISR interruptCallbacks[PI_MAX_USER_GPIO + 1];
-
-
-
- 230 const unsigned int _spiSpeed;
- 231 const uint8_t _gpioDevice;
- 232 const uint8_t _spiDevice;
- 233 const uint8_t _spiChannel;
- 234 int _gpioHandle = -1;
-
-
-
-
- 239 static void lgpioAlertHandler(
int num_alerts, lgGpioAlert_p alerts,
void *userdata) {
-
-
+ 175 long pulseIn(uint32_t pin, uint32_t state,
unsigned long timeout)
override {
+ 176 if(pin == RADIOLIB_NC) {
+
+
+
+
+ 181 uint32_t start = this->
micros();
+ 182 uint32_t curtick = this->
micros();
+
+
+ 185 if((this->
micros() - curtick) > timeout) {
+
+
+
+
+ 190 return(this->
micros() - start);
+
+
+
+
+ 195 if((_spiHandle = lgSpiOpen(_spiDevice, _spiChannel, _spiSpeed, 0)) < 0) {
+ 196 fprintf(stderr,
"Could not open SPI handle on 0: %s\n", lguErrorText(_spiHandle));
+
+
+
+
+
+
+
+ 204 int result = lgSpiXfer(_spiHandle, (
char *)out, (
char*)in, len);
+
+ 206 fprintf(stderr,
"Could not perform SPI transfer: %s\n", lguErrorText(result));
+
+
+
+
+
+
+ 213 if(_spiHandle >= 0) {
+ 214 lgSpiClose(_spiHandle);
+
+
+
+
+ 219 void tone(uint32_t pin,
unsigned int frequency,
unsigned long duration = 0) {
+ 220 lgTxPwm(_gpioHandle, pin, frequency, 50, 0, duration);
+
+
+
+ 224 lgTxPwm(_gpioHandle, pin, 0, 0, 0, 0);
+
+
+
+ 228 bool interruptEnabled[PI_MAX_USER_GPIO + 1];
+ 229 uint32_t interruptModes[PI_MAX_USER_GPIO + 1];
+ 230 typedef void (*RadioLibISR)(void);
+ 231 RadioLibISR interruptCallbacks[PI_MAX_USER_GPIO + 1];
+
+
+
+ 235 const unsigned int _spiSpeed;
+ 236 const uint8_t _gpioDevice;
+ 237 const uint8_t _spiDevice;
+ 238 const uint8_t _spiChannel;
+ 239 int _gpioHandle = -1;
+
+
-
-
-
-
- 247 for(lgGpioAlert_t *alert = alerts; alert < (alerts + num_alerts); alert++) {
- 248 if((hal->interruptEnabled[alert->report.gpio]) &&
- 249 (hal->interruptModes[alert->report.gpio] == alert->report.level) &&
- 250 (hal->interruptCallbacks[alert->report.gpio])) {
- 251 hal->interruptCallbacks[alert->report.gpio]();
-
-
-
-
-
+
+ 244 static void lgpioAlertHandler(
int num_alerts, lgGpioAlert_p alerts,
void *userdata) {
+
+
+
+
+
+
+
+ 252 for(lgGpioAlert_t *alert = alerts; alert < (alerts + num_alerts); alert++) {
+ 253 if((hal->interruptEnabled[alert->report.gpio]) &&
+ 254 (hal->interruptModes[alert->report.gpio] == alert->report.level) &&
+ 255 (hal->interruptCallbacks[alert->report.gpio])) {
+ 256 hal->interruptCallbacks[alert->report.gpio]();
+
+
+
+
+
-void noTone(uint32_t pin)
Method to stop producing a tone.
Definition: PiHal.h:218
-unsigned long millis() override
Get number of milliseconds since start. Must be implemented by the platform-specific hardware abstrac...
Definition: PiHal.h:160
-void digitalWrite(uint32_t pin, uint32_t value) override
Digital write method. Must be implemented by the platform-specific hardware abstraction!
Definition: PiHal.h:80
-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-spe...
Definition: PiHal.h:170
-void spiBegin()
SPI initialization method.
Definition: PiHal.h:188
-void spiEnd()
SPI termination method.
Definition: PiHal.h:207
+void noTone(uint32_t pin)
Method to stop producing a tone.
Definition: PiHal.h:223
+unsigned long millis() override
Get number of milliseconds since start. Must be implemented by the platform-specific hardware abstrac...
Definition: PiHal.h:165
+void digitalWrite(uint32_t pin, uint32_t value) override
Digital write method. Must be implemented by the platform-specific hardware abstraction!
Definition: PiHal.h:85
+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-spe...
Definition: PiHal.h:175
+void spiBegin()
SPI initialization method.
Definition: PiHal.h:193
+void spiEnd()
SPI termination method.
Definition: PiHal.h:212
void init() override
Module initialization method. This will be called by all radio modules at the beginning of startup....
Definition: PiHal.h:34
-void spiEndTransaction()
Method to end SPI transaction.
Definition: PiHal.h:205
-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: PiHal.h:214
-void spiTransfer(uint8_t *out, size_t len, uint8_t *in)
Method to transfer buffer over SPI.
Definition: PiHal.h:198
-unsigned long micros() override
Get number of microseconds since start. Must be implemented by the platform-specific hardware abstrac...
Definition: PiHal.h:165
-void spiBeginTransaction()
Method to start SPI transaction.
Definition: PiHal.h:196
-uint32_t digitalRead(uint32_t pin) override
Digital read method. Must be implemented by the platform-specific hardware abstraction!
Definition: PiHal.h:91
-void delayMicroseconds(unsigned long us) override
Blocking microsecond wait function. Must be implemented by the platform-specific hardware abstraction...
Definition: PiHal.h:147
-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 hard...
Definition: PiHal.h:103
-void pinMode(uint32_t pin, uint32_t mode) override
GPIO pin mode (input/output/...) configuration method. Must be implemented by the platform-specific h...
Definition: PiHal.h:55
-void delay(unsigned long ms) override
Blocking wait function. Must be implemented by the platform-specific hardware abstraction!
Definition: PiHal.h:138
-void term() override
Module termination method. This will be called by all radio modules when the destructor is called....
Definition: PiHal.h:45
-void yield() override
Yield method, called from long loops in multi-threaded environment (to prevent blocking other threads...
Definition: PiHal.h:156
-void detachInterrupt(uint32_t interruptNum) override
Method to detach function from an external interrupt. Must be implemented by the platform-specific ha...
Definition: PiHal.h:123
+void spiEndTransaction()
Method to end SPI transaction.
Definition: PiHal.h:210
+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: PiHal.h:219
+void spiTransfer(uint8_t *out, size_t len, uint8_t *in)
Method to transfer buffer over SPI.
Definition: PiHal.h:203
+unsigned long micros() override
Get number of microseconds since start. Must be implemented by the platform-specific hardware abstrac...
Definition: PiHal.h:170
+void spiBeginTransaction()
Method to start SPI transaction.
Definition: PiHal.h:201
+uint32_t digitalRead(uint32_t pin) override
Digital read method. Must be implemented by the platform-specific hardware abstraction!
Definition: PiHal.h:96
+void delayMicroseconds(unsigned long us) override
Blocking microsecond wait function. Must be implemented by the platform-specific hardware abstraction...
Definition: PiHal.h:152
+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 hard...
Definition: PiHal.h:108
+void pinMode(uint32_t pin, uint32_t mode) override
GPIO pin mode (input/output/...) configuration method. Must be implemented by the platform-specific h...
Definition: PiHal.h:60
+void delay(unsigned long ms) override
Blocking wait function. Must be implemented by the platform-specific hardware abstraction!
Definition: PiHal.h:143
+void term() override
Module termination method. This will be called by all radio modules when the destructor is called....
Definition: PiHal.h:49
+void yield() override
Yield method, called from long loops in multi-threaded environment (to prevent blocking other threads...
Definition: PiHal.h:161
+void detachInterrupt(uint32_t interruptNum) override
Method to detach function from an external interrupt. Must be implemented by the platform-specific ha...
Definition: PiHal.h:128
Hardware abstraction library base interface.
Definition: Hal.h:13
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