#ifndef LORAHANDLER_H
#define LORAHANDLER_H

#include "config.hpp"
#include <RadioLib.h>

#define LORA_SCK            5
#define LORA_MISO           19
#define LORA_MOSI           27
#define LORA_CS             18  // CS  --> NSS
#define LORA_RST            14
#define LORA_IRQ            26  // IRQ --> DIO0
#define LORA_RXEN           2   // RX Enable
#define LORA_TXEN           13  // TX Enable

struct ReceivedLoRaPacket {
    String  text;
    int     rssi;
    float   snr;
    int     freqError;
};

class LoraHandler {
    public:
        LoraHandler();
        void setup();
        ReceivedLoRaPacket receivePacket();
    private:
        SX1278* radio;
        SPIClass* spi;
        int mockCounter = 0;
};

#endif /* LORAHANDLER_H */