C

This code base on language C have the propose to get information about this sensor and display it.

First part that we need to write on our code is the libraries that we are going to use. In this case we are going to use

XdkSensorHandle.h

/************************************************************
*   MagneticSensor.c
************************************************************/

/* system header files */
#include <stdio.h>

/* additional interface header files */
#include "FreeRTOS.h"
#include "timers.h"
#include "BCDS_CmdProcessor.h"
#include "BCDS_Assert.h"

#include "XdkSensorHandle.h"

/* own header files */

A storage struct for every axis’ magnetic field data is declared. The data is then read by the Magnetometer_readXyzTeslaData() function and then stored in a passed reference of the storage struct.

Then we declared the function to initialized the sensor and variable. We need to use the function of Magnetometerinit(xdkMagnetometer_BBM150_Handle)

Finally we declared the main part of the program where we need to call all the function that we previously defined. Also define the timers.

Last updated

Was this helpful?