#ifndef DRILL_ENCODER_H
#define DRILL_ENCODER_H
#include <stdint.h>
#include <stdbool.h>
typedef struct {
 int32_t edge_position;
 uint32_t last_us, invalid_transitions, service_gaps;
 uint8_t previous;
 bool initialized,saturated;
} de_state;
/* AB bits: bit1=A(PB2), bit0=B(PC15). Positive sequence 00,01,11,10,00.
   Raw quadrature EDGES, not detents or RPM. 2ms max gap is a candidate bound.
   No encoder PPR, tactile detent count or physical clockwise mapping assumed. */
bool de_init(de_state *s,uint32_t now,uint8_t ab);
int8_t de_sample(de_state *s,uint32_t now,uint8_t ab);
#endif
