HALL - Hall Effect SensorBSP > Thunderboard Sense BSP

Detailed Description

Driver for Hall effect sensor.

Modules

Si7210 - Hall Effect Sensor
Driver for the Silicon Labs Si7210 Hall effect sensor.
 

Data Structures

struct  __HALL_Config
 Structure to configure the Hall effect sensor device.
 

Typedefs

typedef struct __HALL_Config HALL_Config
 Structure to configure the Hall effect sensor device.
 
typedef void(* HALL_IntCallback) (bool pinHigh)
 

Functions

uint32_t HALL_configure (HALL_Config *config)
 Configures the Si7210 chip.
 
void HALL_deInit (void)
 De-initializes the Hall sensor. Disables the sensor power domain.
 
uint32_t HALL_deInitDevice (void)
 Does device-specific de-initializaiton for the Si7210 chip.
 
float HALL_getTamperLevel (void)
 Returns the tamper level configured in the chip.
 
uint32_t HALL_init (void)
 Initializes the Hall sensor.
 
uint32_t HALL_initDevice (void)
 Does device-specific initializaiton for the Si7210 chip.
 
uint32_t HALL_measure (uint32_t scale, float *result)
 Performs a measurement.
 
void HALL_registerCallback (HALL_IntCallback callback)
 Register GPIO interrupt callback function. This function will be called when the ALERT pin of the Hall sensor changes state and the interrupt functions are enabled.
 

Error Codes

#define HALL_OK   0x0000
 
#define HALL_ERROR_DRIVER_NOT_INITIALIZED   0x0001
 
#define HALL_ERROR_I2C_TRANSACTION_FAILED   0x0002
 
#define HALL_ERROR_DEVICE_ID_MISMATCH   0x0003
 

Configuration values

#define HALL_CONFIG_POLARITY_OMNIPOLAR   0x00
 
#define HALL_CONFIG_POLARITY_NEGATIVE   0x01
 
#define HALL_CONFIG_POLARITY_POSITIVE   0x02
 

Macro Definition Documentation

#define HALL_CONFIG_POLARITY_NEGATIVE   0x01

Negative field polarity

Definition at line 44 of file hall.h.

#define HALL_CONFIG_POLARITY_OMNIPOLAR   0x00

Omnipolar field polarity

Definition at line 43 of file hall.h.

#define HALL_CONFIG_POLARITY_POSITIVE   0x02

Positive field polarity

Definition at line 45 of file hall.h.

#define HALL_ERROR_DEVICE_ID_MISMATCH   0x0003

The device ID does not match the expected value

Definition at line 36 of file hall.h.

Referenced by HALL_initDevice().

#define HALL_ERROR_DRIVER_NOT_INITIALIZED   0x0001

The driver is not initialized

Definition at line 34 of file hall.h.

#define HALL_ERROR_I2C_TRANSACTION_FAILED   0x0002

I2C transaction failed

Definition at line 35 of file hall.h.

Referenced by SI7210_registerRead(), SI7210_registerWrite(), and SI7210_wakeUp().

Typedef Documentation

typedef void(* HALL_IntCallback) (bool pinHigh)

Interrupt callback function

Definition at line 59 of file hall.h.

Function Documentation

void HALL_deInit ( void  )

De-initializes the Hall sensor. Disables the sensor power domain.

Returns
None

Definition at line 82 of file hall.c.

References BOARD_hallSensorEnable(), BOARD_hallSensorEnableIRQ(), and HALL_deInitDevice().

uint32_t HALL_deInitDevice ( void  )

Does device-specific de-initializaiton for the Si7210 chip.

Returns
Returns zero on OK, non-zero otherwise

Definition at line 89 of file hall_si7210.c.

Referenced by HALL_deInit().

float HALL_getTamperLevel ( void  )

Returns the tamper level configured in the chip.

Returns
The tamper level in mT

Definition at line 228 of file hall_si7210.c.

uint32_t HALL_init ( void  )

Initializes the Hall sensor.

Returns
Returns zero on OK, non-zero otherwise

Definition at line 54 of file hall.c.

References BOARD_hallSensorEnable(), BOARD_hallSensorEnableIRQ(), BOARD_hallSensorSetIRQCallback(), HALL_initDevice(), and UTIL_delay().

uint32_t HALL_initDevice ( void  )

Does device-specific initializaiton for the Si7210 chip.

Returns
Returns zero on OK, non-zero otherwise

Definition at line 56 of file hall_si7210.c.

References HALL_ERROR_DEVICE_ID_MISMATCH, HALL_OK, SI7210_identify(), and SI7210_wakeUp().

Referenced by HALL_init().

uint32_t HALL_measure ( uint32_t  scale,
float *  result 
)

Performs a measurement.

Parameters
[in]scaleDesired scale in uT
[out]resultThe measured field strength value in mT
Returns
Returns zero on OK, non-zero otherwise

Definition at line 202 of file hall_si7210.c.

References SI7210_readmTDataSltimeena().

void HALL_registerCallback ( HALL_IntCallback  callback)

Register GPIO interrupt callback function. This function will be called when the ALERT pin of the Hall sensor changes state and the interrupt functions are enabled.

Parameters
[in]callbackPointer to the callback function
Returns
None

Definition at line 105 of file hall.c.