ESPHome 2025.5.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
esphome::msa3xx Namespace Reference

Data Structures

class  MSA3xxComponent
 
union  Orientation
 
union  RegMotionInterrupt
 
union  RegOrientationStatus
 
union  RegOutputDataRate
 
union  RegPowerModeBandwidth
 
union  RegRangeResolution
 
union  RegSwapPolarity
 
union  RegTapDuration
 

Enumerations

enum class  Model : uint8_t { MSA301 = 0x26 , MSA311 = 0x62 }
 
enum class  RegisterMap : uint8_t {
  SOFT_RESET = 0x00 , PART_ID = 0x01 , ACC_X_LSB = 0x02 , ACC_X_MSB = 0x03 ,
  ACC_Y_LSB = 0x04 , ACC_Y_MSB = 0x05 , ACC_Z_LSB = 0x06 , ACC_Z_MSB = 0x07 ,
  MOTION_INTERRUPT = 0x09 , DATA_INTERRUPT = 0x0A , TAP_ACTIVE_STATUS = 0x0B , ORIENTATION_STATUS = 0x0C ,
  RESOLUTION_RANGE_CONFIG = 0x0D , RANGE_RESOLUTION = 0x0F , ODR = 0x10 , POWER_MODE_BANDWIDTH = 0x11 ,
  SWAP_POLARITY = 0x12 , INT_SET_0 = 0x16 , INT_SET_1 = 0x17 , INT_MAP_0 = 0x19 ,
  INT_MAP_1 = 0x1A , INT_CONFIG = 0x20 , INT_LATCH = 0x21 , FREEFALL_DURATION = 0x22 ,
  FREEFALL_THRESHOLD = 0x23 , FREEFALL_HYSTERESIS = 0x24 , ACTIVE_DURATION = 0x27 , ACTIVE_THRESHOLD = 0x28 ,
  TAP_DURATION = 0x2A , TAP_THRESHOLD = 0x2B , ORIENTATION_CONFIG = 0x2C , Z_BLOCK = 0x2D ,
  OFFSET_COMP_X = 0x38 , OFFSET_COMP_Y = 0x39 , OFFSET_COMP_Z = 0x3A
}
 
enum class  Range : uint8_t { RANGE_2G = 0b00 , RANGE_4G = 0b01 , RANGE_8G = 0b10 , RANGE_16G = 0b11 }
 
enum class  Resolution : uint8_t { RES_14BIT = 0b00 , RES_12BIT = 0b01 , RES_10BIT = 0b10 , RES_8BIT = 0b11 }
 
enum class  PowerMode : uint8_t { NORMAL = 0b00 , LOW_POWER = 0b01 , SUSPEND = 0b11 }
 
enum class  Bandwidth : uint8_t {
  BW_1_95HZ = 0b0000 , BW_3_9HZ = 0b0011 , BW_7_81HZ = 0b0100 , BW_15_63HZ = 0b0101 ,
  BW_31_25HZ = 0b0110 , BW_62_5HZ = 0b0111 , BW_125HZ = 0b1000 , BW_250HZ = 0b1001 ,
  BW_500HZ = 0b1010
}
 
enum class  DataRate : uint8_t {
  ODR_1HZ = 0b0000 , ODR_1_95HZ = 0b0001 , ODR_3_9HZ = 0b0010 , ODR_7_81HZ = 0b0011 ,
  ODR_15_63HZ = 0b0100 , ODR_31_25HZ = 0b0101 , ODR_62_5HZ = 0b0110 , ODR_125HZ = 0b0111 ,
  ODR_250HZ = 0b1000 , ODR_500HZ = 0b1001 , ODR_1000HZ = 0b1010
}
 
enum class  OrientationXY : uint8_t { PORTRAIT_UPRIGHT = 0b00 , PORTRAIT_UPSIDE_DOWN = 0b01 , LANDSCAPE_LEFT = 0b10 , LANDSCAPE_RIGHT = 0b11 }
 

