-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons.c
72 lines (62 loc) · 1.83 KB
/
buttons.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "device.h"
#include "display.h"
#include "buttons.h"
#include "interrupts.h"
void Buttons(Button button)
{
switch(button)
{
case volumeUp: //if volumeUp button pressed
sbState.nVolume++;
if (sbState.nVolume > 15) sbState.nVolume = 15;
if (sbState.nVolume <= 0) sbState.nVolume = 0;
SetVolume(sbState.nVolume);
break;
case volumeDown: //if volumeDown button pressed
sbState.nVolume--;
if (sbState.nVolume > 15) sbState.nVolume = 15;
if (sbState.nVolume <= 0) sbState.nVolume = 0;
SetVolume(sbState.nVolume);
break;
case usbMode: //if USB button pressed
PCM3070_USB_IN();
break;
case spdifMode: //if SPDIF button pressed
PCM3070_SPDIF_IN();
break;
case analogMode: //if Analog button pressed
if (sbState.mode == analog)
sbState.nInput++;
sbState.mode = analog;
if ((sbState.nInput > 3) || (sbState.nInput < 1))
sbState.nInput = 1;
SetAnalogMode(sbState.nInput);
break;
case muteMode: //if MUTE button pressed
sbState.bMute = !sbState.bMute;
SetMute(sbState.bMute);
break;
case shutdownMode: // if SHUTDOWN button pressed
sbState.bShutdown = !sbState.bShutdown;
SetShutdown(sbState.bShutdown);
break;
case surround0: //If Surround0 button pressed
if (sbState.nSurround & SURROUND_0)
sbState.nSurround &= ~SURROUND_0;
else
sbState.nSurround |= SURROUND_0;
SetSurround(sbState.nSurround);
break;
case surround1: //if Surround1 button pressed
if (sbState.nSurround & SURROUND_1)
sbState.nSurround &= ~SURROUND_1;
else
sbState.nSurround |= SURROUND_1;
SetSurround(sbState.nSurround);
break;
default:
break;
}
StartDisplayTimer();
UpdateDisplay();
}