Si7210 - Magnetic Hall Effect sensor#

Driver for the Silicon Labs Si7210 Hall effect sensor.


Si7210 example code#

Basic example for measurement of magnetic field strength:

#include "sl_i2cspm_instances.h"
#include "sl_si7210.h"

int main( void )
{

  ...

  float mTdata:;

  sl_si7210_init(sl_i2cspm_sensor);
  sl_si7210_measure(sl_i2cspm_sensor, 10000, &mTdata);

  ...

} 

Modules#

sl_si7210_configure_t

Si7210 Details

Functions#

sl_status_t
sl_si7210_init(sl_i2cspm_t *i2cspm)

Does device-specific initialization for the Si7210 chip.

sl_status_t
sl_si7210_configure(sl_i2cspm_t *i2cspm, sl_si7210_configure_t *config)

Configure the Si7210 chip.

sl_status_t
sl_si7210_measure(sl_i2cspm_t *i2cspm, uint32_t scale, float *result)

Perform a measurement.

float

Return the tamper level configured in the chip.

sl_status_t
sl_si7210_sleep(sl_i2cspm_t *i2cspm)

Put Si7210 into Sleep (No-measurement) Mode.

sl_status_t
sl_si7210_sleep_sltimeena(sl_i2cspm_t *i2cspm)

Put the Si7210 into Sleep w/ Measurement Mode: OUTPUT is updated 200 ms.

sl_status_t
sl_si7210_wake_up(sl_i2cspm_t *i2cspm)

Wake up the Hall sensor chip.

sl_status_t
sl_si7210_read_data(sl_i2cspm_t *i2cspm, int16_t *data)

Read out Si7210 Conversion Data - 15bits.

sl_status_t
sl_si7210_identify(sl_i2cspm_t *i2cspm, uint8_t *id, uint8_t *rev)

Read out Si7210 Revision and ID.

sl_status_t
sl_si7210_set_mt_range_200(sl_i2cspm_t *i2cspm)

Change Mag-Field scale to 200mT.

sl_status_t
sl_si7210_read_magfield_data_and_sltimeena(sl_i2cspm_t *i2cspm, bool range200mT, int32_t *mTdata)

Perform burst-conversion(4 samples), read mT-data, and put part into sltimeena-sleep mode where OUT is updated every 200 ms.

sl_status_t
sl_si7210_read_magfield_data_and_sleep(sl_i2cspm_t *i2cspm, bool range200mT, int32_t *mTdata)

Wake-up from Sleep, perform burst-conversion(4 samples), read mT-data, and put part into sleep mode (no-measurement).

Function Documentation#

sl_si7210_init#

sl_status_t sl_si7210_init (sl_i2cspm_t * i2cspm)

Does device-specific initialization for the Si7210 chip.

Parameters
[in]i2cspm

The I2CSPM instance to use.


Definition at line 96 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_configure#

sl_status_t sl_si7210_configure (sl_i2cspm_t * i2cspm, sl_si7210_configure_t * config)

Configure the Si7210 chip.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[in]config

The structure, which contains the configuration parameters. If all fields are set to zero, the chip will revert to use default values.


Definition at line 112 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_measure#

sl_status_t sl_si7210_measure (sl_i2cspm_t * i2cspm, uint32_t scale, float * result)

Perform a measurement.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[in]scale

Desired scale in uT

[out]result

The measured field strength value in mT


Definition at line 130 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_get_tamper_threshold#

float sl_si7210_get_tamper_threshold (void )

Return the tamper level configured in the chip.

Parameters
N/A

Returns

  • The tamper level in mT


Definition at line 139 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_sleep#

sl_status_t sl_si7210_sleep (sl_i2cspm_t * i2cspm)

Put Si7210 into Sleep (No-measurement) Mode.

Parameters
[in]i2cspm

The I2CSPM instance to use.

Wake-up command needs to be issued to become responsive.


Definition at line 152 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_sleep_sltimeena#

sl_status_t sl_si7210_sleep_sltimeena (sl_i2cspm_t * i2cspm)

Put the Si7210 into Sleep w/ Measurement Mode: OUTPUT is updated 200 ms.

Parameters
[in]i2cspm

The I2CSPM instance to use.


Definition at line 164 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_wake_up#

sl_status_t sl_si7210_wake_up (sl_i2cspm_t * i2cspm)

Wake up the Hall sensor chip.

Parameters
[in]i2cspm

The I2CSPM instance to use.


Definition at line 176 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_read_data#

sl_status_t sl_si7210_read_data (sl_i2cspm_t * i2cspm, int16_t * data)

Read out Si7210 Conversion Data - 15bits.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[out]data

The raw magnetic field conversion data (15 bits)


Definition at line 192 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_identify#

sl_status_t sl_si7210_identify (sl_i2cspm_t * i2cspm, uint8_t * id, uint8_t * rev)

Read out Si7210 Revision and ID.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[out]id

Si7210 part ID

[out]rev

Si7210 part Revision


Definition at line 210 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_set_mt_range_200#

sl_status_t sl_si7210_set_mt_range_200 (sl_i2cspm_t * i2cspm)

Change Mag-Field scale to 200mT.

Parameters
[in]i2cspm

The I2CSPM instance to use.

If desired, must be performed after power-up or wake-up from sleep.


Definition at line 223 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_read_magfield_data_and_sltimeena#

sl_status_t sl_si7210_read_magfield_data_and_sltimeena (sl_i2cspm_t * i2cspm, bool range200mT, int32_t * mTdata)

Perform burst-conversion(4 samples), read mT-data, and put part into sltimeena-sleep mode where OUT is updated every 200 ms.

Parameters
[in]i2cspm

The I2CSPM instance to use.

[in]range200mT

range200mT=false : full-scale equals 20mT range200mT=true : full-scale equals 200mT

[out]mTdata

Mag-field conversion reading, signed 32-bit integer mTdata must be divided by 1000 to get decimal value in mT units


Definition at line 245 of file hardware/driver/si7210/inc/sl_si7210.h

sl_si7210_read_magfield_data_and_sleep#

sl_status_t sl_si7210_read_magfield_data_and_sleep (sl_i2cspm_t * i2cspm, bool range200mT, int32_t * mTdata)

Wake-up from Sleep, perform burst-conversion(4 samples), read mT-data, and put part into sleep mode (no-measurement).

Parameters
[in]i2cspm

The I2CSPM instance to use.

[in]range200mT

range200mT=false : full-scale equals 20mT range200mT=true : full-scale equals 200mT

[out]mTdata

Mag-field conversion reading, signed 32-bit integer mTdata must be divided by 1000 to get decimal value in mT units

Requires Wake-Up.


Definition at line 267 of file hardware/driver/si7210/inc/sl_si7210.h