projet3_temperature/lib/LoRaRadio/LoRaRadio.h

43 lines
971 B
C++

#ifndef LORARADIO_H
#define LORARADIO_H
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
#include <Arduino.h>
class PinMap
{
friend class LoRaRadio;
public:
PinMap(u1_t nss, u1_t rxtx, u1_t rst, const u1_t dio[3]) : _nss(nss), _rxtx(rxtx), _rst(rst)
{
_dio[0] = dio[0];
_dio[1] = dio[1];
_dio[2] = dio[2];
}
protected:
private:
u1_t _nss, _rxtx, _rst, _dio[3];
};
class LoRaRadio
{
public:
LoRaRadio(PinMap pinMap, dr_t dataRate = DR_SF7, s1_t txPower = 23);
void init();
void setTTNSession(u4_t channelId, devaddr_t deviceAddress, xref2u1_t networkSystemKey, xref2u1_t applicationSystemKey, bit_t linkCheckMode = 0);
void setRadioEUChannels();
void setMCUClockError(u2_t percent = 30);
void send(u1_t port, uint8_t *data, uint8_t length, u1_t confirmed = false);
void run();
protected:
private:
dr_t _dataRate;
s1_t _txPower;
PinMap _pinMap;
};
#endif //LORARADIO_H