RadioLib
Universal wireless communication library for Arduino
Hellschreiber.h
1 #if !defined(_RADIOLIB_HELLSCHREIBER_H)
2 #define _RADIOLIB_HELLSCHREIBER_H
3 
4 #include "../../TypeDef.h"
5 
6 #if !RADIOLIB_EXCLUDE_HELLSCHREIBER
7 
8 #include "../PhysicalLayer/PhysicalLayer.h"
9 #include "../AFSK/AFSK.h"
10 #include "../Print/Print.h"
11 
12 #define RADIOLIB_HELL_FONT_WIDTH 7
13 #define RADIOLIB_HELL_FONT_HEIGHT 7
14 
15 // font definition: characters are stored in rows,
16 // least significant byte of each character is the first row
17 // Hellschreiber use 7x7 characters, but this simplified font uses only 5x5
18 // the extra bytes aren't stored
19 static const uint8_t HellFont[64][RADIOLIB_HELL_FONT_WIDTH - 2] RADIOLIB_NONVOLATILE = {
20  { 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0000000 }, // space
21  { 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // !
22  { 0b0010100, 0b0010100, 0b0000000, 0b0000000, 0b0000000 }, // "
23  { 0b0010100, 0b0111110, 0b0010100, 0b0111110, 0b0010100 }, // #
24  { 0b0111110, 0b0101000, 0b0111110, 0b0001010, 0b0111110 }, // $
25  { 0b0110010, 0b0110100, 0b0001000, 0b0010110, 0b0100110 }, // %
26  { 0b0010000, 0b0101000, 0b0010000, 0b0101000, 0b0110100 }, // &
27  { 0b0001000, 0b0001000, 0b0000000, 0b0000000, 0b0000000 }, // '
28  { 0b0000100, 0b0001000, 0b0001000, 0b0001000, 0b0000100 }, // (
29  { 0b0010000, 0b0001000, 0b0001000, 0b0001000, 0b0010000 }, // )
30  { 0b0010100, 0b0001000, 0b0010100, 0b0000000, 0b0000000 }, // *
31  { 0b0001000, 0b0001000, 0b0111110, 0b0001000, 0b0001000 }, // +
32  { 0b0000000, 0b0000000, 0b0000000, 0b0001000, 0b0010000 }, // ,
33  { 0b0000000, 0b0000000, 0b0111110, 0b0000000, 0b0000000 }, // -
34  { 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0001000 }, // .
35  { 0b0000010, 0b0000100, 0b0001000, 0b0010000, 0b0100000 }, // /
36  { 0b0011100, 0b0100110, 0b0101010, 0b0110010, 0b0011100 }, // 0
37  { 0b0011000, 0b0001000, 0b0001000, 0b0001000, 0b0001000 }, // 1
38  { 0b0011000, 0b0100100, 0b0001000, 0b0010000, 0b0111100 }, // 2
39  { 0b0111100, 0b0000100, 0b0011100, 0b0000100, 0b0111100 }, // 3
40  { 0b0100100, 0b0100100, 0b0111100, 0b0000100, 0b0000100 }, // 4
41  { 0b0011100, 0b0100000, 0b0111100, 0b0000100, 0b0111100 }, // 5
42  { 0b0111100, 0b0100000, 0b0111100, 0b0100100, 0b0111100 }, // 6
43  { 0b0111100, 0b0000100, 0b0001000, 0b0010000, 0b0100000 }, // 7
44  { 0b0111100, 0b0100100, 0b0011000, 0b0100100, 0b0111100 }, // 8
45  { 0b0111100, 0b0100100, 0b0111100, 0b0000100, 0b0111100 }, // 9
46  { 0b0000000, 0b0001000, 0b0000000, 0b0000000, 0b0001000 }, // :
47  { 0b0000000, 0b0001000, 0b0000000, 0b0001000, 0b0001000 }, // ;
48  { 0b0000100, 0b0001000, 0b0010000, 0b0001000, 0b0000100 }, // <
49  { 0b0000000, 0b0111110, 0b0000000, 0b0111110, 0b0000000 }, // =
50  { 0b0010000, 0b0001000, 0b0000100, 0b0001000, 0b0010000 }, // >
51  { 0b0011100, 0b0000100, 0b0001000, 0b0000000, 0b0001000 }, // ?
52  { 0b0011100, 0b0100010, 0b0101110, 0b0101010, 0b0001100 }, // @
53  { 0b0111110, 0b0100010, 0b0111110, 0b0100010, 0b0100010 }, // A
54  { 0b0111100, 0b0010010, 0b0011110, 0b0010010, 0b0111100 }, // B
55  { 0b0011110, 0b0110000, 0b0100000, 0b0110000, 0b0011110 }, // C
56  { 0b0111100, 0b0100010, 0b0100010, 0b0100010, 0b0111100 }, // D
57  { 0b0111110, 0b0100000, 0b0111100, 0b0100000, 0b0111110 }, // E
58  { 0b0111110, 0b0100000, 0b0111100, 0b0100000, 0b0100000 }, // F
59  { 0b0111110, 0b0100000, 0b0101110, 0b0100010, 0b0111110 }, // G
60  { 0b0100010, 0b0100010, 0b0111110, 0b0100010, 0b0100010 }, // H
61  { 0b0011100, 0b0001000, 0b0001000, 0b0001000, 0b0011100 }, // I
62  { 0b0111100, 0b0001000, 0b0001000, 0b0101000, 0b0111000 }, // J
63  { 0b0100100, 0b0101000, 0b0110000, 0b0101000, 0b0100100 }, // K
64  { 0b0100000, 0b0100000, 0b0100000, 0b0100000, 0b0111100 }, // L
65  { 0b0100010, 0b0110110, 0b0101010, 0b0100010, 0b0100010 }, // M
66  { 0b0100010, 0b0110010, 0b0101010, 0b0100110, 0b0100010 }, // N
67  { 0b0011100, 0b0100010, 0b0100010, 0b0100010, 0b0011100 }, // O
68  { 0b0111110, 0b0100010, 0b0111110, 0b0100000, 0b0100000 }, // P
69  { 0b0111110, 0b0100010, 0b0100010, 0b0100110, 0b0111110 }, // Q
70  { 0b0111110, 0b0100010, 0b0111110, 0b0100100, 0b0100010 }, // R
71  { 0b0111110, 0b0100000, 0b0111110, 0b0000010, 0b0111110 }, // S
72  { 0b0111110, 0b0001000, 0b0001000, 0b0001000, 0b0001000 }, // T
73  { 0b0100010, 0b0100010, 0b0100010, 0b0100010, 0b0111110 }, // U
74  { 0b0100010, 0b0100010, 0b0010100, 0b0010100, 0b0001000 }, // V
75  { 0b0100010, 0b0100010, 0b0101010, 0b0110110, 0b0100010 }, // W
76  { 0b0100010, 0b0010100, 0b0001000, 0b0010100, 0b0100010 }, // X
77  { 0b0100010, 0b0010100, 0b0001000, 0b0001000, 0b0001000 }, // Y
78  { 0b0111110, 0b0000100, 0b0001000, 0b0010000, 0b0111110 }, // Z
79  { 0b0001100, 0b0001000, 0b0001000, 0b0001000, 0b0001100 }, // [
80  { 0b0100000, 0b0010000, 0b0001000, 0b0000100, 0b0000010 }, // backslash
81  { 0b0011000, 0b0001000, 0b0001000, 0b0001000, 0b0011000 }, // ]
82  { 0b0001000, 0b0010100, 0b0000000, 0b0000000, 0b0000000 }, // ^
83  { 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0111110 } // _
84 };
85 
90 class HellClient: public RadioLibPrint {
91  public:
96  explicit HellClient(PhysicalLayer* phy);
97 
98  #if !RADIOLIB_EXCLUDE_AFSK
103  explicit HellClient(AFSKClient* audio);
104  #endif
105 
106  // basic methods
107 
113  int16_t begin(float base, float rate = 122.5);
114 
120  size_t printGlyph(const uint8_t* buff);
121 
126  void setInversion(bool inv);
127 
133  size_t write(uint8_t b) override;
134 
135 #if !RADIOLIB_GODMODE
136  private:
137 #endif
138  PhysicalLayer* phyLayer;
139  #if !RADIOLIB_EXCLUDE_AFSK
140  AFSKClient* audioClient;
141  #endif
142 
143  uint32_t baseFreq = 0, baseFreqHz = 0;
144  uint32_t pixelDuration = 0;
145  bool invert = false;
146 
147  size_t printNumber(unsigned long, uint8_t);
148  size_t printFloat(double, uint8_t);
149 
150  int16_t transmitDirect(uint32_t freq = 0, uint32_t freqHz = 0);
151  int16_t standby();
152 };
153 
154 #endif
155 
156 #endif
Client for audio-based transmissions. Requires Arduino tone() function, and a module capable of direc...
Definition: AFSK.h:16
Client for Hellschreiber transmissions.
Definition: Hellschreiber.h:90
int16_t begin(float base, float rate=122.5)
Initialization method.
Definition: Hellschreiber.cpp:21
size_t printGlyph(const uint8_t *buff)
Method to "print" a buffer of pixels, this is exposed to allow users to send custom characters.
Definition: Hellschreiber.cpp:33
HellClient(PhysicalLayer *phy)
Constructor for 2-FSK mode.
Definition: Hellschreiber.cpp:5
void setInversion(bool inv)
Invert text color.
Definition: Hellschreiber.cpp:57
size_t write(uint8_t b) override
Write one byte. Implementation of interface of the RadioLibPrint/Print class.
Definition: Hellschreiber.cpp:61
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:135
Printing class, based on Arduino Print class with additional encodings.
Definition: Print.h:17