c3dhall10 2.0.0.0
c3dhall10.h File Reference

This file contains API for 3D Hall 10 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  c3dhall10_data_t
 3D Hall 10 Click data object. More...
 
struct  c3dhall10_t
 3D Hall 10 Click context object. More...
 
struct  c3dhall10_cfg_t
 3D Hall 10 Click configuration object. More...
 

Macros

#define C3DHALL10_REG_DEVICE_CONFIG   0x00
 3D Hall 10 register list.
 
#define C3DHALL10_REG_SENSOR_CONFIG   0x01
 
#define C3DHALL10_REG_SYSTEM_CONFIG   0x02
 
#define C3DHALL10_REG_ALERT_CONFIG   0x03
 
#define C3DHALL10_REG_X_THRX_CONFIG   0x04
 
#define C3DHALL10_REG_Y_THRX_CONFIG   0x05
 
#define C3DHALL10_REG_Z_THRX_CONFIG   0x06
 
#define C3DHALL10_REG_T_THRX_CONFIG   0x07
 
#define C3DHALL10_REG_CONV_STATUS   0x08
 
#define C3DHALL10_REG_X_CH_RESULT   0x09
 
#define C3DHALL10_REG_Y_CH_RESULT   0x0A
 
#define C3DHALL10_REG_Z_CH_RESULT   0x0B
 
#define C3DHALL10_REG_TEMP_RESULT   0x0C
 
#define C3DHALL10_REG_AFE_STATUS   0x0D
 
#define C3DHALL10_REG_SYS_STATUS   0x0E
 
#define C3DHALL10_REG_TEST_CONFIG   0x0F
 
#define C3DHALL10_REG_OSC_MONITOR   0x10
 
#define C3DHALL10_REG_MAG_GAIN_CONFIG   0x11
 
#define C3DHALL10_REG_MAG_OFFSET_CONFIG   0x12
 
#define C3DHALL10_REG_ANGLE_RESULT   0x13
 
#define C3DHALL10_REG_MAGNITUDE_RESULT   0x14
 
#define C3DHALL10_CONV_AVG_1X   0x0000
 3D Hall 10 device config register settings.
 
#define C3DHALL10_CONV_AVG_2X   0x1000
 
#define C3DHALL10_CONV_AVG_4X   0x2000
 
#define C3DHALL10_CONV_AVG_8X   0x3000
 
#define C3DHALL10_CONV_AVG_16X   0x4000
 
#define C3DHALL10_CONV_AVG_32X   0x5000
 
#define C3DHALL10_CONV_AVG_BIT_MASK   0x7000
 
#define C3DHALL10_MAG_TEMPCO_0   0x0000
 
#define C3DHALL10_MAG_TEMPCO_0p12   0x0100
 
#define C3DHALL10_MAG_TEMPCO_0p03   0x0200
 
#define C3DHALL10_MAG_TEMPCO_0p2   0x0300
 
#define C3DHALL10_MAG_TEMPCO_BIT_MASK   0x0300
 
#define C3DHALL10_OPERATING_MODE_CONFIG   0x0000
 
#define C3DHALL10_OPERATING_MODE_STANDBY   0x0010
 
#define C3DHALL10_OPERATING_MODE_MEASURE   0x0020
 
#define C3DHALL10_OPERATING_MODE_TRIGGER   0x0030
 
#define C3DHALL10_OPERATING_MODE_DUTY_CYCLED   0x0040
 
#define C3DHALL10_OPERATING_MODE_SLEEP   0x0050
 
#define C3DHALL10_OPERATING_MODE_DEEP_SLEEP   0x0060
 
#define C3DHALL10_OPERATING_MODE_BIT_MASK   0x0070
 
#define C3DHALL10_T_CH_EN_DISABLE   0x0000
 
#define C3DHALL10_T_CH_EN_ENABLE   0x0008
 
#define C3DHALL10_T_CH_EN_BIT_MASK   0x0008
 
#define C3DHALL10_T_RATE_PER_CONV_AVG   0x0000
 
#define C3DHALL10_T_RATE_ONCE_PER_CONV   0x0004
 
#define C3DHALL10_T_RATE_BIT_MASK   0x0004
 
#define C3DHALL10_T_HLT_EN_DISABLE   0x0000
 
