esp-open-rtos/extras/bmp180
ourairquality 41d4427fba bmp180: separate the task and queue interface from the lower level support.
This just separates them in the one file leaving it as possible future change to actually remove the higher level api or move it to an example.
2016-07-20 18:52:13 +10:00
..
bmp180.c bmp180: separate the task and queue interface from the lower level support. 2016-07-20 18:52:13 +10:00
bmp180.h bmp180: make a lower level interface available and support oversampling. 2016-07-20 18:42:51 +10:00
component.mk Rework component makefiles to have a default <component>_ROOT 2015-09-08 09:59:59 +10:00
LICENSE Added BMP180 and I2C driver and example 2015-08-31 13:39:27 +02:00
README.md bmp180: Fix more 'temperatue' typos (thanks @atomman) 2015-09-21 08:46:45 +10:00

Driver for BMP085/BMP180 digital pressure sensor

This driver is written for usage with the ESP8266 and FreeRTOS (esp-open-rtos and esp-open-rtos-driver-i2c).

Usage

Before using the BMP180 module, the function bmp180_init(SCL_PIN, SDA_PIN) needs to be called to setup the I2C interface and do validation if the BMP180/BMP085 is accessible.

If the setup is sucessfully and a measurement is triggered, the result of the measurement is provided to the user as an event send via the qQueue provided with bmp180_trigger_*measurement(pQueue);

Example

#define SCL_PIN GPIO_ID_PIN(0)
#define SDA_PIN GPIO_ID_PIN(2)
...

if (!bmp180_init(SCL_PIN, SDA_PIN)) {
// An error occured, while dong the init (E.g device not found etc.)
}

// Trigger a measurement
bmp180_trigger_measurement(pQueue);

Change queue event

Per default the event send to the user via the provided queue is of the type bmp180_result_t. As this might not always be desired, a way is provided so that the user can provide a function, which creates and sends the event via the provided queue.

As all data aqquired from the BMP180/BMP085 is provided to the bmp180_informUser function, it is also possible to calculate new informations (E.g altitude etc.)

Example
// Own BMP180 User Inform Implementation
bool my_informUser(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure) {
	my_event_t ev;

	ev.event_type = MY_EVT_BMP180;
	ev.bmp180_data.cmd = cmd;
	ev.bmp180_data.temperature = temperature;
	ev.bmp180_data.pressure = pressure;

	return (xQueueSend(*resultQueue, &ev, 0) == pdTRUE);
}

...

// Use our user inform implementation
// needs to be set before first measurement is triggered
bmp180_informUser = my_informUser;