Axeda Corp / Mbed 2 deprecated AxedaGo-Freescal_FRDM-KL46Z

Dependencies:   FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem

Fork of AxedaGo-Freescal_FRDM-KL46Z by Axeda Corp

Embed: (wiki syntax)

« Back to documentation index

MAG3110 Class Reference

MAG3110 Class Reference

MAG3110 Class to read X/Y/Z data from the magentometer. More...

#include <MAG3110.h>

Public Member Functions

 MAG3110 (PinName sda, PinName scl)
 Main constructor.
 MAG3110 (PinName sda, PinName scl, Serial *pc)
 Debug version of constructor.
void begin ()
 Setup the Magnetometer.
int readReg (char regAddr)
 Read a register, return its value as int.
int readVal (char regAddr)
 Read a value from a pair of registers, return as int.
float getHeading ()
 Calculate the heading.
void getValues (int *xVal, int *yVal, int *zVal)
 Perform a read on the X, Y and Z values.
void setCalibration (int minX, int maxX, int minY, int maxY)
 Set the calibration parameters if required.
void calXY (PinName pin, int activeValue)
 Perfrom the calibration process.

Detailed Description

MAG3110 Class to read X/Y/Z data from the magentometer.

Definition at line 80 of file MAG3110.h.


Constructor & Destructor Documentation

MAG3110 ( PinName  sda,
PinName  scl 
)

Main constructor.

Parameters:
sdaSDA pin
sdlSCL pin
addraddr of the I2C peripheral

Definition at line 8 of file MAG3110.cpp.

MAG3110 ( PinName  sda,
PinName  scl,
Serial *  pc 
)

Debug version of constructor.

Parameters:
sdaSDA pin
sdlSCL pin
addrAddress of the I2C peripheral
pcSerial object to output debug messages

Definition at line 14 of file MAG3110.cpp.


Member Function Documentation

void begin (  )

Setup the Magnetometer.

Definition at line 20 of file MAG3110.cpp.

void calXY ( PinName  pin,
int  activeValue 
)

Perfrom the calibration process.

Parameters:
calPinGPIO pinName to use for coordinating the board rotation
activeValuethe GPIO pin value when input asserted

Definition at line 90 of file MAG3110.cpp.

float getHeading (  )

Calculate the heading.

Returns:
heading in degrees

Definition at line 67 of file MAG3110.cpp.

void getValues ( int *  xVal,
int *  yVal,
int *  zVal 
)

Perform a read on the X, Y and Z values.

Parameters:
xValPointer to X value
yValPointer to Y value
zValPointer to Z value

Definition at line 74 of file MAG3110.cpp.

int readReg ( char  regAddr )

Read a register, return its value as int.

Parameters:
regAddrThe address to read
Returns:
value in register

Definition at line 38 of file MAG3110.cpp.

int readVal ( char  regAddr )

Read a value from a pair of registers, return as int.

Parameters:
regAddrThe address to read
Returns:
Value from 2 consecutive registers

Definition at line 53 of file MAG3110.cpp.

void setCalibration ( int  minX,
int  maxX,
int  minY,
int  maxY 
)

Set the calibration parameters if required.

Parameters:
minXMinimum value for X range
maxXMaximum value for X range
minYMinimum value for Y range
maxYmaximum value for Y range

Definition at line 82 of file MAG3110.cpp.