HW_Lib/lib/inc/iic/iic.h

50 lines
1.5 KiB
C
Raw Normal View History

2024-05-09 05:56:55 +00:00
//
// Created by lydxh on 2024/5/9.
//
#ifndef HW_LIB_IIC_H
#define HW_LIB_IIC_H
#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设备地址
} HW_Dev_IIC;
/**
* @brief IIC
* @param Dev: [] IIC
* @param InternalAddress: []
* @param Write_Data: []
* @param Len: []
* @return void
**/
void HW_IIC_WL(HW_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 HW_IIC_RL(HW_Dev_IIC Dev, uint8_t InternalAddress, uint8_t *Read_Data, uint32_t Len, uint8_t Ack);
#endif //HW_LIB_IIC_H