geomagnetic 2.0.0.0
geomagnetic.h File Reference

This file contains API for Geomagnetic Click driver. More...

#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  geomagnetic_axis_t
 GeoMagnetic axis structure. More...
 
struct  geomagnetic_s
 Click ctx object definition. More...
 
struct  geomagnetic_cfg_t
 Click configuration structure definition. More...
 

Macros

#define GEOMAGNETIC_MAP_MIKROBUS(cfg, mikrobus)
 
#define GEOMAGNETIC_MASTER_I2C   0
 
#define GEOMAGNETIC_MASTER_SPI   1
 
#define GEOMAGNETIC_RETVAL   uint8_t
 
#define GEOMAGNETIC_OK   0x00
 
#define GEOMAGNETIC_INIT_ERROR   0xFF
 
#define GEOMAG_DUMMY   0x00
 
#define GEOMAG_SPI_INTERFACE   0x00
 
#define GEOMAG_I2C_INTERFACE   0x01
 
#define GEOMAG_READ_CMD   0x80
 
#define GEOMAG_DEV_ADDR   0x10
 
#define GEOMAG_ID_REG   0x40
 
#define GEOMAG_RESERVED1_REG   0x41
 
#define GEOMAG_DATAX_LSB_REG   0x42
 
#define GEOMAG_DATAX_MSB_REG   0x43
 
#define GEOMAG_DATAY_LSB_REG   0x44
 
#define GEOMAG_DATAY_MSB_REG   0x45
 
#define GEOMAG_DATAZ_LSB_REG   0x46
 
#define GEOMAG_DATAZ_MSB_REG   0x47
 
#define GEOMAG_RHALL_LSB_REG   0x48
 
#define GEOMAG_RHALL_MSB_REG   0x49
 
#define GEOMAG_INTERRUPT_STATUS_REG   0x4A
 
#define GEOMAG_POWER_AND_RESET_CON_REG   0x4B
 
#define GEOMAG_DATARATE_AND_OPMODE_CON_REG   0x4C
 
#define GEOMAG_INTERR_AND_AXIS_EN_REG   0x4D
 
#define GEOMAG_INTERR_AND_CHANNEL_EN_REG   0x4E
 
#define GEOMAG_LOW_THRESHOLD_REG   0x4F
 
#define GEOMAG_HIGH_THRESHOLD_REG   0x50
 
#define GEOMAG_REPETITION_XY_CON_REG   0x51
 
#define GEOMAG_REPETITION_Z_CON_REG   0x52
 
#define GEOMAG_RESERVED2_REG   0x53
 
#define GEOMAG_RESERVED3_REG   0x54
 
#define GEOMAG_RESERVED4_REG   0x55
 
#define GEOMAG_RESERVED5_REG   0x56
 
#define GEOMAG_RESERVED6_REG   0x57
 
#define GEOMAG_RESERVED7_REG   0x58
 
#define GEOMAG_RESERVED8_REG   0x59
 
#define GEOMAG_RESERVED9_REG   0x5A
 
#define GEOMAG_RESERVED10_REG   0x5B
 
#define GEOMAG_RESERVED11_REG   0x5C
 
#define GEOMAG_RESERVED12_REG   0x5D
 
#define GEOMAG_RESERVED13_REG   0x5E
 
#define GEOMAG_RESERVED14_REG   0x5F
 
#define GEOMAG_RESERVED15_REG   0x60
 
#define GEOMAG_RESERVED16_REG   0x61
 
#define GEOMAG_RESERVED17_REG   0x62
 
#define GEOMAG_RESERVED18_REG   0x63
 
#define GEOMAG_RESERVED19_REG   0x64
 
#define GEOMAG_RESERVED20_REG   0x65
 
#define GEOMAG_RESERVED21_REG   0x66
 
#define GEOMAG_RESERVED22_REG   0x67
 
#define GEOMAG_RESERVED23_REG   0x68
 
#define GEOMAG_RESERVED24_REG   0x69
 
#define GEOMAG_RESERVED25_REG   0x6A
 
#define GEOMAG_RESERVED26_REG   0x6B
 
#define GEOMAG_RESERVED27_REG   0x6C
 
#define GEOMAG_RESERVED28_REG   0x6D
 
#define GEOMAG_RESERVED29_REG   0x6E
 
#define GEOMAG_RESERVED30_REG   0x6F
 
#define GEOMAG_RESERVED31_REG   0x70
 
#define GEOMAG_RESERVED32_REG   0x71
 
#define GEOMAG_OK   0x00
 
#define GEOMAG_ADDR_ERR   0x01
 
