UP 路径优化
This commit is contained in:
49
lib/iic/inc/iic.h
Normal file
49
lib/iic/inc/iic.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef SW_LIB_IIC_H
|
||||
#define SW_LIB_IIC_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#define HIGH 1
|
||||
#define LOW 0
|
||||
#define IN 1
|
||||
#define OUT 0
|
||||
#define NOP() ;
|
||||
#define DELAY1US() NOP()
|
||||
|
||||
/**
|
||||
* @brief IIC设备结构体
|
||||
**/
|
||||
typedef struct {
|
||||
uint8_t (*CLK_SET)(uint8_t); // 设置时钟引脚状态的函数指针
|
||||
uint8_t (*SDA_SET)(uint8_t); // 设置数据引脚状态的函数指针
|
||||
uint8_t (*SDA)(); // 读取数据引脚状态的函数指针
|
||||
uint8_t (*SDA_MODE)(uint8_t); // 设置数据引脚模式的函数指针
|
||||
uint8_t ADD; // IIC设备地址
|
||||
} SW_Dev_IIC;
|
||||
|
||||
/**
|
||||
* @brief 向 IIC 设备写入数据流
|
||||
* @param Dev: [输入] IIC设备结构体
|
||||
* @param InternalAddress: [输入] 内部地址
|
||||
* @param Write_Data: [输入] 要写入的数据流指针
|
||||
* @param Len: [输入] 数据流长度
|
||||
* @return void
|
||||
**/
|
||||
void SW_IIC_WL(SW_Dev_IIC Dev, uint8_t InternalAddress, uint8_t *Write_Data, uint32_t Len);
|
||||
|
||||
/**
|
||||
* @brief 从 IIC 设备读取数据流
|
||||
* @param Dev: [输入] IIC设备结构体
|
||||
* @param InternalAddress: [输入] 内部地址
|
||||
* @param Read_Data: [输出] 存储读取数据的缓冲区指针
|
||||
* @param Len: [输入] 读取数据流长度
|
||||
* @param Ack: [输入] 确认应答位
|
||||
* @return void
|
||||
**/
|
||||
void SW_IIC_RL(SW_Dev_IIC Dev, uint8_t InternalAddress, uint8_t *Read_Data, uint32_t Len, uint8_t Ack);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif //SW_LIB_IIC_H
|
Reference in New Issue
Block a user