RadioLib
Universal wireless communication library for Arduino
BellModem.h
1 #if !defined(_RADIOLIB_BELL_MODEM_H)
2 #define _RADIOLIB_BELL_MODEM_H
3 
4 #include "../../TypeDef.h"
5 #include "../../Module.h"
6 
7 #if !RADIOLIB_EXCLUDE_BELL
8 
9 #include "../PhysicalLayer/PhysicalLayer.h"
10 #include "../AFSK/AFSK.h"
11 #include "../Print/Print.h"
12 #include "../Print/ITA2String.h"
13 
18 struct BellModem_t {
22  int16_t freqMark;
23 
27  int16_t freqSpace;
28 
32  int16_t baudRate;
33 
37  int16_t freqMarkReply;
38 
42  int16_t freqSpaceReply;
43 };
44 
45 // currently implemented Bell modems
46 extern const struct BellModem_t Bell101;
47 extern const struct BellModem_t Bell103;
48 extern const struct BellModem_t Bell202;
49 
54 class BellClient: public AFSKClient, public RadioLibPrint {
55 
56  public:
57 
62  bool reply;
63 
69  explicit BellClient(PhysicalLayer* phy, uint32_t pin);
70 
75  explicit BellClient(AFSKClient* aud);
76 
82  int16_t begin(const BellModem_t& modem);
83 
89  int16_t setModem(const BellModem_t& modem);
90 
97  int16_t setCorrection(float corr);
98 
104  size_t write(uint8_t b) override;
105 
109  int16_t idle();
110 
114  int16_t standby();
115 
116 #if !RADIOLIB_GODMODE
117  private:
118 #endif
119  BellModem_t modemType = Bell101;
120  float correction = 1.0;
121  uint16_t toneLen = 0;
122  bool autoStart = true;
123 
124 };
125 
126 #endif
127 
128 #endif
Client for audio-based transmissions. Requires Arduino tone() function, and a module capable of direc...
Definition: AFSK.h:16
int16_t begin()
Initialization method.
Definition: AFSK.cpp:13
Client for Bell modem communication. The public interface is the same as Arduino Serial.
Definition: BellModem.h:54
int16_t setModem(const BellModem_t &modem)
Set Bell modem.
Definition: BellModem.cpp:44
int16_t standby()
Set the modem to standby (transmitter off).
Definition: BellModem.cpp:93
size_t write(uint8_t b) override
Write one byte. Implementation of interface of the RadioLibPrint/Print class.
Definition: BellModem.cpp:55
int16_t setCorrection(float corr)
Set correction coefficient for tone length.
Definition: BellModem.cpp:50
bool reply
Whether the modem is replying. On some modems, the replying station has different tone frequencies.
Definition: BellModem.h:62
int16_t idle()
Set the modem to idle (ready to transmit).
Definition: BellModem.cpp:88
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:151
Printing class, based on Arduino Print class with additional encodings.
Definition: Print.h:17
Definition of the Bell-compatible modem.
Definition: BellModem.h:18
int16_t freqSpace
Frequency of the space tone.
Definition: BellModem.h:27
int16_t freqSpaceReply
Frequency of the space tone when replying.
Definition: BellModem.h:42
int16_t baudRate
Baud rate.
Definition: BellModem.h:32
int16_t freqMarkReply
Frequency of the mark tone when replying.
Definition: BellModem.h:37
int16_t freqMark
Frequency of the mark tone.
Definition: BellModem.h:22