39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
74#define ANGLE8_REG_ZERO_SETTING_LSB 0x00
75#define ANGLE8_REG_ZERO_SETTING_MSB 0x01
76#define ANGLE8_REG_BIAS_CURRENT_TIMING 0x02
77#define ANGLE8_REG_ENABLE_TRIMMING 0x03
78#define ANGLE8_REG_CYCLE_TIME_LSB 0x04
79#define ANGLE8_REG_CYCLE_TIME_MSB 0x05
80#define ANGLE8_REG_MAGNETIC_FIELD_CONFIG 0x06
81#define ANGLE8_REG_ND_CONFIG 0x07
82#define ANGLE8_REG_ASC_MODE_THRESHOLD 0x08
83#define ANGLE8_REG_ROTATION_DIRECTION 0x09
84#define ANGLE8_REG_ASC_MODE_REFERENCE 0x0A
85#define ANGLE8_REG_ASC_MODE_CONFIG 0x0B
86#define ANGLE8_REG_FILTER_WINDOW 0x0E
87#define ANGLE8_REG_ERROR_FLAGS 0x1A
88#define ANGLE8_REG_ALARM_FLAGS 0x1B
94#define ANGLE8_CMD_READ_ANGLE 0x00
95#define ANGLE8_CMD_READ_REGISTER 0x40
96#define ANGLE8_CMD_WRITE_REGISTER 0x80
97#define ANGLE8_CMD_STORE_SINGLE_REGISTER 0xE0
98#define ANGLE8_CMD_STORE_ALL_REGISTERS 0xC0
99#define ANGLE8_CMD_RESTORE_ALL_REGISTERS 0xA0
100#define ANGLE8_CMD_CLEAR_ERROR_FLAGS 0x20
118#define ANGLE8_ROTATION_DIRECTION_CW 0x00
119#define ANGLE8_ROTATION_DIRECTION_CCW 0x80
125#define ANGLE8_RESOLUTION 0xFFFF
126#define ANGLE8_FULL_CIRCLE 360.0
132#define ANGLE8_CYCLE_TIME_MAX 6553.5
133#define ANGLE8_CYCLE_TIME_100MS 100.0
134#define ANGLE8_CYCLE_TIME_MIN 0.2
149#define ANGLE8_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
150#define ANGLE8_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
168#define ANGLE8_MAP_MIKROBUS( cfg, mikrobus ) \
169 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
170 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
171 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
172 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
173 cfg.nd = MIKROBUS( mikrobus, MIKROBUS_AN ); \
174 cfg.dv = MIKROBUS( mikrobus, MIKROBUS_RST ); \
175 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
176 cfg.mgl = MIKROBUS( mikrobus, MIKROBUS_INT )
angle8_return_value_t
Angle 8 Click return value data.
Definition angle8.h:232
@ ANGLE8_OK
Definition angle8.h:233
@ ANGLE8_ERROR
Definition angle8.h:234
err_t angle8_read_register(angle8_t *ctx, uint8_t reg, uint8_t *data_out)
Angle 8 read register function.
err_t angle8_read_angle(angle8_t *ctx, float *angle)
Angle 8 read angle function.
uint8_t angle8_get_dv_pin(angle8_t *ctx)
Angle 8 get dv pin function.
void angle8_disable_device(angle8_t *ctx)
Angle 8 disable device function.
err_t angle8_store_single_register(angle8_t *ctx, uint8_t reg)
Angle 8 store single register function.
uint8_t angle8_get_nd_pin(angle8_t *ctx)
Angle 8 get nd pin function.
err_t angle8_init(angle8_t *ctx, angle8_cfg_t *cfg)
Angle 8 initialization function.
err_t angle8_default_cfg(angle8_t *ctx)
Angle 8 default configuration function.
uint8_t angle8_get_mgl_pin(angle8_t *ctx)
Angle 8 get mgl pin function.
void angle8_cfg_setup(angle8_cfg_t *cfg)
Angle 8 configuration object setup function.
err_t angle8_store_all_registers(angle8_t *ctx)
Angle 8 store all registers function.
void angle8_enable_device(angle8_t *ctx)
Angle 8 enable device function.
err_t angle8_clear_error_flags(angle8_t *ctx)
Angle 8 clear error flags function.
err_t angle8_write_register(angle8_t *ctx, uint8_t reg, uint8_t data_in)
Angle 8 write register function.
err_t angle8_set_cycle_time(angle8_t *ctx, float time_ms)
Angle 8 set cycle time function.
This file contains SPI specific macros, functions, etc.
Angle 8 Click configuration object.
Definition angle8.h:207
pin_name_t nd
Definition angle8.h:215
spi_master_chip_select_polarity_t cs_polarity
Definition angle8.h:223
pin_name_t sck
Definition angle8.h:211
spi_master_mode_t spi_mode
Definition angle8.h:222
pin_name_t mgl
Definition angle8.h:218
pin_name_t dv
Definition angle8.h:216
pin_name_t mosi
Definition angle8.h:210
uint32_t spi_speed
Definition angle8.h:221
pin_name_t en
Definition angle8.h:217
pin_name_t miso
Definition angle8.h:209
pin_name_t cs
Definition angle8.h:212
Angle 8 Click context object.
Definition angle8.h:186
digital_in_t dv
Definition angle8.h:192
spi_master_t spi
Definition angle8.h:196
digital_out_t en
Definition angle8.h:188
digital_in_t nd
Definition angle8.h:191
digital_in_t mgl
Definition angle8.h:193
pin_name_t chip_select
Definition angle8.h:198