F439_CPP_MPL3115A2_Project_01 1.0
STM32F439 MPL3115A2 pressure and temperature tutorial
Loading...
Searching...
No Matches

: Common application definitions for the MPL3115A2 tutorial. More...

#include "stm32f4xx_hal.h"

Go to the source code of this file.

Macros

#define REDIRECT_PRINTF
 Enable printf redirection to USART1 through __io_putchar().
 

Functions

void Error_Handler (void)
 This function is executed in case of error occurrence.
 
void reset_I2C (void)
 Recover and reinitialize the I2C1 bus.
 

Detailed Description

: Common application definitions for the MPL3115A2 tutorial.

Attention

Copyright (c) 2026 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 main.h.

Macro Definition Documentation

◆ REDIRECT_PRINTF

#define REDIRECT_PRINTF

Enable printf redirection to USART1 through __io_putchar().

Definition at line 66 of file main.h.

Function Documentation

◆ Error_Handler()

void Error_Handler ( void )

This function is executed in case of error occurrence.

Return values
None

Definition at line 416 of file main.c.

Referenced by main(), MPL3115A2_Init(), MX_I2C1_Init(), MX_USART1_UART_Init(), and SystemClock_Config().

◆ reset_I2C()

void reset_I2C ( void )

Recover and reinitialize the I2C1 bus.

Recover and reinitialize the I2C1 bus.

Recover the I2C1 bus by manually clocking SCL before reinitialization.

This helper is used when the MPL3115A2 does not immediately respond during startup. PB8 is temporarily configured as an open-drain GPIO and toggled to help release a stuck slave before I2C1 is initialized again.

Definition at line 97 of file main.c.

References MX_I2C1_Init().

Referenced by MPL3115A2_Init().