angle4 2.0.0.0
angle4.h File Reference

This file contains API for Angle 4 Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  angle4_t
 Click ctx object definition. More...
 
struct  angle4_cfg_t
 Click configuration structure definition. More...
 

Macros

#define ANGLE4_MAP_MIKROBUS(cfg, mikrobus)
 
#define ANGLE4_RETVAL   uint8_t
 
#define ANGLE4_OK   0x00
 
#define ANGLE4_INIT_ERROR   0xFF
 
#define ANGLE4_REG_CUSTOMER_CFG_0   0x04
 
#define ANGLE4_REG_CUSTOMER_CFG_1   0x05
 
#define ANGLE4_REG_CUSTOMER_CFG_2   0x06
 
#define ANGLE4_REG_OPERATING_VOLTAGE   0x0A
 
#define ANGLE4_REG_UNLOCK_REGISTER   0x10
 
#define ANGLE4_REG_CUSTOMER_RESERVED_OTP   0x11
 
#define ANGLE4_REG_ST_ZERO_RESET_OTP   0x12
 
#define ANGLE4_REG_CUSTOMER_CONFIG_OTP   0x13
 
#define ANGLE4_REG_PROGRAM_OPERATING_VOLTAGE   0x14
 
#define ANGLE4_REG_CONFIG_OF_FULL_CALIBRATION_OTP   0x1B
 
#define ANGLE4_CCFG0_SELECT_UVW_MODE   0x80
 
#define ANGLE4_CCFG0_SELECT_PWM_MODE   0x00
 
#define ANGLE4_CCFG0_PWM_PERIOD_8193us   0x60
 
#define ANGLE4_CCFG0_PWM_PERIOD_4097us   0x40
 
#define ANGLE4_CCFG0_PWM_PERIOD_2049us   0x20
 
#define ANGLE4_CCFG0_PWM_PERIOD_1025us   0x00
 
#define ANGLE4_CCFG0_ABI_360edeg   0x18
 
#define ANGLE4_CCFG0_ABI_270edeg   0x10
 
#define ANGLE4_CCFG0_ABI_180edeg   0x08
 
#define ANGLE4_CCFG0_ABI_90edeg   0x00
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_8   0x07
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_7   0x06
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_6   0x05
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_5   0x04
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_4   0x03
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_3   0x02
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_2   0x01
 
#define ANGLE4_CCFG0_UVW_POLE_PAIRS_1   0x00
 
#define ANGLE4_CCFG1_ABI_CPR_4096   0x70
 
#define ANGLE4_CCFG1_ABI_CPR_2048   0x60
 
#define ANGLE4_CCFG1_ABI_CPR_1024   0x50
 
#define ANGLE4_CCFG1_ABI_CPR_512   0x40
 
#define ANGLE4_CCFG1_ABI_CPR_256   0x30
 
#define ANGLE4_CCFG1_ABI_CPR_128   0x20
 
#define ANGLE4_CCFG1_ABI_CPR_64   0x10
 
#define ANGLE4_CCFG1_ABI_CPR_32   0x00
 
#define ANGLE4_CCFG1_HYSTERESIS_1_4mdeg   0x09
 
#define ANGLE4_CCFG1_HYSTERESIS_0_7mdeg   0x08
 
#define ANGLE4_CCFG1_HYSTERESIS_0_35mdeg   0x07
 
#define ANGLE4_CCFG1_HYSTERESIS_0_17mdeg   0x06
 
#define ANGLE4_CCFG1_HYSTERESIS_0_08mdeg   0x05
 
#define ANGLE4_CCFG1_HYSTERESIS_0_04mdeg   0x04
 
#define ANGLE4_CCFG1_HYSTERESIS_0_02mdeg   0x03
 
#define ANGLE4_CCFG1_HYSTERESIS_0_01mdeg   0x02
 
#define ANGLE4_CCFG1_HYSTERESIS_0_005mdeg   0x01
 
#define ANGLE4_CCFG1_NO_HYSTERESIS   0x00
 
#define ANGLE4_CCFG2_DIR_COUNTER_CLOCKWISE_ROTATION   0x80
 
#define ANGLE4_CCFG2_DIR_CLOCKWISE_ROTATION   0x00
 
#define ANGLE4_CCFG2_ZERO_LATENCY_MODE_ON   0x40
 
#define ANGLE4_CCFG2_ZERO_LATENCY_MODE_OFF   0x00
 
#define ANGLE4_CCFG2_ABS_RESOLUTION_10bit   0x30
 
#define ANGLE4_CCFG2_ABS_RESOLUTION_12bit   0x20
 
#define ANGLE4_CCFG2_ABS_RESOLUTION_14bit   0x10
 
#define ANGLE4_CCFG2_ABS_RESOLUTION_16bit   0x00
 
#define ANGLE4_CCFG2_SETTINGS_CPR_4096   0x06
 
#define ANGLE4_CCFG2_SETTINGS_CPR_2048   0x06
 
#define ANGLE4_CCFG2_SETTINGS_CPR_1024   0x04
 
#define ANGLE4_CCFG2_SETTINGS_CPR_512   0x04
 
#define ANGLE4_CCFG2_SETTINGS_CPR_256   0x03
 
#define ANGLE4_CCFG2_SETTINGS_CPR_128   0x02
 
#define ANGLE4_CCFG2_SETTINGS_CPR_64   0x02
 
#define ANGLE4_CCFG2_SETTINGS_CPR_32   0x02
 
#define ANGLE4_CCFG2_CPR_ABS_RESOLUTION   0x04
 
#define ANGLE4_OPERATING_VOLTAGE_3300mV   0x00
 
#define ANGLE4_OPERATING_VOLTAGE_5000mV   0x02
 
#define ANGLE4_DATA_RESOLUTION_14bit   0x10
 
#define ANGLE4_DATA_RESOLUTION_16bit   0x00
 
#define ANGLE4_DATA_RESOLUTION_12bit   0x30
 
#define ANGLE4_DATA_RESOLUTION_10bit   0x30
 

Functions

void angle4_cfg_setup (angle4_cfg_t *cfg)
 Config Object Initialization function.
 
ANGLE4_RETVAL angle4_init (angle4_t *ctx, angle4_cfg_t *cfg)
 Initialization function.
 
void angle4_default_cfg (angle4_t *ctx, uint8_t dir, uint8_t data_resolution)
 Click Default Configuration function.
 
void angle4_generic_transfer (angle4_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void angle4_write_byte (angle4_t *ctx, uint8_t addr, uint8_t w_data)
 One byte write function.
 
uint8_t angle4_read_byte (angle4_t *ctx, uint8_t addr)
 One byte read function.
 
void angle4_start_mesuremenet (angle4_t *ctx)
 Start meaasurement function.
 
uint8_t angle4_get_new_angle (angle4_t *ctx, uint16_t *data_out)
 Functions for reading Angle.
 

Detailed Description

This file contains API for Angle 4 Click driver.