rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
UartTsChannel Class Reference

#include <tunerstudio_io.h>

Inheritance diagram for UartTsChannel:
Inheritance graph
[legend]
Collaboration diagram for UartTsChannel:
Collaboration graph
[legend]

Public Member Functions

 UartTsChannel (UARTDriver &driver)
 
void start (uint32_t baud) override
 
void stop () override
 
void write (const uint8_t *buffer, size_t size, bool isEndOfPacket) override
 
size_t readTimeout (uint8_t *buffer, size_t size, int timeout) override
 
- Public Member Functions inherited from SerialTsChannelBase
 SerialTsChannelBase (const char *p_name)
 
- Public Member Functions inherited from TsChannelBase
 TsChannelBase (const char *name)
 
virtual void flush ()
 
virtual bool isConfigured () const
 
virtual bool isReady () const
 
size_t read (uint8_t *buffer, size_t size)
 
virtual void writeCrcPacket (uint8_t responseCode, const uint8_t *buf, size_t size, bool allowLongPackets=false)
 
void sendResponse (ts_response_format_e mode, const uint8_t *buffer, int size, bool allowLongPackets=false)
 
void assertPacketSize (size_t size, bool allowLongPackets)
 
uint32_t writePacketHeader (const uint8_t responseCode, const size_t size)
 
void crcAndWriteBuffer (const uint8_t responseCode, const size_t size)
 
void copyAndWriteSmallCrcPacket (uint8_t responseCode, const uint8_t *buf, size_t size)
 
void writeCrcResponse (uint8_t responseCode)
 

Protected Attributes

UARTDriver *const m_driver
 
UARTConfig m_config
 

Additional Inherited Members

- Data Fields inherited from TsChannelBase
int bytesIn = 0
 
int bytesOut = 0
 
char scratchBuffer [scratchBuffer_SIZE+30]
 
page1_s page1
 
const charname
 
bool in_sync = false
 

Detailed Description

Definition at line 124 of file tunerstudio_io.h.

Constructor & Destructor Documentation

◆ UartTsChannel()

UartTsChannel::UartTsChannel ( UARTDriver driver)
inline

Definition at line 126 of file tunerstudio_io.h.

126: SerialTsChannelBase("UART"), m_driver(&driver) { }
UARTDriver *const m_driver

Member Function Documentation

◆ readTimeout()

size_t UartTsChannel::readTimeout ( uint8_t *  buffer,
size_t  size,
int  timeout 
)
overridevirtual

Implements TsChannelBase.

Definition at line 73 of file tunerstudio_io_serial.cpp.

73 {
74 // nasty in/out parameter approach:
75 // in entry: number of data frames to receive
76 // on exit the number of frames actually received
77 uartReceiveTimeout(m_driver, &size, buffer, timeout);
78 bytesIn += size;
79 return size;
80}
composite packet size
static BigBufferHandle buffer

◆ start()

void UartTsChannel::start ( uint32_t  baud)
overridevirtual

Implements SerialTsChannelBase.

Definition at line 41 of file tunerstudio_io_serial.cpp.

41 {
42 m_config = {
43 .txend1_cb = NULL,
44 .txend2_cb = NULL,
45 .rxend_cb = NULL,
46 .rxchar_cb = NULL,
47 .rxerr_cb = NULL,
48 .timeout_cb = NULL,
49#if defined(STM32F7XX)
50 .timeout = 0,
51#endif
52 .speed = baud,
53 .cr1 = 0,
54 .cr2 = USART_CR2_STOP1_BITS | USART_CR2_LINEN,
55 .cr3 = 0,
56#if defined(STM32F4XX) || defined(CPU_MKE16F512VLH16)
57 .rxhalf_cb = NULL
58#endif
59 };
60
61 uartStart(m_driver, &m_config);
62}
UARTConfig m_config
uartcb_t txend1_cb
End of transmission buffer callback.

◆ stop()

void UartTsChannel::stop ( )
overridevirtual

Reimplemented from TsChannelBase.

Definition at line 64 of file tunerstudio_io_serial.cpp.

64 {
65 uartStop(m_driver);
66}

◆ write()

void UartTsChannel::write ( const uint8_t *  buffer,
size_t  size,
bool  isEndOfPacket 
)
overridevirtual

Implements TsChannelBase.

Definition at line 68 of file tunerstudio_io_serial.cpp.

68 {
69 size_t transferred = uartSendTimeout(m_driver, &size, buffer, BINARY_IO_TIMEOUT);
70 bytesOut += transferred;
71}

Field Documentation

◆ m_config

UARTConfig UartTsChannel::m_config
protected

Definition at line 136 of file tunerstudio_io.h.

Referenced by start(), and UartDmaTsChannel::start().

◆ m_driver

UARTDriver* const UartTsChannel::m_driver
protected

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