Adafruit MLX90393 Library
Public Member Functions | List of all members
Adafruit_MLX90393 Class Reference

#include <Adafruit_MLX90393.h>

Inheritance diagram for Adafruit_MLX90393:

Public Member Functions

 Adafruit_MLX90393 ()
 
bool begin_I2C (uint8_t i2c_addr=MLX90393_DEFAULT_ADDR, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
bool begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI)
 Sets up the hardware and initializes hardware SPI. More...
 
bool reset (void)
 
bool exitMode (void)
 
bool readMeasurement (float *x, float *y, float *z)
 
bool startSingleMeasurement (void)
 
bool setGain (enum mlx90393_gain gain)
 
enum mlx90393_gain getGain (void)
 
bool setResolution (enum mlx90393_axis, enum mlx90393_resolution resolution)
 
enum mlx90393_resolution getResolution (enum mlx90393_axis)
 
bool setFilter (enum mlx90393_filter filter)
 
enum mlx90393_filter getFilter (void)
 
bool setOversampling (enum mlx90393_oversampling oversampling)
 
enum mlx90393_oversampling getOversampling (void)
 
bool setTrigInt (bool state)
 
bool readData (float *x, float *y, float *z)
 
bool getEvent (sensors_event_t *event)
 Gets the most recent sensor event, Adafruit Unified Sensor format. More...
 
void getSensor (sensor_t *sensor)
 Gets the sensor_t device data, Adafruit Unified Sensor format. More...
 

Detailed Description

Driver for the Adafruit MLX90393 magnetometer breakout board.

Constructor & Destructor Documentation

◆ Adafruit_MLX90393()

Adafruit_MLX90393::Adafruit_MLX90393 ( void  )

Instantiates a new Adafruit_MLX90393 class instance

Member Function Documentation

◆ begin_I2C()

bool Adafruit_MLX90393::begin_I2C ( uint8_t  i2c_addr = MLX90393_DEFAULT_ADDR,
TwoWire *  wire = &Wire 
)

Sets up the hardware and initializes I2C.

Parameters
i2c_addrThe I2C address to be used.
wireThe Wire object to be used for I2C connections.
Returns
True if initialization was successful, otherwise false.

◆ begin_SPI()

boolean Adafruit_MLX90393::begin_SPI ( uint8_t  cs_pin,
SPIClass *  theSPI = &SPI 
)

Sets up the hardware and initializes hardware SPI.

Parameters
cs_pinThe arduino pin # connected to chip select
theSPIThe SPI object to be used for SPI connections.
Returns
True if initialization was successful, otherwise false.

◆ reset()

bool Adafruit_MLX90393::reset ( void  )

Perform a soft reset

Returns
True if the operation succeeded, otherwise false.

◆ exitMode()

bool Adafruit_MLX90393::exitMode ( void  )

Perform a mode exit

Returns
True if the operation succeeded, otherwise false.

◆ readMeasurement()

bool Adafruit_MLX90393::readMeasurement ( float *  x,
float *  y,
float *  z 
)

Reads data from data register & returns the results.

Parameters
xPointer to where the 'x' value should be stored.
yPointer to where the 'y' value should be stored.
zPointer to where the 'z' value should be stored.
Returns
True on command success

◆ startSingleMeasurement()

bool Adafruit_MLX90393::startSingleMeasurement ( void  )

Begin a single measurement on all axes

Returns
True on command success

◆ setGain()

bool Adafruit_MLX90393::setGain ( enum mlx90393_gain  gain)

Sets the sensor gain to the specified level.

Parameters
gainThe gain level to set.
Returns
True if the operation succeeded, otherwise false.

◆ getGain()

mlx90393_gain_t Adafruit_MLX90393::getGain ( void  )

Gets the current sensor gain.

Returns
An enum containing the current gain level.

◆ setResolution()

bool Adafruit_MLX90393::setResolution ( enum mlx90393_axis  axis,
enum mlx90393_resolution  resolution 
)

Sets the sensor resolution to the specified level.

Parameters
axisThe axis to set.
resolutionThe resolution level to set.
Returns
True if the operation succeeded, otherwise false.

◆ getResolution()

enum mlx90393_resolution Adafruit_MLX90393::getResolution ( enum mlx90393_axis  axis)

Gets the current sensor resolution.

Parameters
axisThe axis to get.
Returns
An enum containing the current resolution.

◆ setFilter()

bool Adafruit_MLX90393::setFilter ( enum mlx90393_filter  filter)

Sets the digital filter.

Parameters
filterThe digital filter setting.
Returns
True if the operation succeeded, otherwise false.

◆ getFilter()

enum mlx90393_filter Adafruit_MLX90393::getFilter ( void  )

Gets the current digital filter setting.

Returns
An enum containing the current digital filter setting.

◆ setOversampling()

bool Adafruit_MLX90393::setOversampling ( enum mlx90393_oversampling  oversampling)

Sets the oversampling.

Parameters
oversamplingThe oversampling value to use.
Returns
True if the operation succeeded, otherwise false.

◆ getOversampling()

enum mlx90393_oversampling Adafruit_MLX90393::getOversampling ( void  )

Gets the current oversampling setting.

Returns
An enum containing the current oversampling setting.

◆ setTrigInt()

bool Adafruit_MLX90393::setTrigInt ( bool  state)

Sets the TRIG_INT pin to the specified function.

Parameters
state'true/1' sets the pin to INT, 'false/0' to TRIG.
Returns
True if the operation succeeded, otherwise false.

◆ readData()

bool Adafruit_MLX90393::readData ( float *  x,
float *  y,
float *  z 
)

Performs a single X/Y/Z conversion and returns the results.

Parameters
xPointer to where the 'x' value should be stored.
yPointer to where the 'y' value should be stored.
zPointer to where the 'z' value should be stored.
Returns
True if the operation succeeded, otherwise false.

◆ getEvent()

bool Adafruit_MLX90393::getEvent ( sensors_event_t *  event)

Gets the most recent sensor event, Adafruit Unified Sensor format.

Parameters
eventPointer to an Adafruit Unified sensor_event_t object that we'll fill in
Returns
True on successful read

◆ getSensor()

void Adafruit_MLX90393::getSensor ( sensor_t *  sensor)

Gets the sensor_t device data, Adafruit Unified Sensor format.

Parameters
sensorPointer to an Adafruit Unified sensor_t object that we'll fill in

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