stm32f1_i2c.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * File : stm32f1_i2c.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006-2013, 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. * 2017-07-04 aubrcool@qq.com 1st version
  13. */
  14. #include "stm32f10x.h"
  15. #include <rtdevice.h>
  16. #ifndef __STM32F10X_I2C_H__
  17. #define __STM32F10X_I2C_H__
  18. #include "stm32f10x.h"
  19. #include "stm32f10x_i2c.h"
  20. #include "board.h"
  21. struct stm32_i2c_bus
  22. {
  23. struct rt_i2c_bus_device parent;
  24. struct rt_event ev;
  25. I2C_TypeDef *I2C;
  26. struct rt_i2c_msg *msg;
  27. rt_uint32_t msg_cnt;
  28. volatile rt_uint32_t msg_ptr;
  29. volatile rt_uint32_t dptr;
  30. rt_uint32_t wait_stop;
  31. };
  32. /* public function list */
  33. rt_err_t stm32_i2c_register(I2C_TypeDef *I2C, rt_uint32_t bitrate,
  34. const char * i2c_bus_name);
  35. #endif /*__STM32F10X_I2C_H__*/