进一步迭代优化统一管理
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "hal.h"
|
||||
|
||||
/**
|
||||
* @brief UART parity definitions
|
||||
@ -64,44 +65,50 @@ typedef struct {
|
||||
|
||||
/**
|
||||
* @brief Initialize UART hardware
|
||||
* @retval HAL status code
|
||||
*/
|
||||
void hal_uart_init(void);
|
||||
hal_ret_t hal_uart_init(void);
|
||||
|
||||
/**
|
||||
* @brief Configure UART parameters for specific instance
|
||||
* @param config: UART configuration structure
|
||||
* @retval HAL status code
|
||||
*/
|
||||
void hal_uart_config(const hal_uart_config_t *config);
|
||||
hal_ret_t hal_uart_config(const hal_uart_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Send data over specific UART instance
|
||||
* @param instance: UART instance identifier
|
||||
* @param data: Pointer to data buffer
|
||||
* @param length: Data length in bytes
|
||||
* @retval HAL status code
|
||||
*/
|
||||
void hal_uart_send(hal_uart_instance_t instance, const uint8_t *data, size_t length);
|
||||
hal_ret_t hal_uart_send(hal_uart_instance_t instance, const uint8_t *data, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Receive data from specific UART instance
|
||||
* @param instance: UART instance identifier
|
||||
* @param data: Pointer to data buffer
|
||||
* @param length: Data length to receive in bytes
|
||||
* @retval Number of bytes received
|
||||
* @param received: Pointer to store number of bytes received
|
||||
* @retval HAL status code
|
||||
*/
|
||||
size_t hal_uart_receive(hal_uart_instance_t instance, uint8_t *data, size_t length);
|
||||
hal_ret_t hal_uart_receive(hal_uart_instance_t instance, uint8_t *data, size_t length, size_t *received);
|
||||
|
||||
/**
|
||||
* @brief Check if specific UART instance is ready to send
|
||||
* @param instance: UART instance identifier
|
||||
* @retval 1 if ready, 0 otherwise
|
||||
* @param ready: Pointer to store ready status (1 if ready, 0 otherwise)
|
||||
* @retval HAL status code
|
||||
*/
|
||||
uint8_t hal_uart_is_tx_ready(hal_uart_instance_t instance);
|
||||
hal_ret_t hal_uart_is_tx_ready(hal_uart_instance_t instance, uint8_t *ready);
|
||||
|
||||
/**
|
||||
* @brief Check if specific UART instance has data to receive
|
||||
* @param instance: UART instance identifier
|
||||
* @retval 1 if data available, 0 otherwise
|
||||
* @param ready: Pointer to store ready status (1 if data available, 0 otherwise)
|
||||
* @retval HAL status code
|
||||
*/
|
||||
uint8_t hal_uart_is_rx_ready(hal_uart_instance_t instance);
|
||||
hal_ret_t hal_uart_is_rx_ready(hal_uart_instance_t instance, uint8_t *ready);
|
||||
|
||||
#endif /* HAL_UART_H */
|
||||
Reference in New Issue
Block a user