HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
Loading...
Searching...
No Matches
HalUartTmc5160Comm Class Reference

Concrete UART communication adapter for TMC5160 using BaseUart and BaseGpio. More...

#include <Tmc5160Handler.h>

Inheritance diagram for HalUartTmc5160Comm:
[legend]
Collaboration diagram for HalUartTmc5160Comm:
[legend]

Public Member Functions

 HalUartTmc5160Comm (BaseUart &uart, BaseGpio &enable, BaseGpio *diag0=nullptr, BaseGpio *diag1=nullptr, const tmc51x0::PinActiveLevels &active_levels={}) noexcept
 Construct the UART communication adapter.
 
CRTP-Required Methods
tmc51x0::Result< void > UartSend (const uint8_t *data, size_t length) noexcept
 Send data over UART.
 
tmc51x0::Result< void > UartReceive (uint8_t *data, size_t length) noexcept
 Receive data over UART.
 
tmc51x0::Result< void > GpioSet (tmc51x0::TMC51x0CtrlPin pin, tmc51x0::GpioSignal signal) noexcept
 Set a TMC5160 control pin.
 
tmc51x0::Result< tmc51x0::GpioSignal > GpioRead (tmc51x0::TMC51x0CtrlPin pin) noexcept
 Read a TMC5160 control pin.
 
void DebugLog (int level, const char *tag, const char *format, va_list args) noexcept
 Debug logging.
 
void DelayMs (uint32_t ms) noexcept
 Delay in milliseconds.
 
void DelayUs (uint32_t us) noexcept
 Delay in microseconds.
 
tmc51x0::CommMode GetMode () const noexcept
 Get communication mode (always UART).
 

Private Attributes

BaseUart & uart_
 
Tmc5160CtrlPins ctrl_pins_
 
tmc51x0::PinActiveLevels active_levels_
 

Detailed Description

Concrete UART communication adapter for TMC5160 using BaseUart and BaseGpio.

Implements all methods required by tmc51x0::UartCommInterface<HalUartTmc5160Comm> through the CRTP pattern.

Constructor & Destructor Documentation

◆ HalUartTmc5160Comm()

HalUartTmc5160Comm::HalUartTmc5160Comm ( BaseUart & uart,
BaseGpio & enable,
BaseGpio * diag0 = nullptr,
BaseGpio * diag1 = nullptr,
const tmc51x0::PinActiveLevels & active_levels = {} )
noexcept

Construct the UART communication adapter.

Parameters
uartReference to a pre-configured BaseUart implementation.
enableBaseGpio connected to TMC5160 DRV_ENN (pin 28, active LOW).
diag0Optional BaseGpio connected to DIAG0.
diag1Optional BaseGpio connected to DIAG1.
active_levelsPin active level configuration.

Member Function Documentation

◆ DebugLog()

void HalUartTmc5160Comm::DebugLog ( int level,
const char * tag,
const char * format,
va_list args )
noexcept

Debug logging.

Here is the call graph for this function:

◆ DelayMs()

void HalUartTmc5160Comm::DelayMs ( uint32_t ms)
noexcept

Delay in milliseconds.

Here is the call graph for this function:

◆ DelayUs()

void HalUartTmc5160Comm::DelayUs ( uint32_t us)
noexcept

Delay in microseconds.

Here is the call graph for this function:

◆ GetMode()

tmc51x0::CommMode HalUartTmc5160Comm::GetMode ( ) const
inlinenoexcept

Get communication mode (always UART).

◆ GpioRead()

tmc51x0::Result< tmc51x0::GpioSignal > HalUartTmc5160Comm::GpioRead ( tmc51x0::TMC51x0CtrlPin pin)
noexcept

Read a TMC5160 control pin.

◆ GpioSet()

tmc51x0::Result< void > HalUartTmc5160Comm::GpioSet ( tmc51x0::TMC51x0CtrlPin pin,
tmc51x0::GpioSignal signal )
noexcept

Set a TMC5160 control pin.

◆ UartReceive()

tmc51x0::Result< void > HalUartTmc5160Comm::UartReceive ( uint8_t * data,
size_t length )
noexcept

Receive data over UART.

◆ UartSend()

tmc51x0::Result< void > HalUartTmc5160Comm::UartSend ( const uint8_t * data,
size_t length )
noexcept

Send data over UART.

Member Data Documentation

◆ active_levels_

tmc51x0::PinActiveLevels HalUartTmc5160Comm::active_levels_
private

◆ ctrl_pins_

Tmc5160CtrlPins HalUartTmc5160Comm::ctrl_pins_
private

◆ uart_

BaseUart& HalUartTmc5160Comm::uart_
private

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