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 #if !RADIOLIB_EXCLUDE_BELL
11 
12 #include "../PhysicalLayer/PhysicalLayer.h"
13 #include "../AFSK/AFSK.h"
14 #include "../Print/Print.h"
15 #include "../Print/ITA2String.h"
16 
21 struct BellModem_t {
25  int16_t freqMark;
26 
30  int16_t freqSpace;
31 
35  int16_t baudRate;
36 
40  int16_t freqMarkReply;
41 
45  int16_t freqSpaceReply;
46 };
47 
48 // currently implemented Bell modems
49 extern const struct BellModem_t Bell101;
50 extern const struct BellModem_t Bell103;
51 extern const struct BellModem_t Bell202;
52 
57 class BellClient: public AFSKClient, public RadioLibPrint {
58 
59  public:
60 
65  bool reply;
66 
72  explicit BellClient(PhysicalLayer* phy, uint32_t pin);
73 
78  BellClient(AFSKClient* aud);
79 
85  int16_t begin(const BellModem_t& modem);
86 
92  int16_t setModem(const BellModem_t& modem);
93 
100  int16_t setCorrection(float corr);
101 
107  size_t write(uint8_t b);
108 
112  int16_t idle();
113 
117  int16_t standby();
118 
119 #if !RADIOLIB_GODMODE
120  private:
121 #endif
122  BellModem_t modemType;
123  float correction = 1.0;
124  uint16_t toneLen = 0;
125  bool autoStart = true;
126 
127 };
128 
129 #endif
130 
131 #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:57
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:65
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:54
Printing class, based on Arduino Print class with additional encodings.
Definition: Print.h:17
Definition of the Bell-compatible modem.
Definition: BellModem.h:21
int16_t freqSpace
Frequency of the space tone.
Definition: BellModem.h:30
int16_t freqSpaceReply
Frequency of the space tone when replying.
Definition: BellModem.h:45
int16_t baudRate
Baud rate.
Definition: BellModem.h:35
int16_t freqMarkReply
Frequency of the mark tone when replying.
Definition: BellModem.h:40
int16_t freqMark
Frequency of the mark tone.
Definition: BellModem.h:25