esp-open-rtos/extras/bmp180
Angus Gratton 1221e2117b Rework component makefiles to have a default <component>_ROOT
This fixes a long-standing bug where build directories sometimes
expanded many levels deeper than they should have.

Component names can now no longer contains slashes (ie the component
name for 'extras/i2c' is now just 'i2c')
2015-09-08 09:59:59 +10:00
..
bmp180.c Added BMP180 and I2C driver and example 2015-08-31 13:39:27 +02:00
bmp180.h Added BMP180 and I2C driver and example 2015-08-31 13:39:27 +02: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 Added BMP180 and I2C driver and example 2015-08-31 13:39:27 +02: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 temperatue, bmp180_press_t pressure) {
	my_event_t ev;

	ev.event_type = MY_EVT_BMP180;
	ev.bmp180_data.cmd = cmd;
	ev.bmp180_data.temperatue = temperatue;
	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;