ir_hasher.hpp
Go to the documentation of this file.
00001 #ifndef IR_RX_HASHER_HPP
00002 #define IR_RX_HASHER_HPP
00003 
00004 #include <stdint.h>
00005 
00006 typedef void (*HasherCB_t)(uint32_t);
00007 
00008 class Hasher
00009 {
00010 
00011    /*
00012    This class forms a hash over the IR pulses generated by an
00013    IR remote.
00014 
00015    The remote key press is not converted into a code in the manner of
00016    the lirc module.  No attempt is made to decode the type of protocol
00017    used by the remote.  The hash is likely to be unique for different
00018    keys and different remotes but this is not guaranteed.
00019 
00020    This hashing process works for some remotes/protocols but not for
00021    others.  The only way to find out if it works for one or more of
00022    your remotes is to try it and see.
00023    */
00024 
00025    int mygpio, mytimeout;
00026    HasherCB_t mycallback;
00027    int in_code;
00028    uint32_t hash_val;
00029    int edges;
00030    uint32_t t1, t2, t3, t4;
00031 
00032    void _hash(int old_val, int new_val);
00033    void _callback(int gpio, int level, uint32_t tick);
00034 
00035    /* Need a static callback to link with C. */
00036    static void _callbackExt(int gpio, int level, uint32_t tick, void *user);
00037 
00038    public:
00039 
00040    Hasher(int gpio, HasherCB_t callback, int timeout=5);
00041 };
00042 
00043 #endif
00044 


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