M5Unit-THERMO 0.2.0 git rev:e387a6b
Loading...
Searching...
No Matches
m5::unit::UnitNCIR2 Class Reference

Unit NCIR2. More...

#include <unit_NCIR2.hpp>

Inheritance diagram for m5::unit::UnitNCIR2:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitNCIR2 (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
virtual void update (const bool force=false) override
 
bool readFirmwareVersion (uint8_t &ver)
 Read the firmware version.
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Measurement data by periodic
float temperature () const
 Oldest temperature.
 
float celsius () const
 Oldest celsius.
 
float fahrenheit () const
 Oldest fahrenheit.
 
Periodic measurement
bool startPeriodicMeasurement (const uint32_t interval)
 Start periodic measurement.
 
bool startPeriodicMeasurement ()
 Start periodic measurement in the current settings.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
Single shot measurement
bool measureSingleshot (ncir2::Data &d)
 Measurement single shot.
 
Settings
bool readEmissivity (uint16_t &raw)
 Read the emissivity.
 
bool readEmissivity (float &e)
 Read the emissivity.
 
bool writeEmissivity (const uint16_t raw)
 Write the emissivity.
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool writeEmissivity (const T e)
 Write the emissivity.
 
Alarm
bool readAlarmTemperature (const bool highlow, int16_t &raw)
 Read the alarm temperature threshold.
 
bool readAlarmTemperature (const bool highlow, float &celsius)
 Read the alarm temperature threshold.
 
bool writeAlarmTemperature (const bool highlow, const int16_t raw)
 Write the alarm temperature threshold.
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool writeAlarmTemperature (const bool highlow, const T celsius)
 Write the alarm temperature threshold.
 
bool readAlarmLED (const bool highlow, uint32_t &rgb)
 Read the alarm LED color.
 
bool writeAlarmLED (const bool highlow, const uint32_t rgb)
 Write the alarm LED color.
 
bool writeAlarmLED (const bool highlow, const uint8_t r, const uint8_t g, const uint8_t b)
 Write the alarm LED color.
 
bool readAlarmBuzzer (const bool highlow, uint16_t &freq, uint16_t &interval, uint8_t &rawDuty)
 Read the alarm buzzer settings.
 
bool readAlarmBuzzer (const bool highlow, uint16_t &freq, uint16_t &interval, float &duty)
 Read the alarm buzzer settings.
 
bool writeAlarmBuzzer (const bool highlow, const uint16_t freq, const uint16_t interval, const uint8_t rawDuty)
 Write the alarm buzzer settings.
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool writeAlarmBuzzer (const bool highlow, const uint16_t freq, const uint16_t interval, const T duty)
 Write the alarm buzzer settings.
 
Buzzer
bool readBuzzer (uint16_t &freq, uint8_t &rawDuty)
 Read the buzzer settings.
 
bool readBuzzer (uint16_t &freq, float &duty)
 Write the buzzer settings.
 
bool writeBuzzer (const uint16_t freq, const uint8_t rawDuty)
 Write the buzzer settings.
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool writeBuzzer (const uint16_t freq, const T duty)
 Write the buzzer settings.
 
bool readBuzzerControl (bool &enabled)
 Read the Buzzer control.
 
bool writeBuzzerControl (const bool enabled)
 Write the Buzzer control.
 
LED
bool readLED (uint32_t &rgb)
 Read the LED color.
 
bool writeLED (const uint32_t rgb)
 Write the LED color.
 
bool writeLED (const uint8_t r, const uint8_t g, const uint8_t b)
 Write the LED color.
 
Chip temperature
bool readChipTemperature (ncir2::Data &d)
 Read the Chip temperature.
 
Flash
bool writeConfig ()
 Write configuration to inner flash.
 
Button
bool readButtonStatus (bool &press)
 Read the button status.
 
bool isPressed () const
 Is button pressed?
 
bool wasPressed () const
 Was button pressed?
 
bool wasReleased ()
 Was button released?
 
I2C Address
Warning
Handling warning
bool changeI2CAddress (const uint8_t i2c_address)
 Change device I2C address.
 
bool readI2CAddress (uint8_t &i2c_address)
 Read device I2C address.
 

Protected Member Functions

bool start_periodic_measurement (const uint32_t interval)
 
bool start_periodic_measurement ()
 
bool stop_periodic_measurement ()
 
bool read_temperature (const uint8_t reg, uint8_t v[2])
 
bool write_emissivity (const float e)
 
bool write_alarm_temperature (const bool highlow, const float celsius)
 
bool write_alarm_buzzer (const bool highlow, const uint16_t freq, const uint16_t interval, const float duty)
 
bool write_buzzer (const uint16_t freq, const float duty)
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitNCIR2, ncir2::Data)
 

Detailed Description

Unit NCIR2.

Member Function Documentation

◆ celsius()

float m5::unit::UnitNCIR2::celsius ( ) const
inline

