42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
67#define ANGLE_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
77#define ANGLE_RETVAL uint8_t
80#define ANGLE_INIT_ERROR 0xFF
87#define ANGLE_ERROR_REG_MASK 0x34
88#define ANGLE_EXTENDED_ERROR_REG_MASK 0x36
89#define ANGLE_EXTENDED_ERROR_REG 0x26
90#define ANGLE_ERROR_REG 0x24
91#define ANGLE_STATUS_REG 0x22
92#define ANGLE_SETTINGS_REG 0x1E
99#define ANGLE_CDS_NO_CHANGLE 0x0000 << 13
100#define ANGLE_CDS_IDLE_MODE 0x0002 << 13
101#define ANGLE_CDS_RUN_MODE 0x0003 << 13
108#define ANGLE_HDR_RESET_0 0x0000 << 12
109#define ANGLE_HDR_RESET_1 0x0001 << 12
116#define ANGLE_SFR_RESET_0 0x0000 << 11
117#define ANGLE_SFR_RESET_1 0x0001 << 11
124#define ANGLE_CSR_STA_0 0x0000 << 9
125#define ANGLE_CSR_STA_1 0x0001 << 9
132#define ANGLE_CXE_0 0x0000 << 8
133#define ANGLE_CXE_1 0x0001 << 8
140 #define ANGLE_CER_0 0x0000 << 7
141 #define ANGLE_CER_1 0x0001 << 7
#define ANGLE_RETVAL
Definition angle.h:77
void angle_set_config(angle_t *ctx, uint16_t set_value)
Setting angle configuration.
uint16_t angle_get_angle(angle_t *ctx)
Read angle.
void angle_generic_write(angle_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint16_t angle_get_temperature(angle_t *ctx)
Read temperature.
ANGLE_RETVAL angle_init(angle_t *ctx, angle_cfg_t *cfg)
Initialization function.
void angle_default_cfg(angle_t *ctx)
Click Default Configuration function.
void angle_generic_read(angle_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint16_t angle_get_magnetics(angle_t *ctx)
Read magnetics.
uint16_t angle_get_status(angle_t *ctx, uint8_t reg)
Read angle status.
void angle_cfg_setup(angle_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition angle.h:171
uint32_t i2c_speed
Definition angle.h:179
pin_name_t scl
Definition angle.h:174
pin_name_t sda
Definition angle.h:175
uint8_t i2c_address
Definition angle.h:180
Click ctx object definition.
Definition angle.h:155
i2c_master_t i2c
Definition angle.h:159
uint8_t slave_address
Definition angle.h:163