Skip to content

Driver for the Bosch BME280 Temperature, Humidity, and Pressure Sensor

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
MIT-LICENSE.md
Notifications You must be signed in to change notification settings

embvm-drivers/BME280

Repository files navigation

BME280 Driver

BME280 driver implementation designed according to Design for Change principles, allowing it to work with any system by merely supplying the necessary abstraction implementations.

Table of Contents

  1. About the Project
  2. Project Status
  3. Getting Started
    1. Requirements
      1. git-lfs
      2. Meson Build System
    2. Getting the Source
    3. Building
      1. Enabling Link-time Optimization
    4. Installation
    5. Usage
  4. Configuration Options
  5. Documentation
  6. Need Help?
  7. Contributing
  8. Further Reading
  9. Authors
  10. License
  11. Acknowledgments

About the Project

This project provides a portable and reusable BME280 driver that is not tied to any particular ecosystem.

This repository, in addition to providing an actual driver, is also meant as a demonstration for our course Designing Embedded Software for Change. As such, we have refactored Sparkfun's BME280 Library for Arduino, as well as provided a driver implementation on top of Bosch's BME280 driver.

Back to top

Project Status

This project is currently under development as part of our Designing Embedded Software for Change course.

  • We have adjusted the Sparkfun BME280 driver, removing its dependency on the Arduino SDK.
    • An example application is provided for the ATMega256 (make CROSS=avr:arduino_mega) demonstrating that the library still works on Arduino
    • An example application is provided using the Aardvark USB adapter (only compiles in non-cross-compilation mode for now due to an embvm-core issue with AVR)

Back to top

Getting Started

Requirements

This project uses Embedded Artistry's standard Meson build system, and dependencies are described in detail on our website.

At a minimum you will need:

  • git-lfs, which is used to store binary files in this repository
  • Meson is the build system
  • Some kind of compiler for your target system.
    • This repository has been tested with:
      • gcc-7, gcc-8, gcc-9
      • arm-none-eabi-gcc
      • Apple clang
      • Mainline clang

git-lfs

This project stores some files using git-lfs.

To install git-lfs on Linux:

sudo apt install git-lfs

To install git-lfs on OS X:

brew install git-lfs

Additional installation instructions can be found on the git-lfs website.

Meson Build System

The Meson build system depends on python3 and ninja-build.

To install on Linux:

sudo apt-get install python3 python3-pip ninja-build

To install on OSX:

brew install python3 ninja

Meson can be installed through pip3:

pip3 install meson

If you want to install Meson globally on Linux, use:

sudo -H pip3 install meson

Back to top

Getting the Source

This project uses git-lfs, so please install it before cloning. If you cloned prior to installing git-lfs, simply run git lfs pull after installation.

This project is hosted on GitHub. You can clone the project directly using this command:

git clone --recursive https://github.com/embeddedartistry/project-skeleton

If you don't clone recursively, be sure to run the following command in the repository or your build will fail:

git submodule update --init

Back to top

Building

If Make is installed, the library can be built by issuing the following command:

make

This will build all targets for your current architecture.

You can clean builds using:

make clean

You can eliminate the generated buildresults folder using:

make distclean

You can also use meson directly for compiling.

Create a build output folder:

meson buildresults

And build all targets by running

ninja -C buildresults

Cross-compilation is handled using meson cross files. Example files are included in the build/cross folder. You can write your own cross files for your specific processor by defining the toolchain, compilation flags, and linker flags. These settings will be used to compile the project.

Cross-compilation must be configured using the meson command when creating the build output folder. For example:

meson buildresults --cross-file build/cross/gcc_arm_cortex-m4.txt

Following that, you can run make (at the project root) or ninja to build the project.

Tests will not be cross-compiled. They will only be built for the native platform.

Full instructions for building the project, using alternate toolchains, and running supporting tooling are documented in Embedded Artistry's Standardized Meson Build System on our website.

Back to top

Enabling Link-time Optimization

Link-time Optimization (LTO) can be enabled during the meson configuration stage by setting the built-in option b_lto to true:

meson buildresults -Db_lto=true

This can be combined with other build options.

Back to top

Testing

The tests for this library are written with CMocka, which is included as a subproject and does not need to be installed on your system. You can run the tests by issuing the following command:

make test

By default, test results are generated for use by the CI server and are formatted in JUnit XML. The test results XML files can be found in buildresults/test/.

Back to top

Configuration Options

The following meson project options can be set for this library when creating the build results directory with meson, or by using meson configure:

  • disable-builtins will tell the compiler not to generate built-in function
  • disable-stack-protection will tell the compiler not to insert stack protection calls
  • disable-rtti will disable RTTI for C++ projects
  • disable-exceptions will disable exceptions for C++ projects
  • enable-threading can be used to control threaded targets and libc++ threading support
  • enable-pedantic: Turn on pedantic warnings
  • enable-pedantic-error: Turn on pedantic warnings and errors
  • hide-unimplemented-libc-apis: Hides the header definitions for functions which are not actually implemented
  • enable-gnu-extensions will enable GNU libc extensions that are implemented in this library

Options can be specified using -D and the option name:

meson buildresults -Ddisable-builtins=false

The same style works with meson configure:

cd buildresults
meson configure -Ddisable-builtins=false

Back to top

Documentation

Documentation can be built locally by running the following command:

make docs

Documentation can be found in buildresults/docs, and the root page is index.html.

Back to top

Need help?

If you need further assistance or have any questions, please file a GitHub issue or send us an email using the Embedded Artistry Contact Form.

You can also reach out on Twitter: mbeddedartistry.

Contributing

If you are interested in contributing to this project, please read our contributing guidelines.

Authors

License

Copyright © 2021 Embedded Artistry LLC

See the LICENSE file for licensing details.

For other open-source licenses, please see the Software Inventory.

Acknowledgments

Make any public acknowledgments here

Back to top

About

Driver for the Bosch BME280 Temperature, Humidity, and Pressure Sensor

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
MIT-LICENSE.md

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published