wiegand.hpp
Go to the documentation of this file.
00001 #ifndef WIEGAND_HPP
00002 #define WIEGAND_HPP
00003 
00004 #include <stdint.h>
00005 
00006 typedef void (*WiegandCB_t)(int, uint32_t);
00007 
00008 class Wiegand
00009 {
00010    int mygpio_0, mygpio_1, mytimeout, in_code, bits;
00011 
00012    WiegandCB_t mycallback;
00013 
00014    uint32_t num;
00015 
00016    uint32_t code_timeout;
00017 
00018    void _cb(int gpio, int level, uint32_t tick);
00019 
00020    /* Need a static callback to link with C. */
00021    static void _cbEx(int gpio, int level, uint32_t tick, void *user);
00022 
00023    public:
00024 
00025    Wiegand(int gpio_0, int gpio_1, WiegandCB_t callback, int timeout=5);
00026    /*
00027       This function establishes a Wiegand decoder on gpio_0 and gpio_1.
00028 
00029       A gap of timeout milliseconds without a new bit indicates
00030       the end of a code.
00031 
00032       When the code is ended the callback function is called with the code
00033       bit length and value.
00034    */
00035 
00036    void cancel(void);
00037    /*
00038       This function releases the resources used by the decoder.
00039    */
00040 };
00041 
00042 #endif
00043 


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