xt-sdk 文档 v1.0.3
xt-sdk 嵌入式 SDK API 参考
载入中...
搜索中...
未找到
xt_hal_i2c.h
浏览该文件的文档.
1
12
13#ifndef __XT_HAL_I2C_H__
14#define __XT_HAL_I2C_H__
15
16/* ==================== [Includes] ========================================== */
17
18#include "xt_hal_internal.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
30
31/* ==================== [Defines] =========================================== */
32
33#define XT_HAL_I2C_INVALID_ID (0xFF)
34
35/* ==================== [Typedefs] ========================================== */
36
43
50typedef void (*xt_hal_i2c_cb_t)(uint8_t i2c_id, uint32_t event_id);
51
52/* ==================== [Global Prototypes] ================================= */
53
64 uint8_t i2c_id, uint32_t speed,
65 uint8_t scl_pin, uint8_t sda_pin);
66
74
87 uint8_t i2c_id, uint16_t slave_addr,
88 const void *tx_buffer, size_t size);
89
102 uint8_t i2c_id, uint16_t slave_addr,
103 void *rx_buffer, size_t size);
104
121 uint8_t i2c_id, uint16_t slave_addr,
122 const void *tx_buffer, size_t tx_size,
123 void *rx_buffer, size_t rx_size);
124
125/* ==================== [Macros] ============================================ */
126 /* xt_hal_i2c */
128
129#ifdef __cplusplus
130} /* extern "C" */
131#endif
132
133#endif /* __XT_HAL_I2C_H__ */
int32_t xt_err_t
错误码类型
void(* xt_hal_i2c_cb_t)(uint8_t i2c_id, uint32_t event_id)
I2C 回调函数类型定义
xt_err_t xt_hal_i2cm_close(uint8_t i2c_id)
关闭 I2C Master
int32_t xt_hal_i2cm_rx_block(uint8_t i2c_id, uint16_t slave_addr, void *rx_buffer, size_t size)
阻塞从指定从机读取数据
int32_t xt_hal_i2cm_tx_rx_block(uint8_t i2c_id, uint16_t slave_addr, const void *tx_buffer, size_t tx_size, void *rx_buffer, size_t rx_size)
阻塞半双工传输(先写后读)
int32_t xt_hal_i2cm_tx_block(uint8_t i2c_id, uint16_t slave_addr, const void *tx_buffer, size_t size)
阻塞发送数据到指定从机
xt_hal_i2c_event_id
I2C 事件 ID 枚举
xt_err_t xt_hal_i2cm_setup(uint8_t i2c_id, uint32_t speed, uint8_t scl_pin, uint8_t sda_pin)
初始化 I2C Master
@ XT_HAL_I2C_EVENT_DONE
XTINY HAL 内部公共头文件