1 #ifndef libpropeller_quadrature_encoder_h__ 2 #define libpropeller_quadrature_encoder_h__ 6 extern char _load_start_quadrature_encoder_cog[];
43 bool Start(
const int basePin,
const int numberOfEncoders) {
44 volatile void * asm_reference = NULL;
45 __asm__
volatile (
"mov %[asm_reference], #QuadratureEncoder_Entry \n\t" 46 : [asm_reference]
"+r" (asm_reference));
50 this->numberOfEncoders = numberOfEncoders;
51 this->basePin = basePin;
52 cog = cognew(_load_start_quadrature_encoder_cog, &this->basePin) + 1;
63 int GetReading(
const int index) {
64 return readings[index];
69 volatile int basePin, numberOfEncoders, readings[16];
86 #endif // libpropeller_quadrature_encoder_h__
bool Start(const int basePin, const int numberOfEncoders)