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 opcode
, uint8_t *buffer
, uint8_t size
);
42 void ICACHE_RAM_ATTR
WriteCommand(SX1280_RadioCommands_t command
, uint8_t val
);
43 void ICACHE_RAM_ATTR
WriteRegister(uint16_t address
, uint8_t *buffer
, uint8_t size
);
44 void ICACHE_RAM_ATTR
WriteRegister(uint16_t address
, uint8_t value
);
46 void ICACHE_RAM_ATTR
ReadCommand(SX1280_RadioCommands_t opcode
, uint8_t *buffer
, uint8_t size
);
47 void ICACHE_RAM_ATTR
ReadRegister(uint16_t address
, uint8_t *buffer
, uint8_t size
);
48 uint8_t ICACHE_RAM_ATTR
ReadRegister(uint16_t address
);
50 void ICACHE_RAM_ATTR
WriteBuffer(uint8_t offset
, volatile uint8_t *buffer
, uint8_t size
); // Writes and Reads to FIFO
51 void ICACHE_RAM_ATTR
ReadBuffer(uint8_t offset
, volatile uint8_t *buffer
, uint8_t size
);
53 bool ICACHE_RAM_ATTR
WaitOnBusy();
55 void ICACHE_RAM_ATTR
TXenable();
56 void ICACHE_RAM_ATTR
RXenable();
57 void ICACHE_RAM_ATTR
TXRXdisable();
59 static ICACHE_RAM_ATTR
void dioISR();
60 void (*IsrCallback
)(); //function pointer for callback
62 #if defined(GPIO_PIN_BUSY) && (GPIO_PIN_BUSY != UNDEF_PIN)
63 void BusyDelay(uint32_t duration
) const { (void)duration
; };
65 uint32_t BusyDelayStart
;
66 uint32_t BusyDelayDuration
;
67 void BusyDelay(uint32_t duration
)
69 BusyDelayStart
= micros();
70 BusyDelayDuration
= duration
;