Oldest celsius.

Note
Valid to the second decimal place

◆ changeI2CAddress()

bool m5::unit::UnitNCIR2::changeI2CAddress ( const uint8_t i2c_address)

Change device I2C address.

Parameters
i2c_addressI2C address
Returns
True if successful

◆ fahrenheit()

float m5::unit::UnitNCIR2::fahrenheit ( ) const
inline

Oldest fahrenheit.

Note
Valid to the second decimal place

◆ isPressed()

bool m5::unit::UnitNCIR2::isPressed ( ) const
inline

Is button pressed?

Returns
True if pressed
Note
The state is managed by update

◆ measureSingleshot()

bool m5::unit::UnitNCIR2::measureSingleshot ( ncir2::Data & d)

Measurement single shot.

Parameters
[out]dMeasuerd data
Returns
True if successful
Note
Valid to the second decimal place
Warning
During periodic detection runs, an error is returned

◆ readAlarmBuzzer() [1/2]

bool m5::unit::UnitNCIR2::readAlarmBuzzer ( const bool highlow,
uint16_t & freq,
uint16_t & interval,
float & duty )

Read the alarm buzzer settings.

Parameters
highlowTarget False:low True:high
[out]freqFrequency
[out]intervalInterval(ms) [1 - 5000]
[out]dutyDuty
Returns
True if successful

◆ readAlarmBuzzer() [2/2]

bool m5::unit::UnitNCIR2::readAlarmBuzzer ( const bool highlow,
uint16_t & freq,
uint16_t & interval,
uint8_t & rawDuty )

Read the alarm buzzer settings.

Parameters
highlowTarget False:low True:high
[out]freqFrequency
[out]intervalInterval(ms) [1 - 5000]
[out]rawDutyDuty (0:0.0f 255:1.0f)
Returns
True if successful

◆ readAlarmLED()

bool m5::unit::UnitNCIR2::readAlarmLED ( const bool highlow,
uint32_t & rgb )

Read the alarm LED color.

Parameters
highlowTarget False:low True:high
[out]rgbRGB24 color
Returns
True if successful

◆ readAlarmTemperature() [1/2]

bool m5::unit::UnitNCIR2::readAlarmTemperature ( const bool highlow,
float & celsius )

Read the alarm temperature threshold.

Parameters
highlowTarget False:low True:high
[out]celsiusTemperature
Returns
True if successful
Note
Valid to the second decimal place

◆ readAlarmTemperature() [2/2]

bool m5::unit::UnitNCIR2::readAlarmTemperature ( const bool highlow,
int16_t & raw )

Read the alarm temperature threshold.

Parameters
highlowTarget False:low True:high
[out]rawTemperature (raw)
Returns
True if successful

◆ readButtonStatus()

bool m5::unit::UnitNCIR2::readButtonStatus ( bool & press)

Read the button status.

Parameters
[out]pressPress if true
Returns
True if successful

◆ readBuzzer() [1/2]

bool m5::unit::UnitNCIR2::readBuzzer ( uint16_t & freq,
float & duty )

Write the buzzer settings.

Parameters
[out]freqFrequency
[out]dutyDuty
Returns
True if successful

◆ readBuzzer() [2/2]

bool m5::unit::UnitNCIR2::readBuzzer ( uint16_t & freq,
uint8_t & rawDuty )

Read the buzzer settings.

Parameters
[out]freqFrequency
[out]rawDutyDuty (0:0.0f 255:1.0f)
Returns
True if successful

◆ readBuzzerControl()

bool m5::unit::UnitNCIR2::readBuzzerControl ( bool & enabled)

Read the Buzzer control.

Parameters
[out]enabledTrue:enabled False;disabled
Returns
True if successful

◆ readChipTemperature()

bool m5::unit::UnitNCIR2::readChipTemperature ( ncir2::Data & d)

Read the Chip temperature.

Parameters
[out]dMeasuerd data
Returns
True if successful
Note
Valid to the second decimal place

◆ readEmissivity() [1/2]

bool m5::unit::UnitNCIR2::readEmissivity ( float & e)

Read the emissivity.

Parameters
[out]eEmissivity
Returns
True if successful

◆ readEmissivity() [2/2]

bool m5::unit::UnitNCIR2::readEmissivity ( uint16_t & raw)

Read the emissivity.

Parameters
[out]rawRaw emissivity
Returns
True if successful

◆ readFirmwareVersion()

bool m5::unit::UnitNCIR2::readFirmwareVersion ( uint8_t & ver)

Read the firmware version.

Parameters
[out]verVersion
Returns
True if released

◆ readI2CAddress()

bool m5::unit::UnitNCIR2::readI2CAddress ( uint8_t & i2c_address)

Read device I2C address.

Parameters
[out]i2c_addressI2C address
Returns
True if successful

◆ readLED()

bool m5::unit::UnitNCIR2::readLED ( uint32_t & rgb)

