MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
Enumerations | Functions | Variables
accelerometer_mma8452q.h File Reference

Functions for interacting with the MMA8452Q accelerometer. More...

#include "sensor_common.h"

Go to the source code of this file.

Enumerations

enum  MblMwAccMma8452qRange { MBL_MW_ACC_MMA8452Q_RANGE_2G = 0, MBL_MW_ACC_MMA8452Q_RANGE_4G, MBL_MW_ACC_MMA8452Q_RANGE_8G }
 Available g-ranges on the MMA8452Q accelerometer. More...
 
enum  MblMwAccMma8452qOdr {
  MBL_MW_ACC_MMA8452Q_ODR_800Hz = 0, MBL_MW_ACC_MMA8452Q_ODR_400Hz, MBL_MW_ACC_MMA8452Q_ODR_200Hz, MBL_MW_ACC_MMA8452Q_ODR_100Hz,
  MBL_MW_ACC_MMA8452Q_ODR_50Hz, MBL_MW_ACC_MMA8452Q_ODR_12_5Hz, MBL_MW_ACC_MMA8452Q_ODR_6_25Hz, MBL_MW_ACC_MMA8452Q_ODR_1_56Hz
}
 Available output data rates on the MMA8452Q accelerometer.
 
enum  MblMwAccMma8452qCutoffFreq { MBL_MW_ACC_MMA8452Q_CUTOFF_FREQ_HIGHEST = 0, MBL_MW_ACC_MMA8452Q_CUTOFF_FREQ_HIGH = 1, MBL_MW_ACC_MMA8452Q_CUTOFF_FREQ_MEDIUM = 2, MBL_MW_ACC_MMA8452Q_CUTOFF_FREQ_LOW = 3 }
 Available cutoff frequencies for the MMA8452Q high pass filter.
 

Functions

METAWEAR_API MblMwDataSignal * mbl_mw_acc_mma8452q_get_acceleration_data_signal (const MblMwMetaWearBoard *board)
 Retrieves the data signal representing acceleration data for the MMA8452Q accelerometer. More...
 
METAWEAR_API MblMwDataSignal * mbl_mw_acc_mma8452q_get_high_freq_acceleration_data_signal (const MblMwMetaWearBoard *board)
 
METAWEAR_API MblMwDataSignal * mbl_mw_acc_mma8452q_get_packed_acceleration_data_signal (const MblMwMetaWearBoard *board)
 Variant of acceleration data that packs multiple data samples into 1 BLE packet to increase the data throughput. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_set_odr (MblMwMetaWearBoard *board, MblMwAccMma8452qOdr odr)
 Sets the output data rate. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_set_range (MblMwMetaWearBoard *board, MblMwAccMma8452qRange range)
 Sets the acceleration range. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_set_high_pass_cutoff (MblMwMetaWearBoard *board, float frequency)
 Sets the cutoff frequency for the high-pass filter. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_write_acceleration_config (const MblMwMetaWearBoard *board)
 Writes the acceleration settings to the sensor. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_start (const MblMwMetaWearBoard *board)
 Switches the accelerometer to active mode. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_stop (const MblMwMetaWearBoard *board)
 Switches the accelerometer to standby mode. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_enable_acceleration_sampling (const MblMwMetaWearBoard *board)
 Enables acceleration sampling. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_disable_acceleration_sampling (const MblMwMetaWearBoard *board)
 Disables acceleration sampling. More...
 
METAWEAR_API MblMwDataSignal * mbl_mw_acc_mma8452q_get_orientation_detection_data_signal (const MblMwMetaWearBoard *board)
 Retrieves the data signal representing data from the orientation detection algorithm. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_set_orientation_delay (MblMwMetaWearBoard *board, uint16_t delay)
 Set the orientation calculation mode. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_enable_orientation_detection (const MblMwMetaWearBoard *board)
 Enables orientation detection. More...
 
METAWEAR_API void mbl_mw_acc_mma8452q_disable_orientation_detection (const MblMwMetaWearBoard *board)
 Disables orientation detection. More...
 

Variables

const uint8_t MBL_MW_MODULE_ACC_TYPE_MMA8452Q = 0
 Constant identifying the MMA8452Q accelerometer type.
 

Detailed Description

Functions for interacting with the MMA8452Q accelerometer.

This sensor is only available on MetaWear R boards.

Enumeration Type Documentation

◆ MblMwAccMma8452qRange

Available g-ranges on the MMA8452Q accelerometer.

Enumerator
MBL_MW_ACC_MMA8452Q_RANGE_2G 

+/- 2g

MBL_MW_ACC_MMA8452Q_RANGE_4G 

+/- 4g

MBL_MW_ACC_MMA8452Q_RANGE_8G 

+/- 8g

Function Documentation

◆ mbl_mw_acc_mma8452q_disable_acceleration_sampling()

METAWEAR_API void mbl_mw_acc_mma8452q_disable_acceleration_sampling ( const MblMwMetaWearBoard *  board)

Disables acceleration sampling.

Parameters
boardCalling object

◆ mbl_mw_acc_mma8452q_disable_orientation_detection()

METAWEAR_API void mbl_mw_acc_mma8452q_disable_orientation_detection ( const MblMwMetaWearBoard *  board)

Disables orientation detection.

Parameters
boardCalling object

◆ mbl_mw_acc_mma8452q_enable_acceleration_sampling()

METAWEAR_API void mbl_mw_acc_mma8452q_enable_acceleration_sampling ( const MblMwMetaWearBoard *  board)

Enables acceleration sampling.

Parameters
boardCalling object

◆ mbl_mw_acc_mma8452q_enable_orientation_detection()

METAWEAR_API void mbl_mw_acc_mma8452q_enable_orientation_detection ( const MblMwMetaWearBoard *  board)

Enables orientation detection.

Parameters
boardCalling object

◆ mbl_mw_acc_mma8452q_get_acceleration_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_acc_mma8452q_get_acceleration_data_signal ( const MblMwMetaWearBoard *  board)

Retrieves the data signal representing acceleration data for the MMA8452Q accelerometer.

Parameters
boardPointer to the board to retrieve the signal from
Returns
Pointer to the board's MMA8452Q acceleration data signal

◆ mbl_mw_acc_mma8452q_get_high_freq_acceleration_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_acc_mma8452q_get_high_freq_acceleration_data_signal ( const MblMwMetaWearBoard *  board)
Deprecated:
As of v0.8.0 and will be removed in v1.0.0.

Use mbl_mw_acc_mma8452q_get_packed_acceleration_data_signal instead.

◆ mbl_mw_acc_mma8452q_get_orientation_detection_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_acc_mma8452q_get_orientation_detection_data_signal ( const MblMwMetaWearBoard *  board)

Retrieves the data signal representing data from the orientation detection algorithm.

Parameters
boardCalling object
Returns
Pointer to MMA8452Q's orientation detection data signal

◆ mbl_mw_acc_mma8452q_get_packed_acceleration_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_acc_mma8452q_get_packed_acceleration_data_signal ( const MblMwMetaWearBoard *  board)

Variant of acceleration data that packs multiple data samples into 1 BLE packet to increase the data throughput.

This data signal cannot be used with data processing or logging, only with streaming.

Returns
Pointer to the data singal

◆ mbl_mw_acc_mma8452q_set_high_pass_cutoff()

METAWEAR_API void mbl_mw_acc_mma8452q_set_high_pass_cutoff ( MblMwMetaWearBoard *  board,
float  frequency 
)

Sets the cutoff frequency for the high-pass filter.

Parameters
boardCalling object
frequencyHpf cutoff frequency, set to 0 to disable the high pass filter

◆ mbl_mw_acc_mma8452q_set_odr()

METAWEAR_API void mbl_mw_acc_mma8452q_set_odr ( MblMwMetaWearBoard *  board,
MblMwAccMma8452qOdr  odr 
)

Sets the output data rate.

Parameters
boardCalling object
odrOutput data rate value to set

◆ mbl_mw_acc_mma8452q_set_orientation_delay()

METAWEAR_API void mbl_mw_acc_mma8452q_set_orientation_delay ( MblMwMetaWearBoard *  board,
uint16_t  delay 
)

Set the orientation calculation mode.

Parameters
boardCalling object
delayTime, in milliseconds, for which the sensor's orientation must remain in the new position before a position change is triggered

◆ mbl_mw_acc_mma8452q_set_range()

METAWEAR_API void mbl_mw_acc_mma8452q_set_range ( MblMwMetaWearBoard *  board,
MblMwAccMma8452qRange  range 
)

Sets the acceleration range.

Parameters
boardCalling object
rangeAcceleration range value to set

◆ mbl_mw_acc_mma8452q_start()

METAWEAR_API void mbl_mw_acc_mma8452q_start ( const MblMwMetaWearBoard *  board)

Switches the accelerometer to active mode.

When in active mode, the accelerometer cannot be configured

Parameters
boardCalling object

◆ mbl_mw_acc_mma8452q_stop()

METAWEAR_API void mbl_mw_acc_mma8452q_stop ( const MblMwMetaWearBoard *  board)

Switches the accelerometer to standby mode.

Parameters
boardCalling object

◆ mbl_mw_acc_mma8452q_write_acceleration_config()

METAWEAR_API void mbl_mw_acc_mma8452q_write_acceleration_config ( const MblMwMetaWearBoard *  board)

Writes the acceleration settings to the sensor.

Parameters
boardCalling object