123456789101112131415161718192021222324252627282930313233 |
- #ifndef __DRIVE_24C02_H
- #define __DRIVE_24C02_H
- #include "stm32f10x.h"
- #include <stdbool.h>
- /* Exported macro ------------------------------------------------------------*/
- #define ADDR_24CXX 0xA0
- #define SCLH GPIOB->BSRR = GPIO_Pin_12
- #define SCLL GPIOB->BRR = GPIO_Pin_12
-
- #define SDAH GPIOB->BSRR = GPIO_Pin_13
- #define SDAL GPIOB->BRR = GPIO_Pin_13
- #define SCLread GPIOB->IDR & GPIO_Pin_12
- #define SDAread GPIOB->IDR & GPIO_Pin_13
-
- /* Exported functions ------------------------------------------------------- */
- void I2C_EE_Init(void);
- uint8_t I2C_EE_BufferWrite(uint8_t *psrc_data,uint8_t adr,uint8_t nbyte);
- uint8_t I2C_EE_BufferRead(uint8_t *pdin_data,uint8_t adr,uint8_t nbyte);
- uint8_t TWI_WriteByte(uint8_t SendByte, uint8_t WriteAddress);//写一个字节数据
- uint8_t TWI_ReadByte( uint8_t ReadAddress);//读一个字节数据
- #endif
|