Firmware SDK
twr_lp8

Driver for LP8 CO2 sensor. More...

Data Structures

struct  twr_lp8_driver_t
 LP8 driver. More...
 

Typedefs

typedef struct twr_lp8_t twr_lp8_t
 LP8 instance.
 

Enumerations

enum  twr_lp8_event_t {
  TWR_LP8_EVENT_ERROR = 0 ,
  TWR_LP8_EVENT_UPDATE = 1
}
 Callback events. More...
 
enum  twr_lp8_calibration_t {
  TWR_LP8_CALIBRATION_BACKGROUND_UNFILTERED = 0x50 ,
  TWR_LP8_CALIBRATION_BACKGROUND_FILTERED = 0x51 ,
  TWR_LP8_CALIBRATION_BACKGROUND_UNFILTERED_RF = 0x52 ,
  TWR_LP8_CALIBRATION_BACKGROUND_FILTERED_RF = 0x53 ,
  TWR_LP8_CALIBRATION_ABC = 0x70 ,
  TWR_LP8_CALIBRATION_ATWR_RF = 0x72
}
 Calibration. More...
 

Functions

void twr_lp8_init (twr_lp8_t *self, const twr_lp8_driver_t *driver)
 Initialize LP8.
 
void twr_lp8_set_event_handler (twr_lp8_t *self, void(*event_handler)(twr_lp8_event_t, void *), void *event_param)
 Set callback function. More...
 
void twr_lp8_set_update_interval (twr_lp8_t *self, twr_tick_t interval)
 Set measurement interval. More...
 
bool twr_lp8_measure (twr_lp8_t *self)
 Start measurement manually. More...
 
bool twr_lp8_get_concentration_ppm (twr_lp8_t *self, float *ppm)
 Get CO2 concentration in ppm (parts per million) More...
 
bool twr_lp8_get_error (twr_lp8_t *self, twr_lp8_error_t *error)
 Get last error code. More...
 
void twr_lp8_calibration (twr_lp8_t *self, twr_lp8_calibration_t calibration)
 Request sensor calibration. More...
 

Detailed Description

Driver for LP8 CO2 sensor.

Enumeration Type Documentation

◆ twr_lp8_calibration_t

Calibration.

Enumerator
TWR_LP8_CALIBRATION_BACKGROUND_UNFILTERED 

Background calibration using unfiltered data.

TWR_LP8_CALIBRATION_BACKGROUND_FILTERED 

Background calibration using filtered data.

TWR_LP8_CALIBRATION_BACKGROUND_UNFILTERED_RF 

Background calibration using unfiltered data + reset filters.

TWR_LP8_CALIBRATION_BACKGROUND_FILTERED_RF 

Background calibration using filtered data + reset filters.

TWR_LP8_CALIBRATION_ABC 

ABC (based on filtered data)

TWR_LP8_CALIBRATION_ATWR_RF 

ABC (based on filtered data) + reset filters.

Definition at line 25 of file twr_lp8.h.

◆ twr_lp8_event_t

Callback events.

Enumerator
TWR_LP8_EVENT_ERROR 

Error event.

TWR_LP8_EVENT_UPDATE 

Update event.

Definition at line 13 of file twr_lp8.h.

Function Documentation

◆ twr_lp8_calibration()

void twr_lp8_calibration ( twr_lp8_t self,
twr_lp8_calibration_t  calibration 
)

Request sensor calibration.

Parameters
[in]selfInstance
[in]calibrationCalibration type

Definition at line 97 of file twr_lp8.c.

Referenced by twr_module_co2_calibration().

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

◆ twr_lp8_get_concentration_ppm()

bool twr_lp8_get_concentration_ppm ( twr_lp8_t self,
float *  ppm 
)

Get CO2 concentration in ppm (parts per million)

Parameters
[in]selfInstance
[out]ppmPointer to variable where result will be stored
Returns
true On success
false On failure

Definition at line 76 of file twr_lp8.c.

Referenced by twr_module_co2_get_concentration_ppm().

Here is the caller graph for this function:

◆ twr_lp8_get_error()

bool twr_lp8_get_error ( twr_lp8_t self,
twr_lp8_error_t *  error 
)

Get last error code.

Parameters
[in]selfInstance
[out]pointerto the variable where error code will be stored
Returns
true On success
false On failure

Definition at line 90 of file twr_lp8.c.

Referenced by twr_module_co2_get_error().

Here is the caller graph for this function:

◆ twr_lp8_measure()

bool twr_lp8_measure ( twr_lp8_t self)

Start measurement manually.

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

Definition at line 58 of file twr_lp8.c.

Referenced by twr_lp8_calibration(), twr_lp8_set_update_interval(), and twr_module_co2_measure().

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

◆ twr_lp8_set_event_handler()

void twr_lp8_set_event_handler ( twr_lp8_t self,
void(*)(twr_lp8_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 36 of file twr_lp8.c.

Referenced by twr_module_co2_set_event_handler().

Here is the caller graph for this function:

◆ twr_lp8_set_update_interval()

void twr_lp8_set_update_interval ( twr_lp8_t self,
twr_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 42 of file twr_lp8.c.

Referenced by twr_module_co2_set_update_interval().

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