Audio.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /********************************************************************************
  2. * File Name: Audio.h
  3. * Function Describe: Header file for Audio.c
  4. * Explain:
  5. * Writer: ShiLiangWen
  6. * Date: 2015-6-15
  7. *******************************************************************************/
  8. #ifndef __AUDIO_H
  9. #define __AUDIO_H
  10. #define BEEP_PIN GPIO_Pin_9
  11. #define BEEP_PORT GPIOB
  12. #define SPK_MUTE_PIN GPIO_Pin_15
  13. #define SPK_MUTE_PORT GPIOA
  14. #define HEADSET_PIN GPIO_Pin_10 //耳机检测
  15. #define HEADSET_PORT GPIOB
  16. #define MicEnable()
  17. #define MicDisable()
  18. //static const char *SendheadsetAt="AT+CACCP=1,2,2,\"04002400d3ff000004002400d6ff000004002e00d9ff0000040\
  19. // 02e00dcff000004002e00dfff000004002e00e2ff000004002e00e5ff000004002e00e8ff000004002e00ebff000004002e00eeff000004002e00f1ff000004002e00f4ff000004002e00f7ff000004002e00faff000004002e00fdff00000400f40000000000\"\r\n";
  20. #define HEADSETVOL "AT+CACCP=1,2,2,\"04007e00d3ff000004007f00d6ff00000400b400d9ff00000400b500dcff000004003e00dfff00000400b600e2ff000004007a00e5ff00000400b700e8ff000004002e00ebff00000400b800eeff00000400b800f1ff00000400b900f4ff00000400ba0\
  21. 0f7ff00000400bc00faff00000400be00fdff00000400f50000000000\"\r\n"
  22. //#define SpeakerEnable() SPK_MUTE_PORT->BSRR=SPK_MUTE_PIN//Speaker Enable//BSRR
  23. //#define SpeakerDisable() SPK_MUTE_PORT->BRR=SPK_MUTE_PIN//Speaker Disable //BRR
  24. typedef struct{
  25. unsigned short freq;
  26. unsigned short time;
  27. }SUT_RING_ELEMENT;
  28. typedef struct{
  29. unsigned short start;//0-stop 1-start
  30. unsigned short handle;//当前播放到的位置
  31. unsigned short ElementNum;
  32. SUT_RING_ELEMENT *pElement;
  33. }SUT_RING;
  34. extern SUT_RING sutRing;
  35. extern int cntMeiTiao;
  36. void SpeakerInit(void);
  37. void SpeakerCtrl(int en);
  38. void BeepInit(void);
  39. void SetBeep(int fre,int tick);
  40. void SetBeepByNoOS(int fre,int ms);
  41. void DelayMs(unsigned short ms);
  42. void SetRingFreq(int fre);
  43. void SpeakerEnable(void);
  44. void SpeakerDisable();
  45. /*********************************begin*****************************************/
  46. /**********************************end******************************************/
  47. #endif