Si72xx - Magnetic Hall Effect Sensor#

Enumerations#

enum
SI7210_20MT
SI7210_200MT
}

DEFINES ***********************************.

enum
SI72XX_SLEEP_MODE
SI72XX_SLTIMEENA_MODE
}

Si72xx sleep modes.

Functions#

uint32_t
sl_si72xx_read_register(I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t *data)

PROTOTYPES **********************************.

uint32_t
sl_si72xx_write_register(I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t data)

Writes register in the Si72xx sensor.

uint32_t
sl_si72xx_read_magfield_data(I2C_TypeDef *i2c, uint8_t addr, int16_t *magData)

Read out Si72xx Magnetic Field Conversion Data Command can only be issued if Si72xx in idle mode.

uint32_t
sl_si72xx_from_idle_go_to_sleep(I2C_TypeDef *i2c, uint8_t addr)

Puts Si72xx into Sleep mode (lowest power).

uint32_t
sl_si72xx_from_idle_go_to_sltimeena(I2C_TypeDef *i2c, uint8_t addr)

Puts Si72xx into Sleep-Timer-Enabled mode.

uint32_t
sl_si72xx_wake_up_and_idle(I2C_TypeDef *i2c, uint8_t addr)

Wake-up Si72xx and places sensor in idle-mode.

uint32_t
sl_si72xx_read_magfield_data_and_sleep(I2C_TypeDef *i2c, uint8_t addr, Si72xxFieldScale_t mTScale, Si72xxSleepMode_t sleepMode, int16_t *magFieldData)

Wake-up SI72xx, performs a magnetic-field conversion with FIR, and places Si72xx back to sleep-mode.

int32_t
sl_si72xx_convert_data_codes_to_magnetic_field(Si72xxFieldScale_t fieldScale, int16_t dataCode)

Convert Si7210 I2C Data Readings to Magnetic Field in microTeslas.

uint32_t
sl_si72xx_enter_sleep_mode(I2C_TypeDef *i2c, uint8_t addr, Si72xxSleepMode_t sleepMode)

Wake-up Si72xx, and set sleep-mode option.

uint32_t
sl_si72xx_enter_latch_mode(I2C_TypeDef *i2c, uint8_t addr)

Wake-up Si72xx, and configures output for Latch mode.

uint32_t
sl_si72xx_read_temperature_and_sleep(I2C_TypeDef *i2c, uint8_t addr, int32_t *rawTemp)

Wakes up SI72xx, performs temperature conversion and places Si72xx into SI72XX_SLEEP sleep-mode.

uint32_t
sl_si72xx_read_temp_correction_data_and_sleep(I2C_TypeDef *i2c, uint8_t addr, int16_t *offsetValue, int16_t *gainValue)

Wakes up SI72xx, performs temperature conversion and places Si72xx into SI72XX_SLEEP sleep-mode.

uint32_t
sl_si72xx_read_corrected_temp_and_sleep(I2C_TypeDef *i2c, uint8_t addr, int16_t offsetData, int16_t gainData, int32_t *correctedTemp)

Wakes up SI72xx, performs a temperature conversion, and places sensor back to sleep.

uint32_t
sl_si72xx_identify_and_sleep(I2C_TypeDef *i2c, uint8_t addr, uint8_t *partId, uint8_t *partRev)

Wake-up Si72xx, read out part Revision and ID, and place Si72xx back to SLEEP sleep-mode.

uint32_t
sl_si72xx_read_variant_and_sleep(I2C_TypeDef *i2c, uint8_t addr, uint8_t *basePn, uint8_t *pnVariant)

Wake-up Si72xx, read out Si72xx base part-number and variant, and place sensor back to SLEEP sleep-mode.

Enumeration Documentation#

Si72xxFieldScale_t#

Si72xxFieldScale_t

DEFINES ***********************************.

ENUMS ************************************ Si72xx magnetic field full-scales

Enumerator
SI7210_20MT
SI7210_200MT

Definition at line 94 of file hardware/driver/si72xx/inc/sl_si72xx.h

Si72xxSleepMode_t#

Si72xxSleepMode_t

Si72xx sleep modes.

Enumerator
SI72XX_SLEEP_MODE
SI72XX_SLTIMEENA_MODE

Definition at line 100 of file hardware/driver/si72xx/inc/sl_si72xx.h

Function Documentation#

sl_si72xx_read_register#

uint32_t sl_si72xx_read_register (I2C_TypeDef * i2c, uint8_t addr, uint8_t reg, uint8_t * data)

PROTOTYPES **********************************.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[in]reg

The register address.

[out]data

The data read from the sensor.

Reads register from the Si72xx sensor. Command can only be issued if Si72xx in idle mode.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 130 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_write_register#

uint32_t sl_si72xx_write_register (I2C_TypeDef * i2c, uint8_t addr, uint8_t reg, uint8_t data)

Writes register in the Si72xx sensor.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[in]reg

The register address.

[in]data

The data to write to the sensor.

Command can only be issued if Si72xx in idle mode.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 156 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_read_magfield_data#

uint32_t sl_si72xx_read_magfield_data (I2C_TypeDef * i2c, uint8_t addr, int16_t * magData)

Read out Si72xx Magnetic Field Conversion Data Command can only be issued if Si72xx in idle mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[out]magData

Mag-field conversion reading, signed 16-bit integer.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 179 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_from_idle_go_to_sleep#

uint32_t sl_si72xx_from_idle_go_to_sleep (I2C_TypeDef * i2c, uint8_t addr)