#define C3DHALL10_T_HLT_EN_ENABLE   0x0002
 
#define C3DHALL10_T_HLT_EN_BIT_MASK   0x0002
 
#define C3DHALL10_ANGLE_EN_NO_ANGLE   0x0000
 3D Hall 10 sensor config register settings.
 
#define C3DHALL10_ANGLE_EN_XY_ANGLE   0x4000
 
#define C3DHALL10_ANGLE_EN_YZ_ANGLE   0x8000
 
#define C3DHALL10_ANGLE_EN_XZ_ANGLE   0xC000
 
#define C3DHALL10_ANGLE_EN_BIT_MASK   0xC000
 
#define C3DHALL10_SLEEPTIME_1MS   0x0000
 
#define C3DHALL10_SLEEPTIME_5MS   0x0400
 
#define C3DHALL10_SLEEPTIME_10MS   0x0800
 
#define C3DHALL10_SLEEPTIME_15MS   0x0C00
 
#define C3DHALL10_SLEEPTIME_20MS   0x1000
 
#define C3DHALL10_SLEEPTIME_30MS   0x1400
 
#define C3DHALL10_SLEEPTIME_50MS   0x1800
 
#define C3DHALL10_SLEEPTIME_100MS   0x1C00
 
#define C3DHALL10_SLEEPTIME_500MS   0x2000
 
#define C3DHALL10_SLEEPTIME_1000MS   0x2400
 
#define C3DHALL10_SLEEPTIME_BIT_MASK   0x3C00
 
#define C3DHALL10_MAG_CH_EN_DISABLE   0x0000
 
#define C3DHALL10_MAG_CH_EN_ENABLE_X   0x0040
 
#define C3DHALL10_MAG_CH_EN_ENABLE_Y   0x0080
 
#define C3DHALL10_MAG_CH_EN_ENABLE_XY   0x00C0
 
#define C3DHALL10_MAG_CH_EN_ENABLE_Z   0x0100
 
#define C3DHALL10_MAG_CH_EN_ENABLE_ZX   0x0140
 
#define C3DHALL10_MAG_CH_EN_ENABLE_YZ   0x0180
 
#define C3DHALL10_MAG_CH_EN_ENABLE_XYZ   0x01C0
 
#define C3DHALL10_MAG_CH_EN_ENABLE_XYX   0x0200
 
#define C3DHALL10_MAG_CH_EN_ENABLE_YXY   0x0240
 
#define C3DHALL10_MAG_CH_EN_ENABLE_YZY   0x0280
 
#define C3DHALL10_MAG_CH_EN_ENABLE_ZYZ   0x02C0
 
#define C3DHALL10_MAG_CH_EN_ENABLE_ZXZ   0x0300
 
#define C3DHALL10_MAG_CH_EN_ENABLE_XZX   0x0340
 
#define C3DHALL10_MAG_CH_EN_ENABLE_XYZYX   0x0380
 
#define C3DHALL10_MAG_CH_EN_ENABLE_XYZZYX   0x03C0
 
#define C3DHALL10_MAG_CH_EN_BIT_MASK   0x03C0
 
#define C3DHALL10_Z_RANGE_50mT   0x0000
 
#define C3DHALL10_Z_RANGE_25mT   0x0010
 
#define C3DHALL10_Z_RANGE_100mT   0x0020
 
#define C3DHALL10_Z_RANGE_BIT_MASK   0x0030
 
#define C3DHALL10_Y_RANGE_50mT   0x0000
 
#define C3DHALL10_Y_RANGE_25mT   0x0004
 
#define C3DHALL10_Y_RANGE_100mT   0x0008
 
#define C3DHALL10_Y_RANGE_BIT_MASK   0x000C
 
#define C3DHALL10_X_RANGE_50mT   0x0000
 
#define C3DHALL10_X_RANGE_25mT   0x0001
 
#define C3DHALL10_X_RANGE_100mT   0x0002
 
#define C3DHALL10_X_RANGE_BIT_MASK   0x0003
 
#define C3DHALL10_DIAG_SEL_ALL_DP_DIAG_ALL   0x0000
 3D Hall 10 system config register settings.
 
#define C3DHALL10_DIAG_SEL_EN_DP_ONLY_DIAG_ALL   0x1000
 
