Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: bme280_wrapper.h
- Revision:
- 1:667b9825e7ee
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bme280_wrapper.h Thu Aug 15 23:47:18 2019 +0300 @@ -0,0 +1,42 @@ +/* BME280 BLE sensor -- bme280_wrapper.h +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Copyright 2019 Fedor Chervyakov +*/ + +#ifndef _BME280_WRAPPER_H_ +#define _BME280_WRAPPER_H_ + +#include "bme280.h" + + +void user_delay_ms(uint32_t period); +int8_t user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len); +int8_t user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len); + + +class BME280 { +public: + BME280(PinName sda, PinName scl); + struct bme280_data comp_data; + int force_measurement(); + +private: + PinName _sda, _scl; + struct bme280_dev _dev; + + int init(); +}; + +#endif