Si7210 - Magnetic Hall Effect sensor
Description
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 |
|
Si7210 Details | |
Register interface and implementation details.
|
|
Data Structures |
|
struct | sl_si7210_configure |
Structure to configure the Si7210 sensor.
|
|
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 | sl_si7210_get_tamper_threshold (void) |
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.
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error SL_STATUS_INITIALIZATION
Initialization failed due to device ID mismatch
◆ 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.
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ 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
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ sl_si7210_get_tamper_threshold()
float sl_si7210_get_tamper_threshold | ( | void |
|
) |
Return the tamper level configured in the chip.
- Returns
- The tamper level in mT
◆ sl_si7210_sleep()
sl_status_t sl_si7210_sleep | ( | sl_i2cspm_t * |
i2cspm
|
) |
Put Si7210 into Sleep (No-measurement) Mode.
Wake-up command needs to be issued to become responsive.
- Parameters
-
[in] i2cspm
The I2CSPM instance to use.
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ 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.
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ 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.
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ 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)
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error SL_STATUS_OBJECT_READ
No measurement data available
◆ 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
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ 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.
If desired, must be performed after power-up or wake-up from sleep.
- Parameters
-
[in] i2cspm
The I2CSPM instance to use.
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error
◆ 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
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error SL_STATUS_OBJECT_READ
No measurement data available
◆ 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).
Requires Wake-Up.
- 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
- Return values
-
SL_STATUS_OK
Success SL_STATUS_TRANSMIT
I2C transmission error SL_STATUS_OBJECT_READ
No measurement data available