Code Monkey home page Code Monkey logo

bmx280's Introduction

BMx280

Bosch BME280/BMP280 pressure sensor light library. In original adopted for SMT32 Low Layer library but could be easily changed to any other platform.

BME280 datasheet

BMP280 datasheet

How to use

BMx280_HandleTypeDef bme280;

bme280.hi2c = I2C1;
bme280.address = 0x76;

BMx280_Config config = {
    .filter = BMx280_FILTER_4,
    .t_sb = BMx280_TIMESTBY_1000
};

BMx280_Oversampling oversampling = {
    .osrs_t = BMx280_OVERSAMPLING_4,
    .osrs_p = BMx280_OVERSAMPLING_2,
    .osrs_h = BMx280_OVERSAMPLING_1,
};

BMx280_Init(&bme280);
BMx280_SetConfig(&bme280, config);
BMx280_SetOversampling(&bme280, oversampling);
BMx280_SetMode(&bme280, BMx280_MODE_NORMAL);

BMx280_ReadMeasurements(&bme280);

float temperature = BMx280_GetTemperature(&bme280);
float pressure = BMx280_GetPressure(&bme280);
float humidity = BMx280_GetHumidity(&bme280);

Porting routine

  1. Change includes in bmx280.h to proper for your MCU, also maybe you want to replace I2C with SPI
  2. Change _BMx280_IO_Write8 and _BMx280_IO_Read functions in bmx280.c to implement read and write functionality according your MCU

Tested using

sensors:

  • GY-BME280 (BME280 sensor)
  • GY-91 (BMP280 sensor)

on boards:

  • STM32 Nucleo-L073RZ
  • STM32 L010F4

bmx280's People

Contributors

quard avatar

Stargazers

 avatar

Watchers

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