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 OPTOENCODER_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.o1= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
67 cfg.o2= MIKROBUS( mikrobus, MIKROBUS_INT );
74#define OPTOENCODER_RETVAL uint8_t
76#define OPTOENCODER_OK 0x00
77#define OPTOENCODER_INIT_ERROR 0xFF
#define OPTOENCODER_RETVAL
Definition optoencoder.h:74
OPTOENCODER_RETVAL optoencoder_init(optoencoder_t *ctx, optoencoder_cfg_t *cfg)
Initialization function.
void optoencoder_cfg_setup(optoencoder_cfg_t *cfg)
Config Object Initialization function.
uint8_t optoencoder_get_o1(optoencoder_t *ctx)
Function for reading O1 state.
void optoencoder_init_dev(optoencoder_t *ctx)
Initialization function.
int16_t optoencoder_get_position(optoencoder_t *ctx)
Function for reading the position of the encoder.
uint8_t optoencoder_get_o2(optoencoder_t *ctx)
Function for reading O2 state.
Click configuration structure definition.
Definition optoencoder.h:108
pin_name_t o1
Definition optoencoder.h:111
pin_name_t o2
Definition optoencoder.h:112
Click ctx object definition.
Definition optoencoder.h:91
uint8_t o2_flag
Definition optoencoder.h:99
uint8_t o1_flag
Definition optoencoder.h:98
int16_t dev_rotation
Definition optoencoder.h:100
uint8_t rotary_flag
Definition optoencoder.h:97
digital_in_t o2
Definition optoencoder.h:95
digital_in_t o1
Definition optoencoder.h:94