Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
48 #include "drv_analog_in.h"
70 #define ANGLE7_REG_ZMCO 0x00
71 #define ANGLE7_REG_ZPOS_MSB 0x01
72 #define ANGLE7_REG_ZPOS_LSB 0x02
73 #define ANGLE7_REG_MPOS_MSB 0x03
74 #define ANGLE7_REG_MPOS_LSB 0x04
75 #define ANGLE7_REG_MANG_MSB 0x05
76 #define ANGLE7_REG_MANG_LSB 0x06
77 #define ANGLE7_REG_CONF_MSB 0x07
78 #define ANGLE7_REG_CONF_LSB 0x08
79 #define ANGLE7_REG_STATUS 0x0B
80 #define ANGLE7_REG_RAW_ANGLE_MSB 0x0C
81 #define ANGLE7_REG_RAW_ANGLE_LSB 0x0D
82 #define ANGLE7_REG_ANGLE_MSB 0x0E
83 #define ANGLE7_REG_ANGLE_LSB 0x0F
84 #define ANGLE7_REG_AGC 0x1A
85 #define ANGLE7_REG_MAGNITUDE_MSB 0x1B
86 #define ANGLE7_REG_MAGNITUDE_LSB 0x1C
87 #define ANGLE7_REG_BURN 0xFF
105 #define ANGLE7_CONF_WATCHDOG_OFF 0x0000
106 #define ANGLE7_CONF_WATCHDOG_ON 0x2000
107 #define ANGLE7_CONF_WATCHDOG_BIT_MASK 0x2000
108 #define ANGLE7_CONF_FTH_SLOW 0x0000
109 #define ANGLE7_CONF_FTH_6LSB 0x0400
110 #define ANGLE7_CONF_FTH_7LSB 0x0800
111 #define ANGLE7_CONF_FTH_9LSB 0x0C00
112 #define ANGLE7_CONF_FTH_18LSB 0x1000
113 #define ANGLE7_CONF_FTH_21LSB 0x1400
114 #define ANGLE7_CONF_FTH_24LSB 0x1800
115 #define ANGLE7_CONF_FTH_10LSB 0x1C00
116 #define ANGLE7_CONF_FTH_BIT_MASK 0x1C00
117 #define ANGLE7_CONF_SF_16X 0x0000
118 #define ANGLE7_CONF_SF_8X 0x0100
119 #define ANGLE7_CONF_SF_4X 0x0200
120 #define ANGLE7_CONF_SF_2X 0x0300
121 #define ANGLE7_CONF_SF_BIT_MASK 0x0300
122 #define ANGLE7_CONF_PWMF_115HZ 0x0000
123 #define ANGLE7_CONF_PWMF_230HZ 0x0040
124 #define ANGLE7_CONF_PWMF_460HZ 0x0080
125 #define ANGLE7_CONF_PWMF_920HZ 0x00C0
126 #define ANGLE7_CONF_PWMF_BIT_MASK 0x00C0
127 #define ANGLE7_CONF_OUTS_ANALOG_FULL 0x0000
128 #define ANGLE7_CONF_OUTS_ANALOG_REDUCED 0x0010
129 #define ANGLE7_CONF_OUTS_PWM 0x0020
130 #define ANGLE7_CONF_OUTS_BIT_MASK 0x0030
131 #define ANGLE7_CONF_HYST_OFF 0x0000
132 #define ANGLE7_CONF_HYST_1LSB 0x0004
133 #define ANGLE7_CONF_HYST_2LSB 0x0008
134 #define ANGLE7_CONF_HYST_3LSB 0x000C
135 #define ANGLE7_CONF_HYST_BIT_MASK 0x000C
136 #define ANGLE7_CONF_PM_NOM 0x0000
137 #define ANGLE7_CONF_PM_LPM1 0x0001
138 #define ANGLE7_CONF_PM_LPM2 0x0002
139 #define ANGLE7_CONF_PM_LPM3 0x0003
140 #define ANGLE7_CONF_PM_BIT_MASK 0x0003
146 #define ANGLE7_STATUS_MAGNET_DETECTED 0x20
147 #define ANGLE7_STATUS_MAGNET_TOO_WEAK 0x10
148 #define ANGLE7_STATUS_MAGNET_TOO_STRONG 0x08
154 #define ANGLE7_BURN_ANGLE 0x80
155 #define ANGLE7_BURN_SETTING 0x40
161 #define ANGLE7_RESOLUTION 0x0FFF
162 #define ANGLE7_FULL_CIRCLE 360.0
163 #define ANGLE7_ZERO_POSITION 0.0
170 #define ANGLE7_DEVICE_ADDRESS 0x36
188 #define ANGLE7_MAP_MIKROBUS( cfg, mikrobus ) \
189 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
190 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
191 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
192 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
193 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t int_pin
Definition: angle7.h:233
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:250
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:211
float vref
Definition: angle7.h:239
angle7_return_value_t
Angle 7 Click return value data.
Definition: angle7.h:248
@ ANGLE7_OK
Definition: angle7.h:249
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:215
digital_in_t int_pin
Definition: angle7.h:208
pin_name_t an
Definition: angle7.h:232
analog_in_t adc
Definition: angle7.h:212
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:235
err_t angle7_init(angle7_t *ctx, angle7_cfg_t *cfg)
Angle 7 initialization function.
Angle 7 Click context object.
Definition: angle7.h:203
digital_out_t en
Definition: angle7.h:205
Angle 7 Click configuration object.
Definition: angle7.h:227
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:218
pin_name_t scl
Definition: angle7.h:228
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:238
void angle7_disable_device(angle7_t *ctx)
Angle 7 disable device function.
pin_name_t sda
Definition: angle7.h:229
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:231
err_t angle7_get_agc(angle7_t *ctx, uint8_t *agc)
Angle 7 get agc function.
uint8_t i2c_address
Definition: angle7.h:236
float start_position
Definition: angle7.h:217
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.