| 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 pSerial->swap();
60
61 // optional debug output (debug level 2)
62 #if defined(LIN_SLAVE_DEBUG_SERIAL) && (LIN_SLAVE_DEBUG_LEVEL >= 2)
63 LIN_SLAVE_DEBUG_SERIAL.print(this->nameLIN);
64 LIN_SLAVE_DEBUG_SERIAL.println(": LIN_Slave_HardwareSerial_ESP8266::begin()");
65 #endif
66
67} // LIN_Slave_HardwareSerial_ESP8266::begin()
68
69
70
75 void LIN_Slave_HardwareSerial_ESP8266::end()
76{
77 // call base class method
78 LIN_Slave_Base::end();
79
80 // close serial interface
81 pSerial->end();
82
83 // optional debug output (debug level 2)
84 #if defined(LIN_SLAVE_DEBUG_SERIAL) && (LIN_SLAVE_DEBUG_LEVEL >= 2)
85 LIN_SLAVE_DEBUG_SERIAL.print(this->nameLIN);
86 LIN_SLAVE_DEBUG_SERIAL.println(": LIN_Slave_HardwareSerial_ESP8266::end()");
87 #endif
88
89} // LIN_Slave_HardwareSerial_ESP8266::end()
90
91#endif // ARDUINO_ARCH_ESP8266
92
93/*-----------------------------------------------------------------------------
94 END OF FILE
95-----------------------------------------------------------------------------*/
LIN_slave_HardwareSerial_ESP8266.h
LIN slave emulation library using a HardwareSerial interface of ESP8266.
LIN_Slave_Base::nameLIN
char nameLIN[LIN_SLAVE_BUFLEN_NAME]
LIN node name, e.g. for debug.
Definition LIN_slave_Base.h:140
LIN_Slave_Base::version_t
version_t
LIN protocol version.
Definition LIN_slave_Base.h:58
LIN_Slave_Base::end
virtual void end(void)
Close serial interface.
Definition LIN_slave_Base.cpp:209
LIN_Slave_HardwareSerial_ESP8266::end
void end(void)
Close serial interface.
Definition LIN_slave_HardwareSerial_ESP8266.cpp:75
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