Functions

const char * model_to_string (Model model)
 
const char * power_mode_to_string (PowerMode power_mode)
 
const char * res_to_string (Resolution resolution)
 
const char * range_to_string (Range range)
 
const char * bandwidth_to_string (Bandwidth bandwidth)
 
const char * orientation_xy_to_string (OrientationXY orientation)
 
const char * orientation_z_to_string (bool orientation)
 
void binary_event_debounce (bool state, bool old_state, uint32_t now, uint32_t &last_ms, Trigger<> &trigger, uint32_t cooldown_ms, void *bs, const char *desc)
 

Variables

const uint8_t MSA_3XX_PART_ID = 0x13
 
const float GRAVITY_EARTH = 9.80665f
 
const float LSB_COEFF = 1000.0f / (GRAVITY_EARTH * 3.9)
 
const float G_OFFSET_MIN = -4.5f
 
const float G_OFFSET_MAX = 4.5f
 
const uint8_t RESOLUTION [] = {14, 12, 10, 8}
 
const uint32_t TAP_COOLDOWN_MS = 500
 
const uint32_t DOUBLE_TAP_COOLDOWN_MS = 500
 
const uint32_t ACTIVITY_COOLDOWN_MS = 500
 

Enumeration Type Documentation

◆ Bandwidth

enum class esphome::msa3xx::Bandwidth : uint8_t
strong
Enumerator
BW_1_95HZ 
BW_3_9HZ 
BW_7_81HZ 
BW_15_63HZ 
BW_31_25HZ 
BW_62_5HZ 
BW_125HZ 
BW_250HZ 
BW_500HZ 

Definition at line 91 of file msa3xx.h.

◆ DataRate

enum class esphome::msa3xx::DataRate : uint8_t
strong
Enumerator
ODR_1HZ 
ODR_1_95HZ 
ODR_3_9HZ 
ODR_7_81HZ 
ODR_15_63HZ 
ODR_31_25HZ 
ODR_62_5HZ 
ODR_125HZ 
ODR_250HZ 
ODR_500HZ 
ODR_1000HZ 

Definition at line 103 of file msa3xx.h.

◆ Model

enum class esphome::msa3xx::Model : uint8_t
strong
Enumerator
MSA301 
MSA311 

Definition at line 27 of file msa3xx.h.

◆ OrientationXY

enum class esphome::msa3xx::OrientationXY : uint8_t
strong
Enumerator
PORTRAIT_UPRIGHT 
PORTRAIT_UPSIDE_DOWN 
LANDSCAPE_LEFT 
LANDSCAPE_RIGHT 

Definition at line 117 of file msa3xx.h.

◆ PowerMode

enum class esphome::msa3xx::PowerMode : uint8_t
strong
Enumerator
NORMAL 
LOW_POWER 
SUSPEND 

Definition at line 85 of file msa3xx.h.

◆ Range

enum class esphome::msa3xx::Range : uint8_t
strong
Enumerator
RANGE_2G 
RANGE_4G 
RANGE_8G 
RANGE_16G 

Definition at line 71 of file msa3xx.h.

◆ RegisterMap

enum class esphome::msa3xx::RegisterMap : uint8_t
strong
Enumerator
SOFT_RESET 
PART_ID 
ACC_X_LSB 
ACC_X_MSB 
ACC_Y_LSB 
ACC_Y_MSB 
ACC_Z_LSB 
ACC_Z_MSB 
MOTION_INTERRUPT 
DATA_INTERRUPT 
TAP_ACTIVE_STATUS 
ORIENTATION_STATUS 
RESOLUTION_RANGE_CONFIG 
RANGE_RESOLUTION 
ODR 
POWER_MODE_BANDWIDTH 
SWAP_POLARITY 
INT_SET_0 
INT_SET_1 
INT_MAP_0 
INT_MAP_1 
INT_CONFIG 
INT_LATCH 
FREEFALL_DURATION 
FREEFALL_THRESHOLD 
FREEFALL_HYSTERESIS 
ACTIVE_DURATION 
ACTIVE_THRESHOLD 
TAP_DURATION 
TAP_THRESHOLD 
ORIENTATION_CONFIG 
Z_BLOCK 
OFFSET_COMP_X 
OFFSET_COMP_Y 
OFFSET_COMP_Z 

