#ifndef __IOI2C_H
#define __IOI2C_H
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "sdk_common.h"
#include "SEGGER_RTT.h"
#include "usr_config.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
//IO口操作宏定义
#define BITBAND(addr, bitnum) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(bitnum<<2))
#define MEM_ADDR(addr)  *((volatile unsigned long  *)(addr))
#define BIT_ADDR(addr, bitnum)   MEM_ADDR(BITBAND(addr, bitnum))

#define SCL_H         nrf_gpio_pin_write(PIN_SCL_1,1)
#define SCL_L         nrf_gpio_pin_write(PIN_SCL_1,0)

#define SDA_H         nrf_gpio_pin_write(PIN_SDA_1,1)
#define SDA_L         nrf_gpio_pin_write(PIN_SDA_1,0)

#define SCL_read      nrf_gpio_pin_read(PIN_SCL_1)
#define SDA_read      nrf_gpio_pin_read(PIN_SDA_1)

void 	 VL53L1_IIC_Init(void);                //初始化IIC的IO口
extern uint8_t IIC_ReadOneByte(uint8_t SlaveAddress,uint16_t REG_Address,uint8_t* data);
extern unsigned char IICwriteByte(unsigned char dev, uint16_t reg, unsigned char data);
extern uint8_t IICwriteBytes(uint8_t dev, uint16_t reg, uint16_t length, uint8_t* data);
extern uint8_t IICwriteBit(uint8_t dev,uint16_t reg,uint8_t bitNum,uint8_t data);
extern uint8_t IICreadBytes(uint8_t SlaveAddress,uint16_t REG_Address,uint8_t len,uint8_t *data);


#endif

//------------------End of File----------------------------
