listenlib.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <stdio.h>
  2. #include <sys/time.h>
  3. // LED Pin - wiringPi pin 0 is BCM_GPIO 17.
  4. #define LED 2
  5. /**
  6. * Calculate a duration
  7. *
  8. * @param start start of the computing or null if
  9. * this is the first time this function is inoked
  10. *
  11. * @return current time
  12. */
  13. struct timeval* showTime(struct timeval* start);
  14. /**
  15. * Reading data from GPIO
  16. *
  17. * @param data buffer data
  18. * @param samples number of samples to read
  19. * @param duration waiting time between samples
  20. */
  21. void readData(unsigned char* data, unsigned long int samples, unsigned int duration);
  22. /**
  23. * Calculate the length of the frame
  24. *
  25. * @param data data to scan
  26. * @param high length of high level
  27. * @param low length of low level
  28. *
  29. * @return total length of the frame
  30. */
  31. unsigned int frameSize(unsigned char* data, unsigned int* high, unsigned int* low);
  32. /**
  33. * Analyse the data
  34. *
  35. * @param data buffer data
  36. * @param samples number of samples to read
  37. * @param output output to render the result
  38. * @param all if false the analyze stops at the first error encoutered
  39. */
  40. void analyse(unsigned char* data, unsigned long int samples, FILE* output, unsigned char all);