Files
mr-library/include/device/mr_soft_i2c.h

52 lines
1.2 KiB
C
Raw Permalink Normal View History

2023-12-14 00:41:37 +08:00
/*
2024-01-02 00:02:48 +08:00
* @copyright (c) 2023-2024, MR Development Team
2023-12-14 00:41:37 +08:00
*
* @license SPDX-License-Identifier: Apache-2.0
*
* @date 2023-12-13 MacRsh First version
*/
2024-01-02 00:13:58 +08:00
#ifndef _MR_SOFT_I2C_H_
#define _MR_SOFT_I2C_H_
2023-12-14 00:41:37 +08:00
#include "include/mr_api.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if defined(MR_USING_I2C) && defined(MR_USING_SOFT_I2C)
2024-01-02 00:02:48 +08:00
#include "include/device/mr_i2c.h"
2023-12-14 00:41:37 +08:00
/**
* @addtogroup I2C
* @{
*/
2023-12-14 00:41:37 +08:00
/**
* @brief Soft-I2C bus structure.
*/
struct mr_soft_i2c_bus
{
2023-12-25 15:48:49 +08:00
struct mr_i2c_bus i2c_bus; /**< I2C-bus device */
2023-12-14 00:41:37 +08:00
2023-12-25 15:48:49 +08:00
uint32_t delay; /**< Speed delay */
int scl_pin; /**< SCL pin */
int sda_pin; /**< SDA pin */
2023-12-14 00:41:37 +08:00
};
int mr_soft_i2c_bus_register(struct mr_soft_i2c_bus *soft_i2c_bus,
const char *path,
int scl_pin,
int sda_pin);
2023-12-14 00:41:37 +08:00
/** @} */
2023-12-14 00:41:37 +08:00
#endif /* defined(MR_USING_I2C) && defined(MR_USING_SOFT_I2C) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
2024-01-02 00:13:58 +08:00
#endif /* _MR_SOFT_I2C_H_ */