13#if defined(ESP8266) || defined(ESP32)
14#define CS_ENCODER_ISR_ATTR IRAM_ATTR
16#define CS_ENCODER_ISR_ATTR
20#define CS_ENCODER_ARGLIST_SIZE CORE_NUM_INTERRUPT
75 template <
interrupt_t NumISR = CS_ENCODER_ARGLIST_SIZE>
99#include "AHEncoder.ipp"
#define CS_ENCODER_ISR_ATTR
#define CS_ENCODER_ARGLIST_SIZE
Available number of interrupts.
AH::function_traits< decltype(::digitalWrite)>::argument_t< 0 > ArduinoPin_t
#define BEGIN_CS_NAMESPACE
Class for reading quadrature encoders, heavily influenced by http://www.pjrc.com/teensy/td_libs_Encod...
AH::Array< ArduinoPin_t, 2 > pins
AtomicPosition< int32_t > position
void(*)() isr_func_t
The type of a handler function.
static AHEncoder * instance_table[NUM_DIGITAL_PINS]
Array of pointers to all instances with active interrupts.
void write(int32_t p)
Set the absolute position to the given value.
AHEncoder(const AHEncoder &)=delete
Copy constructor: copying an Encoder object is semantically meaningless, so it has been deleted.
void attachInterruptCtx(interrupt_t interrupt)
Register the interrupt handler for this instance.
~AHEncoder()
Destructor, detaches the interrupts.
AHEncoder(ArduinoPin_t pinA, ArduinoPin_t pinB)
Constructor.
uint8_t interrupts_in_use
int32_t read()
Read the current absolute position of the encoder.
void end()
Disable the interrupts used by this encoder.
int32_t readAndReset(int32_t newpos=0)
Read the current absolute position of the encoder and reset it to zero afterwards.
void begin()
Initialize this encoder by enabling the pull-up resistors and attaching the interrupts handlers (if i...
void detachInterruptCtx(interrupt_t interrupt)
Un-register the interrupt handler for this instance.
AHEncoder & operator=(const AHEncoder &)=delete
Copy assignment: copying an Encoder object is semantically meaningless, so it has been deleted.
static isr_func_t get_isr(interrupt_t interrupt)
Get a pointer to the interrupt handler function for the given interrupt.
friend void swap(AHEncoder &a, AHEncoder &b)
Swap two Encoder objects.
void update()
Private handler function that is called from the ISR.
AH::Array< DirectPinRead, 2 > direct_pins
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...