ESP32-P4 OBC Firmware
ESP-IDF firmware for Plant-B CubeSat OBC
 
Loading...
Searching...
No Matches
uart_device.h File Reference

High-level UART controller driver for ESP-IDF. More...

#include "driver/uart.h"
#include "esp_err.h"
#include "esp_log.h"
#include "freertos/task.h"

Go to the source code of this file.

Data Structures

struct  uartd_config_t
 UART device configuration structure. More...
 

Macros

Default UART1 Controller Configuration

Default parameters for UART communication on the UART1 controller.

#define DEFAULT_TX   (23)
 Default TX GPIO.
 
#define DEFAULT_RX   (22)
 Default RX GPIO.
 
#define DEFAULT_CTS   (20)
 Default CTS GPIO.
 
#define DEFAULT_RTS   (21)
 Default RTS GPIO.
 
#define DEFAULT_BAUDRATE   (115200)
 Default baud rate.
 
#define DEFAULT_BUF_SIZE   (2028)
 Default RX/TX buffer size.
 
#define DEFAULT_CTRL_TRESH   (122)
 Default flow control threshold.
 
#define DEFAULT_EVT_QUEUE_SIZE   (10)
 Default UART event queue size.
 

Functions

esp_err_t uartd_init (uartd_config_t *restrict cfg)
 Initialize an UART controller.
 
esp_err_t uartd_deinit (uartd_config_t *restrict cfg)
 Deinitialize a UART device.
 
uartd_config_t uartd_default_config (void)
 Get a default UART configuration to drive the UART1 controller.
 
esp_err_t uartd_wait_event (const uartd_config_t *cfg, uart_event_t *event, TickType_t timeout)
 Wait for an UART event.
 
esp_err_t uartd_read (const uartd_config_t *const restrict cfg, void *restrict buf, size_t sz, size_t len, TickType_t timeout, size_t *out_bytes)
 Read raw data from UART.
 
esp_err_t uartd_write (const uartd_config_t *const restrict cfg, const void *const restrict buf, size_t sz, size_t len, size_t *out_bytes)
 Write raw data to UART.
 
esp_err_t uartd_readline (const uartd_config_t *const restrict cfg, char *restrict line, size_t max_len, TickType_t timeout, size_t *out_len)
 Read up to a newline-terminated string from UART.
 
esp_err_t uartd_writeline (const uartd_config_t *const restrict cfg, const char *const restrict line, size_t *out_len)
 Write a null-terminated line to UART.
 

Detailed Description

High-level UART controller driver for ESP-IDF.

Author
Adrien Chevrier

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Version
0.1
Date
2026-02-05