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

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LIN_Master_HardwareSerial_ESP8266 Class Reference

LIN master node class via ESP8266 HardwareSerial. More...

`#include <LIN_master_HardwareSerial_ESP8266.h>`

Inheritance diagram for LIN_Master_HardwareSerial_ESP8266:
[legend]

## Public Member Functions
| LIN_Master_HardwareSerial_ESP8266 (bool SwapPins=false, const char NameLIN[]="Master", const int8_t PinTxEN=INT8_MIN)
| Class constructor.
void | begin (uint16_t Baudrate=19200)
| Open serial interface.
void | end (void)
| Close serial interface.
Public Member Functions inherited from LIN_Master_Base
| LIN_Master_Base (const char NameLIN[]="Master", const int8_t PinTxEN=INT8_MIN)
| LIN master node constructor.
virtual | ~LIN_Master_Base (void)
| LIN master node destructor, here dummy. Any class with virtual functions should have virtual destructor.
void | resetStateMachine (void)
| Reset LIN state machine.
LIN_Master_Base::state_t | getState (void)
| Getter for LIN state machine state.
void | resetError (void)
| Clear error of LIN state machine.
LIN_Master_Base::error_t | getError (void)
| Getter for LIN state machine error.
void | getFrame (LIN_Master_Base::frame_t &Type, uint8_t &Id, uint8_t &NumData, uint8_t Data[])
| Getter for LIN frame.
LIN_Master_Base::state_t | sendMasterRequest (LIN_Master_Base::version_t Version=LIN_Master_Base::LIN_V2, uint8_t Id=0x00, uint8_t NumData=0, uint8_t Data[]=NULL)
| Start sending a LIN master request frame in background (if supported)
LIN_Master_Base::error_t | sendMasterRequestBlocking (LIN_Master_Base::version_t Version=LIN_Master_Base::LIN_V2, uint8_t Id=0x00, uint8_t NumData=0, uint8_t Data[]=NULL)
| Send a blocking LIN master request frame (no background operation)
LIN_Master_Base::state_t | receiveSlaveResponse (LIN_Master_Base::version_t Version=LIN_Master_Base::LIN_V2, uint8_t Id=0x00, uint8_t NumData=0)
| Start sending a LIN slave response frame in background (if supported)
LIN_Master_Base::error_t | receiveSlaveResponseBlocking (LIN_Master_Base::version_t Version=LIN_Master_Base::LIN_V2, uint8_t Id=0x00, uint8_t NumData=0, uint8_t *Data=NULL)
| Send a blocking LIN slave response frame (no background operation)
LIN_Master_Base::state_t | handler (void)
| Handle LIN background operation (call until STATE_DONE is returned)

## Protected Member Functions
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)
LIN_Master_Base::state_t | _receiveFrame (void)
| Read and check LIN frame.
Protected Member Functions inherited from LIN_Master_Base
uint8_t | _calculatePID (void)
| Calculate protected frame ID.
uint8_t | _calculateChecksum (uint8_t NumData, uint8_t Data[])
| Calculate LIN frame checksum.
LIN_Master_Base::error_t | _checkFrame (void)
| Check received LIN frame.
void | _enableTransmitter (void)
| Enable RS485 transmitter (DE=high)
void | _disableTransmitter (void)
| Disable RS485 transmitter (DE=low)

## Protected Attributes
HardwareSerial * | pSerial
| serial interface used for LIN
bool | swapPins
| use alternate pins for Serial0
Protected Attributes inherited from LIN_Master_Base
int8_t | pinTxEN
| optional Tx direction pin, e.g. for LIN via RS485
uint16_t | baudrate
| communication baudrate [Baud]
LIN_Master_Base::state_t | state
| status of LIN state machine
LIN_Master_Base::error_t | error
| error state. Is latched until cleared
uint32_t | timePerByte
| time [us] per byte at specified baudrate
uint32_t | timeoutFrame
| max. frame duration [us]
LIN_Master_Base::version_t | version
| LIN protocol version.
LIN_Master_Base::frame_t | type
| LIN frame type.
uint8_t | id
| LIN frame identifier (protected or unprotected)
uint8_t | lenTx
| send buffer length (max. 12)
uint8_t | bufTx [12]
| send buffer incl. BREAK, SYNC, DATA and CHK (max. 12B)
uint8_t | lenRx
| receive buffer length (max. 12)
uint8_t | bufRx [12]
| receive buffer incl. BREAK, SYNC, DATA and CHK (max. 12B)
uint32_t | timeStart
| starting time [us] for frame timeout