#define C3DHALL10_DIAG_SEL_ALL_DP_DIAG_SEQ   0x2000
 
#define C3DHALL10_DIAG_SEL_EN_DP_ONLY_DIAG_SEQ   0x3000
 
#define C3DHALL10_DIAG_SEL_BIT_MASK   0x3000
 
#define C3DHALL10_TRIGGER_MODE_SPI_CMD   0x0000
 
#define C3DHALL10_TRIGGER_MODE_CS_PULSE   0x0200
 
#define C3DHALL10_TRIGGER_MODE_ALERT_PULSE   0x0400
 
#define C3DHALL10_TRIGGER_MODE_BIT_MASK   0x0600
 
#define C3DHALL10_DATA_TYPE_32BIT_REG   0x0000
 
#define C3DHALL10_DATA_TYPE_12BIT_XY_DATA   0x0040
 
#define C3DHALL10_DATA_TYPE_12BIT_XZ_DATA   0x0080
 
#define C3DHALL10_DATA_TYPE_12BIT_ZY_DATA   0x00C0
 
#define C3DHALL10_DATA_TYPE_12BIT_XT_DATA   0x0100
 
#define C3DHALL10_DATA_TYPE_12BIT_YT_DATA   0x0140
 
#define C3DHALL10_DATA_TYPE_12BIT_ZT_DATA   0x0180
 
#define C3DHALL10_DATA_TYPE_12BIT_AM_DATA   0x01C0
 
#define C3DHALL10_DATA_TYPE_BIT_MASK   0x01C0
 
#define C3DHALL10_DIAG_EN_DISABLE   0x0000
 
#define C3DHALL10_DIAG_EN_ENABLE   0x0020
 
#define C3DHALL10_DIAG_EN_BIT_MASK   0x0020
 
#define C3DHALL10_Z_HLT_EN_DISABLE   0x0000
 
#define C3DHALL10_Z_HLT_EN_ENABLE   0x0004
 
#define C3DHALL10_Z_HLT_EN_BIT_MASK   0x0004
 
#define C3DHALL10_Y_HLT_EN_DISABLE   0x0000
 
#define C3DHALL10_Y_HLT_EN_ENABLE   0x0002
 
#define C3DHALL10_Y_HLT_EN_BIT_MASK   0x0002
 
#define C3DHALL10_X_HLT_EN_DISABLE   0x0000
 
#define C3DHALL10_X_HLT_EN_ENABLE   0x0001
 
#define C3DHALL10_X_HLT_EN_BIT_MASK   0x0001
 
#define C3DHALL10_ALERT_LATCH_DISABLE   0x0000
 3D Hall 10 alert config register settings.
 
#define C3DHALL10_ALERT_LATCH_ENABLE   0x2000
 
#define C3DHALL10_ALERT_LATCH_BIT_MASK   0x2000
 
#define C3DHALL10_ALERT_MODE_INTERRUPT   0x0000
 
#define C3DHALL10_ALERT_MODE_SWITCH   0x1000
 
#define C3DHALL10_ALERT_MODE_BIT_MASK   0x1000
 
#define C3DHALL10_STATUS_ALRT_AFE_SYS_NO_ASSERT   0x0000
 
#define C3DHALL10_STATUS_ALRT_AFE_SYS_ASSERT   0x0800
 
#define C3DHALL10_STATUS_ALRT_BIT_MASK   0x0800
 
#define C3DHALL10_RSLT_ALRT_NO_CONV_COMPLETE   0x0000
 
#define C3DHALL10_RSLT_ALRT_CONV_COMPLETE   0x0100
 
#define C3DHALL10_RSLT_ALRT_BIT_MASK   0x0100
 
#define C3DHALL10_THRX_COUNT_1_CONV   0x0000
 
#define C3DHALL10_THRX_COUNT_2_CONV   0x0010
 
#define C3DHALL10_THRX_COUNT_3_CONV   0x0020
 
#define C3DHALL10_THRX_COUNT_4_CONV   0x0030
 
#define C3DHALL10_THRX_COUNT_BIT_MASK   0x0030
 
#define C3DHALL10_T_THRX_ALRT_NO_CROSSED   0x0000
 
#define C3DHALL10_T_THRX_ALRT_CROSSED   0x0008
 
#define C3DHALL10_T_THRX_ALRT_BIT_MASK   0x0008
 
