HW_Lib/lib/iic/inc/iic.h

50 lines
1.6 KiB
C
Raw Permalink Normal View History

2024-05-10 05:47:39 +00:00
#ifndef SW_LIB_IIC_H
#define SW_LIB_IIC_H
2024-05-20 13:53:19 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2024-05-09 05:56:55 +00:00
#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); // 设置数据引脚状态的函数指针
2024-05-09 06:38:55 +00:00
uint8_t (*SDA)(); // 读取数据引脚状态的函数指针
2024-05-09 05:56:55 +00:00
uint8_t (*SDA_MODE)(uint8_t); // 设置数据引脚模式的函数指针
uint8_t ADD; // IIC设备地址
2024-05-10 05:47:39 +00:00
} SW_Dev_IIC;
2024-05-09 05:56:55 +00:00
/**
* @brief IIC
* @param Dev: [] IIC
* @param InternalAddress: []
* @param Write_Data: []
* @param Len: []
* @return void
**/
2024-05-10 05:47:39 +00:00
void SW_IIC_WL(SW_Dev_IIC Dev, uint8_t InternalAddress, uint8_t *Write_Data, uint32_t Len);
2024-05-09 05:56:55 +00:00
/**
* @brief IIC
* @param Dev: [] IIC
* @param InternalAddress: []
* @param Read_Data: []
* @param Len: []
* @param Ack: []
* @return void
**/
2024-05-10 05:47:39 +00:00
void SW_IIC_RL(SW_Dev_IIC Dev, uint8_t InternalAddress, uint8_t *Read_Data, uint32_t Len, uint8_t Ack);
2024-05-20 13:53:19 +00:00
#ifdef __cplusplus
}
#endif
2024-05-10 05:47:39 +00:00
#endif //SW_LIB_IIC_H