ESPHome  2025.3.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::msa3xx::MSA3xxComponent Class Reference

#include <msa3xx.h>

Inheritance diagram for esphome::msa3xx::MSA3xxComponent:
esphome::PollingComponent esphome::i2c::I2CDevice esphome::Component

Public Member Functions

void setup () override
 
void dump_config () override
 
void loop () override
 
void update () override
 
float get_setup_priority () const override
 
void set_model (Model model)
 
void set_offset (float offset_x, float offset_y, float offset_z)
 
void set_range (Range range)
 
void set_bandwidth (Bandwidth bandwidth)
 
void set_resolution (Resolution resolution)
 
void set_transform (bool mirror_x, bool mirror_y, bool mirror_z, bool swap_xy)
 
 SUB_BINARY_SENSOR (tap) SUB_BINARY_SENSOR(double_tap) SUB_BINARY_SENSOR(active) SUB_SENSOR(acceleration_x) SUB_SENSOR(acceleration_y) SUB_SENSOR(acceleration_z) SUB_TEXT_SENSOR(orientation_xy) SUB_TEXT_SENSOR(orientation_z) Trigger<> *get_tap_trigger()
 
Triggerget_double_tap_trigger ()
 
Triggerget_orientation_trigger ()
 
Triggerget_freefall_trigger ()
 
Triggerget_active_trigger ()
 
- Public Member Functions inherited from esphome::PollingComponent
 PollingComponent ()
 
 PollingComponent (uint32_t update_interval)
 Initialize this polling component with the given update interval in ms. More...
 
virtual void set_update_interval (uint32_t update_interval)
 Manually set the update interval in ms for this polling object. More...
 
void call_setup () override
 
virtual uint32_t get_update_interval () const
 Get the update interval in ms of this sensor. More...
 
void start_poller ()
 
void stop_poller ()
 
- Public Member Functions inherited from esphome::Component
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop(). More...
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
uint32_t get_component_state () const
 
virtual void mark_failed ()
 Mark this component as failed. More...
 
bool is_failed () const
 
bool is_ready () const
 
virtual bool can_proceed ()
 
bool status_has_warning () const
 
bool status_has_error () const
 
void status_set_warning (const char *message="unspecified")
 
void status_set_error (const char *message="unspecified")
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const std::string &name, uint32_t length=5000)
 
void status_momentary_error (const std::string &name, uint32_t length=5000)
 
bool has_overridden_loop () const
 
void set_component_source (const char *source)
 Set where this component was loaded from for some debug messages. More...
 
const char * get_component_source () const
 Get the integration where this component was declared as a string. More...
 
- Public Member Functions inherited from esphome::i2c::I2CDevice
 I2CDevice ()=default
 we use the C++ default constructor More...
 
void set_i2c_address (uint8_t address)
 We store the address of the device on the bus. More...
 
void set_i2c_bus (I2CBus *bus)
 we store the pointer to the I2CBus to use More...
 
I2CRegister reg (uint8_t a_register)
 calls the I2CRegister constructor More...
 
I2CRegister16 reg16 (uint16_t a_register)
 calls the I2CRegister16 constructor More...
 
ErrorCode read (uint8_t *data, size_t len)
 reads an array of bytes from the device using an I2CBus More...
 
