123456789101112131415161718192021222324252627 |
- #ifndef __USER_TWIM_SIMULATE_H__
- #define __USER_TWIM_SIMULATE_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "sdk_config.h"
- #include "define.h"
- //IO操作函数
- #define TWIM_CLK_HIGH nrf_gpio_pin_write(TWI_SCL_M0, 1);
- #define TWIM_CLK_LOW nrf_gpio_pin_write(TWI_SCL_M0, 0);
- #define TWIM_SDA_HIGH nrf_gpio_pin_write(TWI_SDA_M0, 1);
- #define TWIM_SDA_LOW nrf_gpio_pin_write(TWI_SDA_M0, 0);
- #define READ_SDA nrf_gpio_pin_read(TWI_SDA_M0) //输入SDA
- //IIC所有操作函数
- void IIC_Init(void); //初始化IIC的IO口
- void IIC_Start(void); //发送IIC开始信号
- void IIC_Stop(void); //发送IIC停止信号
- void IIC_Send_Byte(uint8_t txd); //IIC发送一个字节
- uint8_t IIC_Read_Byte(unsigned char ack);//IIC读取一个字节
- uint8_t IIC_Wait_Ack(void); //IIC等待ACK信号
- void IIC_Ack(void); //IIC发送ACK信号
- void IIC_NAck(void); //IIC不发送ACK信号
- void IIC_Write_One_Byte(uint8_t daddr,uint8_t addr,uint8_t data);
- uint8_t IIC_Read_One_Byte(uint8_t daddr,uint8_t addr);
- #endif //__USER_TWIM_SIMULATE_H__
|