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_analog_in.h"
52#include "drv_i2c_master.h"
75#define MAGNETO9_SET_DEV_ADDR 0x4D
81#define MAGNETO9_ADC_RESOLUTION 0x0FFF
82#define MAGNETO9_VREF_5V 5.0
88#define MAGNETO9_QUIESCENT_VOUT 2.5
89#define MAGNETO9_AN_SENSITIVITY_V_PER_G 0.009
90#define MAGNETO9_GAUSS_TO_MILITESLA 0.1
99#define MAGNETO9_VOLTAGE_TO_FIELD_STRENGTH( voltage ) ( ( ( voltage - MAGNETO9_QUIESCENT_VOUT ) / \
100 MAGNETO9_AN_SENSITIVITY_V_PER_G ) * \
101 MAGNETO9_GAUSS_TO_MILITESLA )
119#define MAGNETO9_MAP_MIKROBUS( cfg, mikrobus ) \
120 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
121 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
122 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
123 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
err_t magneto9_read_adc_voltage(magneto9_t *ctx, float *voltage)
Magneto 9 read ADC voltage function.
err_t magneto9_read_raw_adc(magneto9_t *ctx, uint16_t *raw_adc)
Magneto 9 read raw ADC function.
uint8_t magneto9_get_pwm_pin(magneto9_t *ctx)
Magneto 9 get PWM pin function.
err_t magneto9_read_an_pin_value(magneto9_t *ctx, uint16_t *data_out)
Magneto 9 read AN pin value function.
void magneto9_cfg_setup(magneto9_cfg_t *cfg)
Magneto 9 configuration object setup function.
err_t magneto9_init(magneto9_t *ctx, magneto9_cfg_t *cfg)
Magneto 9 initialization function.
err_t magneto9_read_an_pin_voltage(magneto9_t *ctx, float *data_out)
Magneto 9 read AN pin voltage level function.
magneto9_return_value_t
Magneto 9 Click return value data.
Definition magneto9.h:167
@ MAGNETO9_OK
Definition magneto9.h:168
@ MAGNETO9_ERROR
Definition magneto9.h:169
Magneto 9 Click configuration object.
Definition magneto9.h:148
analog_in_resolution_t resolution
Definition magneto9.h:157
float vref
Definition magneto9.h:158
uint32_t i2c_speed
Definition magneto9.h:154
pin_name_t scl
Definition magneto9.h:151
pin_name_t pwm
Definition magneto9.h:150
pin_name_t sda
Definition magneto9.h:152
pin_name_t an
Definition magneto9.h:149
uint8_t i2c_address
Definition magneto9.h:155
Magneto 9 Click context object.
Definition magneto9.h:133
digital_in_t pwm
Definition magneto9.h:134
i2c_master_t i2c
Definition magneto9.h:137
uint8_t slave_address
Definition magneto9.h:139
analog_in_t adc
Definition magneto9.h:136