ErrorCode read_register (uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
 reads an array of bytes from a specific register in the I²C device More...
 
ErrorCode read_register16 (uint16_t a_register, uint8_t *data, size_t len, bool stop=true)
 reads an array of bytes from a specific register in the I²C device More...
 
ErrorCode write (const uint8_t *data, size_t len, bool stop=true)
 writes an array of bytes to a device using an I2CBus More...
 
ErrorCode write_register (uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
 writes an array of bytes to a specific register in the I²C device More...
 
ErrorCode write_register16 (uint16_t a_register, const uint8_t *data, size_t len, bool stop=true)
 write an array of bytes to a specific register in the I²C device More...
 
bool read_bytes (uint8_t a_register, uint8_t *data, uint8_t len)
 Compat APIs All methods below have been added for compatibility reasons. More...
 
bool read_bytes_raw (uint8_t *data, uint8_t len)
 
template<size_t N>
optional< std::array< uint8_t, N > > read_bytes (uint8_t a_register)
 
template<size_t N>
optional< std::array< uint8_t, N > > read_bytes_raw ()
 
bool read_bytes_16 (uint8_t a_register, uint16_t *data, uint8_t len)
 
bool read_byte (uint8_t a_register, uint8_t *data, bool stop=true)
 
optional< uint8_t > read_byte (uint8_t a_register)
 
bool read_byte_16 (uint8_t a_register, uint16_t *data)
 
bool write_bytes (uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)
 
bool write_bytes (uint8_t a_register, const std::vector< uint8_t > &data)
 
template<size_t N>
bool write_bytes (uint8_t a_register, const std::array< uint8_t, N > &data)
 
bool write_bytes_16 (uint8_t a_register, const uint16_t *data, uint8_t len)
 
bool write_byte (uint8_t a_register, uint8_t data, bool stop=true)
 
bool write_byte_16 (uint8_t a_register, uint16_t data)
 

Protected Member Functions

void setup_odr_ (DataRate rate)
 
void setup_power_mode_bandwidth_ (PowerMode power_mode, Bandwidth bandwidth)
 
void setup_range_resolution_ (Range range, Resolution resolution)
 
void setup_offset_ (float offset_x, float offset_y, float offset_z)
 
bool read_data_ ()
 
bool read_motion_status_ ()
 
int64_t twos_complement_ (uint64_t value, uint8_t bits)
 
void process_motions_ (RegMotionInterrupt old)
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_dump_config ()
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
 
void set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 Set an retry function with a unique name. More...
 
void set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 
bool cancel_retry (const std::string &name)
 Cancel a retry function. More...
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...
 

Protected Attributes

Model model_ {Model::MSA311}
 
PowerMode power_mode_ {PowerMode::NORMAL}
 
DataRate data_rate_ {DataRate::ODR_250HZ}
 
Bandwidth bandwidth_ {Bandwidth::BW_250HZ}
 
Range range_ {Range::RANGE_2G}
 
Resolution resolution_ {Resolution::RES_14BIT}
 
float offset_x_
 
float offset_y_
 
float offset_z_
 
RegSwapPolarity swap_
 
struct {
   int   scale_factor_exp
 
   uint8_t   accel_data_width
 
device_params_
 
struct {
   int16_t   lsb_x
 
   int16_t   lsb_y
 
   int16_t   lsb_z
 
   float   x
 
   float   y
 
   float   z
 
data_
 
struct {
   RegMotionInterrupt   motion_int
 
   RegOrientationStatus   orientation
 
   RegOrientationStatus   orientation_old
 
   uint32_t   last_tap_ms {0}
 
   uint32_t   last_double_tap_ms {0}
 
   uint32_t   last_action_ms {0}
 
   bool   never_published {true}
 
status_
 
Trigger tap_trigger_
 
Trigger double_tap_trigger_
 
Trigger orientation_trigger_
 
Trigger freefall_trigger_
 
Trigger active_trigger_
 
- Protected Attributes inherited from esphome::PollingComponent
uint32_t update_interval_
 
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
 
float setup_priority_override_ {NAN}
 
const char * component_source_ {nullptr}
 
- Protected Attributes inherited from esphome::i2c::I2CDevice
uint8_t address_ {0x00}
 store the address of the device on the bus More...
 
I2CBusbus_ {nullptr}
 pointer to I2CBus instance More...
 

Detailed Description

Definition at line 215 of file msa3xx.h.

Member Function Documentation

◆ dump_config()

void esphome::msa3xx::MSA3xxComponent::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 158 of file msa3xx.cpp.

◆ get_active_trigger()

Trigger* esphome::msa3xx::MSA3xxComponent::get_active_trigger ( )
inline

Definition at line 253 of file msa3xx.h.

◆ get_double_tap_trigger()

Trigger* esphome::msa3xx::MSA3xxComponent::get_double_tap_trigger ( )
inline

Definition at line 250 of file msa3xx.h.

◆ get_freefall_trigger()

Trigger* esphome::msa3xx::MSA3xxComponent::get_freefall_trigger ( )
inline

Definition at line 252 of file msa3xx.h.

◆ get_orientation_trigger()

Trigger* esphome::msa3xx::MSA3xxComponent::get_orientation_trigger ( )
inline

Definition at line 251 of file msa3xx.h.

◆ get_setup_priority()

float esphome::msa3xx::MSA3xxComponent::get_setup_priority ( ) const
overridevirtual

Reimplemented from esphome::Component.

Definition at line 288 of file msa3xx.cpp.

◆ loop()

void esphome::msa3xx::MSA3xxComponent::loop ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 235 of file msa3xx.cpp.

◆ process_motions_()

void esphome::msa3xx::MSA3xxComponent::process_motions_ ( RegMotionInterrupt  old)
protected

Definition at line 397 of file msa3xx.cpp.

◆ read_data_()

bool esphome::msa3xx::MSA3xxComponent::read_data_ ( )
protected

Definition at line 192 of file msa3xx.cpp.

◆ read_motion_status_()

bool esphome::msa3xx::MSA3xxComponent::read_motion_status_ ( )
protected

Definition at line 223 of file msa3xx.cpp.

◆ set_bandwidth()

void esphome::msa3xx::MSA3xxComponent::set_bandwidth ( Bandwidth  bandwidth)
inline

Definition at line 228 of file msa3xx.h.

◆ set_model()

void esphome::msa3xx::MSA3xxComponent::set_model ( Model  model)
inline

Definition at line 225 of file msa3xx.h.

◆ set_offset()

void esphome::msa3xx::MSA3xxComponent::set_offset ( float  offset_x,
float  offset_y,
float  offset_z 
)

Definition at line 290 of file msa3xx.cpp.

◆ set_range()

void esphome::msa3xx::MSA3xxComponent::set_range ( Range  range)
inline

Definition at line 227 of file msa3xx.h.

◆ set_resolution()

void esphome::msa3xx::MSA3xxComponent::set_resolution ( Resolution  resolution)
inline

Definition at line 229 of file msa3xx.h.

◆ set_transform()

void esphome::msa3xx::MSA3xxComponent::set_transform ( bool  mirror_x,
bool  mirror_y,
bool  mirror_z,
bool  swap_xy 
)

Definition at line 296 of file msa3xx.cpp.

◆ setup()

void esphome::msa3xx::MSA3xxComponent::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 120 of file msa3xx.cpp.

◆ setup_odr_()

void esphome::msa3xx::MSA3xxComponent::setup_odr_ ( DataRate  rate)
protected

Definition at line 303 of file msa3xx.cpp.

◆ setup_offset_()

void esphome::msa3xx::MSA3xxComponent::setup_offset_ ( float  offset_x,
float  offset_y,
float  offset_z 
)
protected

Definition at line 347 of file msa3xx.cpp.

◆ setup_power_mode_bandwidth_()

void esphome::msa3xx::MSA3xxComponent::setup_power_mode_bandwidth_ ( PowerMode  power_mode,
Bandwidth  bandwidth 
)
protected

Definition at line 320 of file msa3xx.cpp.

◆ setup_range_resolution_()

void esphome::msa3xx::MSA3xxComponent::setup_range_resolution_ ( Range  range,
Resolution  resolution 
)
protected

Definition at line 337 of file msa3xx.cpp.

◆ SUB_BINARY_SENSOR()

esphome::msa3xx::MSA3xxComponent::SUB_BINARY_SENSOR ( tap  )
inline

Definition at line 233 of file msa3xx.h.

◆ twos_complement_()

int64_t esphome::msa3xx::MSA3xxComponent::twos_complement_ ( uint64_t  value,
uint8_t  bits 
)
protected

Definition at line 365 of file msa3xx.cpp.

◆ update()

void esphome::msa3xx::MSA3xxComponent::update ( )
overridevirtual

Implements esphome::PollingComponent.

Definition at line 250 of file msa3xx.cpp.

Field Documentation

◆ accel_data_width

uint8_t esphome::msa3xx::MSA3xxComponent::accel_data_width

Definition at line 268 of file msa3xx.h.

◆ active_trigger_

Trigger esphome::msa3xx::MSA3xxComponent::active_trigger_
protected

Definition at line 305 of file msa3xx.h.

◆ bandwidth_

Bandwidth esphome::msa3xx::MSA3xxComponent::bandwidth_ {Bandwidth::BW_250HZ}
protected

Definition at line 260 of file msa3xx.h.

◆ data_

struct { ... } esphome::msa3xx::MSA3xxComponent::data_

◆ data_rate_

DataRate esphome::msa3xx::MSA3xxComponent::data_rate_ {DataRate::ODR_250HZ}
protected

Definition at line 259 of file msa3xx.h.

◆ device_params_

struct { ... } esphome::msa3xx::MSA3xxComponent::device_params_

◆ double_tap_trigger_

Trigger esphome::msa3xx::MSA3xxComponent::double_tap_trigger_
protected

Definition at line 302 of file msa3xx.h.

◆ freefall_trigger_

Trigger esphome::msa3xx::MSA3xxComponent::freefall_trigger_
protected

Definition at line 304 of file msa3xx.h.

◆ last_action_ms

uint32_t esphome::msa3xx::MSA3xxComponent::last_action_ms {0}

Definition at line 283 of file msa3xx.h.

◆ last_double_tap_ms

uint32_t esphome::msa3xx::MSA3xxComponent::last_double_tap_ms {0}

Definition at line 282 of file msa3xx.h.

◆ last_tap_ms

uint32_t esphome::msa3xx::MSA3xxComponent::last_tap_ms {0}

Definition at line 281 of file msa3xx.h.

◆ lsb_x

int16_t esphome::msa3xx::MSA3xxComponent::lsb_x

Definition at line 272 of file msa3xx.h.

◆ lsb_y

int16_t esphome::msa3xx::MSA3xxComponent::lsb_y

Definition at line 272 of file msa3xx.h.

◆ lsb_z

int16_t esphome::msa3xx::MSA3xxComponent::lsb_z

Definition at line 272 of file msa3xx.h.

◆ model_

Model esphome::msa3xx::MSA3xxComponent::model_ {Model::MSA311}
protected

Definition at line 256 of file msa3xx.h.

◆ motion_int

RegMotionInterrupt esphome::msa3xx::MSA3xxComponent::motion_int

Definition at line 277 of file msa3xx.h.

◆ never_published

bool esphome::msa3xx::MSA3xxComponent::never_published {true}

Definition at line 285 of file msa3xx.h.

◆ offset_x_

float esphome::msa3xx::MSA3xxComponent::offset_x_
protected

Definition at line 263 of file msa3xx.h.

◆ offset_y_

float esphome::msa3xx::MSA3xxComponent::offset_y_
protected

Definition at line 263 of file msa3xx.h.

◆ offset_z_

float esphome::msa3xx::MSA3xxComponent::offset_z_
protected

Definition at line 263 of file msa3xx.h.

◆ orientation

RegOrientationStatus esphome::msa3xx::MSA3xxComponent::orientation

Definition at line 278 of file msa3xx.h.

◆ orientation_old

RegOrientationStatus esphome::msa3xx::MSA3xxComponent::orientation_old

Definition at line 279 of file msa3xx.h.

◆ orientation_trigger_

Trigger esphome::msa3xx::MSA3xxComponent::orientation_trigger_
protected

Definition at line 303 of file msa3xx.h.

◆ power_mode_

PowerMode esphome::msa3xx::MSA3xxComponent::power_mode_ {PowerMode::NORMAL}
protected

Definition at line 258 of file msa3xx.h.

◆ range_

Range esphome::msa3xx::MSA3xxComponent::range_ {Range::RANGE_2G}
protected

Definition at line 261 of file msa3xx.h.

◆ resolution_

Resolution esphome::msa3xx::MSA3xxComponent::resolution_ {Resolution::RES_14BIT}
protected

Definition at line 262 of file msa3xx.h.

◆ scale_factor_exp

int esphome::msa3xx::MSA3xxComponent::scale_factor_exp

Definition at line 267 of file msa3xx.h.

◆ status_

struct { ... } esphome::msa3xx::MSA3xxComponent::status_

◆ swap_

RegSwapPolarity esphome::msa3xx::MSA3xxComponent::swap_
protected

Definition at line 264 of file msa3xx.h.

◆ tap_trigger_

Trigger esphome::msa3xx::MSA3xxComponent::tap_trigger_
protected

Definition at line 301 of file msa3xx.h.

◆ x

float esphome::msa3xx::MSA3xxComponent::x

Definition at line 273 of file msa3xx.h.

◆ y

float esphome::msa3xx::MSA3xxComponent::y

Definition at line 273 of file msa3xx.h.

◆ z

float esphome::msa3xx::MSA3xxComponent::z

Definition at line 273 of file msa3xx.h.


The documentation for this class was generated from the following files: