[CI] Updated SX1261 autotest

pull/763/head
jgromes 2023-05-18 21:57:24 +02:00
rodzic b02a5c1867
commit a97baa6fc2
2 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
#define PI_HAL_H
// include RadioLib
#include <RadioLib/RadioLib.h>
#include <RadioLib.h>
// include the library for Raspberry GPIO pins
#include "pigpio.h"
@ -107,17 +107,17 @@ class PiHal : public RadioLibHal {
return(0);
}
gpioSetMode(pin, PI_INPUT);
uint32_t start = gpioTick();
uint32_t curtick = gpioTick();
this->pinMode(pin, PI_INPUT);
uint32_t start = this->micros();
uint32_t curtick = this->micros();
while(gpioRead(pin) == state) {
if((gpioTick() - curtick) > timeout) {
while(this->digitalRead(pin) == state) {
if((this->micros() - curtick) > timeout) {
return(0);
}
}
return(gpioTick() - start);
return(this->micros() - start);
}
void spiBegin() {

Wyświetl plik

@ -4,8 +4,10 @@
#include <RadioLib/RadioLib.h>
#include "PiHal.h"
#define RADIOLIB_TEST_ASSERT(STATEVAR) { if((STATEVAR) != RADIOLIB_ERR_NONE) { return(-1*(STATEVAR)); } }
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
int main(int argc, char** argv) {
@ -13,9 +15,11 @@ int main(int argc, char** argv) {
state = radio.begin();
printf("[SX1261] Test:begin() = %d\n", state);
RADIOLIB_TEST_ASSERT(state);
//state = radio.transmit("Hello World!");
//printf("[SX1261] Test:transmit() = %d\n", state);
state = radio.transmit("Hello World!");
printf("[SX1261] Test:transmit() = %d\n", state);
RADIOLIB_TEST_ASSERT(state);
hal->term();
return(0);