22 #include "si7210_config.h"
38 #ifndef SI7210_CONFIG_I2C_DEVICE
39 #define SI7210_CONFIG_I2C_DEVICE (I2C0)
42 #ifndef SI7210_CONFIG_I2C_BUS_ADDRESS
43 #define SI7210_CONFIG_I2C_BUS_ADDRESS (0x30)
46 #ifndef SI7210_CONFIG_DEVICE_ID
47 #define SI7210_CONFIG_DEVICE_ID 0x11
50 #ifndef SI7210_CONFIG_GPIO_PORT_OUT1
51 #define SI7210_CONFIG_GPIO_PORT_OUT1 gpioPortB
54 #ifndef SI7210_CONFIG_GPIO_PIN_OUT1
55 #define SI7210_CONFIG_GPIO_PIN_OUT1 11
59 #define SI7210_I2C_DEVICE ( SI7210_CONFIG_I2C_DEVICE )
60 #define SI7210_I2C_DEVICE_BUS_ADDRESS ( SI7210_CONFIG_I2C_BUS_ADDRESS )
61 #define SI7210_I2C_DEVICE_BUS_TIMEOUT ( SI7210_CONFIG_I2C_BUS_TIMEOUT )
62 #define SI7210_GPIO_PORT_OUT1 ( SI7210_CONFIG_GPIO_PORT_OUT1 )
63 #define SI7210_GPIO_PIN_OUT1 ( SI7210_CONFIG_GPIO_PIN_OUT1 )
64 #define SI7210_DEVICE_ID ( SI7210_CONFIG_DEVICE_ID )
77 #define SI7210_ERROR_I2C_TRANSFER_FAILED 0x0001
78 #define SI7210_ERROR_INVALID_DEVICE_ID 0x0002
79 #define SI7210_ERROR_CONFIG_INVALID_MODE 0x0003
80 #define SI7210_ERROR_OTP_BUSY 0x0004
81 #define SI7210_ERROR_READ_TIMEOUT 0x0005
93 #define SI7210_CONFIG_MODE_THRESHOLD 0x01
94 #define SI7210_CONFIG_MODE_MEASURE 0x02
96 #define SI7210_CONFIG_SCALE_20mT 0x00
97 #define SI7210_CONFIG_SCALE_200mT 0x01
99 #define SI7210_CONFIG_POLARITY_OMNI 0x00
100 #define SI7210_CONFIG_POLARITY_NEG 0x01
101 #define SI7210_CONFIG_POLARITY_POS 0x02
103 #define SI7210_CONFIG_THRESHOLD_MIN 0.08f
104 #define SI7210_CONFIG_THRESHOLD_MAX 19.2f
116 typedef void * SI7210_Config;
117 typedef void (*SI7210_IntCallback)(uint8_t level);
124 typedef struct __SI7210_ConfigMeasure {
128 uint32_t samplePeriod;
130 } SI7210_ConfigMeasure;
137 typedef struct __SI7210_ConfigThreshold {
140 SI7210_IntCallback callback;
146 } SI7210_ConfigThreshold;
168 uint32_t SI7210_regReadOTP ( uint8_t otpAddr, uint8_t *otpData );
Driver for the Silicon Labs Si7210 Hall Effect Sensor.
uint32_t SI7210_regRead(uint8_t addr, uint8_t *data)
Reads register from the Si7021 device.
uint32_t SI7210_suspend(void)
Puts the Si7210 chip in sleep mode.
uint32_t SI7210_regSetBits(uint8_t addr, uint8_t mask)
Sets the given bit(s) in a register in the Si7021 device.
uint32_t SI7210_measure(float *result)
Performs a measurement.
void SI7210_deInit(void)
De-initializes the Si7210 chip. Disables the sensor power domain, this also disables other sensors...
uint32_t SI7210_regClearBits(uint8_t addr, uint8_t mask)
Clears the given bit(s) in a register in the Si7021 device.
uint32_t SI7210_init(void)
Initializes the Si7210 chip.
uint32_t SI7210_regWrite(uint8_t addr, uint8_t data)
Writes a register in the Si7021 device.
uint32_t SI7210_config(SI7210_Config config)
Configures the Si7210 chip.