/** * @file se050_i2c_hal.h * @brief SE050 I2C HAL Interface */ #ifndef SE050_I2C_HAL_H #define SE050_I2C_HAL_H #include #include #include /* Status codes */ typedef enum { SE050_OK = 0, SE050_ERR_INVALID_ARG = -1, SE050_ERR_I2C = -2, SE050_ERR_TIMEOUT = -3, SE050_ERR_INTERNAL = -4, SE050_ERR_SESSION = -5, SE050_ERR_FAIL = -6, SE050_ERR_RNG = -7, SE050_ERR_ECDH = -8, SE050_ERR_NOT_INIT = -9, SE050_ERR_SCP03 = -10 } se050_status_t; /* I2C HAL structure */ #define SE050_I2C_DEV_PATH_MAX 64 typedef struct { void *handle; /**< I2C file descriptor */ uint8_t slave_addr; /**< I2C slave address */ char dev_path[SE050_I2C_DEV_PATH_MAX]; /**< I2C device path */ int wakeup_pin; /**< Wakeup GPIO pin (-1 if unused) */ } se050_i2c_hal_t; /* Public API */ se050_status_t se050_i2c_init(se050_i2c_hal_t *hal, const char *dev_path, uint8_t slave_addr); void se050_i2c_close(se050_i2c_hal_t *hal); int se050_i2c_read(se050_i2c_hal_t *hal, uint8_t *buffer, int length); int se050_i2c_write(se050_i2c_hal_t *hal, const uint8_t *buffer, int length); se050_status_t se050_i2c_wakeup(se050_i2c_hal_t *hal); #endif /* SE050_I2C_HAL_H */