![]() |
LIN_master_portable_Arduino 1.4
Arduino library for Local Interconnect Network master node emulation
|
LIN master node class via SoftwareSerial. More...
#include <LIN_master_SoftwareSerial.h>

Public Member Functions | |
| LIN_Master_SoftwareSerial (uint8_t PinRx, uint8_t PinTx, bool InverseLogic=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) | |
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. | |
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 | |
LIN master node class via SoftwareSerial.
LIN master node class via SoftwareSerial.
Definition at line 36 of file LIN_master_SoftwareSerial.h.
| LIN_Master_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.
Constructor for LIN node class using SoftwareSerial.
Constructor for LIN node class for using SoftwareSerial. Initialize SW serial instance.
| [in] | PinRx | GPIO used for reception |
| [in] | PinTx | GPIO used for transmission |
| [in] | InverseLogic | use inverse logic (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 201 of file LIN_master_SoftwareSerial.cpp.
|
protectedvirtual |
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)
Reimplemented from LIN_Master_Base.
Definition at line 114 of file LIN_master_SoftwareSerial.cpp.

|
protectedvirtual |
Send LIN break.
Send LIN break (=16bit low). Here blocking!
Reimplemented from LIN_Master_Base.
Definition at line 21 of file LIN_master_SoftwareSerial.cpp.

|
protectedvirtual |
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). Here blocking!
Reimplemented from LIN_Master_Base.
Definition at line 63 of file LIN_master_SoftwareSerial.cpp.

|
virtual |
Open serial interface.
Open serial interface with specified baudrate
| [in] | Baudrate | communication speed [Baud] (default = 19200) |
Reimplemented from LIN_Master_Base.
Definition at line 224 of file LIN_master_SoftwareSerial.cpp.

|
virtual |
Close serial interface.
Close serial interface
Reimplemented from LIN_Master_Base.
Definition at line 247 of file LIN_master_SoftwareSerial.cpp.
