Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
38 #include "drv_analog_in.h"
60 #define ANGLE7_REG_ZMCO 0x00
61 #define ANGLE7_REG_ZPOS_MSB 0x01
62 #define ANGLE7_REG_ZPOS_LSB 0x02
63 #define ANGLE7_REG_MPOS_MSB 0x03
64 #define ANGLE7_REG_MPOS_LSB 0x04
65 #define ANGLE7_REG_MANG_MSB 0x05
66 #define ANGLE7_REG_MANG_LSB 0x06
67 #define ANGLE7_REG_CONF_MSB 0x07
68 #define ANGLE7_REG_CONF_LSB 0x08
69 #define ANGLE7_REG_STATUS 0x0B
70 #define ANGLE7_REG_RAW_ANGLE_MSB 0x0C
71 #define ANGLE7_REG_RAW_ANGLE_LSB 0x0D
72 #define ANGLE7_REG_ANGLE_MSB 0x0E
73 #define ANGLE7_REG_ANGLE_LSB 0x0F
74 #define ANGLE7_REG_AGC 0x1A
75 #define ANGLE7_REG_MAGNITUDE_MSB 0x1B
76 #define ANGLE7_REG_MAGNITUDE_LSB 0x1C
77 #define ANGLE7_REG_BURN 0xFF
95 #define ANGLE7_CONF_WATCHDOG_OFF 0x0000
96 #define ANGLE7_CONF_WATCHDOG_ON 0x2000
97 #define ANGLE7_CONF_WATCHDOG_BIT_MASK 0x2000
98 #define ANGLE7_CONF_FTH_SLOW 0x0000
99 #define ANGLE7_CONF_FTH_6LSB 0x0400
100 #define ANGLE7_CONF_FTH_7LSB 0x0800
101 #define ANGLE7_CONF_FTH_9LSB 0x0C00
102 #define ANGLE7_CONF_FTH_18LSB 0x1000
103 #define ANGLE7_CONF_FTH_21LSB 0x1400
104 #define ANGLE7_CONF_FTH_24LSB 0x1800
105 #define ANGLE7_CONF_FTH_10LSB 0x1C00
106 #define ANGLE7_CONF_FTH_BIT_MASK 0x1C00
107 #define ANGLE7_CONF_SF_16X 0x0000
108 #define ANGLE7_CONF_SF_8X 0x0100
109 #define ANGLE7_CONF_SF_4X 0x0200
110 #define ANGLE7_CONF_SF_2X 0x0300
111 #define ANGLE7_CONF_SF_BIT_MASK 0x0300
112 #define ANGLE7_CONF_PWMF_115HZ 0x0000
113 #define ANGLE7_CONF_PWMF_230HZ 0x0040
114 #define ANGLE7_CONF_PWMF_460HZ 0x0080
115 #define ANGLE7_CONF_PWMF_920HZ 0x00C0
116 #define ANGLE7_CONF_PWMF_BIT_MASK 0x00C0
117 #define ANGLE7_CONF_OUTS_ANALOG_FULL 0x0000
118 #define ANGLE7_CONF_OUTS_ANALOG_REDUCED 0x0010
119 #define ANGLE7_CONF_OUTS_PWM 0x0020
120 #define ANGLE7_CONF_OUTS_BIT_MASK 0x0030
121 #define ANGLE7_CONF_HYST_OFF 0x0000
122 #define ANGLE7_CONF_HYST_1LSB 0x0004
123 #define ANGLE7_CONF_HYST_2LSB 0x0008
124 #define ANGLE7_CONF_HYST_3LSB 0x000C
125 #define ANGLE7_CONF_HYST_BIT_MASK 0x000C
126 #define ANGLE7_CONF_PM_NOM 0x0000
127 #define ANGLE7_CONF_PM_LPM1 0x0001
128 #define ANGLE7_CONF_PM_LPM2 0x0002
129 #define ANGLE7_CONF_PM_LPM3 0x0003
130 #define ANGLE7_CONF_PM_BIT_MASK 0x0003
136 #define ANGLE7_STATUS_MAGNET_DETECTED 0x20
137 #define ANGLE7_STATUS_MAGNET_TOO_WEAK 0x10
138 #define ANGLE7_STATUS_MAGNET_TOO_STRONG 0x08
144 #define ANGLE7_BURN_ANGLE 0x80
145 #define ANGLE7_BURN_SETTING 0x40
151 #define ANGLE7_RESOLUTION 0x0FFF
152 #define ANGLE7_FULL_CIRCLE 360.0
153 #define ANGLE7_ZERO_POSITION 0.0
160 #define ANGLE7_DEVICE_ADDRESS 0x36
178 #define ANGLE7_MAP_MIKROBUS( cfg, mikrobus ) \
179 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
180 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
181 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
182 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
183 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t int_pin
Definition: angle7.h:223
err_t angle7_set_start_position(angle7_t *ctx, float angle)
Angle 7 set start position function.
void angle7_enable_device(angle7_t *ctx)
Angle 7 enable device function.
@ ANGLE7_ERROR
Definition: angle7.h:240
err_t angle7_read_two_bytes(angle7_t *ctx, uint8_t reg, uint16_t *data_out)
Angle 7 read two bytes function.
i2c_master_t i2c
Definition: angle7.h:201
float vref
Definition: angle7.h:229
angle7_return_value_t
Angle 7 Click return value data.
Definition: angle7.h:238
@ ANGLE7_OK
Definition: angle7.h:239
err_t angle7_write_two_bytes(angle7_t *ctx, uint8_t reg, uint16_t data_in)
Angle 7 write two bytes function.
uint8_t slave_address
Definition: angle7.h:205
digital_in_t int_pin
Definition: angle7.h:198
pin_name_t an
Definition: angle7.h:222
analog_in_t adc
Definition: angle7.h:202
err_t angle7_set_stop_position(angle7_t *ctx, float angle)
Angle 7 set stop position function.
uint8_t angle7_get_int_pin(angle7_t *ctx)
Angle 7 get int pin function.
uint32_t i2c_speed
Definition: angle7.h:225
err_t angle7_init(angle7_t *ctx, angle7_cfg_t *cfg)
Angle 7 initialization function.
Angle 7 Click context object.
Definition: angle7.h:193
digital_out_t en
Definition: angle7.h:195
Angle 7 Click configuration object.
Definition: angle7.h:217
err_t angle7_generic_read(angle7_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Angle 7 I2C reading function.
err_t angle7_get_stop_position(angle7_t *ctx, float *angle)
Angle 7 get stop position function.
float stop_position
Definition: angle7.h:208
pin_name_t scl
Definition: angle7.h:218
err_t angle7_get_start_position(angle7_t *ctx, float *angle)
Angle 7 get start position function.
analog_in_resolution_t resolution
Definition: angle7.h:228
void angle7_disable_device(angle7_t *ctx)
Angle 7 disable device function.
pin_name_t sda
Definition: angle7.h:219
err_t angle7_default_cfg(angle7_t *ctx)
Angle 7 default configuration function.
err_t angle7_get_raw_angle(angle7_t *ctx, float *angle)
Angle 7 get raw angle function.
pin_name_t en
Definition: angle7.h:221
err_t angle7_get_agc(angle7_t *ctx, uint8_t *agc)
Angle 7 get agc function.
uint8_t i2c_address
Definition: angle7.h:226
float start_position
Definition: angle7.h:207
err_t angle7_get_magnitude(angle7_t *ctx, uint16_t *magnitude)
Angle 7 get magnitude function.
err_t angle7_get_angle(angle7_t *ctx, float *angle)
Angle 7 get angle function.
err_t angle7_read_an_pin_voltage(angle7_t *ctx, float *data_out)
Angle 7 read AN pin voltage level function.
void angle7_cfg_setup(angle7_cfg_t *cfg)
Angle 7 configuration object setup function.
err_t angle7_generic_write(angle7_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Angle 7 I2C writing function.
err_t angle7_read_an_pin_value(angle7_t *ctx, uint16_t *data_out)
Angle 7 read AN pin value function.
err_t angle7_get_status(angle7_t *ctx, uint8_t *status)
Angle 7 get status function.