Skip to content

Driver library for input (Rotary Encoder)

Morten Hattesen edited this page Dec 18, 2022 · 1 revision
  • APIs
    • RawEncoder
      • Features Configurable debounce period
      • Properties
        • interfaceMode: (POLLING, INTERRUPT)
        • port/pin
        • debounceTimeMillis: uint32_t
        • debounceDurationMillis: uint_8 (20ms)
        • callbackFunction: std::function<RawState()> or nullptr
        • rawState: RawState Maintained and returned when calling getRawState or when generating callback
          • rotationPosition: int16_t (-n/0/+n, reset to 0 when calling getRawState or when generating Callback)
          • isPressed: bool
          • pressedStateDurationMillis: uint16_t
          • precedingInverseStateDurationMillis: uint16_t
      • Methods
        • poll(): bool (returns true if RawState has changed since the last callback or call to getRawState()) Must be called at short intervals if not using Interrupt HardwareInterfaceMode). Returns true if state has changed since last callback or call to getRawState()
        • getRawState(): RawState
        • setCallback(std::function<RawState()>)
    • EventEncoder
      • Features

        • Progressive acceleration support for rotation with adjustable agressivity
        • If using an eventFilter including all Events, the following series of events will be generated when...
          • Double clicking: ButtonDown, SingleClick, ButtonUp, ButtonDown, DoubleClick, ButtonUp
          • Clicking and holding down the button for 4 seconds: ButtonDown, LongClick, ClickAndHold, ButtonUp
      • Properties

        • rawEncoder: RawEncoder
        • doubleClickMaximumPause (500ms)
        • longClickMinimumPressDuration (1s)
        • clickAndHoldMinimumPressDuration (3s)
        • eventState: EventState Maintained and returned from calls to getEventState() and callbacks
          • event: Events enum
          • counterValue
          • counterMinimum
          • counterMaximum
          • eventFilter: uint8 (EventName | EventName ...)
      • Methods

        • poll(): bool Returns true if EventState has changed since the last callback or call to getEventState()) Must be called at short intervals if not using Interrupt HardwareInterfaceMode.
        • getEventState(): RawState
        • setCallback(std::function<EventState()>)
      • Events (enum)

        • ButtonDown = 0x00000001
        • ButtonUp = 0x00000010
        • SingleClick = 0x00000100
        • DoubleClick = 0x00001000
        • TripleClick = 0x00010000
        • LongClick = 0x00100000
        • ClickAndHold = 0x01000000
        • Rotation = 0x10000000
Clone this wiki locally