Skip to content

Class daisy::Encoder

ClassList > daisy > Encoder

Generic Class for handling Quadrature Encoders Inspired/influenced by Mutable Instruments (pichenettes)Encoder classes.More...

  • #include <encoder.h>

Public Functions

Type Name
void Debounce ()
Encoder ()
bool FallingEdge () const
int32_t Increment () const
void Init (Pin a, Pin b, Pin click, float update_rate=0.f)
bool Pressed () const
bool RisingEdge () const
void SetUpdateRate (float update_rate)
float TimeHeldMs () const
~Encoder ()

Detailed Description

Author:

Stephen Hensley

Date:

December 2019

Public Functions Documentation

function Debounce

void daisy::Encoder::Debounce () 

Called at update_rate to debounce and handle timing for the switch. In order for events not to be missed, its important that the Edge/Pressed checks be made at the same rate as the debounce function is being called.


function Encoder

inline daisy::Encoder::Encoder () 

function FallingEdge

inline bool daisy::Encoder::FallingEdge () const

Returns true if the encoder was just released.


function Increment

inline int32_t daisy::Encoder::Increment () const

Returns +1 if the encoder was turned clockwise, -1 if it was turned counter-clockwise, or 0 if it was not just turned.


function Init

void daisy::Encoder::Init (
    Pin a,
    Pin b,
    Pin click,
    float update_rate=0. f
) 

Initializes the encoder with the specified hardware pins. Update rate is to be deprecated in a future release


function Pressed

inline bool daisy::Encoder::Pressed () const

Returns true while the encoder is held down.


function RisingEdge

inline bool daisy::Encoder::RisingEdge () const

Returns true if the encoder was just pressed.


function SetUpdateRate

inline void daisy::Encoder::SetUpdateRate (
    float update_rate
) 

To be removed in breaking update

Parameters:

  • update_rate Does nothing

function TimeHeldMs

inline float daisy::Encoder::TimeHeldMs () const

Returns the time in milliseconds that the encoder has been held down.


function ~Encoder

inline daisy::Encoder::~Encoder () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/encoder.h