/********************************** (C) COPYRIGHT *******************************
* File Name          : IIC_Hardware.h
* Author             : WCH
* Version            : V1.0
* Date               : 2018/12/12
* Description        :
*******************************************************************************/

#ifndef __IIC_HARDWARE_H__
#define __IIC_HARDWARE_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "ch32x035_usbpd.h"
#include "ch32v30x.h"

// #define   IIC_SDA     (GPIO_Pin_18)  //PC18
// #define   IIC_SCL     (GPIO_Pin_19)  //PC19
// #define   RST_PIN     (GPIO_Pin_0)   //PA0
// #define   INT_PIN     (GPIO_Pin_1)   //PA1


void MS1826A_IIC_Init(void);

BOOL Check_I2C_Address(u8 Address);
u8 IICReadOneByte(u32 ReadAddr);
BOOL IICReadBytes(u32 ReadAddr, u8 *pBuffer, u16 Length);
BOOL IICWriteOneByte(u32 WriteAddr, u8 DataToWrite);
BOOL IICWriteBytes(u32 WriteAddr, u8 *pBuffer, u16 Length);

void IICRead(u16 ReadAddr, u8 *pBuffer, u16 NumToRead);
void IICWrite(u16 WriteAddr, u8 *pBuffer, u16 NumToWrite);


void IIC_hd_Init(u32 bound, u16 address);

#ifdef __cplusplus
}
#endif

#endif
