42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
65#define OPTOENCODER2_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.b_pin = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
67 cfg.a_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
74#define OPTOENCODER2_OK 0
75#define OPTOENCODER2_ERROR -1
void optoencoder2_zero_counter(optoencoder2_t *ctx)
Reset encoder counter.
err_t optoencoder2_init(optoencoder2_t *ctx, optoencoder2_cfg_t *cfg)
Initialization function.
uint8_t optoencoder2_pwm_get(optoencoder2_t *ctx)
Getting PWM pin state.
uint8_t optoencoder2_int_get(optoencoder2_t *ctx)
Getting INT pin state.
void optoencoder2_cfg_setup(optoencoder2_cfg_t *cfg)
Config Object Initialization function.
int32_t optoencoder2_get_position(optoencoder2_t *ctx)
Getting encoder position.
uint8_t optoencoder2_isr(optoencoder2_t *ctx, uint8_t n_cycles)
Incrementing/decrementing encoder counter.
Click configuration structure definition.
Definition optoencoder2.h:103
pin_name_t a_pin
Definition optoencoder2.h:106
pin_name_t b_pin
Definition optoencoder2.h:105
Click ctx object definition.
Definition optoencoder2.h:89
int32_t position_counter
Definition optoencoder2.h:95
digital_in_t a_pin
Definition optoencoder2.h:92
uint32_t timeout_counter
Definition optoencoder2.h:94
digital_in_t b_pin
Definition optoencoder2.h:91