28#ifndef MAGNETICROTARY3_H
29#define MAGNETICROTARY3_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 MAGNETICROTARY3_REG_NOP 0x0000
75#define MAGNETICROTARY3_REG_ERRFL 0x0001
76#define MAGNETICROTARY3_REG_PROG 0x0003
77#define MAGNETICROTARY3_REG_DIA 0x3FF5
78#define MAGNETICROTARY3_REG_AGC 0x3FF9
79#define MAGNETICROTARY3_REG_SIN_DATA 0x3FFA
80#define MAGNETICROTARY3_REG_COS_DATA 0x3FFB
81#define MAGNETICROTARY3_REG_VEL 0x3FFC
82#define MAGNETICROTARY3_REG_MAG 0x3FFD
83#define MAGNETICROTARY3_REG_ANGLEUNC 0x3FFE
84#define MAGNETICROTARY3_REG_ANGLECOM 0x3FFF
85#define MAGNETICROTARY3_REG_ECC_CHECKSUM 0x00D1
91#define MAGNETICROTARY3_REG_DISABLE 0x0015
92#define MAGNETICROTARY3_REG_ZPOSM 0x0016
93#define MAGNETICROTARY3_REG_ZPOSL 0x0017
94#define MAGNETICROTARY3_REG_SETTINGS1 0x0018
95#define MAGNETICROTARY3_REG_SETTINGS2 0x0019
96#define MAGNETICROTARY3_REG_SETTINGS3 0x001A
97#define MAGNETICROTARY3_REG_ECC 0x001B
115#define MAGNETICROTARY3_DATA_RESOLUTION 0x3FFF
116#define MAGNETICROTARY3_FULL_CIRCLE 360
124#define MAGNETICROTARY3_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
125#define MAGNETICROTARY3_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
143#define MAGNETICROTARY3_MAP_MIKROBUS( cfg, mikrobus ) \
144 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
145 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
146 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
147 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS );
err_t magneticrotary3_read_register(magneticrotary3_t *ctx, uint16_t reg, uint16_t *data_out)
Magnetic Rotary 3 read register function.
void magneticrotary3_cfg_setup(magneticrotary3_cfg_t *cfg)
Magnetic Rotary 3 configuration object setup function.
err_t magneticrotary3_get_angle(magneticrotary3_t *ctx, float *angle)
Magnetic Rotary 3 get angle function.
err_t magneticrotary3_init(magneticrotary3_t *ctx, magneticrotary3_cfg_t *cfg)
Magnetic Rotary 3 initialization function.
err_t magneticrotary3_write_register(magneticrotary3_t *ctx, uint16_t reg, uint16_t data_in)
Magnetic Rotary 3 write register function.
magneticrotary3_return_value_t
Magnetic Rotary 3 Click return value data.
Definition magneticrotary3.h:189
@ MAGNETICROTARY3_OK
Definition magneticrotary3.h:190
@ MAGNETICROTARY3_ERROR
Definition magneticrotary3.h:191
This file contains SPI specific macros, functions, etc.
Magnetic Rotary 3 Click configuration object.
Definition magneticrotary3.h:170
spi_master_chip_select_polarity_t cs_polarity
Definition magneticrotary3.h:180
pin_name_t sck
Definition magneticrotary3.h:174
spi_master_mode_t spi_mode
Definition magneticrotary3.h:179
pin_name_t mosi
Definition magneticrotary3.h:173
uint32_t spi_speed
Definition magneticrotary3.h:178
pin_name_t miso
Definition magneticrotary3.h:172
pin_name_t cs
Definition magneticrotary3.h:175
Magnetic Rotary 3 Click context object.
Definition magneticrotary3.h:157
spi_master_t spi
Definition magneticrotary3.h:159
pin_name_t chip_select
Definition magneticrotary3.h:161