#define C3DHALL10_Z_THRX_ALRT_NO_CROSSED   0x0000
 
#define C3DHALL10_Z_THRX_ALRT_CROSSED   0x0004
 
#define C3DHALL10_Z_THRX_ALRT_BIT_MASK   0x0004
 
#define C3DHALL10_Y_THRX_ALRT_NO_CROSSED   0x0000
 
#define C3DHALL10_Y_THRX_ALRT_CROSSED   0x0002
 
#define C3DHALL10_Y_THRX_ALRT_BIT_MASK   0x0002
 
#define C3DHALL10_X_THRX_ALRT_NO_CROSSED   0x0000
 
#define C3DHALL10_X_THRX_ALRT_CROSSED   0x0001
 
#define C3DHALL10_X_THRX_ALRT_BIT_MASK   0x0001
 
#define C3DHALL10_GAIN_SELECTION_NO_AXIS   0x0000
 3D Hall 10 mag gain config register settings.
 
#define C3DHALL10_GAIN_SELECTION_X_AXIS   0x4000
 
#define C3DHALL10_GAIN_SELECTION_Y_AXIS   0x8000
 
#define C3DHALL10_GAIN_SELECTION_Z_AXIS   0xC000
 
#define C3DHALL10_GAIN_SELECTION_BIT_MASK   0xC000
 
#define C3DHALL10_GAIN_VALUE_BIT_MASK   0x07FF
 
#define C3DHALL10_CONV_STATUS_RDY   0x2000
 3D Hall 10 conv status register settings.
 
#define C3DHALL10_CONV_STATUS_A   0x1000
 
#define C3DHALL10_CONV_STATUS_T   0x0800
 
#define C3DHALL10_CONV_STATUS_Z   0x0400
 
#define C3DHALL10_CONV_STATUS_Y   0x0200
 
#define C3DHALL10_CONV_STATUS_X   0x0100
 
#define C3DHALL10_CONV_STATUS_SET_COUNT   0x0070
 
#define C3DHALL10_CONV_STATUS_ALRT_STATUS   0x0003
 
#define C3DHALL10_ANGLE_RESOLUTION   16.0
 3D Hall 10 calculation values.
 
#define C3DHALL10_TEMP_SENS_T0   25.0
 
#define C3DHALL10_TEMP_ADC_T0   17522
 
#define C3DHALL10_TEMP_ADC_RESOLUTION   60.0
 
#define C3DHALL10_XYZ_RESOLUTION   32768.0
 
#define C3DHALL10_SPI_READ_MASK   0x80
 3D Hall 10 SPI read/write bit mask.
 
#define C3DHALL10_SPI_WRITE_MASK   0x7F
 
#define C3DHALL10_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define C3DHALL10_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define C3DHALL10_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  c3dhall10_return_value_t { C3DHALL10_OK = 0 , C3DHALL10_ERROR = -1 }
 3D Hall 10 Click return value data. More...
 

Functions

void c3dhall10_cfg_setup (c3dhall10_cfg_t *cfg)
 3D Hall 10 configuration object setup function.
 
err_t c3dhall10_init (c3dhall10_t *ctx, c3dhall10_cfg_t *cfg)
 3D Hall 10 initialization function.
 
err_t c3dhall10_default_cfg (c3dhall10_t *ctx)
 3D Hall 10 default configuration function.
 
err_t c3dhall10_write_frame (c3dhall10_t *ctx, uint8_t reg_addr, uint16_t data_in)
 3D Hall 10 write frame function.
 
err_t c3dhall10_read_frame (c3dhall10_t *ctx, uint8_t reg_addr, uint16_t *data_out, uint16_t *status)
 3D Hall 10 read frame function.
 
err_t c3dhall10_read_data (c3dhall10_t *ctx, c3dhall10_data_t *data_out)
 3D Hall 10 read data function.
 
uint8_t c3dhall10_get_alert_pin (c3dhall10_t *ctx)
 3D Hall 10 get alert pin function.
 

Detailed Description

This file contains API for 3D Hall 10 Click Driver.

Enumeration Type Documentation

◆ c3dhall10_return_value_t

3D Hall 10 Click return value data.

Predefined enum values for driver return values.

Enumerator
C3DHALL10_OK 
C3DHALL10_ERROR