Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

108 rindas
2.9 KiB

  1. #include "PushBtnMgr.h"
  2. #include "timer.h"
  3. #include "Syslog.h"
  4. BtnState_t mLinkZ2BtnState, mMainZonePwrBtn, mZ2PwrBtn;
  5. void PushBtnMgrInit()
  6. {
  7. mLinkZ2BtnState.Debouncing = false;
  8. mMainZonePwrBtn.Debouncing = false;
  9. mZ2PwrBtn.Debouncing = false;
  10. mLinkZ2BtnState.BtnState = AUDIO_CONSOLE_LINK_Z2_BTN;
  11. mMainZonePwrBtn.BtnState = AUDIO_CONSOLE_MAIN_PWR_BTN;
  12. mZ2PwrBtn.BtnState = AUDIO_CONSOLE_Z2_PWR_BTN;
  13. TimerStart(PUSHBTN_DEBOUNCE_TIMER,PUSHBTN_DEBOUNCE_TIMEOUT);
  14. }
  15. void PushButtonMgrTick()
  16. {
  17. if(IsTimerExpired(PUSHBTN_DEBOUNCE_TIMER) == true)
  18. {
  19. //Check link Z2 volume with main zone btn
  20. if(mLinkZ2BtnState.BtnState != AUDIO_CONSOLE_LINK_Z2_BTN)
  21. {
  22. mLinkZ2BtnState.BtnState = AUDIO_CONSOLE_LINK_Z2_BTN;
  23. mLinkZ2BtnState.Debouncing = true;
  24. }
  25. else if(mLinkZ2BtnState.Debouncing == true)
  26. {
  27. //signal is debounced
  28. mLinkZ2BtnState.Debouncing = false;
  29. if(AUDIO_CONSOLE_LINK_Z2_BTN == 0)
  30. {
  31. LinkZ2BtnPressed();
  32. ONBOARD_LED7_PIN = LED_ON;
  33. SyslogNewString("Link Z2 Btn ON\n");
  34. }
  35. else
  36. {
  37. ONBOARD_LED7_PIN = LED_OFF;
  38. SyslogNewString("Link Z2 Btn OFF\n");
  39. }
  40. }
  41. //Check Main zone power toggle btn
  42. if(mMainZonePwrBtn.BtnState != AUDIO_CONSOLE_MAIN_PWR_BTN)
  43. {
  44. mMainZonePwrBtn.BtnState = AUDIO_CONSOLE_MAIN_PWR_BTN;
  45. mMainZonePwrBtn.Debouncing = true;
  46. }
  47. else if(mMainZonePwrBtn.Debouncing == true)
  48. {
  49. //signal is debounced
  50. mMainZonePwrBtn.Debouncing = false;
  51. if(AUDIO_CONSOLE_MAIN_PWR_BTN == 0)
  52. {
  53. MainZonePwrBtnPressed();
  54. ONBOARD_LED7_PIN = LED_ON;
  55. SyslogNewString("Main Zone Pwr ON\n");
  56. }
  57. else
  58. {
  59. ONBOARD_LED7_PIN = LED_OFF;
  60. SyslogNewString("Main Zone Pwr OFF\n");
  61. }
  62. }
  63. //Check Main zone power toggle btn
  64. if(mZ2PwrBtn.BtnState != AUDIO_CONSOLE_Z2_PWR_BTN)
  65. {
  66. mZ2PwrBtn.BtnState = AUDIO_CONSOLE_Z2_PWR_BTN;
  67. mZ2PwrBtn.Debouncing = true;
  68. }
  69. else if(mZ2PwrBtn.Debouncing == true)
  70. {
  71. //signal is debounced
  72. mZ2PwrBtn.Debouncing = false;
  73. if(AUDIO_CONSOLE_Z2_PWR_BTN == 0)
  74. {
  75. Zone2PwrBtnPressed();
  76. ONBOARD_LED7_PIN = LED_ON;
  77. SyslogNewString("Zone 2 Pwr ON\n");
  78. }
  79. else
  80. {
  81. ONBOARD_LED7_PIN = LED_OFF;
  82. SyslogNewString("Zone 2 Pwr OFF\n");
  83. }
  84. }
  85. TimerStart(PUSHBTN_DEBOUNCE_TIMER,PUSHBTN_DEBOUNCE_TIMEOUT);
  86. }
  87. }