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"
73#define ANTOPWM2_OTP_BIT 0x80
74#define ANTOPWM2_STATUS_READY 0x00
75#define ANTOPWM2_STATUS_TEST_FUSE 0x40
76#define ANTOPWM2_STATUS_FATAL_ERROR 0x80
77#define ANTOPWM2_STATUS_OTP_SUCCESS 0xC0
78#define ANTOPWM2_STATUS_MASK 0xC0
84#define ANTOPWM2_DIGIPOT_WIPER_MAX 0x3F
85#define ANTOPWM2_DIGIPOT_R6 49900u
86#define ANTOPWM2_DIGIPOT_WIPER_RES 60
87#define ANTOPWM2_DIGIPOT_MAX_RES 50000u
93#define ANTOPWM2_FREQ_MAX 1000000ul
94#define ANTOPWM2_FREQ_MIN 500000ul
95#define ANTOPWM2_RSET_REF 50000u
96#define ANTOPWM2_NDIV 1
103#define ANTOPWM2_DEVICE_ADDRESS 0x2C
121#define ANTOPWM2_MAP_MIKROBUS( cfg, mikrobus ) \
122 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
123 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
124 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
antopwm2_return_value_t
AN to PWM 2 Click return value data.
Definition antopwm2.h:167
@ ANTOPWM2_ERROR
Definition antopwm2.h:169
@ ANTOPWM2_OK
Definition antopwm2.h:168
err_t antopwm2_init(antopwm2_t *ctx, antopwm2_cfg_t *cfg)
AN to PWM 2 initialization function.
err_t antopwm2_set_frequency_otp(antopwm2_t *ctx, uint32_t freq)
AN to PWM 2 set frequency otp function.
err_t antopwm2_read_digipot(antopwm2_t *ctx, uint8_t *data_out)
AN to PWM 2 read digipot function.
err_t antopwm2_set_digipot(antopwm2_t *ctx, uint8_t wiper)
AN to PWM 2 set digipot function.
void antopwm2_cfg_setup(antopwm2_cfg_t *cfg)
AN to PWM 2 configuration object setup function.
err_t antopwm2_set_digipot_otp(antopwm2_t *ctx, uint8_t wiper)
AN to PWM 2 set digipot otp function.
err_t antopwm2_set_frequency(antopwm2_t *ctx, uint32_t freq)
AN to PWM 2 set frequency function.
uint8_t antopwm2_get_int_pin(antopwm2_t *ctx)
AN to PWM 2 get int pin function.
AN to PWM 2 Click configuration object.
Definition antopwm2.h:151
uint32_t i2c_speed
Definition antopwm2.h:157
pin_name_t scl
Definition antopwm2.h:152
pin_name_t int_pin
Definition antopwm2.h:155
pin_name_t sda
Definition antopwm2.h:153
uint8_t i2c_address
Definition antopwm2.h:158
AN to PWM 2 Click context object.
Definition antopwm2.h:134
digital_in_t int_pin
Definition antopwm2.h:136
i2c_master_t i2c
Definition antopwm2.h:139
uint8_t slave_address
Definition antopwm2.h:142