Initial commit

This commit is contained in:
2025-06-16 00:50:22 +03:00
parent 699370323d
commit a84f62d86e
3 changed files with 198 additions and 0 deletions

68
Inc/DS_BMP180.h Normal file
View File

@@ -0,0 +1,68 @@
#ifndef DS_BMP180_H
#define DS_BMP180_H
#include "main.h"
#ifdef STM32G0
#include "stm32g0xx_hal.h"
#endif
#ifdef STM32F0
#include "stm32f0xx_hal.h"
#endif
typedef struct __DS_BMP180_CalibrationType
{
int16_t AC1;
int16_t AC2;
int16_t AC3;
uint16_t AC4;
uint16_t AC5;
uint16_t AC6;
int16_t B1;
int16_t B2;
long B5;
int16_t MB;
int16_t MC;
int16_t MD;
uint8_t OSS;
} __DS_BMP180_CalibrationType;
typedef struct DS_BMP180
{
I2C_HandleTypeDef *hi2c;
uint8_t address;
__DS_BMP180_CalibrationType Calibration;
} DS_BMP180;
void DS_BMP180_Init(DS_BMP180 *DS_BMP180, I2C_HandleTypeDef *hi2c, uint8_t address);
/// @brief
/// @param DS_BMP180
/// @param OversamplingRatio 0 - ultra low power
//// 1 - standard
//// 2 - high resolution
//// 3 - ultra high resolution
void DS_BMP180_StartConversionPressure(DS_BMP180 *DS_BMP180, uint8_t OversamplingRatio);
void DS_BMP180_StartConversionTemperature(DS_BMP180 *DS_BMP180);
/// @brief Temperature in 0.1° Celsius
/// @param DS_BMP180
/// @return
long DS_BMP180_GetTemperature(DS_BMP180 *DS_BMP180);
/// @brief Pressure in Pascal
/// @param DS_BMP180
/// @return Pressure
long DS_BMP180_GetPressure(DS_BMP180 *DS_BMP180);
#endif //DS_BMP180_H