test_ir_hasher.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 #include <pigpio.h>
4 
5 #include "ir_hasher.h"
6 
7 /*
8 
9 REQUIRES
10 
11 An IR receiver output pin connected to a Pi gpio.
12 
13 TO BUILD
14 
15 gcc -o ir_hash_c test_ir_hasher.c ir_hasher.c -lpigpio -lrt -lpthread
16 
17 TO RUN
18 
19 sudo ./ir_hash_c
20 
21 */
22 
23 void callback(uint32_t hash)
24 {
25  printf("hash=%u\n", hash);
26 }
27 
28 int main(int argc, char *argv[])
29 {
30  Pi_Hasher_t *hasher;
31 
32  if (gpioInitialise() < 0) return 1;
33 
34  /*
35  This assumes the output pin of an IR receiver is
36  connected to gpio 7.
37  */
38 
39  hasher = Pi_Hasher(7, callback, 5);
40 
41  sleep(300);
42 
43  Pi_Hasher_cancel(hasher);
44 
45  gpioTerminate();
46 }
47 
int gpioInitialise(void)
Definition: pigpio.c:8459
void Pi_Hasher_cancel(Pi_Hasher_t *hasher)
Definition: ir_hasher.c:125
int main(int argc, char *argv[])
void callback(uint32_t hash)
void gpioTerminate(void)
Definition: pigpio.c:8495
Pi_Hasher_t * Pi_Hasher(int gpio, Pi_Hasher_CB_t callback, int timeout)
Definition: ir_hasher.c:107


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57