magneticrotary2 2.0.0.0
magneticrotary2.h File Reference

This file contains API for Magnetic Rotary 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  magneticrotary2_t
 Magnetic Rotary 2 Click context object. More...
 
struct  magneticrotary2_cfg_t
 Magnetic Rotary 2 Click configuration object. More...
 

Macros

#define MAGNETICROTARY2_REG_CUST_RES_0   0x00
 Magnetic Rotary 2 registers list.
 
#define MAGNETICROTARY2_REG_CUST_RES_1   0x01
 
#define MAGNETICROTARY2_REG_CUST_RES_2   0x02
 
#define MAGNETICROTARY2_REG_CUST_RES_3   0x03
 
#define MAGNETICROTARY2_REG_CUST_RES_4   0x04
 
#define MAGNETICROTARY2_REG_CUST_RES_5   0x05
 
#define MAGNETICROTARY2_REG_CUST_RES_6   0x06
 
#define MAGNETICROTARY2_REG_CUST_CONFIG_0_MSB   0x07
 
#define MAGNETICROTARY2_REG_CUST_CONFIG_0_LSB   0x08
 
#define MAGNETICROTARY2_REG_CUST_CONFIG_1_MSB   0x09
 
#define MAGNETICROTARY2_REG_CUST_CONFIG_1_LSB   0x0A
 
#define MAGNETICROTARY2_REG_CUST_CONFIG_2   0x0B
 
#define MAGNETICROTARY2_REG_ZERO_RESET_2   0x0C
 
#define MAGNETICROTARY2_REG_ZERO_RESET_1   0x0D
 
#define MAGNETICROTARY2_REG_ZERO_RESET_0   0x0E
 
#define MAGNETICROTARY2_REG_UNLOCK   0x10
 
#define MAGNETICROTARY2_REG_PROGRAM   0x11
 
#define MAGNETICROTARY2_REG_CALIBRATION   0x12
 
#define MAGNETICROTARY2_REG_ERROR_BITS   0x21
 
#define MAGNETICROTARY2_REG_CALIBRATION_STAT   0x22
 
#define MAGNETICROTARY2_REG_POSITION   0x3F
 
#define MAGNETICROTARY2_UNLOCK_VALUE   0xAB
 Magnetic Rotary 2 register settings.
 
#define MAGNETICROTARY2_LOCK_VALUE   0xFF
 
#define MAGNETICROTARY2_PROGRAM_VALUE   0xA1
 
#define MAGNETICROTARY2_ODD_PARITY   0x01
 Magnetic Rotary 2 ODD parity flag.
 
#define MAGNETICROTARY2_MSEL1_READ_BIT   0x40
 Magnetic Rotary 2 read write bits.
 
#define MAGNETICROTARY2_MSEL0_WRITE_BIT   0x80
 
#define MAGNETICROTARY2_CC0_MSB_HW_ST_ZERO_EN   0x80
 Magnetic Rotary 2 custom config 0 registers settings.
 
#define MAGNETICROTARY2_CC0_MSB_HW_ACC_CALIB_EN   0x40
 
#define MAGNETICROTARY2_CC0_MSB_AXIS_MODE_OFF   0x20
 
#define MAGNETICROTARY2_CC0_MSB_IWIDTH_90   0x00
 
#define MAGNETICROTARY2_CC0_MSB_IWIDTH_180   0x04
 
#define MAGNETICROTARY2_CC0_MSB_IWIDTH_270   0x08
 
#define MAGNETICROTARY2_CC0_MSB_IWIDTH_360   0x0C
 
#define MAGNETICROTARY2_CC0_MSB_IPHASE_90   0x00
 
#define MAGNETICROTARY2_CC0_MSB_IPHASE_180   0x01
 
#define MAGNETICROTARY2_CC0_MSB_IPHASE_270   0x02
 
#define MAGNETICROTARY2_CC0_MSB_IPHASE_360   0x03
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_00   0x00
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_01   0x20
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_02   0x40
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_04   0x60
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_08   0x80
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_17   0xA0
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_35   0xC0
 
#define MAGNETICROTARY2_CC0_LSB_HYST_0_70   0xE0
 
#define MAGNETICROTARY2_CC0_LSB_DIR_CCW   0x10
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_18BIT   0x00
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_17BIT   0x01
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_16BIT   0x02
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_15BIT   0x03
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_14BIT   0x04
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_13BIT   0x05
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_12BIT   0x06
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_11BIT   0x07
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_10BIT   0x08
 
#define MAGNETICROTARY2_CC0_LSB_ABS_RES_MASK   0x0F
 
#define MAGNETICROTARY2_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define MAGNETICROTARY2_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define MAGNETICROTARY2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  magneticrotary2_msel_t { MAGNETICROTARY2_MSEL_0 , MAGNETICROTARY2_MSEL_1 }
 Magnetic Rotary 2 Click driver selector. More...
 
enum  magneticrotary2_return_value_t { MAGNETICROTARY2_OK = 0 , MAGNETICROTARY2_ERROR = -1 }
 Magnetic Rotary 2 Click return value data. More...
 

Functions

void magneticrotary2_cfg_setup (magneticrotary2_cfg_t *cfg)
 Magnetic Rotary 2 configuration object setup function.
 
void magneticrotary2_msel_pin_selection (magneticrotary2_cfg_t *cfg, magneticrotary2_msel_t msel)
 Magnetic Rotary 2 MSEL pin selection function.
 
err_t magneticrotary2_init (magneticrotary2_t *ctx, magneticrotary2_cfg_t *cfg)
 Magnetic Rotary 2 initialization function.
 
err_t magneticrotary2_default_cfg (magneticrotary2_t *ctx)
 Magnetic Rotary 2 default configuration function.
 
err_t magneticrotary2_write_register (magneticrotary2_t *ctx, uint8_t reg, uint8_t data_in)
 Magnetic Rotary 2 write register function.
 
err_t magneticrotary2_read_register (magneticrotary2_t *ctx, uint8_t reg, uint8_t *data_out)
 Magnetic Rotary 2 read register function.
 
err_t magneticrotary2_unlock_eeprom (magneticrotary2_t *ctx)
 Magnetic Rotary 2 unlock eeprom function.
 
err_t magneticrotary2_lock_eeprom (magneticrotary2_t *ctx)
 Magnetic Rotary 2 lock eeprom function.
 
err_t magneticrotary2_program_eeprom (magneticrotary2_t *ctx)
 Magnetic Rotary 2 program eeprom function.
 
err_t magneticrotary2_get_raw_data (magneticrotary2_t *ctx, uint32_t *data_out)
 Magnetic Rotary 2 get raw data function.
 
err_t magneticrotary2_get_angle (magneticrotary2_t *ctx, float *angle)
 Magnetic Rotary 2 get angle function.
 

Detailed Description

This file contains API for Magnetic Rotary 2 Click Driver.

Enumeration Type Documentation

◆ magneticrotary2_return_value_t

Magnetic Rotary 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
MAGNETICROTARY2_OK 
MAGNETICROTARY2_ERROR