LIN_master_portable_Arduino 1.9
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 defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_RENESAS)
12
13/*-----------------------------------------------------------------------------
14 MODULE DEFINITION FOR MULTIPLE INCLUSION
15-----------------------------------------------------------------------------*/
16#ifndef _LIN_MASTER_SW_SERIAL_H_
17#define _LIN_MASTER_SW_SERIAL_H_
18
19
20/*-----------------------------------------------------------------------------
21 INCLUDE FILES
22-----------------------------------------------------------------------------*/
23
24// include required libraries
25#include <LIN_master_Base.h>
26#include <SoftwareSerial.h>
27
28
29/*-----------------------------------------------------------------------------
30 GLOBAL CLASS
31-----------------------------------------------------------------------------*/
38{
39 // PRIVATE VARIABLES
40 private:
41
42 SoftwareSerial SWSerial;
43 uint8_t pinRx;
44 uint8_t pinTx;
45 bool inverseLogic;
46 uint32_t startBreak;
47 uint32_t durationBreak;
48
49
50 // PROTECTED METHODS
51 protected:
52
55
58
61
62
63 // PUBLIC METHODS
64 public:
65
67 LIN_master_SoftwareSerial(uint8_t PinRx, uint8_t PinTx, bool InverseLogic = false, const char NameLIN[] = "Master", const int8_t PinTxEN = INT8_MIN);
68
69
71 void begin(uint16_t Baudrate = 19200);
72
74 void end(void);
75
76}; // class LIN_master_SoftwareSerial
77
78
79/*-----------------------------------------------------------------------------
80 END OF MODULE DEFINITION FOR MULTIPLE INLUSION
81-----------------------------------------------------------------------------*/
82#endif // _LIN_MASTER_SW_SERIAL_H_
83
84#else // ARDUINO_ARCH_AVR || ARDUINO_ARCH_ESP8266 || ARDUINO_ARCH_ESP32 || ARDUINO_ARCH_MEGAAVR || ARDUINO_ARCH_STM32 || ARDUINO_ARCH_RENESAS
85
86 #error architecture not yet supported
87
88#endif
89
90/*-----------------------------------------------------------------------------
91 END OF FILE
92-----------------------------------------------------------------------------*/
Base class for LIN master emulation (non-functional)
LIN master node base class.
state_t
state of LIN master state machine. Use bitmasks for fast checking multiple states
LIN master node class via SoftwareSerial.
LIN_master_SoftwareSerial(uint8_t PinRx, uint8_t PinTx, bool InverseLogic=false, const char NameLIN[]="Master", const int8_t PinTxEN=INT8_MIN)
Class constructor.
LIN_Master_Base::state_t _sendBreak(void)
Send LIN break.
LIN_Master_Base::state_t _sendFrame(void)
Send LIN bytes (request frame: SYNC+ID+DATA[]+CHK; response frame: SYNC+ID)
void end(void)
Close serial interface.
LIN_Master_Base::state_t _receiveFrame(void)
Read and check LIN frame.
void begin(uint16_t Baudrate=19200)
Open serial interface.