rotary_encoder.hpp
Go to the documentation of this file.
00001 #ifndef ROTARY_ENCODER_HPP
00002 #define ROTARY_ENCODER_HPP
00003 
00004 #include <stdint.h>
00005 
00006 typedef void (*re_decoderCB_t)(int);
00007 
00008 class re_decoder
00009 {
00010    int mygpioA, mygpioB, levA, levB, lastGpio;
00011 
00012    re_decoderCB_t mycallback;
00013 
00014    void _pulse(int gpio, int level, uint32_t tick);
00015 
00016    /* Need a static callback to link with C. */
00017    static void _pulseEx(int gpio, int level, uint32_t tick, void *user);
00018 
00019 
00020    public:
00021 
00022    re_decoder(int gpioA, int gpioB, re_decoderCB_t callback);
00023    /*
00024       This function establishes a rotary encoder on gpioA and gpioB.
00025 
00026       When the encoder is turned the callback function is called.
00027    */
00028 
00029    void re_cancel(void);
00030    /*
00031       This function releases the resources used by the decoder.
00032    */
00033 };
00034 
00035 #endif


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Thu Jun 6 2019 20:43:57