i2c.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. ******************************************************************************
  3. * File Name : I2C.h
  4. * Description : This file provides code for the configuration
  5. * of the I2C instances.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __i2c_H
  21. #define __i2c_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "main.h"
  27. /* USER CODE BEGIN Includes */
  28. #define I2C_BUFFER_SIZE ((uint32_t)512)
  29. #define I2C_TX_TIMEOUT ((uint32_t)0x010)
  30. #ifdef MODIFY_METER_IC_I2C_RX_TIMEOUT
  31. //#define I2C_RX_TIMEOUT ((uint32_t)0xFFFFFFFF - 1)
  32. //#define I2C_RX_TIMEOUT ((uint32_t)(300))
  33. #define I2C_RX_TIMEOUT ((uint32_t)(1000))
  34. #else
  35. #define I2C_RX_TIMEOUT ((uint32_t)0xFFFFFFFF)
  36. #endif
  37. /* USER CODE END Includes */
  38. extern I2C_HandleTypeDef hi2c2;
  39. /* USER CODE BEGIN Private defines */
  40. /* USER CODE END Private defines */
  41. void MX_I2C2_Init(void);
  42. /* USER CODE BEGIN Prototypes */
  43. extern uint8_t I2C_METER_rx_buffer[I2C_BUFFER_SIZE];
  44. extern uint8_t I2C_METER_recv_end_flag;
  45. extern uint16_t I2C_METER_rx_len;
  46. /* USER CODE END Prototypes */
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /*__ i2c_H */
  51. /**
  52. * @}
  53. */
  54. /**
  55. * @}
  56. */
  57. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/