## Additional Inherited Members
Public Types inherited from LIN_Master_Base
enum | version_t : uint8_t { LIN_V1 = 1 , LIN_V2 = 2 }
| LIN protocol version. More...
enum | frame_t : uint8_t { MASTER_REQUEST = 0x01 , SLAVE_RESPONSE = 0x02 }
| LIN frame type. More...
enum | state_t : uint8_t { STATE_OFF = 0x01 , STATE_IDLE = 0x02 , STATE_BREAK = 0x04 , STATE_BODY = 0x08 , STATE_DONE = 0x10 }
| state of LIN master state machine. Use bitmasks for fast checking multiple states More...
enum | error_t : uint8_t { NO_ERROR = 0x00 , ERROR_STATE = 0x01 , ERROR_ECHO = 0x02 , ERROR_TIMEOUT = 0x04 , ERROR_CHK = 0x08 , ERROR_MISC = 0x80 }
| LIN error codes. Use bitmasks, as error is latched. Use same as LIN_slave_portable. More...
Public Attributes inherited from LIN_Master_Base
char | nameLIN [LIN_MASTER_BUFLEN_NAME]
| LIN node name, e.g. for debug.

## Detailed Description

LIN master node class via ESP8266 HardwareSerial.

LIN master node class via ESP8266 HardwareSerial.

Definition at line 35 of file LIN_master_HardwareSerial_ESP8266.h.

## Constructor & Destructor Documentation

## ◆ LIN_Master_HardwareSerial_ESP8266()

LIN_Master_HardwareSerial_ESP8266::LIN_Master_HardwareSerial_ESP8266 | ( | bool | SwapPins = `false`,
|  | const char | NameLIN[] = `"Master"`,
|  | const int8_t | PinTxEN = `INT8_MIN`
| ) |  |

Class constructor.

Constructor for LIN node class using ESP8266 HardwareSerial 0.

Constructor for LIN node class for using ESP8266 HardwareSerial 0.

Parameters

  [in] | SwapPins | use alternate Serial2 Rx/Tx pins (default = false)
  [in] | NameLIN | LIN node name (default = "Master")
  [in] | PinTxEN | optional Tx enable pin (high active) e.g. for LIN via RS485 (default = -127/none)

Definition at line 206 of file LIN_master_HardwareSerial_ESP8266.cpp.

## Member Function Documentation

## ◆ _receiveFrame()

LIN_Master_Base::state_t LIN_Master_HardwareSerial_ESP8266::_receiveFrame | ( | void |  | ) |
| protected virtual

Read and check LIN frame.

Receive and check LIN frame.

Receive and check LIN frame (request frame: check echo; response frame: check header echo & checksum)

Returns
  current state of LIN state machine

Reimplemented from LIN_Master_Base.

Definition at line 135 of file LIN_master_HardwareSerial_ESP8266.cpp.

Here is the call graph for this function:

## ◆ _sendBreak()

LIN_Master_Base::state_t LIN_Master_HardwareSerial_ESP8266::_sendBreak | ( | void |  | ) |
| protected virtual

Send LIN break.

Send LIN break (=16bit low)

Returns
  current state of LIN state machine

Reimplemented from LIN_Master_Base.

Definition at line 23 of file LIN_master_HardwareSerial_ESP8266.cpp.

Here is the call graph for this function:

## ◆ _sendFrame()

LIN_Master_Base::state_t LIN_Master_HardwareSerial_ESP8266::_sendFrame | ( | void |  | ) |
| protected virtual

Send LIN bytes (request frame: SYNC+ID+DATA[]+CHK; response frame: SYNC+ID)

Send LIN bytes (request frame: SYNC+ID+DATA[]+CHK; response frame: SYNC+ID)

Returns
  current state of LIN state machine

Reimplemented from LIN_Master_Base.

Definition at line 70 of file LIN_master_HardwareSerial_ESP8266.cpp.

Here is the call graph for this function:

## ◆ begin()

void LIN_Master_HardwareSerial_ESP8266::begin | ( | uint16_t | Baudrate = `19200` | ) |
| virtual

Open serial interface.

Open serial interface with specified baudrate. Optionally use Serial2 pins

Parameters

  [in] | Baudrate | communication speed [Baud] (default = 19200)

Reimplemented from LIN_Master_Base.

Definition at line 226 of file LIN_master_HardwareSerial_ESP8266.cpp.

Here is the call graph for this function:

## ◆ end()

void LIN_Master_HardwareSerial_ESP8266::end | ( | void |  | ) |
| virtual

Close serial interface.

Close serial interface

Reimplemented from LIN_Master_Base.

Definition at line 255 of file LIN_master_HardwareSerial_ESP8266.cpp.

Here is the call graph for this function:

## Member Data Documentation

## ◆ pSerial

HardwareSerial* LIN_Master_HardwareSerial_ESP8266::pSerial
| protected

serial interface used for LIN

Definition at line 40 of file LIN_master_HardwareSerial_ESP8266.h.

## ◆ swapPins

bool LIN_Master_HardwareSerial_ESP8266::swapPins
| protected

use alternate pins for Serial0

Definition at line 41 of file LIN_master_HardwareSerial_ESP8266.h.

The documentation for this class was generated from the following files:

- LIN_master_HardwareSerial_ESP8266.h
- LIN_master_HardwareSerial_ESP8266.cpp