upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Public Types | Public Member Functions
MMC35240 Class Reference

MMC35240 Tri-axis Magnetic Sensor API. More...

Detailed Description

The MMC3524xPJ is a complete 3-axis magnetic sensor

// Instantiate a MMC35240 Magnetic Sensor on iio device 5. This configuration
// is a reference and
// should be changed per platform/board type.
// Kernel driver does not allow changing the value of scale at run-time,
// default scale is
// 0.001000
upm::MMC35240 magnetometer(5);
// Available sampling frequency are 1.5, 13, 25, 50
magnetometer.installISR(data_callback, &magnetometer);
while (shouldRun) {

Data Structures

struct  compass_cal_t
struct  filter_average_t

Public Types

typedef double mat_input_t[MAGN_DS_SIZE][3]

Public Member Functions

 MMC35240 (int device)
 ~MMC35240 ()
void installISR (void(*isr)(char *, void *), void *arg)
int64_t getChannelValue (unsigned char *input, mraa_iio_channel *chan)
bool enableBuffer (int length)
bool disableBuffer ()
bool setScale (const float scale)
bool setSamplingFrequency (const float sampling_frequency)
bool enable3AxisChannel ()
void extract3Axis (char *data, float *x, float *y, float *z)
int getCalibratedLevel ()
void initCalibrate ()
void getCalibratedData (int *cal_level, double offset[3][1], double w_invert[3][3], double *bfield)
void loadCalibratedData (int cal_level, double offset[3][1], double w_invert[3][3], double bfield)

Constructor & Destructor Documentation

MMC35240 ( int  device)

MMC35240 Tri-axis Magnetic Sensor

deviceiio device number
~MMC35240 ( )

MMC35240 destructor

Member Function Documentation

void installISR ( void(*)(char *, void *)  isr,
void *  arg 

Installs an interrupt service routine (ISR) to be called when an interrupt occurs

isrPointer to a function to be called on interrupt
argPointer to an object to be supplied as an argument to the ISR.
int64_t getChannelValue ( unsigned char *  input,
mraa_iio_channel *  chan 

Extract the channel value based on channel type

inputChannel data
chanMRAA iio-layer channel info
bool enableBuffer ( int  length)

Enable trigger buffer

lengthbuffer length in integer
bool disableBuffer ( )

Disable trigger buffer

bool setScale ( const float  scale)

Set scale

scalein float Kernel driver does not support changing the value of scale on run-time Default scale is 0.001000
bool setSamplingFrequency ( const float  sampling_frequency)

Set sampling frequency

sampling_frequencysampling frequency in float Available sampling frequency are 1.5, 13, 25, 50 Default sampling frequency is 1.500000
bool enable3AxisChannel ( )

Enable 3 axis scan element

void extract3Axis ( char *  data,
float *  x,
float *  y,
float *  z 

Process enabled channel buffer and return x, y, z axis

dataEnabled channel data, 6 bytes, each axis 2 bytes
int getCalibratedLevel ( )

Get calibrated level

void initCalibrate ( )

Reset calibration data and start collect calibration data again

void getCalibratedData ( int *  cal_level,
double  offset[3][1],
double  w_invert[3][3],
double *  bfield 

Get calibrated data

void loadCalibratedData ( int  cal_level,
double  offset[3][1],
double  w_invert[3][3],
double  bfield 

Load calibrated data

The documentation for this class was generated from the following files: