2022-10-19 22:44:15 +08:00

32 lines
929 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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__