magneticrotary5 2.1.0.0
magneticrotary5.h File Reference

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

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_analog_in.h"

Go to the source code of this file.

Data Structures

struct  magneticrotary5_t
 Magnetic Rotary 5 Click context object. More...
 
struct  magneticrotary5_cfg_t
 Magnetic Rotary 5 Click configuration object. More...
 

Macros

#define MAGNETICROTARY5_CMD_WRITE_CONFIG   0x17
 Magnetic Rotary 5 command list.
 
#define MAGNETICROTARY5_CMD_SET_MT_COUNTER   0x14
 
#define MAGNETICROTARY5_CMD_EN_PROG   0x10
 
#define MAGNETICROTARY5_CMD_RD_MT_COUNTER   0x04
 
#define MAGNETICROTARY5_CMD_RD_ANGLE   0x00
 
#define MAGNETICROTARY5_CMD_WRITE_OTP   0x1F
 
#define MAGNETICROTARY5_CMD_PROG_OTP   0x19
 
#define MAGNETICROTARY5_CMD_READ_OTP   0x0F
 
#define MAGNETICROTARY5_CMD_READ_ANA   0x09
 
#define MAGNETICROTARY5_MASK_AGC_BITS   0x3F
 Magnetic Rotary 5 bit mask and range setting.
 
#define MAGNETICROTARY5_MASK_ANGLE_MSB   0x01
 
#define MAGNETICROTARY5_MASK_MT_CNT_MSB   0x01FE
 
#define MAGNETICROTARY5_MASK_MT_CNT_LSB   0x01
 
#define MAGNETICROTARY5_MASK_5_LSB   0x1F
 
#define MAGNETICROTARY5_MASK_3_LSB   0x07
 
#define MAGNETICROTARY5_MAX_DATA_LEN   8
 
#define MAGNETICROTARY5_MIN_DATA_LEN   1
 
#define MAGNETICROTARY5_MAX_MT_CNT   255
 
#define MAGNETICROTARY5_MIN_MT_CNT   (-256)
 
#define MAGNETICROTARY5_DEFAULT_MT_CNT   0
 
#define MAGNETICROTARY5_VREF_3V3   3.3
 Magnetic Rotary 5 ADC setting.
 
#define MAGNETICROTARY5_VREF_5V   5.0
 
#define MAGNETICROTARY5_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  magneticrotary5_return_value_t { MAGNETICROTARY5_OK = 0 , MAGNETICROTARY5_ERROR = -1 }
 Magnetic Rotary 5 Click return value data. More...
 

Functions

void magneticrotary5_cfg_setup (magneticrotary5_cfg_t *cfg)
 Magnetic Rotary 5 configuration object setup function.
 
err_t magneticrotary5_init (magneticrotary5_t *ctx, magneticrotary5_cfg_t *cfg)
 Magnetic Rotary 5 initialization function.
 
err_t magneticrotary5_default_cfg (magneticrotary5_t *ctx)
 Magnetic Rotary 5 default configuration function.
 
err_t magneticrotary5_write_cmd (magneticrotary5_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
 Magnetic Rotary 5 write cmd function.
 
err_t magneticrotary5_read_cmd (magneticrotary5_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t len)
 Magnetic Rotary 5 read cmd function.
 
err_t magneticrotary5_read_angle (magneticrotary5_t *ctx, uint8_t *agc, uint16_t *angle)
 Magnetic Rotary 5 read angle function.
 
err_t magneticrotary5_read_mt_cnt (magneticrotary5_t *ctx, int16_t *mt_cnt)
 Magnetic Rotary 5 read multi turn counter function.
 
err_t magneticrotary5_set_mt_cnt (magneticrotary5_t *ctx, int16_t mt_cnt)
 Magnetic Rotary 5 set multi turn counter function.
 
err_t magneticrotary5_read_raw_adc (magneticrotary5_t *ctx, uint16_t *raw_adc)
 Magnetic Rotary 5 read raw ADC value function.
 
err_t magneticrotary5_read_voltage (magneticrotary5_t *ctx, float *voltage)
 Magnetic Rotary 5 read voltage level function.
 
err_t magneticrotary5_set_vref (magneticrotary5_t *ctx, float vref)
 Magnetic Rotary 5 set vref function.
 

Detailed Description

This file contains API for Magnetic Rotary 5 Click Driver.

Enumeration Type Documentation

◆ magneticrotary5_return_value_t

Magnetic Rotary 5 Click return value data.

Predefined enum values for driver return values.

Enumerator
MAGNETICROTARY5_OK 
MAGNETICROTARY5_ERROR