上传文件至 include

This commit is contained in:
认知智能 2025-05-26 19:29:55 +08:00
parent e8732009f2
commit 4794a062dc

81
include/jlinux_uart.h Normal file
View File

@ -0,0 +1,81 @@
/***********************************************************************
* @file jlinux_uart.h
JLINUX_UART
* @brief header file
* @history
* Date Version Author description
* ========== ======= ========= =======================================
* 2022-07-27 V1.0 Lucky,lukai@jovision.com Create
*
* @Copyright (C) 2022 Jovision Technology Co., Ltd.
***********************************************************************/
#ifndef __JLINUX_UART_H__
#define __JLINUX_UART_H__
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct _uart_ctx *juart_hdl_t;
typedef struct
{
int baudrate; //波特率:1200/2400/4800/9600/19200/38400/57600/115200/230400/380400/460800/921600
int datawidth; //数据位宽度:5/6/7/8
int stopbit; //停止位宽度:1/2
int parity; //奇偶校验:0无校验1奇校验2偶校验
}JUartAttr_t;
/**
*@brief 485jctrl_rs485相关接口使用
*@param name /dev/ttyS0
*@return
*/
juart_hdl_t juart_open(const char *name);
/**
*@brief
*@param handle
*/
int juart_close(juart_hdl_t handle);
/**
*@brief
*@param handle
*@param attr
*/
int juart_set_attr(juart_hdl_t handle, JUartAttr_t *attr);
int juart_get_fd(juart_hdl_t uart);
/**
*@brief
*@param handle
*@param data buffer
*@param len
*@return 0
*/
int juart_send(juart_hdl_t handle, char *data, int len);
/**
*@brief
*@param handle
*@param data buffer
*@param len buffer的长度
*@param timeout
*@return
*/
int juart_recv(juart_hdl_t handle, char *data, int len, int timeout);
/**
*@brief rs485模式
*@param handle
*@param mode 0:0
*@return 0
*/
int juart_set_rs485(juart_hdl_t handle, int mode);
#ifdef __cplusplus
}
#endif
#endif // __JLINUX_UART_H__