Updated raspberry example

This commit is contained in:
jgromes 2023-05-18 20:52:28 +01:00
parent 6d54ea65db
commit b02a5c1867
2 changed files with 9 additions and 9 deletions

View file

@ -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() {

View file

@ -29,8 +29,8 @@ PiHal* hal = new PiHal(1);
// NSS pin: 7
// DIO1 pin: 17
// NRST pin: 22
// BUSY pin: 4
SX1261 radio = new Module(hal, 7, 17, 22, 4);
// BUSY pin: not connected
SX1261 radio = new Module(hal, 7, 17, 22, RADIOLIB_NC);
// the entry point for the program
int main(int argc, char** argv) {
@ -50,7 +50,7 @@ int main(int argc, char** argv) {
state = radio.transmit("Hello World!");
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
printf("success!");
printf("success!\n");
// wait for a second before transmitting again
hal->delay(1000);