L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
i2c.h File Reference

This file contains all the function prototypes for the i2c.c file. More...

#include "main.h"
Include dependency graph for i2c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void MX_I2C2_Init (void)
 Initialise the I2C2 peripheral (hi2c2) as configured by STM32CubeMX. Sets clock speed, addressing mode, and timing registers for communication with all I2C-connected sensors (SHT45, TSL2591, ILPS22QS, BMP585, SCD41, SPS30, ST25DV16KC NFC tag).
void MX_I2C2_DeInit (void)
 Deinitialise the I2C2 peripheral to reduce current consumption in low-power mode. Call before entering STOP or OFF mode; call MX_I2C2_Init() again after wakeup.
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 error state, the function resets the peripheral (DeInit / Init cycle) before retrying the device poll.

Variables

I2C_HandleTypeDef hi2c2

Detailed Description

This file contains all the function prototypes for the i2c.c file.

Attention

Copyright (c) 2025 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file i2c.h.

Function Documentation

◆ I2C_IsDeviceReadyMT()

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 error state, the function resets the peripheral (DeInit / Init cycle) before retrying the device poll.

Parameters
hi2cPointer to the I2C handle.
DevAddress7-bit or 10-bit device address (left-shifted by 1 for HAL).
TrialsNumber of consecutive ACK attempts before giving up.
TimeoutTimeout in milliseconds for each trial.
Return values
HAL_OK– device acknowledged within the given number of trials.
HAL_ERROR– device not present or bus error after recovery attempt.
HAL_TIMEOUT– device did not acknowledge within the timeout.

Definition at line 158 of file i2c.c.

References HAL_Delay().

Referenced by amb_tsl2591_Init(), bar_bmp585_Init(), bar_ils22qs_Init(), nfc_st25dv16kc_Init(), scd41_Init(), sps30_Init(), tempHum_onOff(), and tmphm_sht45_Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MX_I2C2_DeInit()

void MX_I2C2_DeInit ( void )

Deinitialise the I2C2 peripheral to reduce current consumption in low-power mode. Call before entering STOP or OFF mode; call MX_I2C2_Init() again after wakeup.

Deinitialise the I2C2 peripheral to reduce current consumption in low-power mode. Call before entering STOP or OFF mode; call MX_I2C2_Init() again after wakeup.

Definition at line 150 of file i2c.c.

References hi2c2.

Referenced by i2c_OnOff().

Here is the caller graph for this function:

◆ MX_I2C2_Init()

void MX_I2C2_Init ( void )

Initialise the I2C2 peripheral (hi2c2) as configured by STM32CubeMX. Sets clock speed, addressing mode, and timing registers for communication with all I2C-connected sensors (SHT45, TSL2591, ILPS22QS, BMP585, SCD41, SPS30, ST25DV16KC NFC tag).

Configure Analogue filter

Configure Digital filter

Definition at line 30 of file i2c.c.

References Error_Handler(), and hi2c2.

Referenced by i2c_OnOff(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ hi2c2

I2C_HandleTypeDef hi2c2
extern

Definition at line 27 of file i2c.c.

Referenced by checkResetRestart(), main(), MX_I2C2_DeInit(), and MX_I2C2_Init().