How to use

Platform support

Framework:

  • Arduino

This library is made to be used with:

  • ESP32 family

Necessary inclusions

Only the header has to be included to you project

#include "libDM_mmc5983ma.hpp"

Object creation

The library supports only SPI reading. The following example shows how to create the object:

Important

API ref: MMC5983MA_SPI

timerTool myTimer;
SDIO_CONF sdioConf(generalConf.sdioClock,
                    pinConf.pinSdioClk,
                    pinConf.pinSdioCmd,
                    pinConf.pinSdioDat0,
                    pinConf.pinSdioDat1,
                    pinConf.pinSdioDat2,
                    pinConf.pinSdioDat3,
                    generalConf.sdioMountpoint,
                    false);
streamLogger streamObj(&myTimer, sdioConf);
MMC5983MA_SPI mmc(generalConf.mmcSpiClock,
              pinConf.pinMmcSS,
              &streamObj,
              &myTimer,
              &SPI,
              ABSTRACT_SENSOR_SPI::SPI_CONF());

Object configuration

The following example shows how to configure the sensor to use it:

1    mmc.softResetSensor();
2    delay(10);
3    mmc.begin();
4    mmc.setMagOdrBw(MMC5983MA_ENUM::ODR::_100HZ, MMC5983MA_ENUM::BW::_200HZ);
5    mmc.setAutoSetResetState(true);

Get data

The following example shows how to get the data from the sensor:

1    ABSTRACT_MAG::MAG_OUTPUT resMAG;
2
3    mmc.readMag();
4    resMAG = mmc.getOutput();