6 ( (____ _____ ____ _| |_ _____ ____| |__
7 \____ \| ___ | (_ _) ___ |/ ___) _ \
8 _____) ) ____| | | || |_| ____( (___| | | |
9 (______/|_____)_|_|_| \__)_____)\____)_| |_|
12 Description: Handling of the node configuration protocol
14 License: Revised BSD License, see LICENSE.TXT file include in the project
16 Maintainer: Miguel Luis and Gregory Cristian
18 Heavily modified/simplified by Alessandro Carcione 2020 for ELRS project
21 #include "SX1280_Regs.h"
24 enum SX1280_BusyState_
26 SX1280_NOT_BUSY
= true,
33 static SX1280Hal
*instance
;
41 void ICACHE_RAM_ATTR
WriteCommand(SX1280_RadioCommands_t command
, uint8_t val
, SX12XX_Radio_Number_t radioNumber
, uint32_t busyDelay
= 15);
42 void ICACHE_RAM_ATTR
WriteCommand(SX1280_RadioCommands_t opcode
, uint8_t *buffer
, uint8_t size
, SX12XX_Radio_Number_t radioNumber
, uint32_t busyDelay
= 15);
43 void ICACHE_RAM_ATTR
WriteRegister(uint16_t address
, uint8_t *buffer
, uint8_t size
, SX12XX_Radio_Number_t radioNumber
);
44 void ICACHE_RAM_ATTR
WriteRegister(uint16_t address
, uint8_t value
, SX12XX_Radio_Number_t radioNumber
);
46 void ICACHE_RAM_ATTR
ReadCommand(SX1280_RadioCommands_t opcode
, uint8_t *buffer
, uint8_t size
, SX12XX_Radio_Number_t radioNumber
);
47 void ICACHE_RAM_ATTR
ReadRegister(uint16_t address
, uint8_t *buffer
, uint8_t size
, SX12XX_Radio_Number_t radioNumber
);
48 uint8_t ICACHE_RAM_ATTR
ReadRegister(uint16_t address
, SX12XX_Radio_Number_t radioNumber
);
50 void ICACHE_RAM_ATTR
WriteBuffer(uint8_t offset
, uint8_t *buffer
, uint8_t size
, SX12XX_Radio_Number_t radioNumber
); // Writes and Reads to FIFO
51 void ICACHE_RAM_ATTR
ReadBuffer(uint8_t offset
, uint8_t *buffer
, uint8_t size
, SX12XX_Radio_Number_t radioNumber
);
53 bool ICACHE_RAM_ATTR
WaitOnBusy(SX12XX_Radio_Number_t radioNumber
);
55 static ICACHE_RAM_ATTR
void dioISR_1();
56 static ICACHE_RAM_ATTR
void dioISR_2();
57 void (*IsrCallback_1
)(); //function pointer for callback
58 void (*IsrCallback_2
)(); //function pointer for callback
60 uint32_t BusyDelayStart
;
61 uint32_t BusyDelayDuration
;
62 void BusyDelay(uint32_t duration
)
64 if (GPIO_PIN_BUSY
== UNDEF_PIN
)
66 BusyDelayStart
= micros();
67 BusyDelayDuration
= duration
;