ISSDK  1.8
IoT Sensing Software Development Kit
Macros | Functions | Variables
mag3110_normal_interrupt.c File Reference

The mag3110_normal_interrupt.c file implements the ISSDK MAG3110 sensor driver example demonstration with interrupt 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 "gpio_driver.h"
#include "mag3110_drv.h"
Include dependency graph for mag3110_normal_interrupt.c:

Go to the source code of this file.

Macros

#define MAG3110_DATA_SIZE   (6) /* 2 byte X,Y,Z Axis Data each. */
 

Functions

void mag3110_int_data_ready_callback (void *pUserData)
 This is the Sensor Data Ready ISR implementation. More...
 
int main (void)
 This is the The main function implementation. More...
 

Variables

const registerwritelist_t cMag3110ConfigNormal []
 Register settings for Normal (non buffered) mode since Interrupt is enabled implicitly. More...
 
const registerreadlist_t cMag3110OutputNormal []
 Address and size of Raw Pressure+Temperature Data in Normal Mode. More...
 
volatile bool gMag3110DataReady
 

Detailed Description

The mag3110_normal_interrupt.c file implements the ISSDK MAG3110 sensor driver example demonstration with interrupt mode.

Definition in file mag3110_normal_interrupt.c.

Macro Definition Documentation

◆ MAG3110_DATA_SIZE

#define MAG3110_DATA_SIZE   (6) /* 2 byte X,Y,Z Axis Data each. */

Definition at line 38 of file mag3110_normal_interrupt.c.

Referenced by main().

Function Documentation

◆ mag3110_int_data_ready_callback()

void mag3110_int_data_ready_callback ( void *  pUserData)

This is the Sensor Data Ready ISR implementation.


This function sets the flag which indicates if a new sample(s) is available for reading.

Parameters
[in]pUserDataThis is a void pointer to the instance of the user specific data structure for the ISR.
Returns
void There is no return value.
Constraints:
None

Yes

Set flag to indicate Sensor has signalled data ready.

Definition at line 73 of file mag3110_normal_interrupt.c.

References gMag3110DataReady.

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void  )

This is the The main function implementation.


This function invokes board initializes routines, then then brings up the sensor and finally enters an endless loop to continuously read available samples.

Parameters
[in]voidThis is no input parameter.
Returns
void There is no return value.
Constraints:
None

No

Initialize the MCU hardware.

Initialize MAG3110 pin used by FRDM board

Initialize RGB LED pin used by FRDM board

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

Initialize MAG3110 sensor driver.

Set the task to be executed while waiting for I2C transactions to complete.

Configure the MAG3110 sensor driver.

Clear the data ready flag, it will be set again by the ISR.

Read the raw sensor data from the MAG3110.

Process the sample and convert the raw sensor data to signed 16-bit container.

Definition at line 87 of file mag3110_normal_interrupt.c.

References ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), data, Driver_GPIO_KSDK, gMag3110DataReady, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), mag3110_magdata_t::mag, MAG3110_CalibrateHardIronOffset(), MAG3110_DATA_SIZE, MAG3110_I2C_ADDR, MAG3110_I2C_Configure(), MAG3110_I2C_Initialize(), MAG3110_I2C_ReadData(), MAG3110_I2C_SetIdleTask(), MAG3110_INT1, mag3110_int_data_ready_callback(), MAG3110_WHOAMI_VALUE, pGpioDriver, GENERIC_DRIVER_GPIO::pin_init, rawData, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), status, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

Variable Documentation

◆ cMag3110ConfigNormal

const registerwritelist_t cMag3110ConfigNormal[]
Initial value:
= {
#define MAG3110_CTRL_REG1_DR_ODR_2
Definition: mag3110.h:423
#define MAG3110_CTRL_REG2_MAG_RST_EN
Definition: mag3110.h:471
#define MAG3110_CTRL_REG2_MAG_RST_MASK
Definition: mag3110.h:458
#define __END_WRITE_DATA__
Definition: sensor_drv.h:45
#define MAG3110_CTRL_REG1_DR_MASK
Definition: mag3110.h:404
#define MAG3110_CTRL_REG1_OS_MASK
Definition: mag3110.h:401
#define MAG3110_CTRL_REG2_AUTO_MSRT_EN_MASK
Definition: mag3110.h:464
#define MAG3110_CTRL_REG2_RAW_RAW
Definition: mag3110.h:474
#define MAG3110_CTRL_REG2_AUTO_MSRT_EN_EN
Definition: mag3110.h:477
#define MAG3110_CTRL_REG1_OS_OSR_32
Definition: mag3110.h:418
#define MAG3110_CTRL_REG2_RAW_MASK
Definition: mag3110.h:461

Register settings for Normal (non buffered) mode since Interrupt is enabled implicitly.

Definition at line 44 of file mag3110_normal_interrupt.c.

◆ cMag3110OutputNormal

const registerreadlist_t cMag3110OutputNormal[]
Initial value:
= {{.readFrom = MAG3110_OUT_X_MSB, .numBytes = MAG3110_DATA_SIZE},
#define __END_READ_DATA__
Definition: sensor_drv.h:51
#define MAG3110_DATA_SIZE

Address and size of Raw Pressure+Temperature Data in Normal Mode.

Definition at line 54 of file mag3110_normal_interrupt.c.

◆ gMag3110DataReady

volatile bool gMag3110DataReady

Definition at line 60 of file mag3110_normal_interrupt.c.

Referenced by mag3110_int_data_ready_callback(), and main().