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 OPTOENCODER3_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.o1= MIKROBUS( mikrobus, MIKROBUS_AN ); \
67 cfg.o2= MIKROBUS( mikrobus, MIKROBUS_RST ); \
68 cfg.en= MIKROBUS( mikrobus, MIKROBUS_CS ); \
69 cfg.o4= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
70 cfg.o3= MIKROBUS( mikrobus, MIKROBUS_INT );
77#define OPTOENCODER3_RETVAL uint8_t
79#define OPTOENCODER3_OK 0x00
80#define OPTOENCODER3_INIT_ERROR 0xFF
87#define OPTOENCODER3_ENABLE 0
88#define OPTOENCODER3_DISABLE 1
95#define OPTOENCODER3_PIN_ACTIVE 0
96#define OPTOENCODER3_PIN_NOT_ACTIVE 1
#define OPTOENCODER3_RETVAL
Definition optoencoder3.h:77
void optoencoder3_reset_counters(optoencoder3_t *ctx)
Functions for reseting counters.
void optoencoder3_read_all_pins(optoencoder3_t *ctx, optoencoder3_pins_t *pins)
Sets state of all pins.
void optoencoder3_cfg_setup(optoencoder3_cfg_t *cfg)
Config Object Initialization function.
uint8_t optoencoder3_cnt(optoencoder3_t *ctx)
Functions for reading number of swipes.
uint8_t optoencoder3_read_pin_o1(optoencoder3_t *ctx)
Functions for reading state of pin o1.
uint8_t optoencoder3_read_pin_o3(optoencoder3_t *ctx)
Functions for reading state of pin o3.
void optoencoder3_enable(optoencoder3_t *ctx, uint8_t active)
Sets state of click.
int8_t optoencoder3_dir_cnt(optoencoder3_t *ctx)
Functions for reading number of swipe directions.
OPTOENCODER3_RETVAL optoencoder3_init(optoencoder3_t *ctx, optoencoder3_cfg_t *cfg)
Initialization function.
uint8_t optoencoder3_read_pin_o4(optoencoder3_t *ctx)
Functions for reading state of pin o4.
uint8_t optoencoder3_read_pin_o2(optoencoder3_t *ctx)
Functions for reading state of pin o2.
optoencoder3_pins_t pins
Definition main.c:32
Click configuration structure definition.
Definition optoencoder3.h:133
pin_name_t o1
Definition optoencoder3.h:136
pin_name_t o4
Definition optoencoder3.h:139
pin_name_t en
Definition optoencoder3.h:138
pin_name_t o3
Definition optoencoder3.h:140
pin_name_t o2
Definition optoencoder3.h:137
Click pins state.
Definition optoencoder3.h:148
uint8_t pin_o2
Definition optoencoder3.h:150
uint8_t pin_o1
Definition optoencoder3.h:149
uint8_t pin_o3
Definition optoencoder3.h:151
uint8_t pin_o4
Definition optoencoder3.h:152
Click ctx object definition.
Definition optoencoder3.h:110
uint8_t dev_stage
Definition optoencoder3.h:125
digital_in_t o3
Definition optoencoder3.h:120
digital_in_t o4
Definition optoencoder3.h:119
digital_out_t en
Definition optoencoder3.h:113
uint8_t dev_cnt
Definition optoencoder3.h:122
uint8_t dev_swiping_dir
Definition optoencoder3.h:124
int8_t dev_swipe_cnt
Definition optoencoder3.h:123
digital_in_t o2
Definition optoencoder3.h:118
digital_in_t o1
Definition optoencoder3.h:117