Puts Si72xx into Sleep mode (lowest power).

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

Command can only be issued if Si72xx in idle mode.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 198 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_from_idle_go_to_sltimeena#

uint32_t sl_si72xx_from_idle_go_to_sltimeena (I2C_TypeDef * i2c, uint8_t addr)

Puts Si72xx into Sleep-Timer-Enabled mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

Si72xx periodically wakes-up, samples the magnetic field, updates the output, and goes back to sleep-timer-enabled mode. Command can only be issued if Si72xx in idle mode.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 217 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_wake_up_and_idle#

uint32_t sl_si72xx_wake_up_and_idle (I2C_TypeDef * i2c, uint8_t addr)

Wake-up Si72xx and places sensor in idle-mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 233 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_read_magfield_data_and_sleep#

uint32_t sl_si72xx_read_magfield_data_and_sleep (I2C_TypeDef * i2c, uint8_t addr, Si72xxFieldScale_t mTScale, Si72xxSleepMode_t sleepMode, int16_t * magFieldData)

Wake-up SI72xx, performs a magnetic-field conversion with FIR, and places Si72xx back to sleep-mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[in]mTScale

mTScale= Si7210_20MT: 20mT full-scale magnetic-field range. mTScale= Si7210_200MT: 200mT full-scale magnetic-field range.

[in]sleepMode

SI72XX_SLEEP: Sleep mode. Lowest power & doesn't update output. SI72XX_SLTIMEENA: Sleep-Timer-Enabled mode. Updates output periodically.

[out]magFieldData

Magnetic-field conversion reading, signed 16-bit integer.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 261 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_convert_data_codes_to_magnetic_field#

int32_t sl_si72xx_convert_data_codes_to_magnetic_field (Si72xxFieldScale_t fieldScale, int16_t dataCode)

Convert Si7210 I2C Data Readings to Magnetic Field in microTeslas.

Parameters
[in]fieldScale

20mT or 200mT full-scale magnetic field range.

[in]dataCode

signed 15-bit value read from hall sensor after magnetic field conversion.

Returns

  • microTeslas.


Definition at line 280 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_enter_sleep_mode#

uint32_t sl_si72xx_enter_sleep_mode (I2C_TypeDef * i2c, uint8_t addr, Si72xxSleepMode_t sleepMode)

Wake-up Si72xx, and set sleep-mode option.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[in]sleepMode

SI72XX_SLEEP: Puts Si72xx into sleep mode. Lowest power & doesn't update. SI72XX_SLTIMEENA: Si72xx into sltimeena mode. Updates output periodically.

If Si72xx is in a sleep-mode, it requires a wake-up command first. Useful for placing Si72xx in SLTIMEENA mode from SLEEP mode, or vice-versa.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 304 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_enter_latch_mode#

uint32_t sl_si72xx_enter_latch_mode (I2C_TypeDef * i2c, uint8_t addr)

Wake-up Si72xx, and configures output for Latch mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

Switch point = 0mT w/ 0.2mT hysteresis

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 323 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_read_temperature_and_sleep#

uint32_t sl_si72xx_read_temperature_and_sleep (I2C_TypeDef * i2c, uint8_t addr, int32_t * rawTemp)

Wakes up SI72xx, performs temperature conversion and places Si72xx into SI72XX_SLEEP sleep-mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[out]rawTemp

Temperature measurement in millidegree Celsius.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 343 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_read_temp_correction_data_and_sleep#

uint32_t sl_si72xx_read_temp_correction_data_and_sleep (I2C_TypeDef * i2c, uint8_t addr, int16_t * offsetValue, int16_t * gainValue)

Wakes up SI72xx, performs temperature conversion and places Si72xx into SI72XX_SLEEP sleep-mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[out]offsetValue

Temperature offset correction.

[out]gainValue

Temperature gain correction.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 368 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_read_corrected_temp_and_sleep#

uint32_t sl_si72xx_read_corrected_temp_and_sleep (I2C_TypeDef * i2c, uint8_t addr, int16_t offsetData, int16_t gainData, int32_t * correctedTemp)

Wakes up SI72xx, performs a temperature conversion, and places sensor back to sleep.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[out]offsetData

Temperature measurement in millidegree Celsius.

[in]gainData

Offset correction data.

[in]correctedTemp

Gain correction data.

Temperature calculation is performed using compensation data.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 398 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_identify_and_sleep#

uint32_t sl_si72xx_identify_and_sleep (I2C_TypeDef * i2c, uint8_t addr, uint8_t * partId, uint8_t * partRev)

Wake-up Si72xx, read out part Revision and ID, and place Si72xx back to SLEEP sleep-mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[out]partId

Si72xx part ID.

[out]partRev

Si72xx part Revision.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 425 of file hardware/driver/si72xx/inc/sl_si72xx.h

sl_si72xx_read_variant_and_sleep#

uint32_t sl_si72xx_read_variant_and_sleep (I2C_TypeDef * i2c, uint8_t addr, uint8_t * basePn, uint8_t * pnVariant)

Wake-up Si72xx, read out Si72xx base part-number and variant, and place sensor back to SLEEP sleep-mode.

Parameters
[in]i2c

Pointer to the I2C peripheral register block.

[in]addr

The I2C address of the sensor.

[out]basePn

Si72xx part ID.

[out]pnVariant

Si72xx part Revision.

Returns

  • Returns zero on success. Otherwise returns error codes based on the I2CSPM.


Definition at line 451 of file hardware/driver/si72xx/inc/sl_si72xx.h