si72xx.c File Reference

Driver for the Si72xx Hall Effect Sensor.

Version
5.4.0

License

Copyright 2017 Silicon Labs, Inc. http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file si72xx.c .

#include " i2cspm.h "
#include " si72xx.h "
#include <stddef.h>
#include <stdbool.h>

Functions

int32_t Si72xx_ConvertDataCodesToMagneticField ( Si72xxFieldScale_t fieldScale, int16_t dataCode)
Convert Si7210 I2C Data Readings to Magnetic Field in microTeslas.
uint32_t Si72xx_EnterLatchMode ( I2C_TypeDef *i2c, uint8_t addr)
Wake-up Si72xx, and configures output for Latch mode. Switch point = 0mT w/ 0.2mT hysteresis.
uint32_t Si72xx_EnterSleepMode ( I2C_TypeDef *i2c, uint8_t addr, Si72xxSleepMode_t sleepMode)
Wake-up Si72xx, and set sleep-mode option. 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.
uint32_t Si72xx_FromIdle_GoToSleep ( I2C_TypeDef *i2c, uint8_t addr)
Puts Si72xx into Sleep mode (lowest power).. Command can only be issued if Si72xx is idle mode.
uint32_t Si72xx_FromIdle_GoToSltimeena ( I2C_TypeDef *i2c, uint8_t addr)
Puts Si72xx into Sleep-Timer-Enable mode. 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 is idle mode.
uint32_t Si72xx_IdentifyAndSleep ( I2C_TypeDef *i2c, uint8_t addr, uint8_t *partId, uint8_t *partRev)
uint32_t 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 is idle mode.
static uint32_t Si72xx_Read_OTP ( I2C_TypeDef *i2c, uint8_t addr, uint8_t otpAddr, uint8_t *otpData)
Read Si72xx OTP Data Command can only be issued if Si72xx is idle mode.
uint32_t Si72xx_Read_Register ( I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t *data)
Reads register from the Si72xx sensor. Command can only be issued if Si72xx is idle mode.
uint32_t Si72xx_ReadCorrectedTempAndSleep ( 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. Temperature calculation is performed using compensation data.
uint32_t Si72xx_ReadMagFieldDataAndSleep ( 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.
uint32_t Si72xx_ReadTempCorrectionDataAndSleep ( 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 Si72xx_ReadTemperatureAndSleep ( 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 Si72xx_ReadVariantAndSleep ( I2C_TypeDef *i2c, uint8_t addr, uint8_t *basePn, uint8_t *pnVariant)
static uint32_t Si72xx_Set_mT_Range ( I2C_TypeDef *i2c, uint8_t addr, Si72xxFieldScale_t mTScale)
Set magnetic-field output range, 20mT or 200mT full-scale Command can only be issued if Si72xx is idle mode.
uint32_t Si72xx_WakeUpAndIdle ( I2C_TypeDef *i2c, uint8_t addr)
Wake-up Si72xx and places sensor in idle-mode.
uint32_t Si72xx_Write_Register ( I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t data)
Writes register in the Si72xx sensor. Command can only be issued if Si72xx is idle mode.

Function Documentation

static uint32_t Si72xx_Read_OTP ( I2C_TypeDef * i2c,
uint8_t addr,
uint8_t otpAddr,
uint8_t * otpData
)
static

Read Si72xx OTP Data Command can only be issued if Si72xx is idle mode.

Parameters
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor
[in] otpAddr The OTB Byte address of the coefficients
[out] data OTP data read out

Definition at line 298 of file si72xx.c .

References Si72xx_Read_Register() , and Si72xx_Write_Register() .

Referenced by Si72xx_ReadTempCorrectionDataAndSleep() , and Si72xx_Set_mT_Range() .

static uint32_t Si72xx_Set_mT_Range ( I2C_TypeDef * i2c,
uint8_t addr,
Si72xxFieldScale_t mTScale
)
static

Set magnetic-field output range, 20mT or 200mT full-scale Command can only be issued if Si72xx is idle mode.

Parameters
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor
[in] mTScale 20mT or 200mT

Definition at line 330 of file si72xx.c .

References Si72xx_Read_OTP() , and Si72xx_Write_Register() .

Referenced by Si72xx_ReadMagFieldDataAndSleep() .