UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

MMC35240 Class

Module: mmc35240
  • ID: mmc35240
  • Name: MMC35240 Tri-axis Magnetic Sensor
  • Category: compass
  • Manufacturer: Memsic
  • Connection: iio i2c

The MMC3524xPJ is a complete 3-axis magnetic sensor

Methods

MMC35240

(
  • device
)
Number

MMC35240 Tri-axis Magnetic Sensor

Parameters:

  • device Number

    iio device number

Returns:

Number:

installISR

(
  • isr
  • arg
)

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

Parameters:

  • isr Void()(char *, void *)

    Pointer to a function to be called on interrupt

  • arg Void *

    Pointer to an object to be supplied as an argument to the ISR.

getChannelValue

(
  • input
  • chan
)
Number

Extract the channel value based on channel type

Parameters:

  • input String

    Channel data

  • chan Mraa_iio_channel *

    MRAA iio-layer channel info

Returns:

Number:

enableBuffer

(
  • length
)
Boolean

Enable trigger buffer

Parameters:

  • length Number

    buffer length in integer

Returns:

Boolean:

disableBuffer

() Boolean

Disable trigger buffer

Returns:

Boolean:

setScale

(
  • scale
)
Boolean

Set scale

Parameters:

  • scale Number

    in float Kernel driver does not support changing the value of scale on run-time Default scale is 0.001000

Returns:

Boolean:

setSamplingFrequency

(
  • sampling_frequency
)
Boolean

Set sampling frequency

Parameters:

  • sampling_frequency Number

    sampling frequency in float Available sampling frequency are 1.5, 13, 25, 50 Default sampling frequency is 1.500000

Returns:

Boolean:

enable3AxisChannel

() Boolean

Enable 3 axis scan element

Returns:

Boolean:

extract3Axis

(
  • data
  • x
  • y
  • z
)

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

Parameters:

  • data String

    Enabled channel data, 6 bytes, each axis 2 bytes

  • x Float *

    X-Axis

  • y Float *

    Y-Axis

  • z Float *

    Z-Axis

getCalibratedLevel

() Number

Get calibrated level

Returns:

Number:

initCalibrate

()

Reset calibration data and start collect calibration data again

getCalibratedData

(
  • cal_level
  • offset
  • w_invert
  • bfield
)

Get calibrated data

Parameters:

  • cal_level Int *

    undefined

  • offset Number

    undefined

  • w_invert Number

    undefined

  • bfield Double *

    undefined

loadCalibratedData

(
  • cal_level
  • offset
  • w_invert
  • bfield
)

Load calibrated data

Parameters:

  • cal_level Number

    undefined

  • offset Number

    undefined

  • w_invert Number

    undefined

  • bfield Number

    undefined