| LIN_master_portable_Arduino 1.4 Arduino library for Local Interconnect Network master node emulation

Loading...
Searching...
No Matches
LIN_master_SoftwareSerial.h
Go to the documentation of this file.
1
9// assert platform which supports SoftwareSerial. Note: ARDUINO_ARCH_ESP32 requires library ESPSoftwareSerial
10#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
11
12/*-----------------------------------------------------------------------------
13 MODULE DEFINITION FOR MULTIPLE INCLUSION
14-----------------------------------------------------------------------------*/
15#ifndef _LIN_MASTER_SW_SERIAL_H_
16#define _LIN_MASTER_SW_SERIAL_H_
17
18
19/*-----------------------------------------------------------------------------
20 INCLUDE FILES
21-----------------------------------------------------------------------------*/
22
23// include required libraries
24#include <LIN_master_Base.h>
25#include <SoftwareSerial.h>
26
27
28/*-----------------------------------------------------------------------------
29 GLOBAL CLASS
30-----------------------------------------------------------------------------*/
36 class LIN_Master_SoftwareSerial : public LIN_Master_Base
37{
38 // PRIVATE VARIABLES
39 private:
40
41 SoftwareSerial SWSerial;
42 uint8_t pinRx;
43 uint8_t pinTx;
44 bool inverseLogic;
45 uint32_t durationBreak;
46
47
48 // PROTECTED METHODS
49 protected:
50
52 LIN_Master_Base::state_t _sendBreak(void);
53
55 LIN_Master_Base::state_t _sendFrame(void);
56
58 LIN_Master_Base::state_t _receiveFrame(void);
59
60
61 // PUBLIC METHODS
62 public:
63
65 LIN_Master_SoftwareSerial(uint8_t PinRx, uint8_t PinTx, bool InverseLogic = false, const char NameLIN[] = "Master", const int8_t PinTxEN = INT8_MIN);
66
67
69 void begin(uint16_t Baudrate = 19200);
70
72 void end(void);
73
74}; // class LIN_Master_SoftwareSerial
75
76
77/*-----------------------------------------------------------------------------
78 END OF MODULE DEFINITION FOR MULTIPLE INLUSION
79-----------------------------------------------------------------------------*/
80#endif // _LIN_MASTER_SW_SERIAL_H_
81
82#endif // ARDUINO_ARCH_AVR || ARDUINO_ARCH_ESP8266 || ARDUINO_ARCH_ESP32
83
84/*-----------------------------------------------------------------------------
85 END OF FILE
86-----------------------------------------------------------------------------*/
LIN_master_Base.h
Base class for LIN master emulation (non-functional)
LIN_Master_Base
LIN master node base class.
Definition LIN_master_Base.h:106
LIN_Master_Base::state_t
state_t
state of LIN master state machine. Use bitmasks for fast checking multiple states
Definition LIN_master_Base.h:128
LIN_Master_SoftwareSerial
LIN master node class via SoftwareSerial.
Definition LIN_master_SoftwareSerial.h:37
LIN_Master_SoftwareSerial::begin
void begin(uint16_t Baudrate=19200)
Open serial interface.
Definition LIN_master_SoftwareSerial.cpp:224
LIN_Master_SoftwareSerial::_sendBreak
LIN_Master_Base::state_t _sendBreak(void)
Send LIN break.
Definition LIN_master_SoftwareSerial.cpp:21
LIN_Master_SoftwareSerial::end
void end(void)
Close serial interface.
Definition LIN_master_SoftwareSerial.cpp:247
LIN_Master_SoftwareSerial::_receiveFrame
LIN_Master_Base::state_t _receiveFrame(void)
Read and check LIN frame.
Definition LIN_master_SoftwareSerial.cpp:114
LIN_Master_SoftwareSerial::_sendFrame
LIN_Master_Base::state_t _sendFrame(void)
Send LIN bytes (request frame: SYNC+ID+DATA[]+CHK; response frame: SYNC+ID)
Definition LIN_master_SoftwareSerial.cpp:63