28#ifndef MAGNETICROTARY6_H
29#define MAGNETICROTARY6_H
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 MAGNETICROTARY6_REG_NOP 0x0000u
75#define MAGNETICROTARY6_REG_ERRFL 0x0001u
76#define MAGNETICROTARY6_REG_PROG 0x0003u
77#define MAGNETICROTARY6_REG_DIA 0x3FF5u
78#define MAGNETICROTARY6_REG_AGC 0x3FF9u
79#define MAGNETICROTARY6_REG_SIN_DATA 0x3FFAu
80#define MAGNETICROTARY6_REG_COS_DATA 0x3FFBu
81#define MAGNETICROTARY6_REG_VEL 0x3FFCu
82#define MAGNETICROTARY6_REG_MAG 0x3FFDu
83#define MAGNETICROTARY6_REG_ANGLEUNC 0x3FFEu
84#define MAGNETICROTARY6_REG_ANGLECOM 0x3FFFu
85#define MAGNETICROTARY6_REG_ECC_CHECKSUM 0x00D1u
91#define MAGNETICROTARY6_REG_DISABLE 0x0015u
92#define MAGNETICROTARY6_REG_ZPOSM 0x0016u
93#define MAGNETICROTARY6_REG_ZPOSL 0x0017u
94#define MAGNETICROTARY6_REG_SETTINGS1 0x0018u
95#define MAGNETICROTARY6_REG_SETTINGS2 0x0019u
96#define MAGNETICROTARY6_REG_SETTINGS3 0x001Au
97#define MAGNETICROTARY6_REG_ECC 0x001Bu
115#define MAGNETICROTARY6_ERRFL_CORDIC_OF 0x0400u
116#define MAGNETICROTARY6_ERRFL_OFF_COMP_NOT_FIN 0x0200u
117#define MAGNETICROTARY6_ERRFL_BRKHALL 0x0100u
118#define MAGNETICROTARY6_ERRFL_WDTST 0x0080u
119#define MAGNETICROTARY6_ERRFL_CRC_ERROR 0x0040u
120#define MAGNETICROTARY6_ERRFL_CMD_ERROR 0x0020u
121#define MAGNETICROTARY6_ERRFL_FRAMING_ERROR 0x0010u
122#define MAGNETICROTARY6_ERRFL_P2RAM_ERROR 0x0008u
123#define MAGNETICROTARY6_ERRFL_P2RAM_WARNING 0x0004u
124#define MAGNETICROTARY6_ERRFL_MAGHALF 0x0002u
125#define MAGNETICROTARY6_ERRFL_AGC_WARNING 0x0001u
131#define MAGNETICROTARY6_PROG_PROGVER 0x0040u
132#define MAGNETICROTARY6_PROG_PROGOTP 0x0008u
133#define MAGNETICROTARY6_PROG_OTPREF 0x0004u
134#define MAGNETICROTARY6_PROG_PROGEN 0x0001u
140#define MAGNETICROTARY6_DIA_SPI_CNT 0x1800u
141#define MAGNETICROTARY6_DIA_FUSA_ERROR 0x0400u
142#define MAGNETICROTARY6_DIA_AGC_FIN 0x0200u
143#define MAGNETICROTARY6_DIA_OFF_COMP_FIN 0x0100u
144#define MAGNETICROTARY6_DIA_SINOFF_FIN 0x0080u
145#define MAGNETICROTARY6_DIA_COSOFF_FIN 0x0040u
146#define MAGNETICROTARY6_DIA_MAGHALF_FLAG 0x0020u
147#define MAGNETICROTARY6_DIA_COMP_H 0x0010u
148#define MAGNETICROTARY6_DIA_COMP_L 0x0008u
149#define MAGNETICROTARY6_DIA_CORDIC_OF 0x0004u
150#define MAGNETICROTARY6_DIA_LOOPSFIN 0x0002u
151#define MAGNETICROTARY6_DIA_VDD_MODE_5V 0x0001u
152#define MAGNETICROTARY6_DIA_VDD_MODE_3V 0x0000u
158#define MAGNETICROTARY6_DISABLE_FILTER_DISABLE 0x0040u
159#define MAGNETICROTARY6_DISABLE_BRKHALL_SET 0x003Cu
160#define MAGNETICROTARY6_DISABLE_ABI_OFF 0x0002u
161#define MAGNETICROTARY6_DISABLE_UVW_OFF 0x0001u
167#define MAGNETICROTARY6_ZPOSL_DIA2_EN 0x0080u
168#define MAGNETICROTARY6_ZPOSL_DIA1_EN 0x0040u
169#define MAGNETICROTARY6_ZPOSL_LSB 0x003Fu
175#define MAGNETICROTARY6_SETTINGS1_DIA3_EN 0x0040u
176#define MAGNETICROTARY6_SETTINGS1_K_MIN 0x0038u
177#define MAGNETICROTARY6_SETTINGS1_K_MAX 0x0007u
183#define MAGNETICROTARY6_SETTINGS2_PWMON 0x0080u
184#define MAGNETICROTARY6_SETTINGS2_DATA_SELECT 0x0040u
185#define MAGNETICROTARY6_SETTINGS2_ABI_DEC 0x0020u
186#define MAGNETICROTARY6_SETTINGS2_DAECDIS 0x0010u
187#define MAGNETICROTARY6_SETTINGS2_UVW_ABI 0x0008u
188#define MAGNETICROTARY6_SETTINGS2_DIR_CW 0x0000u
189#define MAGNETICROTARY6_SETTINGS2_DIR_CCW 0x0004u
190#define MAGNETICROTARY6_SETTINGS2_DIR_MASK 0x0004u
191#define MAGNETICROTARY6_SETTINGS2_NOISESET 0x0002u
192#define MAGNETICROTARY6_SETTINGS2_IWIDTH 0x0001u
198#define MAGNETICROTARY6_SETTINGS3_ABIRES_MASK 0x00E0u
199#define MAGNETICROTARY6_SETTINGS3_HYS_MASK 0x0018u
200#define MAGNETICROTARY6_SETTINGS3_UVWPP_1PP 0x0000u
201#define MAGNETICROTARY6_SETTINGS3_UVWPP_2PP 0x0001u
202#define MAGNETICROTARY6_SETTINGS3_UVWPP_3PP 0x0002u
203#define MAGNETICROTARY6_SETTINGS3_UVWPP_4PP 0x0003u
204#define MAGNETICROTARY6_SETTINGS3_UVWPP_5PP 0x0004u
205#define MAGNETICROTARY6_SETTINGS3_UVWPP_6PP 0x0005u
206#define MAGNETICROTARY6_SETTINGS3_UVWPP_7PP 0x0006u
207#define MAGNETICROTARY6_SETTINGS3_UVWPP_MASK 0x0007u
213#define MAGNETICROTARY6_ECC_EN 0x0080u
214#define MAGNETICROTARY6_ECC_CHSUM_MASK 0x007Fu
220#define MAGNETICROTARY6_DIE_BOTTOM 0
221#define MAGNETICROTARY6_DIE_TOP 1
227#define MAGNETICROTARY6_DATA_RESOLUTION 0x3FFFu
228#define MAGNETICROTARY6_FULL_CIRCLE 360u
234#define MAGNETICROTARY6_DIR_CW 0
235#define MAGNETICROTARY6_DIR_CCW 1
243#define MAGNETICROTARY6_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
244#define MAGNETICROTARY6_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
262#define MAGNETICROTARY6_MAP_MIKROBUS( cfg, mikrobus ) \
263 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
264 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
265 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
266 cfg.cs_t = MIKROBUS( mikrobus, MIKROBUS_CS ); \
267 cfg.cs_b = MIKROBUS( mikrobus, MIKROBUS_PWM );
err_t magneticrotary6_set_direction(magneticrotary6_t *ctx, uint8_t die_sel, uint8_t dir)
Magnetic Rotary 6 set direction function.
err_t magneticrotary6_write_register(magneticrotary6_t *ctx, uint8_t die_sel, uint16_t reg, uint16_t data_in)
Magnetic Rotary 6 write register function.
void magneticrotary6_cfg_setup(magneticrotary6_cfg_t *cfg)
Magnetic Rotary 6 configuration object setup function.
err_t magneticrotary6_init(magneticrotary6_t *ctx, magneticrotary6_cfg_t *cfg)
Magnetic Rotary 6 initialization function.
err_t magneticrotary6_get_angle(magneticrotary6_t *ctx, uint8_t die_sel, float *angle)
Magnetic Rotary 6 get angle function.
err_t magneticrotary6_default_cfg(magneticrotary6_t *ctx)
Magnetic Rotary 6 default configuration function.
err_t magneticrotary6_read_register(magneticrotary6_t *ctx, uint8_t die_sel, uint16_t reg, uint16_t *data_out)
Magnetic Rotary 6 read register b function.
magneticrotary6_return_value_t
Magnetic Rotary 6 Click return value data.
Definition magneticrotary6.h:311
@ MAGNETICROTARY6_OK
Definition magneticrotary6.h:312
@ MAGNETICROTARY6_ERROR
Definition magneticrotary6.h:313
This file contains SPI specific macros, functions, etc.
Magnetic Rotary 6 Click configuration object.
Definition magneticrotary6.h:291
pin_name_t cs_b
Definition magneticrotary6.h:297
spi_master_chip_select_polarity_t cs_polarity
Definition magneticrotary6.h:302
pin_name_t sck
Definition magneticrotary6.h:295
pin_name_t cs_t
Definition magneticrotary6.h:296
spi_master_mode_t spi_mode
Definition magneticrotary6.h:301
pin_name_t mosi
Definition magneticrotary6.h:294
uint32_t spi_speed
Definition magneticrotary6.h:300
pin_name_t miso
Definition magneticrotary6.h:293
Magnetic Rotary 6 Click context object.
Definition magneticrotary6.h:277
spi_master_t spi
Definition magneticrotary6.h:279
pin_name_t cs_b
Definition magneticrotary6.h:282
pin_name_t cs_t
Definition magneticrotary6.h:281