| LIN_slave_portable_Arduino 1.4 Arduino library for Local Interconnect Network slave node emulation

Loading...
Searching...
No Matches
LIN_slave_HardwareSerial_ESP8266.cpp
Go to the documentation of this file.
1
12// assert ESP8266 platform
13#if defined(ARDUINO_ARCH_ESP8266)
14
15// include files
16#include <LIN_slave_HardwareSerial_ESP8266.h>
17
18
19
20/**************************
21 * PUBLIC METHODS
22**************************/
23
34 LIN_Slave_HardwareSerial_ESP8266::LIN_Slave_HardwareSerial_ESP8266(bool SwapPins, uint16_t MinFramePause,
35 LIN_Slave_Base::version_t Version, const char NameLIN[], uint32_t TimeoutRx, const int8_t PinTxEN) :
36 LIN_Slave_HardwareSerial(Serial, MinFramePause, Version, NameLIN, TimeoutRx, PinTxEN)
37{
38 // Debug serial initialized in begin() -> no debug output here
39
40 // store parameters in class variables
41 this->swapPins = SwapPins; // use alternate pins Rx=D7 / Tx=D8 for Serial0
42
43} // LIN_Slave_HardwareSerial_ESP8266::LIN_Slave_HardwareSerial_ESP8266()
44
45
46
52 void LIN_Slave_HardwareSerial_ESP8266::begin(uint16_t Baudrate)
53{
54 // call parent class method
55 LIN_Slave_HardwareSerial::begin(Baudrate);
56
57 // optionally route Serial0 to alternate pins
58 if (this->swapPins == true)
59 this->pSerial->swap();
60
61 // print debug message
62 DEBUG_PRINT(2, "ok, pin swap=%d", (int) this->swapPins);
63
64} // LIN_Slave_HardwareSerial_ESP8266::begin()
65
66
67
72 void LIN_Slave_HardwareSerial_ESP8266::end()
73{
74 // call base class method
75 LIN_Slave_Base::end();
76
77 // close serial interface
78 this->pSerial->end();
79
80 // print debug message
81 DEBUG_PRINT(2, " ");
82
83} // LIN_Slave_HardwareSerial_ESP8266::end()
84
85#endif // ARDUINO_ARCH_ESP8266
86
87/*-----------------------------------------------------------------------------
88 END OF FILE
89-----------------------------------------------------------------------------*/
LIN_slave_HardwareSerial_ESP8266.h
LIN slave emulation library using a HardwareSerial interface of ESP8266.
LIN_Slave_Base::version_t
version_t
LIN protocol version.
Definition LIN_slave_Base.h:112
LIN_Slave_Base::end
virtual void end(void)
Close serial interface.
Definition LIN_slave_Base.cpp:201
LIN_Slave_HardwareSerial_ESP8266::end
void end(void)
Close serial interface.
Definition LIN_slave_HardwareSerial_ESP8266.cpp:72
LIN_Slave_HardwareSerial_ESP8266::LIN_Slave_HardwareSerial_ESP8266
LIN_Slave_HardwareSerial_ESP8266(bool SwapPins=false, uint16_t MinFramePause=1000L, LIN_Slave_Base::version_t Version=LIN_Slave_Base::LIN_V2, const char NameLIN[]="Slave", uint32_t TimeoutRx=1500L, const int8_t PinTxEN=INT8_MIN)
Class constructor.
Definition LIN_slave_HardwareSerial_ESP8266.cpp:34
LIN_Slave_HardwareSerial_ESP8266::begin
void begin(uint16_t Baudrate=19200)
Open serial interface.
Definition LIN_slave_HardwareSerial_ESP8266.cpp:52
LIN_Slave_HardwareSerial
LIN slave node class via generic HardwareSerial.
Definition LIN_slave_HardwareSerial.h:42
LIN_Slave_HardwareSerial::pSerial
HardwareSerial * pSerial
pointer to serial interface used for LIN
Definition LIN_slave_HardwareSerial.h:46
LIN_Slave_HardwareSerial::begin
void begin(uint16_t Baudrate=19200)
Open serial interface.
Definition LIN_slave_HardwareSerial.cpp:83