| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /**
- * @file HW_I2C_ATY.h
- *
- * @param Project DEVICE_GENERAL_ATY_LIB
- *
- * @author ATY
- *
- * @copyright
- * - Copyright 2017 - 2023 MZ-ATY
- * - This code follows:
- * - MZ-ATY Various Contents Joint Statement -
- * <a href="https://mengze.top/MZ-ATY_VCJS">
- * https://mengze.top/MZ-ATY_VCJS</a>
- * - CC 4.0 BY-NC-SA -
- * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
- * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
- * - Your use will be deemed to have accepted the terms of this statement.
- *
- * @brief Familiar functions of I2C for all embedded device
- *
- * @version
- * - 1_01_220608 > ATY
- * -# Preliminary version, first Release
- ********************************************************************************
- */
- #ifndef __HW_I2C_ATY_H
- #define __HW_I2C_ATY_H
- #include "INCLUDE_ATY.h"
- #include "HW_TIMER_ATY.h"
- #include "HW_GPIO_ATY.h"
- /******************************* For user *************************************/
- #define I2C_WAIT_ACK_TIME 250 // us
- /******************************************************************************/
- #ifndef __I2C_HARDWARE_ATY
- #define I2C_SCL_SET_H GPIO_SET_H(I2C_SCL_PORT, I2C_SCL_PIN)
- #define I2C_SCL_SET_L GPIO_SET_L(I2C_SCL_PORT, I2C_SCL_PIN)
- #define I2C_SDA_SET_OUT I2C_SDA_SetOut()
- #define I2C_SDA_SET_IN I2C_SDA_SetIn()
- #define I2C_SDA_SET_H GPIO_SET_H(I2C_SDA_PORT, I2C_SDA_PIN)
- #define I2C_SDA_SET_L GPIO_SET_L(I2C_SDA_PORT, I2C_SDA_PIN)
- #define I2C_SDA_GET_H GPIO_GET_H(I2C_SDA_PORT, I2C_SDA_PIN)
- #define I2C_SDA_GET_L GPIO_GET_L(I2C_SDA_PORT, I2C_SDA_PIN)
- void I2C_Start(void);
- void I2C_Stop(void);
- void I2C_Ack(void);
- void I2C_NoAck(void);
- uint8_t I2C_WaitAck(uint16_t maxErrTime);
- void I2C_WriteByte(uint8_t byte);
- uint8_t I2C_ReadByte(uint8_t ack);
- #endif /* __I2C_HARDWARE_ATY */
- uint8_t I2C_Write(uint8_t addr, uint8_t* data_t, uint8_t len);
- uint8_t I2C_Write_NoStop(uint8_t addr, uint8_t* data_t, uint8_t len);
- uint8_t I2C_Read(uint8_t addr, uint8_t* data_t, uint8_t len);
- uint8_t I2C_WriteReg(uint8_t addr, uint8_t reg, uint8_t* data_t, uint8_t len);
- uint8_t I2C_ReadReg(uint8_t addr, uint8_t reg, uint8_t* data_t, uint8_t len);
- #endif /* __HW_I2C_ATY_H */
- /******************************** End Of File *********************************/
|