EFM32 Happy Gecko Software Documentation
efm32hg-doc-5.1.2
|
Driver for the Silicon Labs Si7210 Hall Effect Sensor.
Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com
This file is licensed under the Silicon Labs 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 si7210.c.
#include <stddef.h>
#include "i2cspm.h"
#include "gpiointerrupt.h"
#include "em_cmu.h"
#include "thunderboard/board.h"
#include "thunderboard/util.h"
#include "thunderboard/si7210.h"
Go to the source code of this file.
Functions | |
uint32_t | SI7210_config (SI7210_Config config) |
Configures the Si7210 chip. More... | |
void | SI7210_deInit (void) |
De-initializes the Si7210 chip. Disables the sensor power domain, this also disables other sensors. More... | |
uint32_t | SI7210_init (void) |
Initializes the Si7210 chip. More... | |
uint32_t | SI7210_measure (float *result) |
Performs a measurement. More... | |
uint32_t | SI7210_regClearBits (uint8_t addr, uint8_t mask) |
Clears the given bit(s) in a register in the Si7021 device. More... | |
uint32_t | SI7210_regRead (uint8_t addr, uint8_t *data) |
Reads register from the Si7021 device. More... | |
uint32_t | SI7210_regSetBits (uint8_t addr, uint8_t mask) |
Sets the given bit(s) in a register in the Si7021 device. More... | |
uint32_t | SI7210_regWrite (uint8_t addr, uint8_t data) |
Writes a register in the Si7021 device. More... | |
uint32_t | SI7210_suspend (void) |
Puts the Si7210 chip in sleep mode. More... | |
uint32_t SI7210_config | ( | SI7210_Config | config | ) |
Configures the Si7210 chip.
[in] | config | The structure, which contains the configuration parameters |
Definition at line 202 of file si7210.c.
References GPIO_IntConfig(), GPIOINT_CallbackRegister(), SI7210_regClearBits(), SI7210_regSetBits(), and SI7210_regWrite().
Referenced by SI7210_suspend().
void SI7210_deInit | ( | void | ) |
De-initializes the Si7210 chip. Disables the sensor power domain, this also disables other sensors.
Definition at line 150 of file si7210.c.
References BOARD_envSensEnable(), GPIO_IntConfig(), GPIO_PinModeSet(), GPIOINT_CallbackUnRegister(), and gpioModeDisabled.
uint32_t SI7210_init | ( | void | ) |
Initializes the Si7210 chip.
{DOXYGEN_INCLUDE_HALL_EFFECT_SENSOR} {DO_NOT_INCLUDE_WITH_DOXYGEN} DO_NOT_INCLUDE_WITH_DOXYGEN
Definition at line 102 of file si7210.c.
References BOARD_envSensEnable(), GPIO_PinModeSet(), GPIOINT_Init(), gpioModeInput, SI7210_regRead(), and UTIL_delay().
uint32_t SI7210_measure | ( | float * | result | ) |
Performs a measurement.
[out] | result | The measured field strength value in mT |
Definition at line 374 of file si7210.c.
References SI7210_regRead().
uint32_t SI7210_regClearBits | ( | uint8_t | addr, |
uint8_t | mask | ||
) |
Clears the given bit(s) in a register in the Si7021 device.
[in] | addr | The address of the register |
[in] | mask | The mask specifies which bits should be clear. If a given bit of the mask is 1 that register bit will be cleared to 0. All the other register bits will be untouched. |
Definition at line 531 of file si7210.c.
References SI7210_regRead(), and SI7210_regWrite().
Referenced by SI7210_config().
uint32_t SI7210_regRead | ( | uint8_t | addr, |
uint8_t * | data | ||
) |
Reads register from the Si7021 device.
[in] | addr | The register address to read from in the sensor |
[out] | data | The data read from the device |
Definition at line 423 of file si7210.c.
References I2C_TransferSeq_TypeDef::addr, I2C_TransferSeq_TypeDef::buf, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE_READ, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
Referenced by SI7210_init(), SI7210_measure(), SI7210_regClearBits(), and SI7210_regSetBits().
uint32_t SI7210_regSetBits | ( | uint8_t | addr, |
uint8_t | mask | ||
) |
Sets the given bit(s) in a register in the Si7021 device.
[in] | addr | The address of the register |
[in] | mask | The mask specifies which bits should be set. If a given bit of the mask is 1 that register bit will be set to 1. All the other register bits will be untouched. |
Definition at line 497 of file si7210.c.
References SI7210_regRead(), and SI7210_regWrite().
Referenced by SI7210_config(), and SI7210_suspend().
uint32_t SI7210_regWrite | ( | uint8_t | addr, |
uint8_t | data | ||
) |
Writes a register in the Si7021 device.
[in] | addr | The register address to write |
[in] | data | The data to write to the register |
Definition at line 459 of file si7210.c.
References I2C_TransferSeq_TypeDef::addr, I2C_TransferSeq_TypeDef::buf, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE_WRITE, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
Referenced by SI7210_config(), SI7210_regClearBits(), and SI7210_regSetBits().
uint32_t SI7210_suspend | ( | void | ) |
Puts the Si7210 chip in sleep mode.
Definition at line 170 of file si7210.c.
References SI7210_config(), and SI7210_regSetBits().