2020-05-08 17:52:43 +00:00
|
|
|
#ifndef FT817_NBS_H
|
|
|
|
#define FT817_NBS_H
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <SoftwareSerial.h>
|
|
|
|
//#include <Arduino.h>
|
|
|
|
|
|
|
|
class FT817_NBS {
|
|
|
|
public:
|
|
|
|
enum SignalMode {LSB = 0x0, USB = 0x1, CW = 0x2, CWR = 0x3, AM = 0x4, WFM = 0x6, FM = 0x8, DIG = 0xA, PKT = 0xC, UNKNOWN};
|
|
|
|
|
|
|
|
private:
|
2020-05-08 21:12:15 +00:00
|
|
|
SoftwareSerial *serial;
|
2020-05-08 17:52:43 +00:00
|
|
|
unsigned long bcdToInt(uint8_t bcd);
|
|
|
|
unsigned long getDevicer(int step);
|
|
|
|
uint8_t intToBcd(unsigned long value);
|
|
|
|
void convertFromValueToBcd(uint8_t *buffer, unsigned long actualValue);
|
|
|
|
unsigned long convertFromBcdToValue(uint8_t *buffer);
|
|
|
|
void clearAvailableBytes();
|
2020-05-08 21:12:15 +00:00
|
|
|
void sendCommand(uint8_t *data, size_t len);
|
2020-05-08 17:52:43 +00:00
|
|
|
FT817_NBS::SignalMode getSignalMode(uint8_t numericValue);
|
|
|
|
|
|
|
|
public:
|
2020-05-08 21:12:15 +00:00
|
|
|
FT817_NBS(SoftwareSerial *connection);
|
|
|
|
|
2020-05-08 17:52:43 +00:00
|
|
|
struct Frequency {
|
|
|
|
unsigned long frequency;
|
|
|
|
FT817_NBS::SignalMode mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
FT817_NBS::Frequency getFrequency();
|
|
|
|
void setFrequency(unsigned long frequency);
|
|
|
|
void toggleAB();
|
2020-05-08 21:39:46 +00:00
|
|
|
void setMode(FT817_NBS::SignalMode);
|
2020-05-09 09:51:19 +00:00
|
|
|
void setSplit(bool on);
|
2020-05-08 17:52:43 +00:00
|
|
|
};
|
|
|
|
#endif
|