luat_audio_air101.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _LUAT_AUDIOAIR101_H_
  2. #define _LUAT_AUDIOAIR101_H_
  3. struct audio_codec_opts;
  4. typedef struct audio_codec_conf {
  5. int samplerate; //16k
  6. int bits; //16
  7. int channels; //1ch/2ch
  8. int pa_pin;
  9. uint8_t vol;
  10. uint8_t pa_on_level;
  11. uint32_t dummy_time_len;
  12. uint32_t pa_delay_time;
  13. const struct audio_codec_opts* codec_opts;
  14. } audio_codec_conf_t;
  15. typedef struct audio_codec_opts{
  16. const char* name;
  17. int (*init)(audio_codec_conf_t* conf);
  18. int (*deinit)(audio_codec_conf_t* conf);
  19. int (*control)(audio_codec_conf_t* conf,uint8_t cmd,int data);
  20. int (*start)(audio_codec_conf_t* conf);
  21. int (*stop)(audio_codec_conf_t* conf);
  22. } audio_codec_opts_t;
  23. #define CODEC_MODE_MASTER 0x00
  24. #define CODEC_MODE_SLAVE 0x01
  25. #define CODEC_PA_OFF 0x00
  26. #define CODEC_PA_ON 0x01
  27. #define CODEC_CTL_MODE 0x00
  28. #define CODEC_CTL_VOLUME 0x01
  29. #define CODEC_CTL_RATE 0x02
  30. #define CODEC_CTL_BITS 0x03
  31. #define CODEC_CTL_CHANNEL 0x04
  32. #define CODEC_CTL_PA 0x05
  33. #endif