The project has a simple layered structure:
Application Layer main.c
- initializes HAL, clocks, GPIO, I2C1, and USART1
- initializes the MPL3115A2 driver
- polls data-ready status bits
- prints converted temperature and pressure values
MPL3115A2 Driver Layer MPL3115A2/mpl3115a2.c MPL3115A2/mpl3115a2.h
- owns MPL3115A2 register definitions
- stores the active I2C handle and device address
- verifies WHO_AM_I
- configures pressure/temperature data-ready events
- reads and converts pressure and temperature samples
STM32 HAL / CubeMX Layer Core/Src/main.c Core/Inc/main.h
- provides generated peripheral initialization
- provides HAL I2C, UART, GPIO, timer, and clock services