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

: MPL3115A2 pressure and temperature tutorial application More...

#include "main.h"
#include <stdio.h>
#include <string.h>
#include "mpl3115a2.h"

Go to the source code of this file.

Functions

void SystemClock_Config (void)
 System Clock Configuration.
 
static void MX_GPIO_Init (void)
 GPIO Initialization Function.
 
static void MX_I2C1_Init (void)
 I2C1 Initialization Function.
 
static void MX_USART1_UART_Init (void)
 USART1 Initialization Function.
 
void reset_I2C (void)
 Enable printf redirection through USART1 when REDIRECT_PRINTF is defined.
 
int main (void)
 The application entry point.
 
void Error_Handler (void)
 This function is executed in case of error occurrence.
 

Variables

I2C_HandleTypeDef hi2c1
 
UART_HandleTypeDef huart1
 

Detailed Description

: MPL3115A2 pressure and temperature tutorial application

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.c.

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().

◆ main()

int main ( void )

◆ MX_GPIO_Init()

static void MX_GPIO_Init ( void )
static

GPIO Initialization Function.

Parameters
None
Return values
None

Definition at line 391 of file main.c.

Referenced by main().

◆ MX_I2C1_Init()

static void MX_I2C1_Init ( void )
static

I2C1 Initialization Function.

Parameters
None
Return values
None

Configure Analogue filter

Configure Digital filter

Definition at line 310 of file main.c.

References Error_Handler().

Referenced by main(), and reset_I2C().

◆ MX_USART1_UART_Init()

static void MX_USART1_UART_Init ( void )
static

USART1 Initialization Function.

Parameters
None
Return values
None

Definition at line 358 of file main.c.

References Error_Handler().

Referenced by main().

◆ reset_I2C()

void reset_I2C ( void )

Enable printf redirection through USART1 when REDIRECT_PRINTF is defined.

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().

◆ SystemClock_Config()

void SystemClock_Config ( void )

System Clock Configuration.

Return values
None

Configure the main internal regulator output voltage

Initializes the RCC Oscillators according to the specified parameters in the RCC_OscInitTypeDef structure.

Activate the Over-Drive mode

Initializes the CPU, AHB and APB buses clocks

Definition at line 256 of file main.c.

References Error_Handler().

Referenced by main().

Variable Documentation

◆ hi2c1

I2C_HandleTypeDef hi2c1

Definition at line 46 of file main.c.

◆ huart1

UART_HandleTypeDef huart1

Definition at line 48 of file main.c.