Silence unused-variable warning (#2872)
[ExpressLRS.git] / src / lib / SX1280Driver / SX1280_hal.h
blobdf4b99b4da821b438683bbb5316e78d59e7db1be
1 #pragma once
3 /*
4 ______ _
5 / _____) _ | |
6 ( (____ _____ ____ _| |_ _____ ____| |__
7 \____ \| ___ | (_ _) ___ |/ ___) _ \
8 _____) ) ____| | | || |_| ____( (___| | | |
9 (______/|_____)_|_|_| \__)_____)\____)_| |_|
10 (C)2015 Semtech
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"
22 #include "SX1280.h"
24 enum SX1280_BusyState_
26 SX1280_NOT_BUSY = true,
27 SX1280_BUSY = false,
30 class SX1280Hal
32 public:
33 static SX1280Hal *instance;
35 SX1280Hal();
37 void init();
38 void end();
39 void reset();
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;
71 private: