How to use¶
Platform support¶
Framework:
Arduino
This library is made to be used with:
All
Necessary inclusions¶
Only the header has to be included to you project
#include "libMM_lps22hb.hpp"
Object creation¶
The library supports only SPI reading. The following example shows how to create the object:
Important
API ref: LPS22HB_SPI
LPS22HB_SPI lps(generalConf.lpsSpiClock,
pinConf.pinLpsSS,
false,
&SPI,
ABSTRACT_SENSOR_SPI::SPI_CONF());
Object configuration¶
The following example shows how to configure the sensor to use it:
Important
API ref: LPS22HB_SPI::setOdr()
, LPS22HB_SPI::setLowPassFilterState()
1 lps.begin();
2 lps.setOdr(LPS22HB_ENUM::ODR::_75HZ);
3 delay(100);
4 // lps.setLowPassFilterState(LPS22HB_ENUM::FILTER_BW::ODR_DIV_20);
5 lps.configureReferenceParameters(
6 ABSTRACT_BARO_ENUM::BARO_VALUES::INVALID_PRESSURE,
7 ABSTRACT_BARO_ENUM::BARO_VALUES::DEFAULT_SEA_LEVEL_TEMPERATURE,
8 ABSTRACT_BARO_ENUM::BARO_VALUES::INVALID_ALTITUDE);
Get data¶
The following example shows how to get the data from the sensor:
1 ABSTRACT_BARO::BARO_OUTPUT resBARO;
2
3 lps.readTemperaturePressureAltitude();
4 resBARO = lps.getOutput();