drv_soft_i2c.h 911 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023/04/15 chushicheng first version
  9. */
  10. #ifndef __DRV_I2C__
  11. #define __DRV_I2C__
  12. #include <rtthread.h>
  13. #include <rthw.h>
  14. #include <rtdevice.h>
  15. /* bl i2c dirver class */
  16. struct bl_i2c
  17. {
  18. struct rt_i2c_bit_ops ops;
  19. struct rt_i2c_bus_device i2c2_bus;
  20. };
  21. /* bl config class */
  22. struct bl_soft_i2c_config
  23. {
  24. rt_uint8_t scl;
  25. rt_uint8_t sda;
  26. const char *bus_name;
  27. };
  28. #ifdef BSP_USING_I2C1
  29. #define I2C1_BUS_CONFIG \
  30. { \
  31. .scl = BSP_I2C1_SCL_PIN, \
  32. .sda = BSP_I2C1_SDA_PIN, \
  33. .bus_name = "i2c1", \
  34. }
  35. #endif
  36. int rt_hw_i2c_init(void);
  37. #endif