vfd_util.c
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:3k
源码类别:

DVD

开发平台:

C/C++

  1. /*
  2. ** vfd-utility file
  3. ** Creater: wanghaoying 2004-7-19 16:27
  4. ** 
  5. **
  6. */
  7. #if  defined(TWO_FUN_IN_ONE_VFD_KEY) || defined(TWO_FUNC_IN_LEFT_RIGHT_KEY)  //xyy add for Oritron 2004-11-12
  8. UINT32 keycode_to_num(UINT32 key_data)
  9. {
  10. UINT32 temp;
  11. UINT8 i;
  12. for(i = 0; i < 24; i++)
  13. {
  14. temp = 0x01 << i;
  15. if(key_data & temp)
  16. {
  17. if (key_data > temp) 
  18. {
  19. return 0;
  20. }
  21. else
  22. {
  23. key_data = i + 1;
  24. break;
  25. }
  26. }
  27. }
  28. return key_data; 
  29. }
  30. #endif //TWO_FUN_IN_ONE_VFD_KEY
  31. /*
  32. ** freyman 2002-7-4 11:27
  33. ** 
  34. ** FUNCTION
  35. ** polling_vfdtime
  36. **
  37. ** DESCRIPTION
  38. ** checking VFD timeout, every time 'diff' RTC ticks is subtracted
  39. ** from VFD timeout.
  40. **
  41. ** NOTES: if timeout value is 0 then this check is ignored.
  42. **
  43. */
  44. #if defined(VFD_VOLUME_DISPLAY) || defined(SUPPORT_TUNER_MV114) || defined(SUPPORT_TUNER_ALPS)
  45. void polling_vfdtime(int diff)
  46. {
  47. //      int    i;
  48. int     TimeToLive;
  49. if(diff < 0)
  50. return;
  51. else if(diff > 100)
  52. diff = 100;
  53. //printf("timeout : %d  diff:%dn", timeout_vfd, diff);
  54. if((TimeToLive = timeout_vfd) != 0)
  55. {
  56. if((TimeToLive -= diff) <= 0)
  57. {
  58. TimeToLive = 0;
  59. }
  60. timeout_vfd = TimeToLive;
  61. }
  62. }
  63. #endif
  64. ///********VFD Volume display******** 
  65. //wangfeng 2003-09-29 15:47
  66. #ifdef VFD_VOLUME_DISPLAY
  67. UINT16 vfd_set_volume(UINT16 index)
  68. {
  69. BYTE    iVolume;
  70.     BYTE    idVolumeFont;
  71. erase_vfd_mem();
  72. #ifdef CNTR_5SPK_VOLUME
  73. if (volume_Switch>=0) {
  74.             iVolume         = volume_5SPK[volume_Switch];
  75.             idVolumeFont    = idVolume_5SPK[volume_Switch];
  76.         } 
  77.     else {
  78.             iVolume         = audio_volume;
  79.             idVolumeFont    = Volume_Font_ID;
  80.         }
  81. if(idVolumeFont==VOL_FL_ID)
  82. psprintf(linebuf,"FL VOL%02d",iVolume);
  83. else if(idVolumeFont==VOL_FR_ID)
  84. psprintf(linebuf,"FR VOL%02d",iVolume);
  85. else if(idVolumeFont==VOL_SL_ID)
  86. psprintf(linebuf,"SL VOL%02d",iVolume);
  87. else if(idVolumeFont==VOL_SR_ID)
  88. psprintf(linebuf,"SR VOL%02d",iVolume);
  89. else if(idVolumeFont==VOL_C_ID)
  90. psprintf(linebuf,"CENVOL%02d",iVolume);
  91. else if(idVolumeFont==VOL_SW_ID)
  92. psprintf(linebuf,"SW VOL%02d",iVolume);//WANGFENG 2003-10-28 14:08
  93. else {
  94.     #ifdef MAIN_VOL_20// defined(HIMAGE1251) || defined(HIMAGE1250_03_185W)//wangfeng 2003-10-31 21:44
  95. if(volume_Switch==0)
  96. psprintf(linebuf,"VOL %02d",iVolume/4);
  97. else
  98.     #endif
  99. psprintf(linebuf,"VOL %02d",iVolume);
  100.     }
  101.     #else   //CNTR_5SPK_VOLUME
  102. iVolume         = audio_volume;
  103.     psprintf(linebuf,"VOL %02d",iVolume);//((80-5*(15-audio_volume))/5-1));
  104.     #endif //CNTR_5SPK_VOLUME
  105. vfd_set_str(0,linebuf);
  106. return index;
  107. }
  108. #endif  //VFD_VOLUME_DISPLAY
  109. #if defined(PCM1742)&&defined(CHECK_DAC_ZERO_FLAG_TO_GPIO_MUTE) //gerry,3-10-20 11:36
  110. void check_pcm1742_zero_flag(void)
  111. {
  112. //printf("============= come here to mute=============n");
  113. if((GPIO_I_GET(14))&&(setup_IsMICOff()))
  114. {
  115. //mute
  116. //printf("=== mute ======n");
  117. GPIO_MUTE();
  118. }
  119. else
  120. {
  121. //de-mute
  122. //printf("============= de mute=============n");
  123. GPIO_DEMUTE();
  124. }
  125. }
  126. #endif