14 #ifndef _LIN_MASTER_H_ 15 #define _LIN_MASTER_H_ 22 #define LIN_DEBUG_SERIAL Serial 23 #define LIN_DEBUG_LEVEL 0 31 #if defined(__AVR__) //the __has_include() macro only kind of works at least with the Arduino MEGA 32 #if !__has_include("../../Task_Scheduler/src/Tasks.h") 33 #error This LIN library requires the "Task Scheduler" library by Kai Liebich & Georg Icking-Konert. Please install it via the Arduino library manager! 111 volatile uint8_t *UCSRA;
116 #if (LIN_DEBUG_LEVEL != 0) 135 uint8_t
checksum(uint8_t
id, uint8_t numData, uint8_t *data);
162 #endif // _LIN_MASTER_H_ void defaultCallback(uint8_t numData, uint8_t *data)
receive callback function to copy data to buffer
bool flagRxComplete
flag to indicate that data reception is complete. Must be cleared manually
uint8_t checksum(uint8_t id, uint8_t numData, uint8_t *data)
calculate frame checksum
uint8_t lenRx
receive buffer length (max. 12)
void begin(uint16_t Baudrate, LIN_version_t Version, bool Background)
setup UART and LIN framework
error in LIN state machine
LIN_status_t
state of LIN master state machine
LIN_error_t
LIN communication error codes.
LIN_version_t
LIN version of checksum.
uint8_t * dataPtr
pointer to data buffer in LIN_master3_copy()
misc error, should not occur
LIN_error_t receiveSlaveResponse(uint8_t id, uint8_t numData, void(*Rx_handler)(uint8_t, uint8_t *))
receive a slave response frame with callback function
void(* wrapperDefaultCallback)(uint8_t, uint8_t *)
wrapper for default receive callback function
break is being transmitted
uint8_t bufRx[12]
receive buffer incl. SYNC, DATA and CHK (max. 11B)
uint8_t lenTx
send buffer length (max. 12)
uint8_t durationFrame
duration of frame w/o BREAK [ms]
bool flagTxComplete
flag to indicate that data transmission is complete. Must be cleared manually
void handlerSend(void)
LIN master receive handler for task scheduler.
void end(void)
end UART communication void end(void); //!< end UART communication
no LIN transmission ongoing
void(* decoder_t)(uint8_t, uint8_t *)
typedef for data decoder to hadle received data
void handlerReceive(void)
send handler for task scheduler
LIN_frame_t
LIN frame type.
LIN_error_t error
error state. Is latched until cleared
uint16_t baudrate
communication baudrate [Baud]
LIN master node base class.
LIN_status_t state
status of LIN state machine
bool background
background or blocking operation
LIN_frame_t frameType
LIN frame type.
uint8_t durationBreak
duration of sync break [ms]
uint8_t protectID(uint8_t id)
calculate protected LIN ID
LIN_version_t version
LIN version for checksum calculation.
void(* wrapperReceive)(void)
wrapper for reception handler (for task scheduler)
LIN_error_t sendMasterRequest(uint8_t id, uint8_t numData, uint8_t *data)
send a master request frame
void(* rx_handler)(uint8_t, uint8_t *)
handler to decode slave response (for receiveFrame())
frame is being transmitted
void(* wrapperSend)(void)
wrapper for transmission handler (for task scheduler)
HardwareSerial * pSerial
pointer to used serial
uint8_t bufTx[12]
send buffer incl. BREAK, SYNC, DATA and CHK (max. 12B)