初始化仓库
This commit is contained in:
34
Header/iic.h
Normal file
34
Header/iic.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef __IIC_H__
|
||||
#define __IIC_H__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IIC_1 = 0,
|
||||
IIC_2 = 1,
|
||||
IIC_3 = 2,
|
||||
IIC_4 = 3,
|
||||
|
||||
} IICN_enum;
|
||||
|
||||
// IO口是绑定死的,这里只是列出来
|
||||
typedef enum
|
||||
{
|
||||
IIC1_SCL_P15 = 0x00, IIC1_SDA_P14,
|
||||
IIC2_SCL_P25 = 0x10, IIC2_SDA_P24,
|
||||
IIC3_SCL_P77 = 0x20, IIC3_SDA_P76,
|
||||
IIC4_SCL_P32 = 0x30, IIC4_SDA_P33,
|
||||
} IIC_PIN_enum;
|
||||
|
||||
|
||||
#define IIC_SEND_OK 0
|
||||
#define IIC_SEND_FAIL 1
|
||||
|
||||
void iic_init(IICN_enum iic_n, uint8 wait_time);
|
||||
uint8 iic_write_reg(uint8 dev_add, uint8 reg, uint8 dat);
|
||||
uint8 iic_read_reg(uint8 dev_add, uint8 reg, uint8 *dat);
|
||||
uint8 iic_read_reg_bytes(uint8 dev_add, uint8 reg, uint8 *dat, uint8 num);
|
||||
void iic_change_pin(IICN_enum iic_n);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user