-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPwmTransceiver.h
52 lines (43 loc) · 1.19 KB
/
PwmTransceiver.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
/*
Created by: Esposito Vittorio
GitHub: https://github.com/VittorioEsposito
J1850-Arduino-Transceiver-Library
*/
#define LIBCALL_ENABLEINTERRUPT
#define EI_ARDUINO_INTERRUPTED_PIN
#include <stdint.h>
#include <Arduino.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <digitalWriteFast.h>
#include <EnableInterrupt.h>
#define BUFFER_SIZE 64
class PwmTransceiver
{
public:
PwmTransceiver(uint8_t RX_PIN, uint8_t TX_PIN);
PwmTransceiver(uint8_t RX_PIN, uint8_t TX_PIN, uint8_t MODE_PIN, uint8_t EN_PIN);
void setRxPin(uint8_t RX_PIN);
void setTxPin(uint8_t TX_PIN);
void setEnablePin(uint8_t EN_PIN);
void setTxRxModePin(uint8_t MODE_PIN);
void setLogic(bool logic);
uint8_t getRxPin();
uint8_t getTxPin();
void begin(uint32_t BITRATE);
void powerDown();
void powerUp();
void enableTxMode();
void enableRxMode();
void println(String str);
void print(String str);
void print(char txt[]);
void print(char c);
void print(uint8_t n);
void send (bool b);
bool isReceiving();
bool available();
String readString();
byte CRC8(String str);
byte CRC8(byte data[], byte len);
};