GithubHelp home page GithubHelp logo

stm32_bmp280's Introduction

BMP280 Driver

This repository contains the driver code for interfacing with the BMP280 sensor using I2C communication. The BMP280 is a barometric pressure sensor that can measure temperature and pressure.

Files

  • BMP280.h - Header file containing function declarations and necessary macros.
  • BMP280.c - Source file containing function definitions for interacting with the BMP280 sensor.

Functions

BMP280CheckStatus

void BMP280CheckStatus(I2C_HandleTypeDef &hi2c);

Checks if the BMP280 sensor is connected and ready for communication.

  • Parameters: hi2c - I2C handle.
  • Returns: Prints "BMP280 found" if the sensor is ready, otherwise prints "BMP280 not found".

register_read_8

uint8_t register_read_8(I2C_HandleTypeDef &hi2c, uint16_t MemAddress);

Reads an 8-bit value from the specified register.

  • Parameters:
    • hi2c - I2C handle.
    • MemAddress - Memory address to read from.
  • Returns: The 8-bit value read from the specified register.

register_write_8

void register_write_8(I2C_HandleTypeDef &hi2c, uint16_t MemAddress, uint8_t * pData);

Writes an 8-bit value to the specified register.

  • Parameters:
    • hi2c - I2C handle.
    • MemAddress - Memory address to write to.
    • pData - Pointer to the data to be written.

register_read_16

uint16_t register_read_16(I2C_HandleTypeDef &hi2c, uint16_t MemAddress);

Reads a 16-bit value from the specified register.

  • Parameters:
    • hi2c - I2C handle.
    • MemAddress - Memory address to read from.
  • Returns: The 16-bit value read from the specified register.

register_read_16_LE

uint16_t register_read_16_LE(I2C_HandleTypeDef &hi2c, uint16_t MemAddress);

Reads a 16-bit value from the specified register and converts it to little-endian format.

  • Parameters:
    • hi2c - I2C handle.
    • MemAddress - Memory address to read from.
  • Returns: The 16-bit value in little-endian format.

register_read_24

uint32_t register_read_24 (I2C_HandleTypeDef &hi2c, uint16_t MemAddress);

Reads a 24-bit value from the specified register.

  • Parameters:
    • hi2c - I2C handle.
    • MemAddress - Memory address to read from.
  • Returns: The 24-bit value read from the specified register.

BMP280_init

void BMP280_init(I2C_HandleTypeDef *pI2cHandle);

Initializes the BMP280 sensor by writing to the control and config registers.

  • Parameters: pI2cHandle - Pointer to the I2C handle.

BMP280_Read_Calib_Data

void BMP280_Read_Calib_Data(I2C_HandleTypeDef &hi2c);

Reads calibration data from the BMP280 sensor.

  • Parameters: hi2c - I2C handle.

BMP280_read_Temperature

float BMP280_read_Temperature(I2C_HandleTypeDef &i2c);

Reads and calculates the temperature from the BMP280 sensor.

  • Parameters: i2c - I2C handle.
  • Returns: The temperature in degrees Celsius.

BMP280_read_Pressure

float BMP280_read_Pressure();

Reads and calculates the pressure from the BMP280 sensor.

  • Returns: The pressure in Pascals.

Usage

  1. Initialize the I2C handle.
  2. Call BMP280CheckStatus to ensure the BMP280 sensor is connected.
  3. Use BMP280_init to initialize the sensor.
  4. Call BMP280_Read_Calib_Data to read the sensor's calibration data.
  5. Use BMP280_read_Temperature and BMP280_read_Pressure to read temperature and pressure values, respectively.

License

This project is licensed under the MIT License.


Feel free to contribute to this repository by creating pull requests or reporting issues. For any questions, please open an issue or contact the repository owner.

stm32_bmp280's People

Contributors

pritham13 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.