amrangle2 2.1.0.0
amrangle2.h File Reference

This file contains API for AMR Angle 2 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  amrangle2_t
 AMR Angle 2 Click context object. More...
 
struct  amrangle2_cfg_t
 AMR Angle 2 Click configuration object. More...
 

Macros

#define AMRANGLE2_REG_ADC_MODE_CONTROL   0x0000
 AMR Angle 2 register list.
 
#define AMRANGLE2_REG_ADC_CONFIGURATION   0x8000
 
#define AMRANGLE2_REG_UNIPOLAR   0x8800
 
#define AMRANGLE2_REG_BIPOLAR   0x9000
 
#define AMRANGLE2_REG_RANGE   0x9800
 
#define AMRANGLE2_REG_CUSTOM_SCAN0   0xA000
 
#define AMRANGLE2_REG_CUSTOM_SCAN1   0xA800
 
#define AMRANGLE2_REG_SAMPLE_SET   0xB000
 
#define AMRANGLE2_SCAN_UNCHANGED   0x0000
 AMR Angle 2 adc mode register settings.
 
#define AMRANGLE2_SCAN_MANUAL   0x0800
 
#define AMRANGLE2_SCAN_REPEAT   0x1000
 
#define AMRANGLE2_SCAN_STANDARD_INT   0x1800
 
#define AMRANGLE2_SCAN_STANDARD_EXT   0x2000
 
#define AMRANGLE2_SCAN_UPPER_INT   0x2800
 
#define AMRANGLE2_SCAN_UPPER_EXT   0x3000
 
#define AMRANGLE2_SCAN_CUSTOM_INT   0x3800
 
#define AMRANGLE2_SCAN_CUSTOM_EXT   0x4000
 
#define AMRANGLE2_SCAN_SAMPLE_SET   0x4800
 
#define AMRANGLE2_CHSEL_AIN0   0x0000
 
#define AMRANGLE2_CHSEL_AIN1   0x0080
 
#define AMRANGLE2_CHSEL_AIN2   0x0100
 
#define AMRANGLE2_CHSEL_AIN3   0x0180
 
#define AMRANGLE2_RESET_FIFO   0x0020
 
#define AMRANGLE2_RESET_ALL   0x0040
 
#define AMRANGLE2_PM_NORMAL   0x0000
 
#define AMRANGLE2_PM_AUTO_SHUTDOWN   0x0008
 
#define AMRANGLE2_PM_AUTO_STANDBY   0x0010
 
#define AMRANGLE2_CHAN_ID_ENABLE   0x0004
 
#define AMRANGLE2_SWCNV_START   0x0002
 
#define AMRANGLE2_REFSEL_EXT_DIFFERENTIAL   0x0400
 AMR Angle 2 adc configuration register settings.
 
#define AMRANGLE2_AVGON   0x0200
 
#define AMRANGLE2_NAVG_4   0x0000
 
#define AMRANGLE2_NAVG_8   0x0080
 
#define AMRANGLE2_NAVG_16   0x0100
 
#define AMRANGLE2_NAVG_32   0x0180
 
#define AMRANGLE2_NSCAN_4   0x0000
 
#define AMRANGLE2_NSCAN_8   0x0020
 
#define AMRANGLE2_NSCAN_12   0x0040
 
#define AMRANGLE2_NSCAN_16   0x0060
 
#define AMRANGLE2_SPM_NORMAL   0x0000
 
#define AMRANGLE2_SPM_FULL_SHUTDOWN   0x0008
 
#define AMRANGLE2_SPM_PARTIAL_SHUTDOWN   0x0010
 
#define AMRANGLE2_ECHO_ON   0x0004
 
#define AMRANGLE2_RANGE01_HALF_VREF   0x0000
 AMR Angle 2 range register settings.
 
#define AMRANGLE2_RANGE01_FULL_VREF   0x0400
 
#define AMRANGLE2_RANGE23_HALF_VREF   0x0000
 
#define AMRANGLE2_RANGE23_FULL_VREF   0x0200
 
#define AMRANGLE2_BCH01_UNIPOLAR   0x0000
 AMR Angle 2 bipolar register settings.
 
#define AMRANGLE2_BCH01_BIPOLAR_FULLY_DIFF   0x0400
 
#define AMRANGLE2_BCH23_UNIPOLAR   0x0000
 
#define AMRANGLE2_BCH23_BIPOLAR_FULLY_DIFF   0x0200
 
#define AMRANGLE2_ADC_VREF   3.3
 AMR Angle 2 Vsin and Vcos calculation values.
 
#define AMRANGLE2_ADC_RESOLUTION   0x0FFF
 
#define AMRANGLE2_RADIANS_TO_DEGREES   57.295779513
 AMR Angle 2 angle calculation values.
 
#define AMRANGLE2_ANGLE_ZERO_OFFSET   90.0
 
#define AMRANGLE2_TEMP_VDD   3.3
 AMR Angle 2 temperature calculation values.
 
#define AMRANGLE2_TEMP_TCAL   25.0
 
#define AMRANGLE2_TEMP_TCO   0.003173
 
#define AMRANGLE2_TEMP_NUM_CONVERSIONS   100
 
#define AMRANGLE2_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define AMRANGLE2_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define AMRANGLE2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  amrangle2_return_value_t { AMRANGLE2_OK = 0 , AMRANGLE2_ERROR = -1 }
 AMR Angle 2 Click return value data. More...
 

Functions

void amrangle2_cfg_setup (amrangle2_cfg_t *cfg)
 AMR Angle 2 configuration object setup function.
 
err_t amrangle2_init (amrangle2_t *ctx, amrangle2_cfg_t *cfg)
 AMR Angle 2 initialization function.
 
err_t amrangle2_default_cfg (amrangle2_t *ctx)
 AMR Angle 2 default configuration function.
 
err_t amrangle2_spi_transfer (amrangle2_t *ctx, uint16_t data_in)
 AMR Angle 2 spi transfer function.
 
err_t amrangle2_read_an_pin_value (amrangle2_t *ctx, uint16_t *data_out)
 AMR Angle 2 read AN pin value function.
 
err_t amrangle2_read_an_pin_voltage (amrangle2_t *ctx, float *data_out)
 AMR Angle 2 read AN pin voltage level function.
 
err_t amrangle2_calibrate_temperature (amrangle2_t *ctx)
 AMR Angle 2 calibrate temperature function.
 
err_t amrangle2_read_temperature (amrangle2_t *ctx, float *temperature)
 AMR Angle 2 read temperature function.
 
err_t amrangle2_read_vsin_vcos (amrangle2_t *ctx, float *vsin, float *vcos)
 AMR Angle 2 read vsin vcos function.
 
err_t amrangle2_read_angle (amrangle2_t *ctx, float *angle)
 AMR Angle 2 read angle function.
 
void amrangle2_set_cst_pin (amrangle2_t *ctx, uint8_t state)
 AMR Angle 2 set cst pin function.
 
uint8_t amrangle2_get_eoc_pin (amrangle2_t *ctx)
 AMR Angle 2 get eoc pin function.
 
void amrangle2_start_conversion (amrangle2_t *ctx)
 AMR Angle 2 start conversion function.
 

Detailed Description

This file contains API for AMR Angle 2 Click Driver.

Enumeration Type Documentation

◆ amrangle2_return_value_t

AMR Angle 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
AMRANGLE2_OK 
AMRANGLE2_ERROR