drv_soft_i2c.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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-11 linshrie first version
  9. */
  10. #ifndef __DRV_I2C__
  11. #define __DRV_I2C__
  12. #include <rtdevice.h>
  13. /* lpc55s69 config class */
  14. struct lpc55s69_soft_i2c_config
  15. {
  16. rt_uint8_t scl;
  17. rt_uint8_t sda;
  18. const char *bus_name;
  19. };
  20. /* lpc55s69 i2c dirver class */
  21. struct lpc55s69_i2c
  22. {
  23. struct rt_i2c_bit_ops ops;
  24. struct rt_i2c_bus_device i2c_bus;
  25. };
  26. #ifdef BSP_USING_SOFT_I2C1
  27. #define SOFT_I2C1_BUS_CONFIG \
  28. { \
  29. .scl = BSP_SOFT_I2C1_SCL_PIN, \
  30. .sda = BSP_SOFT_I2C1_SDA_PIN, \
  31. .bus_name = "si2c1", \
  32. }
  33. #endif /*BSP_USING_SOFT_I2C1*/
  34. #ifdef BSP_USING_SOFT_I2C2
  35. #define SOFT_I2C2_BUS_CONFIG \
  36. { \
  37. .scl = BSP_SOFT_I2C2_SCL_PIN, \
  38. .sda = BSP_SOFT_I2C2_SDA_PIN, \
  39. .bus_name = "si2c2", \
  40. }
  41. #endif /*BSP_USING_SOFT_I2C2*/
  42. int rt_soft_i2c_init(void);
  43. #endif