RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
SSTV.h
1#if !defined(_RADIOLIB_SSTV_H)
2#define _RADIOLIB_SSTV_H
3
4#include "../../TypeDef.h"
5
6#if !RADIOLIB_EXCLUDE_SSTV
7
8#include "../PhysicalLayer/PhysicalLayer.h"
9#include "../AFSK/AFSK.h"
10
11// the following implementation is based on information from
12// http://www.barberdsp.com/downloads/Dayton%20Paper.pdf
13
14// VIS codes
15#define RADIOLIB_SSTV_SCOTTIE_1 60
16#define RADIOLIB_SSTV_SCOTTIE_2 56
17#define RADIOLIB_SSTV_SCOTTIE_DX 76
18#define RADIOLIB_SSTV_MARTIN_1 44
19#define RADIOLIB_SSTV_MARTIN_2 40
20#define RADIOLIB_SSTV_WRASSE_SC2_180 55
21#define RADIOLIB_SSTV_PASOKON_P3 113
22#define RADIOLIB_SSTV_PASOKON_P5 114
23#define RADIOLIB_SSTV_PASOKON_P7 115
24#define RADIOLIB_SSTV_ROBOT_36 8
25#define RADIOLIB_SSTV_ROBOT_72 12
26
27// SSTV tones in Hz
28#define RADIOLIB_SSTV_TONE_LEADER 1900
29#define RADIOLIB_SSTV_TONE_BREAK 1200
30#define RADIOLIB_SSTV_TONE_VIS_1 1100
31#define RADIOLIB_SSTV_TONE_VIS_0 1300
32#define RADIOLIB_SSTV_TONE_BRIGHTNESS_MIN 1500
33#define RADIOLIB_SSTV_TONE_BRIGHTNESS_MAX 2300
34
35// calibration header timing in us
36#define RADIOLIB_SSTV_HEADER_LEADER_LENGTH 300000
37#define RADIOLIB_SSTV_HEADER_BREAK_LENGTH 10000
38#define RADIOLIB_SSTV_HEADER_BIT_LENGTH 30000
39
44struct tone_t {
45
49 enum {
50 GENERIC = 0,
51 SCAN_GREEN_Y,
52 SCAN_BLUE_CB,
53 SCAN_RED_CR
55
60
64 uint16_t freq;
65};
66
71struct SSTVMode_t {
72
76 uint8_t visCode;
77
81 uint16_t width;
82
86 uint16_t height;
87
91 uint16_t scanPixelLen;
92
96 uint8_t numTones;
97
102};
103
104// all currently supported SSTV modes
105extern const SSTVMode_t Scottie1;
106extern const SSTVMode_t Scottie2;
107extern const SSTVMode_t ScottieDX;
108extern const SSTVMode_t Martin1;
109extern const SSTVMode_t Martin2;
110extern const SSTVMode_t Wrasse;
111extern const SSTVMode_t PasokonP3;
112extern const SSTVMode_t PasokonP5;
113extern const SSTVMode_t PasokonP7;
114extern const SSTVMode_t Robot36;
115extern const SSTVMode_t Robot72;
116
122 public:
127 explicit SSTVClient(PhysicalLayer* phy);
128
129 #if !RADIOLIB_EXCLUDE_AFSK
134 explicit SSTVClient(AFSKClient* audio);
135 #endif
136
137 // basic methods
138
147 int16_t begin(float base, const SSTVMode_t& mode);
148
149 #if !RADIOLIB_EXCLUDE_AFSK
157 int16_t begin(const SSTVMode_t& mode);
158 #endif
159
166 int16_t setCorrection(float correction);
167
171 void idle();
172
176 void sendHeader();
177
183 void sendLine(const uint32_t* imgLine);
184
189 uint16_t getPictureHeight() const;
190
191#if !RADIOLIB_GODMODE
192 private:
193#endif
194 PhysicalLayer* phyLayer;
195 #if !RADIOLIB_EXCLUDE_AFSK
196 AFSKClient* audioClient;
197 #endif
198
199 uint32_t baseFreq = 0;
200 SSTVMode_t txMode = Scottie1;
201 uint32_t lineCount = 0;
202
203 void tone(float freq, RadioLibTime_t len = 0);
204};
205
206#endif
207
208#endif
Client for audio-based transmissions. Requires Arduino tone() function, and a module capable of direc...
Definition AFSK.h:16
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition PhysicalLayer.h:216
Client for SSTV transmissions.
Definition SSTV.h:121
void idle()
Sends out tone at 1900 Hz.
Definition SSTV.cpp:242
int16_t setCorrection(float correction)
Set correction coefficient for tone length.
Definition SSTV.cpp:228
void sendHeader()
Sends synchronization header for the SSTV mode set in begin method.
Definition SSTV.cpp:247
int16_t begin(float base, const SSTVMode_t &mode)
Initialization method for 2-FSK.
Definition SSTV.cpp:217
void sendLine(const uint32_t *imgLine)
Sends single picture line in the currently configured SSTV mode.
Definition SSTV.cpp:284
uint16_t getPictureHeight() const
Get picture height of the currently configured SSTV mode.
Definition SSTV.cpp:357
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition TypeDef.h:642
Structure to save data about supported SSTV modes.
Definition SSTV.h:71
uint8_t visCode
Unique VIS code of the SSTV mode.
Definition SSTV.h:76
tone_t tones[9]
Sequence of tones in each transmission line. This is used to create the correct encoding sequence.
Definition SSTV.h:101
uint16_t scanPixelLen
Pixel scan length in us.
Definition SSTV.h:91
uint16_t height
Picture height in pixels.
Definition SSTV.h:86
uint16_t width
Picture width in pixels.
Definition SSTV.h:81
uint8_t numTones
Number of tones in each transmission line. Picture scan data is considered single tone.
Definition SSTV.h:96
Structure to save data about tone.
Definition SSTV.h:44
uint16_t freq
Frequency of tone in Hz, set to 0 for picture scan tones.
Definition SSTV.h:64
RadioLibTime_t len
Length of tone in us, set to 0 for picture scan tones.
Definition SSTV.h:59
enum tone_t::@1 type
Tone type: GENERIC for sync and porch tones, SCAN_GREEN, SCAN_BLUE and SCAN_RED for scan lines.