Go to the documentation of this file.
39 #ifdef PREINIT_SUPPORTED
43 #ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
52 #include "drv_analog_in.h"
74 #define ANGLE7_REG_ZMCO 0x00
75 #define ANGLE7_REG_ZPOS_MSB 0x01
76 #define ANGLE7_REG_ZPOS_LSB 0x02
77 #define ANGLE7_REG_MPOS_MSB 0x03
78 #define ANGLE7_REG_MPOS_LSB 0x04
79 #define ANGLE7_REG_MANG_MSB 0x05
80 #define ANGLE7_REG_MANG_LSB 0x06
81 #define ANGLE7_REG_CONF_MSB 0x07
82 #define ANGLE7_REG_CONF_LSB 0x08
83 #define ANGLE7_REG_STATUS 0x0B
84 #define ANGLE7_REG_RAW_ANGLE_MSB 0x0C
85 #define ANGLE7_REG_RAW_ANGLE_LSB 0x0D
86 #define ANGLE7_REG_ANGLE_MSB 0x0E
87 #define ANGLE7_REG_ANGLE_LSB 0x0F
88 #define ANGLE7_REG_AGC 0x1A
89 #define ANGLE7_REG_MAGNITUDE_MSB 0x1B
90 #define ANGLE7_REG_MAGNITUDE_LSB 0x1C
91 #define ANGLE7_REG_BURN 0xFF
109 #define ANGLE7_CONF_WATCHDOG_OFF 0x0000
110 #define ANGLE7_CONF_WATCHDOG_ON 0x2000
111 #define ANGLE7_CONF_WATCHDOG_BIT_MASK 0x2000
112 #define ANGLE7_CONF_FTH_SLOW 0x0000
113 #define ANGLE7_CONF_FTH_6LSB 0x0400
114 #define ANGLE7_CONF_FTH_7LSB 0x0800
115 #define ANGLE7_CONF_FTH_9LSB 0x0C00
116 #define ANGLE7_CONF_FTH_18LSB 0x1000
117 #define ANGLE7_CONF_FTH_21LSB 0x1400
118 #define ANGLE7_CONF_FTH_24LSB 0x1800
119 #define ANGLE7_CONF_FTH_10LSB 0x1C00
120 #define ANGLE7_CONF_FTH_BIT_MASK 0x1C00
121 #define ANGLE7_CONF_SF_16X 0x0000
122 #define ANGLE7_CONF_SF_8X 0x0100
123 #define ANGLE7_CONF_SF_4X 0x0200
124 #define ANGLE7_CONF_SF_2X 0x0300
125 #define ANGLE7_CONF_SF_BIT_MASK 0x0300
126 #define ANGLE7_CONF_PWMF_115HZ 0x0000
127 #define ANGLE7_CONF_PWMF_230HZ 0x0040
128 #define ANGLE7_CONF_PWMF_460HZ 0x0080
129 #define ANGLE7_CONF_PWMF_920HZ 0x00C0
130 #define ANGLE7_CONF_PWMF_BIT_MASK 0x00C0
131 #define ANGLE7_CONF_OUTS_ANALOG_FULL 0x0000
132 #define ANGLE7_CONF_OUTS_ANALOG_REDUCED 0x0010
133 #define ANGLE7_CONF_OUTS_PWM 0x0020
134 #define ANGLE7_CONF_OUTS_BIT_MASK 0x0030
135 #define ANGLE7_CONF_HYST_OFF 0x0000
136 #define ANGLE7_CONF_HYST_1LSB 0x0004
137 #define ANGLE7_CONF_HYST_2LSB 0x0008
138 #define ANGLE7_CONF_HYST_3LSB 0x000C
139 #define ANGLE7_CONF_HYST_BIT_MASK 0x000C
140 #define ANGLE7_CONF_PM_NOM 0x0000
141 #define ANGLE7_CONF_PM_LPM1 0x0001
142 #define ANGLE7_CONF_PM_LPM2 0x0002
143 #define ANGLE7_CONF_PM_LPM3 0x0003
144 #define ANGLE7_CONF_PM_BIT_MASK 0x0003
150 #define ANGLE7_STATUS_MAGNET_DETECTED 0x20
151 #define ANGLE7_STATUS_MAGNET_TOO_WEAK 0x10
152 #define ANGLE7_STATUS_MAGNET_TOO_STRONG 0x08
158 #define ANGLE7_BURN_ANGLE 0x80
159 #define ANGLE7_BURN_SETTING 0x40
165 #define ANGLE7_RESOLUTION 0x0FFF
166 #define ANGLE7_FULL_CIRCLE 360.0
167 #define ANGLE7_ZERO_POSITION 0.0
174 #define ANGLE7_DEVICE_ADDRESS 0x36
192 #define ANGLE7_MAP_MIKROBUS( cfg, mikrobus ) \
193 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
194 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
195 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
196 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
197 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t int_pin
Definition: angle7.h:237
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:254
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:215
float vref
Definition: angle7.h:243
angle7_return_value_t
Angle 7 Click return value data.
Definition: angle7.h:252
@ ANGLE7_OK
Definition: angle7.h:253
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:219
digital_in_t int_pin
Definition: angle7.h:212
pin_name_t an
Definition: angle7.h:236
analog_in_t adc
Definition: angle7.h:216
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:239
err_t angle7_init(angle7_t *ctx, angle7_cfg_t *cfg)
Angle 7 initialization function.
Angle 7 Click context object.
Definition: angle7.h:207
digital_out_t en
Definition: angle7.h:209
Angle 7 Click configuration object.
Definition: angle7.h:231
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:222
pin_name_t scl
Definition: angle7.h:232
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:242
void angle7_disable_device(angle7_t *ctx)
Angle 7 disable device function.
pin_name_t sda
Definition: angle7.h:233
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:235
err_t angle7_get_agc(angle7_t *ctx, uint8_t *agc)
Angle 7 get agc function.
uint8_t i2c_address
Definition: angle7.h:240
float start_position
Definition: angle7.h:221
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.