JZ_uart.h
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
************************************************************************************************
* @file dji_sdk_app_info.h
* @brief This is the header file for defining the structure and (exported) function prototypes.
*************************************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _JZ_UART_H
#define _JZ_UART_H
/* Includes ------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <error.h>
#include <termios.h>
#include <malloc.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>
#include <stdint.h>
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef struct termios termios_t;
typedef struct JzSerData
{
uint8_t dataBuf[256]; // 发送/接受数据
int dataLen; // 发送/接受数据长度
int serFd; // 串口文件描述符
} JzSerData;
/* Exported functions --------------------------------------------------------*/
int JzUartInit(const char *path,int bitRate);//串口初始化
int JzUartSet(const char *path,int bitRate);//串口设置
int uart_send(uint8_t *dataBuf,int dataLen);
static void *Recv_Task(void *arg);
#ifdef __cplusplus
}
#endif
#endif //_UART_H