drv_soft_i2c.h 970 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2024-04-23 LZero Modify the I2C framework.
  9. */
  10. #ifndef __DRV_I2C__
  11. #define __DRV_I2C__
  12. #include <rtthread.h>
  13. #include <board.h>
  14. #include <rtdbg.h>
  15. #include <rtdevice.h>
  16. #include <drivers/dev_pin.h>
  17. /* acm32 config class */
  18. struct acm32_soft_i2c_config
  19. {
  20. rt_uint8_t scl;
  21. rt_uint8_t sda;
  22. const char *bus_name;
  23. };
  24. /* acm32 i2c dirver class */
  25. struct acm32_i2c
  26. {
  27. struct rt_i2c_bit_ops ops;
  28. struct rt_i2c_bus_device i2c_bus;
  29. };
  30. #ifdef BSP_USING_I2C0
  31. #define I2C0_BUS_CONFIG \
  32. { \
  33. .scl = BSP_I2C0_SCL_PIN, \
  34. .sda = BSP_I2C0_SDA_PIN, \
  35. .bus_name = "i2c0", \
  36. }
  37. #endif
  38. #endif //__DRV_I2C__