![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
The mag3110_oneshot.c file implements the ISSDK MAG3110 sensor driver example demonstration with polling mode. More...
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "mag3110_drv.h"
Go to the source code of this file.
Macros | |
#define | MAG3110_DATA_SIZE (6) /* 2 byte X,Y,Z Axis Data each. */ |
Functions | |
int | main (void) |
Main function. More... | |
Variables | |
const registerwritelist_t | cMag3110ConfigOneShot [] |
Register settings for Magnetic Strength readings in One-Shot mode. More... | |
const registerwritelist_t | cMag3110SetOST [] |
Register settings for Triggring One-Shot Sampling. More... | |
const registerreadlist_t | cMag3110GetOST [] = {{.readFrom = MAG3110_CTRL_REG1, .numBytes = 1}, __END_READ_DATA__} |
Address of Register containing OST Bit. More... | |
const registerreadlist_t | cMag3110OutputNormal [] |
Address and size of Raw Magnetic Strength Data. More... | |
The mag3110_oneshot.c file implements the ISSDK MAG3110 sensor driver example demonstration with polling mode.
Definition in file mag3110_oneshot.c.
#define MAG3110_DATA_SIZE (6) /* 2 byte X,Y,Z Axis Data each. */ |
Definition at line 35 of file mag3110_oneshot.c.
Referenced by main().
int main | ( | void | ) |
Main function.
Initialize the I2C driver.
Set the I2C Power mode.
Set the I2C bus speed.
Initialize MAG3110 sensor driver.
We do not need to call MAG3110_I2C_Configure() in this case as we are going to read samples on demand. Instead we directly write register settings for One-Shot Mode...
The code contained withing the braces illustrate steps to read one-sample. These can be repated at desired intervals to acquire more samples.
Keep checking the OST FLAG for completion.
Read raw sensor data from the MAG3110.
Process the sample and convert the raw sensor data to signed 16-bit container.
Definition at line 66 of file mag3110_oneshot.c.
References ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), data, registerDeviceInfo_t::deviceInstance, registerDeviceInfo_t::functionParam, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, registerDeviceInfo_t::idleFunction, int32_t(), mag3110_magdata_t::mag, MAG3110_CTRL_REG1_TM_MASK, MAG3110_DATA_SIZE, MAG3110_I2C_ADDR, MAG3110_I2C_Initialize(), MAG3110_I2C_ReadData(), MAG3110_WHOAMI_VALUE, mag3110_i2c_sensorhandle_t::pCommDrv, rawData, SENSOR_ERROR_NONE, SENSOR_ERROR_WRITE, Sensor_I2C_Write(), mag3110_i2c_sensorhandle_t::slaveAddress, SMC, SMC_SetPowerModeWait(), and status.
const registerwritelist_t cMag3110ConfigOneShot[] |
Register settings for Magnetic Strength readings in One-Shot mode.
Definition at line 41 of file mag3110_oneshot.c.
const registerreadlist_t cMag3110GetOST[] = {{.readFrom = MAG3110_CTRL_REG1, .numBytes = 1}, __END_READ_DATA__} |
Address of Register containing OST Bit.
Definition at line 54 of file mag3110_oneshot.c.
const registerreadlist_t cMag3110OutputNormal[] |
Address and size of Raw Magnetic Strength Data.
Definition at line 57 of file mag3110_oneshot.c.
const registerwritelist_t cMag3110SetOST[] |
Register settings for Triggring One-Shot Sampling.
Definition at line 48 of file mag3110_oneshot.c.