12#ifndef WHEEL_ENCODER_H
13#define WHEEL_ENCODER_H
14#include "pico/stdlib.h"
27#define WHEEL_ENC_CYCLE_PULSE 20
29#define WHEEL_ENC_DIST_PER_PULSE (204.203f / 20.0f)
31#define WHEEL_ENC_SEC_TO_MSEC 1000.0f
Struct to store global encoder data.
Definition: wheel_encoder.h:45
uint pulse_count
Number of pulses since last reset.
Definition: wheel_encoder.h:47
uint64_t prev_time
Time of previous interrupt.
Definition: wheel_encoder.h:46
float distance_traversed
Distance traversed since last reset.
Definition: wheel_encoder.h:48
float wheel_enc_get_speed(float time_elapsed, bool is_pulse)
Get the speed in either pulses/second or mm/second.
Definition: wheel_encoder.c:40
struct wheel_encoder wheel_encoder_t
Struct to store global encoder data.
float wheel_enc_get_time_diff(uint64_t current_time, uint64_t prev_time)
Get the time difference in ms.
Definition: wheel_encoder.c:23