21 #ifndef __SoftwareLin_h
22 #define __SoftwareLin_h
24 #include "espsoftwareserial/src/SoftwareSerial.h"
25 #include "freertos/semphr.h"
50 void sendBreak(
int breakBits = 13,
int delimiterBits = 1);
81 uint32_t
setAutoBaud(
const uint32_t commonBaud[],
int commonBaudSize);
98 int read(uint8_t* buffer,
size_t size);
107 size_t write(
const uint8_t* buffer,
size_t size)
override;
Definition: SoftwareLin.h:28
static void wakeCheckBreak(SoftwareLin *pThis)
This function wake checkBreak() from blocking. When the UART ISR is triggered, m_isrSem is given so t...
Definition: SoftwareLin.cpp:25
size_t write(const uint8_t *buffer, size_t size) override
Write bytes to the bus.
Definition: SoftwareLin.cpp:166
uint32_t setAutoBaud(const uint32_t commonBaud[], int commonBaudSize)
setAutoBaud() is used for automatically detect and set baud rate after the break field has been detec...
Definition: SoftwareLin.cpp:101
SemaphoreHandle_t m_isrSem
The semaphore for notifying checkBreak() that the ISR has been triggered.
Definition: SoftwareLin.h:125
SoftwareLin(int8_t rxPin, int8_t txPin)
Construct a new Software Lin object.
Definition: SoftwareLin.cpp:31
StaticSemaphore_t m_isrSemBuf
The buffer for static allocation of m_isrSem.
Definition: SoftwareLin.h:129
void sendBreak(int breakBits=13, int delimiterBits=1)
Send Break Field and Break Delimiter to the bus.
Definition: SoftwareLin.cpp:47
bool checkBreak()
Check whether there is Break Field sent on the bus. This function blocks until the UART ISR is trigge...
Definition: SoftwareLin.cpp:57
int read(uint8_t *buffer, size_t size)
Read bytes to buffer.
Definition: SoftwareLin.cpp:159
~SoftwareLin()
Destroy the Software Lin object.
Definition: SoftwareLin.cpp:40
bool m_inFrame
Indicate whether SoftwareLin is still processing a frame. Initially, m_inFrame is false....
Definition: SoftwareLin.h:120
void endFrame()
Notify SoftwareLin the LIN frame has ended. This is for SoftwareLin to reset the internal state regis...
Definition: SoftwareLin.cpp:154