|
CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
|


Public Types | |
| enum | uartState { NONE , INSTALLED , CONFIGURED , STARTED } |
| Public Types inherited from UARTCore | |
| enum | DataBits { UART_DATA_5_BITS = 0 , UART_DATA_6_BITS = 1 , UART_DATA_7_BITS = 2 , UART_DATA_8_BITS = 3 } |
| Possible data bit widths for UART communication. More... | |
| enum | Parity { UART_PARITY_NONE = 0 , UART_PARITY_EVEN = 1 , UART_PARITY_ODD = 2 } |
| Parity configuration options. More... | |
| enum | StopBits { UART_STOP_BITS_1 = 1 , UART_STOP_BITS_1_5 = 2 , UART_STOP_BITS_2 = 3 } |
| Stop bit configuration options. More... | |
| Public Types inherited from HardwareResource | |
| enum | Type { UART , SPI , I2C , PWM , CAN } |
| Enumeration of hardware resource types. More... | |
Public Member Functions | |
| virtual bool | reset () override |
| Reset the ESP32 UART instance. | |
| bool | install (int uart_num, uint8_t tx_pin, uint8_t rx_pin, uint16_t bufferSize) override |
| Install the UART driver and prepare the instance. | |
| bool | applyConfig () |
| Configure UART communication parameters. | |
| bool | applyPins (int tx_pin, int rx_pin) |
| Set TX and RX pins and start the UART peripheral. | |
| bool | applyPins () |
| Apply previously stored TX/RX pin mapping. | |
| void | setUARTPort (uart_port_t uartPort) |
| bool | send (const char buffer[], size_t size) override |
| Send a buffer of bytes over UART. | |
| size_t | read (char buffer[]) override |
| Read available bytes from UART into buffer. | |
| size_t | available () override |
| Get number of bytes available to read. | |
| void | flush () override |
| Flush UART RX and TX buffers. | |
| Public Member Functions inherited from UARTCore | |
| virtual bool | config (uint32_t baudrate, DataBits dataBits, Parity parity, StopBits stopBits) |
| Configure UART communication parameters. | |
| virtual bool | setBaudrate (uint32_t baudrate) |
| virtual bool | setDataBits (DataBits dataBits) |
| virtual bool | setParity (Parity parity) |
| virtual bool | setStopBits (StopBits stopBits) |
| HardwareResource::Type | getType () override |
| Get the HardwareResource type for this core. | |
| virtual bool | setPins (uint8_t tx_pin, uint8_t rx_pin) |
| Public Member Functions inherited from HardwareResource | |
| bool | requestUsage () |
| Request a usage slot for this resource. | |
| uint8_t | getUsages () |
| Get the current number of usages of this resource. | |
| bool | isUsed () |
| Check if the resource is currently used. | |
| virtual uint8_t | getRemainingUsages () |
| Get remaining usage capacity for this resource. | |
Additional Inherited Members | |
| Protected Member Functions inherited from HardwareResource | |
| HardwareResource ()=default | |
| Default constructor. | |
| virtual uint8_t | getMaxUsages () |
| Get the maximum simultaneous usages allowed for this resource. | |
| Protected Attributes inherited from UARTCore | |
| int8_t | _rxPin = DEFAULT_REF |
| int8_t | _txPin = DEFAULT_REF |
| bool | pinsConfigured = false |
| uint32_t | _baudrate = 0 |
| StopBits | _stopBits = UART_STOP_BITS_1 |
| Parity | _parity = UART_PARITY_NONE |
| DataBits | _dataBits = UART_DATA_8_BITS |
| Protected Attributes inherited from HardwareResource | |
| uint8_t | usages =0 |
| Current usage counter. | |
| bool ESP32_UART::applyConfig | ( | ) |
Configure UART communication parameters.
Applies baudrate, data bits, parity and stop bits to the UART peripheral. Requires the instance to be in INSTALLED state prior to calling.
| baudrate | Desired baud rate (e.g., 115200). |
| dataBits | Data bits selection from UARTCore::DataBits. |
| parity | Parity selection from UARTCore::Parity. |
| stopBits | Stop bits selection from UARTCore::StopBits. |
| bool ESP32_UART::applyPins | ( | ) |
Apply previously stored TX/RX pin mapping.
Overload that calls setPins using stored _txPin/_rxPin values.


| bool ESP32_UART::applyPins | ( | int | tx_pin, |
| int | rx_pin ) |
Set TX and RX pins and start the UART peripheral.
Configures the UART peripheral to use the provided pins and transitions the state to STARTED. Requires the instance to be in CONFIGURED state.
| tx_pin | GPIO pin number to use for TX. |
| rx_pin | GPIO pin number to use for RX. |
|
overridevirtual |
Get number of bytes available to read.
Queries the UART driver's buffered data length and returns the number of bytes ready for reading.
Implements UARTCore.

|
overridevirtual |
Flush UART RX and TX buffers.
Ensures any queued transmit data is flushed and input buffers are cleared.
Implements UARTCore.
|
overridevirtual |
Install the UART driver and prepare the instance.
Installs the UART driver for the given uart_num if not already installed, stores pin and port configuration and marks the instance state as INSTALLED.
| uart_num | UART peripheral number to install. |
| tx_pin | GPIO pin used for TX. |
| rx_pin | GPIO pin used for RX. |
| bufferSize | Size in bytes for RX/TX buffers. |
Implements UARTCore.
|
overridevirtual |
Read available bytes from UART into buffer.
Attempts to read up to the number of bytes currently available. Requires UART to be STARTED.
| buffer | Destination buffer to receive bytes. |
Reimplemented from UARTCore.

|
overridevirtual |
Reset the ESP32 UART instance.
Releases driver resources, flushes buffers and returns the internal state to NONE. Safe to call if driver is not installed; performs no action in that case.
Reimplemented from UARTCore.

|
overridevirtual |
Send a buffer of bytes over UART.
Writes the provided buffer to the UART transmit queue. Requires the UART to be STARTED.
| buffer | Character buffer containing bytes to send. |
| size | Number of bytes to send from the buffer. |
Reimplemented from UARTCore.
