Audio.h 2.0 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_1
  11. //#define BEEP_PORT GPIOA
  12. //#define MIC_MUTE_PIN GPIO_Pin_0
  13. //#define MIC_MUTE_PORT GPIOC
  14. //#define SPK_MUTE_PIN GPIO_Pin_8
  15. //#define SPK_MUTE_PORT GPIOC
  16. #define MicEnable() HAL_GPIO_WritePin(MIC_EN_GPIO_Port,MIC_EN_Pin, GPIO_PIN_RESET);
  17. #define MicEnableEX() HAL_GPIO_WritePin(MIC_ENB_GPIO_Port,MIC_ENB_Pin, GPIO_PIN_RESET);
  18. //Set Pin Low ,MIC Enalbe//BRR
  19. #define MicDisable() HAL_GPIO_WritePin(MIC_EN_GPIO_Port,MIC_EN_Pin, GPIO_PIN_SET);//Set Pin High ,MIC MUTE//BSRR
  20. #define MicDisableEX() HAL_GPIO_WritePin(MIC_ENB_GPIO_Port,MIC_ENB_Pin, GPIO_PIN_SET);//Set Pin High ,MIC MUTE//BSRR
  21. #define SpeakerEnable() HAL_GPIO_WritePin(SPK_EN1_GPIO_Port,SPK_EN1_Pin, GPIO_PIN_SET);//Speaker Enable//BSRR
  22. #define SpeakerDisable() HAL_GPIO_WritePin(SPK_EN1_GPIO_Port,SPK_EN1_Pin, GPIO_PIN_RESET);//Speaker Disable //BRR
  23. #define TMR_INF_BEEP 1
  24. #define TMR_INF_MIC 2
  25. #define TMR_INF_RING 3
  26. typedef struct{
  27. unsigned short freq;
  28. unsigned short time;
  29. }SUT_RING_ELEMENT;
  30. typedef struct{
  31. unsigned short start;//0-stop 1-start
  32. unsigned short handle;//µ±Ç°²¥·Åµ½µÄλÖÃ
  33. unsigned short ElementNum;
  34. SUT_RING_ELEMENT *pElement;
  35. }SUT_RING;
  36. extern SUT_RING sutRing;
  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. /*********************************begin*****************************************/
  48. /**********************************end******************************************/
  49. #endif