/* * Copyright (c) 2023 HPMicro * * SPDX-License-Identifier: BSD-3-Clause * */ #ifndef UART_LIN_H #define UART_LIN_H #include "hpm_clock_drv.h" #include "hpm_gpio_drv.h" #include "hpm_uart_drv.h" /** * * @brief UART Lin component APIs * @defgroup uart_lin_interface UART component APIs * @ingroup io_interfaces * @{ */ typedef struct uart_lin_pin { GPIO_Type *ptr; uint32_t baudrate; void (*config_uart_pin)(UART_Type *ptr); void (*config_uart_pin_as_gpio)(UART_Type *ptr); void (*delay_us)(uint32_t us); uint8_t tx_port; uint8_t tx_pin; } uart_lin_master_pin_ctrl_t; typedef struct { uint8_t *buff; uint8_t length; bool enhance_checksum; } uart_lin_data_t; typedef enum { uart_lin_success = 0, uart_lin_fail = 1, uart_lin_invalid_argument = 2, uart_lin_timeout = 3, uart_lin_id_parity_error = 4, uart_lin_checksum_error = 5, uart_lin_frame_error = 6, /*