Definition at line 33 of file msa3xx.h.

◆ Resolution

enum class esphome::msa3xx::Resolution : uint8_t
strong
Enumerator
RES_14BIT 
RES_12BIT 
RES_10BIT 
RES_8BIT 

Definition at line 78 of file msa3xx.h.

Function Documentation

◆ bandwidth_to_string()

const char * esphome::msa3xx::bandwidth_to_string ( Bandwidth bandwidth)

Definition at line 78 of file msa3xx.cpp.

◆ binary_event_debounce()

void esphome::msa3xx::binary_event_debounce ( bool state,
bool old_state,
uint32_t now,
uint32_t & last_ms,
Trigger<> & trigger,
uint32_t cooldown_ms,
void * bs,
const char * desc )

Definition at line 373 of file msa3xx.cpp.

◆ model_to_string()

const char * esphome::msa3xx::model_to_string ( Model model)

Definition at line 24 of file msa3xx.cpp.

◆ orientation_xy_to_string()

const char * esphome::msa3xx::orientation_xy_to_string ( OrientationXY orientation)

Definition at line 103 of file msa3xx.cpp.

◆ orientation_z_to_string()

const char * esphome::msa3xx::orientation_z_to_string ( bool orientation)

Definition at line 118 of file msa3xx.cpp.

◆ power_mode_to_string()

const char * esphome::msa3xx::power_mode_to_string ( PowerMode power_mode)

Definition at line 35 of file msa3xx.cpp.

◆ range_to_string()

const char * esphome::msa3xx::range_to_string ( Range range)

Definition at line 63 of file msa3xx.cpp.

◆ res_to_string()

const char * esphome::msa3xx::res_to_string ( Resolution resolution)

Definition at line 48 of file msa3xx.cpp.

Variable Documentation

◆ ACTIVITY_COOLDOWN_MS

const uint32_t esphome::msa3xx::ACTIVITY_COOLDOWN_MS = 500

Definition at line 22 of file msa3xx.cpp.

◆ DOUBLE_TAP_COOLDOWN_MS

const uint32_t esphome::msa3xx::DOUBLE_TAP_COOLDOWN_MS = 500

Definition at line 21 of file msa3xx.cpp.

◆ G_OFFSET_MAX

const float esphome::msa3xx::G_OFFSET_MAX = 4.5f

Definition at line 16 of file msa3xx.cpp.

◆ G_OFFSET_MIN

const float esphome::msa3xx::G_OFFSET_MIN = -4.5f

Definition at line 15 of file msa3xx.cpp.

◆ GRAVITY_EARTH

const float esphome::msa3xx::GRAVITY_EARTH = 9.80665f

Definition at line 13 of file msa3xx.cpp.

◆ LSB_COEFF

const float esphome::msa3xx::LSB_COEFF = 1000.0f / (GRAVITY_EARTH * 3.9)

Definition at line 14 of file msa3xx.cpp.

◆ MSA_3XX_PART_ID

const uint8_t esphome::msa3xx::MSA_3XX_PART_ID = 0x13

Definition at line 11 of file msa3xx.cpp.

◆ RESOLUTION

const uint8_t esphome::msa3xx::RESOLUTION[] = {14, 12, 10, 8}

Definition at line 18 of file msa3xx.cpp.

◆ TAP_COOLDOWN_MS

const uint32_t esphome::msa3xx::TAP_COOLDOWN_MS = 500

Definition at line 20 of file msa3xx.cpp.