i2c-bit-ops.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * File : i2c-bit-ops.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2012-04-25 weety first version
  13. */
  14. #ifndef __I2C_BIT_OPS_H__
  15. #define __I2C_BIT_OPS_H__
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. struct rt_i2c_bit_ops
  20. {
  21. void *data; /* private data for lowlevel routines */
  22. void (*set_sda) (void *data, rt_int32_t state);
  23. void (*set_scl) (void *data, rt_int32_t state);
  24. rt_int32_t (*get_sda) (void *data);
  25. rt_int32_t (*get_scl) (void *data);
  26. void (*udelay) (rt_uint32_t us);
  27. rt_uint32_t delay_us; /* scl and sda line delay */
  28. rt_uint32_t timeout; /* in tick */
  29. };
  30. rt_err_t rt_i2c_bit_add_bus(struct rt_i2c_bus_device *bus,
  31. const char *bus_name);
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif