You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
777 B

2 years ago
  1. #include <errno.h>
  2. #include <fcntl.h>
  3. #include <getopt.h>
  4. #include <linux/spi/spidev.h>
  5. #include <linux/types.h>
  6. #include <stdbool.h>
  7. #include <stdint.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <sys/ioctl.h>
  12. #include <unistd.h>
  13. extern "C" {
  14. #include "libiflytop_adc_capture.h"
  15. }
  16. void sound_capture_callback(uint32_t* data, uint32_t len) {}
  17. int main(int argc, char const* argv[]) {
  18. error_code_t erro_code = sound_capturer_init("/dev/spidev1.0", 59, sound_capture_callback);
  19. if (erro_code != ksp_success) {
  20. sound_capturer_dump_last_error();
  21. return -1;
  22. }
  23. erro_code = sound_capturer_start();
  24. if (erro_code != ksp_success) {
  25. sound_capturer_dump_last_error();
  26. return -1;
  27. }
  28. while (true) {
  29. sleep(1);
  30. }
  31. return 0;
  32. }