optoencoder2 2.0.0.0
|
Functions | |
void | optoencoder2_cfg_setup (optoencoder2_cfg_t *cfg) |
Config Object Initialization function. | |
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. | |
int32_t | optoencoder2_get_position (optoencoder2_t *ctx) |
Getting encoder position. | |
void | optoencoder2_zero_counter (optoencoder2_t *ctx) |
Reset encoder counter. | |
uint8_t | optoencoder2_isr (optoencoder2_t *ctx, uint8_t n_cycles) |
Incrementing/decrementing encoder counter. | |
void optoencoder2_cfg_setup | ( | optoencoder2_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
This function initializes click configuration structure to init state.
int32_t optoencoder2_get_position | ( | optoencoder2_t * | ctx | ) |
Getting encoder position.
ctx | Click object. |
This function returns current encoder position
err_t optoencoder2_init | ( | optoencoder2_t * | ctx, |
optoencoder2_cfg_t * | cfg ) |
Initialization function.
optoencoder2 | Click object. |
cfg | Click configuration structure. |
This function initializes all necessary pins and peripherals used for this click.
uint8_t optoencoder2_int_get | ( | optoencoder2_t * | ctx | ) |
Getting INT pin state.
ctx | Click object. |
This function gets state of INT pin
uint8_t optoencoder2_isr | ( | optoencoder2_t * | ctx, |
uint8_t | n_cycles ) |
Incrementing/decrementing encoder counter.
n_cycles | Number of times(cycles) used to detect rising edge on channel A |
ctx | Click object. |
This function - increments/decrements encoder position - checks for rising edge on Channel A (INT pin), within specified number of cycles (n_cycles), and increments or decrements encoder position - increments encoder position if Channel B (PWM pin) is in LOW state - decrements encoder position if Channel B (PWM pin) is in HIGH state - can be used to detect direction of rotation by comparing two consecutive encoder positions
uint8_t optoencoder2_pwm_get | ( | optoencoder2_t * | ctx | ) |
Getting PWM pin state.
ctx | Click object. |
This function gets state of PWM pin
void optoencoder2_zero_counter | ( | optoencoder2_t * | ctx | ) |
Reset encoder counter.
ctx | Click object. |
This function resets encoder counter to 0(zero)