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#
Functions#
Does device-specific initialization for the Si7210 chip.
Configure the Si7210 chip.
Perform a measurement.
Return the tamper level configured in the chip.
Put Si7210 into Sleep (No-measurement) Mode.
Put the Si7210 into Sleep w/ Measurement Mode: OUTPUT is updated 200 ms.
Wake up the Hall sensor chip.
Read out Si7210 Conversion Data - 15bits.
Read out Si7210 Revision and ID.
Change Mag-Field scale to 200mT.
Perform burst-conversion(4 samples), read mT-data, and put part into sltimeena-sleep mode where OUT is updated every 200 ms.
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.
[in] | i2cspm | The I2CSPM instance to use. |
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.
[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. |
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.
[in] | i2cspm | The I2CSPM instance to use. |
[in] | scale | Desired scale in uT |
[out] | result | The measured field strength value in mT |
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.
N/A |
Returns
The tamper level in mT
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.
[in] | i2cspm | The I2CSPM instance to use. |
Wake-up command needs to be issued to become responsive.
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.
[in] | i2cspm | The I2CSPM instance to use. |
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.
[in] | i2cspm | The I2CSPM instance to use. |
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.
[in] | i2cspm | The I2CSPM instance to use. |
[out] | data | The raw magnetic field conversion data (15 bits) |
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.
[in] | i2cspm | The I2CSPM instance to use. |
[out] | id | Si7210 part ID |
[out] | rev | Si7210 part Revision |
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.
[in] | i2cspm | The I2CSPM instance to use. |
If desired, must be performed after power-up or wake-up from sleep.
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.
[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 |
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).
[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.
267
of file hardware/driver/si7210/inc/sl_si7210.h