L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
i2c.h
Go to the documentation of this file.
1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file i2c.h
5 * @brief This file contains all the function prototypes for
6 * the i2c.c file
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2025 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef __I2C_H__
22#define __I2C_H__
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* Includes ------------------------------------------------------------------*/
29#include "main.h"
30
31/* USER CODE BEGIN Includes */
32
33/* USER CODE END Includes */
34
35extern I2C_HandleTypeDef hi2c2;
36
37/* USER CODE BEGIN Private defines */
38
39/* USER CODE END Private defines */
40
41void MX_I2C2_Init(void);
42
43/* USER CODE BEGIN Prototypes */
44
45/**
46 * @brief Deinitialise the I2C2 peripheral to reduce current consumption in low-power mode.
47 * Call before entering STOP or OFF mode; call MX_I2C2_Init() again after wakeup.
48 */
49void MX_I2C2_DeInit(void);
50
51/**
52 * @brief Wrapper around HAL_I2C_IsDeviceReady() that recovers from a busy bus.
53 * If the HAL I2C bus is in a BUSY error state, the function resets the
54 * peripheral (DeInit / Init cycle) before retrying the device poll.
55 * @param hi2c Pointer to the I2C handle.
56 * @param DevAddress 7-bit or 10-bit device address (left-shifted by 1 for HAL).
57 * @param Trials Number of consecutive ACK attempts before giving up.
58 * @param Timeout Timeout in milliseconds for each trial.
59 * @retval HAL_OK – device acknowledged within the given number of trials.
60 * @retval HAL_ERROR – device not present or bus error after recovery attempt.
61 * @retval HAL_TIMEOUT – device did not acknowledge within the timeout.
62 */
63HAL_StatusTypeDef I2C_IsDeviceReadyMT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout);
64
65
66/* USER CODE END Prototypes */
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif /* __I2C_H__ */
73
void MX_I2C2_Init(void)
Definition i2c.c:30
HAL_StatusTypeDef I2C_IsDeviceReadyMT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
Wrapper around HAL_I2C_IsDeviceReady() that recovers from a busy bus. If the HAL I2C bus is in a BUSY...
Definition i2c.c:158
I2C_HandleTypeDef hi2c2
Definition i2c.c:27
void MX_I2C2_DeInit(void)
Deinitialise the I2C2 peripheral to reduce current consumption in low-power mode. Call before enterin...
Definition i2c.c:150
: Header for main.c file. This file contains the common defines of the application....