Skip to content

Commit

Permalink
Added bme280 instructions and made it safe to use from c++
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebiroll committed Apr 29, 2018
1 parent 86c4603 commit 6baf428
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ The option -nostartfiles instructs the linker to not use the standard system sta
If you patch the function to call , bl __libc_init_array then you might get an undefined reference to _init.
https://answers.launchpad.net/gcc-arm-embedded/+question/224709

# BME280 i2c drivers

To use these you must
#include "OBME280.h"

// After MCUInit()
i2c_bme280_begin();

float temp=i2c_bme280_read_temp();
float pressure=i2c_bme280_read_pressure();
float rh=i2c_bme280_read_rh();
printf("RH %2f Temp %2f , pressure %2f\r\n",rh,temp,pressure);

To force new readings you should use,
i2c_bme280_force_readings();

Note that this uses the same i2c as the MEMS sensor. The 3
bottom pins is GND, SCL, SDA


# Blackmagic Single Wire Debug

Allows flashing over wifi and single step the code with gdb
Expand Down
9 changes: 9 additions & 0 deletions lib/obme280/OBME280.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#ifndef __BME280_H__
#define __BME280_H__

#ifdef __cplusplus
extern "C"
{
#endif


#include "stdint.h"


Expand Down Expand Up @@ -204,5 +210,8 @@ FOR POWER MODE */



#ifdef __cplusplus
}
#endif

#endif

0 comments on commit 6baf428

Please sign in to comment.