rt-thread/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_i2c.h

32 lines
929 B
C
Raw Normal View History

2021-02-18 13:29:12 +08:00
#ifndef __SWM320_I2C_H__
#define __SWM320_I2C_H__
typedef struct {
uint8_t Master; //1 <20><><EFBFBD><EFBFBD>ģʽ
uint8_t Addr7b; //1 7λ<37><CEBB>ַ 0 10λ<30><CEBB>ַ
uint32_t MstClk; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ƶ<EFBFBD><C6B5>
uint8_t MstIEn; //<2F><><EFBFBD><EFBFBD>ģʽ<C4A3>ж<EFBFBD>ʹ<EFBFBD><CAB9>
uint16_t SlvAddr; //<2F>ӻ<EFBFBD><D3BB><EFBFBD>ַ
uint8_t SlvRxEndIEn; //<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>
uint8_t SlvTxEndIEn; //<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>
uint8_t SlvSTADetIEn; //<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><E2B5BD>ʼ<EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>
uint8_t SlvSTODetIEn; //<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><E2B5BD>ֹ<EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>
uint8_t SlvRdReqIEn; //<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>
uint8_t SlvWrReqIEn; //<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD>յ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>
} I2C_InitStructure;
void I2C_Init(I2C_TypeDef * I2Cx, I2C_InitStructure * initStruct);
void I2C_Open(I2C_TypeDef * I2Cx);
void I2C_Close(I2C_TypeDef * I2Cx);
uint8_t I2C_Start(I2C_TypeDef * I2Cx, uint8_t addr);
void I2C_Stop(I2C_TypeDef * I2Cx);
uint8_t I2C_Write(I2C_TypeDef * I2Cx, uint8_t data);
uint8_t I2C_Read(I2C_TypeDef * I2Cx, uint8_t ack);
#endif //__SWM320_I2C_H__