[CI] Updated SX1261 autotest
This commit is contained in:
parent
b02a5c1867
commit
a97baa6fc2
2 changed files with 14 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
||||||
#define PI_HAL_H
|
#define PI_HAL_H
|
||||||
|
|
||||||
// include RadioLib
|
// include RadioLib
|
||||||
#include <RadioLib/RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the library for Raspberry GPIO pins
|
// include the library for Raspberry GPIO pins
|
||||||
#include "pigpio.h"
|
#include "pigpio.h"
|
||||||
|
@ -107,17 +107,17 @@ class PiHal : public RadioLibHal {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpioSetMode(pin, PI_INPUT);
|
this->pinMode(pin, PI_INPUT);
|
||||||
uint32_t start = gpioTick();
|
uint32_t start = this->micros();
|
||||||
uint32_t curtick = gpioTick();
|
uint32_t curtick = this->micros();
|
||||||
|
|
||||||
while(gpioRead(pin) == state) {
|
while(this->digitalRead(pin) == state) {
|
||||||
if((gpioTick() - curtick) > timeout) {
|
if((this->micros() - curtick) > timeout) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(gpioTick() - start);
|
return(this->micros() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiBegin() {
|
void spiBegin() {
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
#include <RadioLib/RadioLib.h>
|
#include <RadioLib/RadioLib.h>
|
||||||
#include "PiHal.h"
|
#include "PiHal.h"
|
||||||
|
|
||||||
|
#define RADIOLIB_TEST_ASSERT(STATEVAR) { if((STATEVAR) != RADIOLIB_ERR_NONE) { return(-1*(STATEVAR)); } }
|
||||||
|
|
||||||
PiHal* hal = new PiHal(1);
|
PiHal* hal = new PiHal(1);
|
||||||
SX1261 radio = new Module(hal, 7, 17, 22, 4);
|
SX1261 radio = new Module(hal, 7, 17, 22, RADIOLIB_NC);
|
||||||
|
|
||||||
// the entry point for the program
|
// the entry point for the program
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
@ -13,9 +15,11 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
state = radio.begin();
|
state = radio.begin();
|
||||||
printf("[SX1261] Test:begin() = %d\n", state);
|
printf("[SX1261] Test:begin() = %d\n", state);
|
||||||
|
RADIOLIB_TEST_ASSERT(state);
|
||||||
|
|
||||||
//state = radio.transmit("Hello World!");
|
state = radio.transmit("Hello World!");
|
||||||
//printf("[SX1261] Test:transmit() = %d\n", state);
|
printf("[SX1261] Test:transmit() = %d\n", state);
|
||||||
|
RADIOLIB_TEST_ASSERT(state);
|
||||||
|
|
||||||
hal->term();
|
hal->term();
|
||||||
return(0);
|
return(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue