The FXOS8700CQ module implements the functions to initialize, configure, and read the FXOS8700CQ accelerometer + magnetometer sensor from NXP.
The sensor registers are described in the FXOS8700CQ Registers section.
The current driver version is 1.0 and it does not include these features:
Modules | |
FXOS8700CQ Registers | |
Files | |
file | FXOS8700CQ_registers.h |
Data Structures | |
struct | FXOS8700CQ_config_t |
struct | FXOS8700CQ_interrupt_config_t |
struct | FXOS8700CQ_accelerometer_config_t |
struct | FXOS8700CQ_magnetometer_config_t |
struct | FXOS8700CQ_output_data_t |
Macros | |
#define | FXOS8700CQ_TRANSPORT_I2C |
#define | FXOS8700CQ_I2C_ADDRESS |
#define | FXOS8700CQ_I2C_INSTANCE |
#define | FXOS8700CQ_I2C_BAUDRATE_KBPS |
#define | FXOS8700CQ_TIMEOUT_MS |
Typedefs | |
typedef void(* | FXOS8700CQ_callback_function_t) (uint8_t *dataSource, uint8_t byteCount) |
Enumerations | |
enum | FXOS8700CQ_status_t { kStatusSuccess, kStatusTimeOutError, kStatusInitializationError, kStatusTransportBusyError, kStatusCommunicationsError, kStatusMemoryAllocationError } |
struct FXOS8700CQ_config_t |
Configuration structure for the FXOS8700CQ initialization.
Data Fields | ||
---|---|---|
FXOS8700CQ_data_rate_hz_t | outputDataRate | Set the output data rate. |
FXOS8700CQ_sensor_enable_t | enabledSensors | Set the sensors to enable. |
struct FXOS8700CQ_interrupt_config_t |
Configuration structure for the FXOS8700CQ interruptions initialization.
Data Fields | ||
---|---|---|
FXOS8700CQ_interrupt_sources_t | interruptSources | Interrupt sources to enable separated by | operator. |
FXOS8700CQ_interrupt_pin_map_t | interruptPinMap | Interrupt sources to map to INT2 separated by | operator (mapped to INT1 when clear) |
struct FXOS8700CQ_accelerometer_config_t |
Configuration structure for the accelerometer sensor initialization.
Data Fields | ||
---|---|---|
FXOS8700CQ_sensitivity_t | sensitivity | Accelerometer sensitivity. |
bool_t | fastModeEnabled | Enable fast mode; 8-bit output resolution when enabled. |
bool_t | lowNoiseEnabled | Enable low noise; does not work with +-8g sensitivity. |
FXOS8700CQ_oversampling_mods_t | oversamplingMod | Select the ADC oversampling mod. |
struct FXOS8700CQ_magnetometer_config_t |
Configuration structure for the magnetometer sensor initialization.
Data Fields | ||
---|---|---|
FXOS8700CQ_magnetometer_osr_t | oversamplingRatio | Magnetometer oversampling ratio. |
FXOS8700CQ_magnetic_sensor_reset_t | autoSensorResetFreq | Magnetic sensor reset (degaussing) frequency. |
bool_t | autoCalibrationEnabled | Enable sensor autocalibration. |
struct FXOS8700CQ_output_data_t |
#define FXOS8700CQ_TRANSPORT_I2C |
I2C transport selected.
Select just one transport. If both are selected, I2C takes precedence
#define FXOS8700CQ_I2C_ADDRESS |
I2C address configured for the FXOS8700CQ.
#define FXOS8700CQ_I2C_INSTANCE |
I2C module instance to use.
#define FXOS8700CQ_I2C_BAUDRATE_KBPS |
Baudrate (in kbit/s)
#define FXOS8700CQ_TIMEOUT_MS |
Timeout for the blocking functions.
typedef void(* FXOS8700CQ_callback_function_t) (uint8_t *dataSource, uint8_t byteCount) |
FXOS8700CQ non-blocking functions callback type.
enum FXOS8700CQ_status_t |
Status responses for the FXOS8700CQ driver functions.
FXOS8700CQ_status_t FXOS8700CQ_init | ( | FXOS8700CQ_config_t * | pConfigStruct | ) |
Initializes the FXOS8700CQ module over the selected transport
[in] | pConfigStruct | Module configuration structure (See FXOS8700CQ_config_t ) |
FXOS8700CQ_status_t FXOS8700CQ_start | ( | void | ) |
Starts the FXOS8700CQ module
[in] | None |
FXOS8700CQ_status_t FXOS8700CQ_stop | ( | void | ) |
Stops the FXOS8700CQ module
[in] | None |
FXOS8700CQ_status_t FXOS8700CQ_communication_test | ( | void | ) |
Executes communications tests by reading the WHO AM I register
[in] | None |
FXOS8700CQ_status_t FXOS8700CQ_interrupt_configuration | ( | FXOS8700CQ_interrupt_config_t * | pConfigurationParameters | ) |
Configures the FXOS8700CQ module to generate interrupt requests using the INT1 and INT2 pins.
[in] | pConfigurationParameters | Interrupt configuration parameters (See FXOS8700CQ_interrupt_config_t) |
FXOS8700CQ_status_t FXOS8700CQ_get_interrupt_status | ( | uint8_t * | interruptStatus | ) |
Gets the current interrupt status register
[out] | interruptStatus | Pointer to the 8-bit variable where the result is to be stored |
FXOS8700CQ_status_t FXOS8700CQ_accelerometer_configuration | ( | FXOS8700CQ_accelerometer_config_t * | pConfigurationParameters | ) |
Configures the accelerometer sensor
[in] | pConfigurationParameters | Configuration structure for the accelerometer (see FXOS8700CQ_accelerometer_config_t) |
FXOS8700CQ_status_t FXOS8700CQ_get_accelerometer_readings | ( | FXOS8700CQ_output_data_t * | pAccelerometerData | ) |
Reads the accelerometer data from the FXOS8700CQ
[out] | pAccelerometerData | Pointer to the structure where the results are to be stored (see FXOS8700CQ_output_data_t) |
FXOS8700CQ_status_t FXOS8700CQ_magnetometer_configuration | ( | FXOS8700CQ_magnetometer_config_t * | pConfigurationParameters | ) |
Configures the magnetometer sensor
[in] | pConfigurationParameters | Configuration structure for the magnetometer (see FXOS8700CQ_magnetometer_config_t) |
FXOS8700CQ_status_t FXOS8700CQ_get_magnetometer_readings | ( | FXOS8700CQ_output_data_t * | pMagnetometerData | ) |
Reads the magnetometer data from the FXOS8700CQ
[out] | pMagnetometerData | Pointer to the structure where the results are to be stored (see FXOS8700CQ_output_data_t) |
FXOS8700CQ_status_t FXOS8700CQ_get_hybrid_sensor_readings | ( | FXOS8700CQ_output_data_t * | pAccelerometerData, |
FXOS8700CQ_output_data_t * | pMagnetometerData | ||
) |
Reads the accelerometer and magnetometer data in a single sequence
[out] | pAccelerometerData | Pointer to the structure where the results are to be stored (see FXOS8700CQ_output_data_t) |
[out] | pMagnetometerData | Pointer to the structure where the results are to be stored (see FXOS8700CQ_output_data_t) |
FXOS8700CQ_status_t FXOS8700CQ_get_registers | ( | uint8_t | startRegisterAddress, |
uint8_t | byteCount, | ||
FXOS8700CQ_callback_function_t | onCompletionCallback | ||
) |
Reads a sequence of the FXOS8700CQ registers
[in] | startRegisterAddress | Address for the first register to read |
[in] | byteCount | Number of registers to read |
[in] | onCompletionCallback | Callback function to execute upon read complete. This function must be compatible with the FXOS8700CQ_callback_function_t type. |
FXOS8700CQ_status_t FXOS8700CQ_get_registers_blocking | ( | uint8_t | startRegisterAddress, |
uint8_t | byteCount, | ||
uint8_t * | pOutBuffer | ||
) |
Reads a sequence of the FXOS8700CQ registers blocking the execution until completion.
[in] | startRegisterAddress | Address for the first register to read |
[in] | byteCount | Number of registers to read |
[out] | pOutBuffer | Pointer to the buffer where the data are to be stored |
FXOS8700CQ_status_t FXOS8700CQ_set_register | ( | uint8_t | registerAddress, |
uint8_t * | registerDataPtr | ||
) |
Starts a FXOS8700CQ register write.
[in] | registerAddress | Address for the register to write. |
[in] | registerDataPtr | Pointer to the variable containing the data to write. |
FXOS8700CQ_status_t FXOS8700CQ_set_register_blocking | ( | uint8_t | registerAddress, |
uint8_t * | registerDataPtr | ||
) |
Starts a FXOS8700CQ register write and waits until it is complete.
[in] | registerAddress | Address for the register to write. |
[in] | registerDataPtr | Pointer to the variable containing the data to write. |
unsigned char FXOS8700CQ_CTRL_REG1_map_t::ctrl_reg1 |
unsigned { ... } ::active |
unsigned { ... } ::f_read |
unsigned { ... } ::lnoise |
unsigned { ... } ::dr |
unsigned { ... } ::aslp_rate |
struct { ... } FXOS8700CQ_CTRL_REG1_map_t::ctrl_reg1_map |
unsigned char FXOS8700CQ_CTRL_REG2_map_t::ctrl_reg2 |
unsigned { ... } ::mods |
unsigned { ... } ::slpe |
unsigned { ... } ::smods |
unsigned { ... } ::reserved |
unsigned { ... } ::rst |
unsigned { ... } ::st |
struct { ... } FXOS8700CQ_CTRL_REG2_map_t::ctrl_reg2_map |
unsigned char FXOS8700CQ_XYZ_DATA_CFG_map_t::xyz_data_cfg |
unsigned { ... } ::fs |
unsigned { ... } ::reserved0 |
unsigned { ... } ::hpf_out |
unsigned { ... } ::reserved1 |
struct { ... } FXOS8700CQ_XYZ_DATA_CFG_map_t::xyz_data_cfg_map |
unsigned char FXOS8700CQ_M_CTRL_REG1_map_t::m_ctrl_reg1 |
unsigned { ... } ::m_hms |
unsigned { ... } ::m_os |
unsigned { ... } ::m_ost |
unsigned { ... } ::m_rst |
unsigned { ... } ::m_acal |
struct { ... } FXOS8700CQ_M_CTRL_REG1_map_t::m_ctrl_reg1_map |
unsigned char FXOS8700CQ_M_CTRL_REG2_map_t::m_ctrl_reg2 |
unsigned { ... } ::m_rst_cnt |
unsigned { ... } ::m_maxmin_rst |
unsigned { ... } ::m_maxmin_dis_ths |
unsigned { ... } ::m_maxmin_dis |
unsigned { ... } ::hyb_autoinc_mode |
unsigned { ... } ::reserved |
struct { ... } FXOS8700CQ_M_CTRL_REG2_map_t::m_ctrl_reg2_map |
unsigned char FXOS8700CQ_M_CTRL_REG3_map_t::m_ctrl_reg3 |
unsigned { ... } ::reserved |
unsigned { ... } ::m_ths_xys_update |
unsigned { ... } ::m_aslp_os |
unsigned { ... } ::m_raw |
struct { ... } FXOS8700CQ_M_CTRL_REG3_map_t::m_ctrl_reg3_map |