Firmware SDK
twr_mpl3115a2

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...
 

Detailed Description

Driver for MPL3115A2 pressure/altitude sensor.

Enumeration Type Documentation

◆ twr_mpl3115a2_event_t

Callback events.

Enumerator
TWR_MPL3115A2_EVENT_ERROR 

Error event.

TWR_MPL3115A2_EVENT_UPDATE 

Update event.

Definition at line 13 of file twr_mpl3115a2.h.

Function Documentation

◆ twr_mpl3115a2_deinit()

void twr_mpl3115a2_deinit ( twr_mpl3115a2_t self)

Deinitialize MPL3115A2.

Parameters
[in]selfInstance

Definition at line 26 of file twr_mpl3115a2.c.

Here is the call graph for this function:

◆ twr_mpl3115a2_get_altitude_meter()

bool twr_mpl3115a2_get_altitude_meter ( twr_mpl3115a2_t self,
float *  meter 
)

Get measured altitude in meters.

Parameters
[in]selfInstance
[in]meterPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 71 of file twr_mpl3115a2.c.

Referenced by twr_module_climate_get_altitude_meter(), and twr_tag_barometer_get_altitude_meter().

Here is the caller graph for this function:

◆ twr_mpl3115a2_get_pressure_pascal()

bool twr_mpl3115a2_get_pressure_pascal ( twr_mpl3115a2_t self,
float *  pascal 
)

Get measured pressured in Pascal.

Parameters
[in]selfInstance
[in]pascalPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 85 of file twr_mpl3115a2.c.

Referenced by twr_module_climate_get_pressure_pascal(), and twr_tag_barometer_get_pressure_pascal().

Here is the caller graph for this function:

◆ twr_mpl3115a2_init()

void twr_mpl3115a2_init ( twr_mpl3115a2_t self,
twr_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize MPL3115A2.

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address

Definition at line 11 of file twr_mpl3115a2.c.

Referenced by twr_module_climate_init(), and twr_tag_barometer_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_mpl3115a2_measure()

bool twr_mpl3115a2_measure ( twr_mpl3115a2_t self)

Start measurement manually.

Parameters
[in]selfInstance
Returns
true On success
false When other measurement is in progress

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_mpl3115a2_set_event_handler()

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.

Parameters
[in]selfInstance
[in]event_handlerFunction address
[in]event_paramOptional 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().

Here is the caller graph for this function:

◆ twr_mpl3115a2_set_update_interval()

void twr_mpl3115a2_set_update_interval ( twr_mpl3115a2_t self,
twr_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement 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().

Here is the call graph for this function:
Here is the caller graph for this function: