M5Unit-THERMO 0.4.0 git rev:7cce598
Loading...
Searching...
No Matches
unit_Thermal2_data.hpp File Reference

Thermal2 data types (constants, Refresh, conversions, Data struct) More...

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <limits>

Go to the source code of this file.

Classes

struct  m5::unit::thermal2::Data
 Measurement data group. More...
 

Namespaces

namespace  m5
 Top level namespace of M5stack.
 
namespace  thermal2
 For UnitThermal2.
 

Enumerations

enum class  m5::unit::thermal2::Refresh : uint8_t {
  Rate0_5Hz , Rate1Hz , Rate2Hz , Rate4Hz ,
  Rate8Hz , Rate16Hz , Rate32Hz , Rate64Hz
}
 Refresh rate(Hz) More...
 

Functions

uint16_t m5::unit::thermal2::celsius_to_raw (const float f)
 Celsius to raw temperature value.
 
float m5::unit::thermal2::raw_to_celsius (const uint16_t u16)
 Raw temperature value to celsius.
 

Variables

Button status
constexpr uint8_t m5::unit::thermal2::button_is_pressed {0x01}
 Is pressed now.
 
constexpr uint8_t m5::unit::thermal2::button_was_pressed {0x02}
 Was pressed.
 
constexpr uint8_t m5::unit::thermal2::button_was_released {0x04}
 Was released.
 
constexpr uint8_t m5::unit::thermal2::button_was_clicked {0x08}
 Was clicked.
 
constexpr uint8_t m5::unit::thermal2::button_was_hold {0x10}
 Was held.
 
Function control
constexpr uint8_t m5::unit::thermal2::enabled_function_buzzer {0x01}
 Buzzer enabled.
 
constexpr uint8_t m5::unit::thermal2::enabled_function_led {0x02}
 LED enabled.
 
constexpr uint8_t m5::unit::thermal2::enabled_function_auto_refresh {0x04}
 Auto refresh (periodic measurement) enabled.
 
Alarm enabled bits
constexpr uint8_t m5::unit::thermal2::enabled_low_temperature_low {0x01}
 Low temp reached low threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_med_temperature_low {0x02}
 Med temp reached low threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_ave_temperature_low {0x04}
 Ave temp reached low threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_high_temperature_low {0x08}
 High temp reached low threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_low_temperature_high {0x10}
 Low temp reached high threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_med_temperature_high {0x20}
 Med temp reached high threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_ave_temperature_high {0x40}
 Ave temp reached high threshold.
 
constexpr uint8_t m5::unit::thermal2::enabled_high_temperature_high {0x80}
 High temp reached high threshold.
 

Detailed Description

Thermal2 data types (constants, Refresh, conversions, Data struct)

Kept apart from unit_Thermal2.hpp so the native (host) tests can include it without pulling in M5UnitComponent.

Enumeration Type Documentation

◆ Refresh

enum class m5::unit::thermal2::Refresh : uint8_t
strong

Refresh rate(Hz)

Enumerator
Rate0_5Hz 

0.5Hz

Rate1Hz 

1Hz

Rate2Hz 

2Hz

Rate4Hz 

4Hz

Rate8Hz 

8Hz

Rate16Hz 

16Hz

Rate32Hz 

32Hz

Rate64Hz 

64Hz

Function Documentation

◆ celsius_to_raw()

uint16_t m5::unit::thermal2::celsius_to_raw ( const float f)
inline

Celsius to raw temperature value.

Parameters
fCelsius
Returns
Raw value ((f + 64) * 128, clamped to 0 - 65535; NaN gives 65535)

◆ raw_to_celsius()

float m5::unit::thermal2::raw_to_celsius ( const uint16_t u16)
inline

Raw temperature value to celsius.

Parameters
u16Raw value
Returns
Celsius