Read the LED color.

Parameters
[out]rgbRGB24 color
Returns
True if successful

◆ startPeriodicMeasurement()

bool m5::unit::UnitNCIR2::startPeriodicMeasurement ( const uint32_t interval)
inline

Start periodic measurement.

Parameters
intervalMeasurement interval time (ms)
Returns
True if successful

◆ stopPeriodicMeasurement()

bool m5::unit::UnitNCIR2::stopPeriodicMeasurement ( )
inline

Stop periodic measurement.

Returns
True if successful

◆ temperature()

float m5::unit::UnitNCIR2::temperature ( ) const
inline

Oldest temperature.

Note
Valid to the second decimal place

◆ wasPressed()

bool m5::unit::UnitNCIR2::wasPressed ( ) const
inline

Was button pressed?

Returns
True if pressed
Note
The state is managed by update

◆ wasReleased()

bool m5::unit::UnitNCIR2::wasReleased ( )
inline

Was button released?

Returns
True if released
Note
The state is managed by update

◆ writeAlarmBuzzer() [1/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitNCIR2::writeAlarmBuzzer ( const bool highlow,
const uint16_t freq,
const uint16_t interval,
const T duty )
inline

Write the alarm buzzer settings.

Parameters
highlowTarget False:low True:high
freqFrequency
intervalInterval(ms) [1 - 5000]
dutyDuty
Returns
True if successful

◆ writeAlarmBuzzer() [2/2]

bool m5::unit::UnitNCIR2::writeAlarmBuzzer ( const bool highlow,
const uint16_t freq,
const uint16_t interval,
const uint8_t rawDuty )

Write the alarm buzzer settings.

Parameters
highlowTarget False:low True:high
freqFrequency
intervalInterval(ms) [1 - 5000]
rawDutyDuty (0:0.0f 255:1.0f)
Returns
True if successful

◆ writeAlarmLED() [1/2]

bool m5::unit::UnitNCIR2::writeAlarmLED ( const bool highlow,
const uint32_t rgb )
inline

Write the alarm LED color.

Parameters
highlowTarget False:low True:high
rgbRGB24 color
Returns
True if successful

◆ writeAlarmLED() [2/2]

bool m5::unit::UnitNCIR2::writeAlarmLED ( const bool highlow,
const uint8_t r,
const uint8_t g,
const uint8_t b )

Write the alarm LED color.

Parameters
highlowTarget False:low True:high
rRed
gGreen
bBlue
Returns
True if successful

◆ writeAlarmTemperature() [1/2]

bool m5::unit::UnitNCIR2::writeAlarmTemperature ( const bool highlow,
const int16_t raw )

Write the alarm temperature threshold.

Parameters
highlowTarget False:low True:high
rawTemperature (raw)
Returns
True if successful

◆ writeAlarmTemperature() [2/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitNCIR2::writeAlarmTemperature ( const bool highlow,
const T celsius )
inline

Write the alarm temperature threshold.

Parameters
highlowTarget False:low True:high
celsiusTemperature
Returns
True if successful
Note
Valid to the second decimal place

◆ writeBuzzer() [1/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitNCIR2::writeBuzzer ( const uint16_t freq,
const T duty )
inline

Write the buzzer settings.

Parameters
freqFrequency
dutyDuty
Returns
True if successful

◆ writeBuzzer() [2/2]

bool m5::unit::UnitNCIR2::writeBuzzer ( const uint16_t freq,
const uint8_t rawDuty )

Write the buzzer settings.

Parameters
freqFrequency
rawDutyDuty (0:0.0f 255:1.0f)
Returns
True if successful

◆ writeBuzzerControl()

bool m5::unit::UnitNCIR2::writeBuzzerControl ( const bool enabled)

Write the Buzzer control.

Parameters
enabledTrue:enabled False;disabled
Returns
True if successful

◆ writeConfig()

bool m5::unit::UnitNCIR2::writeConfig ( )

Write configuration to inner flash.

Write Emissivity,Alarm,LED settings to flash

Returns
True if successful

◆ writeEmissivity() [1/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitNCIR2::writeEmissivity ( const T e)
inline

Write the emissivity.

Parameters
eEmissivity
Returns
True if successful

◆ writeEmissivity() [2/2]

bool m5::unit::UnitNCIR2::writeEmissivity ( const uint16_t raw)

Write the emissivity.

Parameters
rawRaw emissivity
Returns
True if successful

◆ writeLED() [1/2]

bool m5::unit::UnitNCIR2::writeLED ( const uint32_t rgb)
inline

Write the LED color.

Parameters
rgbRGB24 color
Returns
True if successful

◆ writeLED() [2/2]

bool m5::unit::UnitNCIR2::writeLED ( const uint8_t r,
const uint8_t g,
const uint8_t b )

Write the LED color.

Parameters
rRed
gGreen
bBlue
Returns
True if successful