#define GEOMAG_INTERRUPT_OCCURED   0x02
 
#define GEOMAG_NBYTES_ERR   0x03
 
#define GEOMAG_DATA_READY   0x01
 
#define GEOMAG_DATA_NOT_READY   0x00
 
#define GEOMAG_SUSPEND_MODE_SPI4_EN   0x00
 
#define GEOMAG_SLEEP_MODE   0x01
 
#define GEOMAG_SOFT_RESET_EN   0x82
 
#define GEOMAG_SPI3_EN   0x04
 
#define GEOMAG_NORMAL_OPMODE_DR_10HZ   0x00
 
#define GEOMAG_FORCED_OPMODE   0x02
 
#define GEOMAG_SLEEP_OPMODE   0x06
 
#define GEOMAG_DR_2HZ   0x08
 
#define GEOMAG_DR_6HZ   0x10
 
#define GEOMAG_DR_8HZ   0x18
 
#define GEOMAG_DR_15HZ   0x20
 
#define GEOMAG_DR_20HZ   0x28
 
#define GEOMAG_DR_25HZ   0x30
 
#define GEOMAG_DR_30HZ   0x38
 
#define GEOMAG_INTERR_DISABLED_THRESHOLDS_ENABLED   0x00
 
#define GEOMAG_LOWTHRESHOLD_X_DISABLED   0x01
 
#define GEOMAG_LOWTHRESHOLD_Y_DISABLED   0x02
 
#define GEOMAG_LOWTHRESHOLD_Z_DISABLED   0x04
 
#define GEOMAG_HIGHTHRESHOLD_X_DISABLED   0x08
 
#define GEOMAG_HIGHTHRESHOLD_Y_DISABLED   0x10
 
#define GEOMAG_HIGHTHRESHOLD_Z_DISABLED   0x20
 
#define GEOMAG_OVERFLOW_PIN_IND_EN   0x40
 
#define GEOMAG_DATAOVERRUN_IND_EN   0x80
 
#define GEOMAG_CHANNELS_ENABLED_INTERR_DATAREADY_ACTIVE_LOW   0x00
 
#define GEOMAG_INTERR_PIN_ACTIVE_HIGH   0x01
 
#define GEOMAG_INTERR_LATCHED   0x02
 
#define GEOMAG_DATAREADY_ACTIVE_HIGH   0x04
 
#define GEOMAG_CHANNEL_X_DISABLED   0x08
 
#define GEOMAG_CHANNEL_Y_DISABLED   0x10
 
#define GEOMAG_CHANNEL_Z_DISABLED   0x20
 
#define GEOMAG_INTERR_PIN_EN   0x40
 
#define GEOMAG_DATAREADY_PIN_EN   0x80
 

Typedefs

typedef uint8_t geomagnetic_select_t
 Communication type.
 
typedef void(* geomagnetic_master_io_t) (struct geomagnetic_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct geomagnetic_s geomagnetic_t
 Click ctx object definition.
 

Functions

void geomagnetic_cfg_setup (geomagnetic_cfg_t *cfg)
 Config Object Initialization function.
 
GEOMAGNETIC_RETVAL geomagnetic_init (geomagnetic_t *ctx, geomagnetic_cfg_t *cfg)
 Initialization function.
 
void geomagnetic_default_cfg (geomagnetic_t *ctx)
 Click Default Configuration function.
 
void geomagnetic_generic_write (geomagnetic_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void geomagnetic_generic_read (geomagnetic_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
GEOMAGNETIC_RETVAL geomagnetic_write_byte (geomagnetic_t *ctx, uint8_t input_data, uint8_t address)
 Write byte function.
 
GEOMAGNETIC_RETVAL geomagnetic_read_data (geomagnetic_t *ctx, uint8_t *out_buf, uint8_t address, uint8_t len)
 Read data function.
 
uint8_t geomagnetic_check_ready (geomagnetic_t *ctx)
 Check ready function.
 
void geomagnetic_read_axis_data (geomagnetic_t *ctx, geomagnetic_axis_t *geomag_axis, uint16_t *resolution_hall)
 Read axis data function.
 
GEOMAGNETIC_RETVAL geomagnetic_check_interrupt (geomagnetic_t *ctx)
 Check interrupt function.
 
uint8_t get_interrupt (geomagnetic_t *ctx)
 Get interrupt function.
 
void geomagnetic_software_reset (geomagnetic_t *ctx)
 Software reset function.
 
void geomagnetic_power_on_reset (geomagnetic_t *ctx)
 Power ON reset function.
 

Detailed Description

This file contains API for Geomagnetic Click driver.