-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transmitter.h
49 lines (41 loc) · 984 Bytes
/
Transmitter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef TRANSMITTER_H
#define TRANSMITTER_H
#include <Arduino.h>
#include "TimerTwo.h"
#include "Constants.h"
#include "LEDBitmap.h"
typedef struct Frame{
size_t size = 0;
uint8_t* data;
} Frame;
class Transmitter
{
public:
Transmitter(int frequency = 1000);
virtual ~Transmitter() { };
public: //methods
int sendData(LEDBitmap &image);
int sendData(String &string);
void transmitBit();
void start();
void stop();
int setFrequency(int frequency);
bool lastTransmissionComplete();
bool isStarted() { return _active; };
void setPin(int pin);
int getPin();
private: //members
uint8_t _state;
Frame _frame;
uint16_t _pos;
uint8_t _manHalf;
int _pin;
bool _busy;
bool _active;
static Transmitter *_instance = NULL;
int _prepFrame(LEDBitmap &image);
int _prepFrame(String &string);
uint8_t _buildBitFrame(uint8_t* frame, uint8_t &size);
static void _transmitBit();
};
#endif