Firmware SDK
|
Driver for MPL3115A2 pressure/altitude sensor. More...
Typedefs | |
typedef struct twr_mpl3115a2_t | twr_mpl3115a2_t |
MPL3115A2 instance. | |
Enumerations | |
enum | twr_mpl3115a2_event_t { TWR_MPL3115A2_EVENT_ERROR = 0 , TWR_MPL3115A2_EVENT_UPDATE = 1 } |
Callback events. More... | |
Functions | |
void | twr_mpl3115a2_init (twr_mpl3115a2_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address) |
Initialize MPL3115A2. More... | |
void | twr_mpl3115a2_deinit (twr_mpl3115a2_t *self) |
Deinitialize MPL3115A2. More... | |
void | twr_mpl3115a2_set_event_handler (twr_mpl3115a2_t *self, void(*event_handler)(twr_mpl3115a2_t *, twr_mpl3115a2_event_t, void *), void *event_param) |
Set callback function. More... | |
void | twr_mpl3115a2_set_update_interval (twr_mpl3115a2_t *self, twr_tick_t interval) |
Set measurement interval. More... | |
bool | twr_mpl3115a2_measure (twr_mpl3115a2_t *self) |
Start measurement manually. More... | |
bool | twr_mpl3115a2_get_altitude_meter (twr_mpl3115a2_t *self, float *meter) |
Get measured altitude in meters. More... | |
bool | twr_mpl3115a2_get_pressure_pascal (twr_mpl3115a2_t *self, float *pascal) |
Get measured pressured in Pascal. More... | |
Driver for MPL3115A2 pressure/altitude sensor.
Callback events.
Enumerator | |
---|---|
TWR_MPL3115A2_EVENT_ERROR | Error event. |
TWR_MPL3115A2_EVENT_UPDATE | Update event. |
Definition at line 13 of file twr_mpl3115a2.h.
void twr_mpl3115a2_deinit | ( | twr_mpl3115a2_t * | self | ) |
Deinitialize MPL3115A2.
[in] | self | Instance |
Definition at line 26 of file twr_mpl3115a2.c.
bool twr_mpl3115a2_get_altitude_meter | ( | twr_mpl3115a2_t * | self, |
float * | meter | ||
) |
Get measured altitude in meters.
[in] | self | Instance |
[in] | meter | Pointer to variable where result will be stored |
Definition at line 71 of file twr_mpl3115a2.c.
Referenced by twr_module_climate_get_altitude_meter(), and twr_tag_barometer_get_altitude_meter().
bool twr_mpl3115a2_get_pressure_pascal | ( | twr_mpl3115a2_t * | self, |
float * | pascal | ||
) |
Get measured pressured in Pascal.
[in] | self | Instance |
[in] | pascal | Pointer to variable where result will be stored |
Definition at line 85 of file twr_mpl3115a2.c.
Referenced by twr_module_climate_get_pressure_pascal(), and twr_tag_barometer_get_pressure_pascal().
void twr_mpl3115a2_init | ( | twr_mpl3115a2_t * | self, |
twr_i2c_channel_t | i2c_channel, | ||
uint8_t | i2c_address | ||
) |
Initialize MPL3115A2.
[in] | self | Instance |
[in] | i2c_channel | I2C channel |
[in] | i2c_address | I2C device address |
Definition at line 11 of file twr_mpl3115a2.c.
Referenced by twr_module_climate_init(), and twr_tag_barometer_init().
bool twr_mpl3115a2_measure | ( | twr_mpl3115a2_t * | self | ) |
Start measurement manually.
[in] | self | Instance |
Definition at line 57 of file twr_mpl3115a2.c.
Referenced by twr_module_climate_measure_all_sensors(), twr_module_climate_measure_barometer(), twr_mpl3115a2_set_update_interval(), and twr_tag_barometer_measure().
void twr_mpl3115a2_set_event_handler | ( | twr_mpl3115a2_t * | self, |
void(*)(twr_mpl3115a2_t *, twr_mpl3115a2_event_t, void *) | event_handler, | ||
void * | event_param | ||
) |
Set callback function.
[in] | self | Instance |
[in] | event_handler | Function address |
[in] | event_param | Optional event parameter (can be NULL) |
Definition at line 35 of file twr_mpl3115a2.c.
Referenced by twr_module_climate_init(), and twr_tag_barometer_set_event_handler().
void twr_mpl3115a2_set_update_interval | ( | twr_mpl3115a2_t * | self, |
twr_tick_t | interval | ||
) |
Set measurement interval.
[in] | self | Instance |
[in] | interval | Measurement interval |
Definition at line 41 of file twr_mpl3115a2.c.
Referenced by twr_module_climate_set_update_interval_all_sensors(), twr_module_climate_set_update_interval_barometer(), and twr_tag_barometer_set_update_interval().