luat_soc_sdk_2024 V1.0
|
结构体 | |
struct | luat_spi |
struct | luat_spi_device |
struct | luat_fatfs_spi |
类型定义 | |
typedef struct luat_spi | luat_spi_t |
typedef struct luat_spi_device | luat_spi_device_t |
typedef struct luat_fatfs_spi | luat_fatfs_spi_t |
函数 | |
int | luat_spi_setup (luat_spi_t *spi) |
初始化配置SPI各项参数,并打开SPI luat_spi_t 结构体参数 spiId,–串口id cs, 0,–CPHA 0,–CPOL 8,–数据宽度 20000000,–最大频率20M spi.MSB,–高低位顺序 可选,默认高位在前 spi.master,–主模式 可选,默认主 spi.full,–全双工 可选,默认全双工 | |
int | luat_spi_config_dma (int spi_id, uint32_t tx_channel, uint32_t rx_channel) |
SPI收发数据尝试启动DMA模式 | |
int | luat_spi_close (int spi_id) |
关闭SPI | |
int | luat_spi_transfer (int spi_id, const char *send_buf, size_t send_length, char *recv_buf, size_t recv_length) |
收发SPI数据 | |
int | luat_spi_recv (int spi_id, char *recv_buf, size_t length) |
收SPI数据 | |
int | luat_spi_send (int spi_id, const char *send_buf, size_t length) |
发SPI数据 | |
int | luat_spi_change_speed (int spi_id, uint32_t speed) |
SPI速率修改 | |
int | luat_spi_no_block_transfer (int spi_id, uint8_t *tx_buff, uint8_t *rx_buff, size_t len, void *CB, void *pParam) |
SPI收发数据(异步) | |
int | luat_spi_get_mode (int spi_id) |
SPI模式获取 | |
int | luat_spi_set_mode (int spi_id, uint8_t mode) |
SPI模式修改 | |
int | luat_spi_bus_setup (luat_spi_device_t *spi_dev) |
spi总线初始化 | |
int | luat_spi_device_setup (luat_spi_device_t *spi_dev) |
spi设备初始化 | |
int | luat_spi_device_config (luat_spi_device_t *spi_dev) |
spi设备配置 | |
int | luat_spi_device_close (luat_spi_device_t *spi_dev) |
spi设备关闭 | |
int | luat_spi_device_transfer (luat_spi_device_t *spi_dev, const char *send_buf, size_t send_length, char *recv_buf, size_t recv_length) |
spi设备收发数据,返回接收字节数 | |
int | luat_spi_device_recv (luat_spi_device_t *spi_dev, char *recv_buf, size_t length) |
spi设备接收数据,返回接收字节数 | |
int | luat_spi_device_send (luat_spi_device_t *spi_dev, const char *send_buf, size_t length) |
spi设备发送数据,返回接收字节数 | |
typedef struct luat_fatfs_spi luat_fatfs_spi_t |
typedef struct luat_spi_device luat_spi_device_t |
typedef struct luat_spi luat_spi_t |
int luat_spi_bus_setup | ( | luat_spi_device_t * | spi_dev | ) |
spi总线初始化
spi_dev | luat_spi_device_t 结构体 |
int luat_spi_change_speed | ( | int | spi_id, |
uint32_t | speed ) |
SPI速率修改
spi_id | spi id |
speed | 速率 |
int luat_spi_close | ( | int | spi_id | ) |
关闭SPI
spi_id | spi id |
int luat_spi_config_dma | ( | int | spi_id, |
uint32_t | tx_channel, | ||
uint32_t | rx_channel ) |
SPI收发数据尝试启动DMA模式
spi_id | spi id |
tx_channel | 发送通道 |
rx_channel | 接收通道 |
int luat_spi_device_close | ( | luat_spi_device_t * | spi_dev | ) |
spi设备关闭
spi_dev | luat_spi_device_t 结构体 |
int luat_spi_device_config | ( | luat_spi_device_t * | spi_dev | ) |
spi设备配置
spi_dev | luat_spi_device_t 结构体 |
int luat_spi_device_recv | ( | luat_spi_device_t * | spi_dev, |
char * | recv_buf, | ||
size_t | length ) |
spi设备接收数据,返回接收字节数
spi_dev | luat_spi_device_t 结构体 |
recv_buf | 接收数据 |
length | 数据长度 |
int luat_spi_device_send | ( | luat_spi_device_t * | spi_dev, |
const char * | send_buf, | ||
size_t | length ) |
spi设备发送数据,返回接收字节数
spi_dev | luat_spi_device_t 结构体 |
send_buf | 发送数据 |
length | 数据长度 |
int luat_spi_device_setup | ( | luat_spi_device_t * | spi_dev | ) |
spi设备初始化
spi_dev | luat_spi_device_t 结构体 |
int luat_spi_device_transfer | ( | luat_spi_device_t * | spi_dev, |
const char * | send_buf, | ||
size_t | send_length, | ||
char * | recv_buf, | ||
size_t | recv_length ) |
spi设备收发数据,返回接收字节数
spi_dev | luat_spi_device_t 结构体 |
send_buf | 发送数据 |
send_length | 发送数据长度 |
recv_buf | 接收数据 |
recv_length | 接收数据长度 |
int luat_spi_get_mode | ( | int | spi_id | ) |
SPI模式获取
spi_id | spi id |
int luat_spi_no_block_transfer | ( | int | spi_id, |
uint8_t * | tx_buff, | ||
uint8_t * | rx_buff, | ||
size_t | len, | ||
void * | CB, | ||
void * | pParam ) |
SPI收发数据(异步)
spi_id | spi id |
tx_buff | 发送数据 |
rx_buff | 接收数据 |
len | 数据长度 |
CB | 回调函数 |
pParam | 回调参数 |
int luat_spi_recv | ( | int | spi_id, |
char * | recv_buf, | ||
size_t | length ) |
收SPI数据
spi_id | spi id |
recv_buf | 接收数据 |
length | 数据长度 |
int luat_spi_send | ( | int | spi_id, |
const char * | send_buf, | ||
size_t | length ) |
发SPI数据
spi_id | spi id |
send_buf | 发送数据 |
length | 数据长度 |
int luat_spi_set_mode | ( | int | spi_id, |
uint8_t | mode ) |
SPI模式修改
spi_id | spi id |
mode | 模式 |
int luat_spi_setup | ( | luat_spi_t * | spi | ) |
初始化配置SPI各项参数,并打开SPI luat_spi_t 结构体参数
spiId,–串口id
cs,
0,–CPHA
0,–CPOL
8,–数据宽度
20000000,–最大频率20M
spi.MSB,–高低位顺序 可选,默认高位在前
spi.master,–主模式 可选,默认主
spi.full,–全双工 可选,默认全双工
spi | spi结构体 |
int luat_spi_transfer | ( | int | spi_id, |
const char * | send_buf, | ||
size_t | send_length, | ||
char * | recv_buf, | ||
size_t | recv_length ) |
收发SPI数据
spi_id | spi id |
send_buf | 发送数据 |
send_length | 发送数据长度 |
recv_buf | 接收数据 |
recv_length | 接收数据长度 |