-
Notifications
You must be signed in to change notification settings - Fork 5
/
SA818.h
73 lines (53 loc) · 1.84 KB
/
SA818.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
SA818.h - SA818U/SA818V Communication Library.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
For a full copy of the GNU General Public License,
see <http://www.gnu.org/licenses/>.
*/
#ifndef SA818_h
#define SA818_h
#include <SomeSerial.h>
#include <Stream.h>
#define SA_BANDWIDTH_12_5KHZ 0
#define SA_BANDWIDTH_25KHZ 1
#define SA_CTCSS_OFF "0000"
#define SA_SQUELCH_OFF 0
#define SA_POWER_LOW 0
#define SA_POWER_HIGH 1
#define SA_VOLUME_MIN 0
#define SA_VOLUME_DEFAULT 4
#define SA_VOLUME_MAX 8
#define SA_FILTER_OFF 0
#define SA_FILTER_ON 1
#define SA_POWER_OFF 0
#define SA_POWER_ON 1
#define SA_MODE_TX 0
#define SA_MODE_RX 1
class SA818 {
public:
SA818(SomeSerial *serial, uint8_t PIN_PTT, uint8_t PIN_PD, uint8_t PIN_HL, uint8_t PIN_AMP = 0);
uint8_t begin();
uint8_t setConfig(uint8_t bw, char* tx_f, char* rx_f, char* tx_ctcss, char* rx_ctcss, uint8_t squelch);
uint8_t setVolume(uint8_t volume);
uint8_t setPower(uint8_t is_high);
uint8_t setFilters(boolean preemph, boolean highpass, boolean lowpass);
void powerDown(uint8_t powerdown);
void changeMode(uint8_t mode);
void setModeTX();
void setModeRX();
private:
//Stream *serial;
//NewSoftSerial *serial;
SomeSerial *serial;
uint8_t PTT_PIN, PD_PIN, HL_PIN, AMP_PIN;
uint8_t readSerialTimeout();
//char buffer[60];
};
#endif