Audio.h 1.7 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. #include "rtl.h"
  11. #define BEEP_PIN GPIO_Pin_1
  12. #define BEEP_PORT GPIOA
  13. #define MIC_MUTE_PIN GPIO_Pin_0
  14. #define MIC_MUTE_PORT GPIOC
  15. #define SPK_MUTE_PIN GPIO_Pin_8
  16. #define SPK_MUTE_PORT GPIOC
  17. #define MicEnable() MIC_MUTE_PORT->BRR=MIC_MUTE_PIN;//Set Pin Low ,MIC Enalbe//BRR
  18. #define MicDisable() MIC_MUTE_PORT->BSRR=MIC_MUTE_PIN;//Set Pin High ,MIC MUTE//BSRR
  19. //#define SpeakerEnable() SPK_MUTE_PORT->BSRR=SPK_MUTE_PIN//Speaker Enable//BSRR
  20. #define SpeakerDisable() SPK_MUTE_PORT->BRR=SPK_MUTE_PIN//Speaker Disable //BRR
  21. #define TMR_INF_BEEP 1
  22. #define TMR_INF_MIC 2
  23. #define TMR_INF_RING 3
  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 OS_ID idBeepTimer;
  36. extern OS_ID idRingTimer;
  37. void MicrophoneInit(void);
  38. void MicrophoneCtrl(int en);
  39. void SpeakerInit(void);
  40. void SpeakerCtrl(int en);
  41. void BeepInit(void);
  42. void SetBeep(int fre,int tick);
  43. void SetBeepByNoOS(int fre,int ms);
  44. void DelayMs(unsigned short ms);
  45. void SetRingFreq(int fre);
  46. extern int cntMeiTiao;
  47. void SpeakerEnable(void);
  48. /*********************************begin*****************************************/
  49. /**********************************end******************************************/
  50. #endif