天嵌二次封装库使用手册  V2.1.2
tq_spi.h
浏览该文件的文档.
1 
7 #ifndef LINUX_LIBV2_SOURCE_SPI_TQ_SPI_H_
8 #define LINUX_LIBV2_SOURCE_SPI_TQ_SPI_H_
9 
10 // Copyright 2024 广东省天嵌嵌入式技术股份有限公司
11 
12 
13 #ifdef __cplusplus
14 #define SPI_API extern "C"
15 #else
16 #define SPI_API
17 #endif
18 
24  SPI_API int tq_set_spi_mode(int fd, unsigned short mode);
31  SPI_API int tq_set_spi_bits_per_word(int fd, unsigned short bits);
38  SPI_API int tq_set_spi_max_transfer_speed(int fd, unsigned int speed);
49  SPI_API int tq_spi_message_transfer(int fd, unsigned char *sendBuf, int send_len, unsigned char *recvBuf, int recv_len);
58  SPI_API int tq_spi_message_send(int fd, unsigned char *sendBuf, int len);
59 
60 #endif
SPI_API int tq_set_spi_max_transfer_speed(int fd, unsigned int speed)
设置SPI通讯时最大波特率
SPI_API int tq_spi_message_send(int fd, unsigned char *sendBuf, int len)
SPI通讯发送函数
SPI_API int tq_spi_message_transfer(int fd, unsigned char *sendBuf, int send_len, unsigned char *recvBuf, int recv_len)
全双工SPI通讯函数,能同时收发
SPI_API int tq_set_spi_bits_per_word(int fd, unsigned short bits)
设置SPI通讯时每个字是多少位
SPI_API int tq_set_spi_mode(int fd, unsigned short mode)
设置SPI模式
#define SPI_API
Definition: tq_spi.h:16