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 #if defined(RADIOLIB_BUILD_ARDUINO)
7 #include "../../ArduinoHal.h"
8 #endif
9 
10 #include "../PhysicalLayer/PhysicalLayer.h"
11 #include "../AFSK/AFSK.h"
12 #include "../Print/Print.h"
13 #include "../Print/ITA2String.h"
14 
19 struct BellModem_t {
23  int16_t freqMark;
24 
28  int16_t freqSpace;
29 
33  int16_t baudRate;
34 
38  int16_t freqMarkReply;
39 
43  int16_t freqSpaceReply;
44 };
45 
46 // currently implemented Bell modems
47 extern const struct BellModem_t Bell101;
48 extern const struct BellModem_t Bell103;
49 extern const struct BellModem_t Bell202;
50 
55 class BellClient: public AFSKClient, public RadioLibPrint {
56 
57  public:
58 
63  bool reply;
64 
70  explicit BellClient(PhysicalLayer* phy, uint32_t pin);
71 
76  BellClient(AFSKClient* aud);
77 
83  int16_t begin(const BellModem_t& modem);
84 
90  int16_t setModem(const BellModem_t& modem);
91 
98  int16_t setCorrection(float corr);
99 
105  size_t write(uint8_t b);
106 
110  int16_t idle();
111 
115  int16_t standby();
116 
117 #if !defined(RADIOLIB_GODMODE)
118  private:
119 #endif
120  BellModem_t modemType;
121  float correction = 1.0;
122  uint16_t toneLen = 0;
123  bool autoStart = true;
124 
125 };
126 
127 #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:55
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
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:63
size_t write(uint8_t b)
Write one byte. Implementation of interface of the RadioLibPrint/Print class.
Definition: BellModem.cpp:55
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:15
Definition: Print.h:14
Definition: BellModem.cpp:4
Definition: BellModem.cpp:12
Definition: BellModem.cpp:20
Definition of the Bell-compatible modem.
Definition: BellModem.h:19
int16_t freqSpace
Frequency of the space tone.
Definition: BellModem.h:28
int16_t freqSpaceReply
Frequency of the space tone when replying.
Definition: BellModem.h:43
int16_t baudRate
Baud rate.
Definition: BellModem.h:33
int16_t freqMarkReply
Frequency of the mark tone when replying.
Definition: BellModem.h:38
int16_t freqMark
Frequency of the mark tone.
Definition: BellModem.h:23