📄 kbd_task.lst
字号:
C51 COMPILER V7.50 KBD_TASK 09/20/2005 21:47:42 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE KBD_TASK
OBJECT MODULE PLACED IN kbd_task.obj
COMPILER INVOKED BY: e:\Keil\C51\BIN\C51.EXE modules\kbd\kbd_task.c OPTIMIZE(7,SPEED) BROWSE INCDIR(.\modules\system;.\;
-.\;.\lib_refd) DEFINE(KEIL) DEBUG OBJECTEXTEND PRINT(.\kbd_task.lst) OBJECT(kbd_task.obj)
line level source
1 /*C**************************************************************************
2 * NAME: kbd_task.c
3 *----------------------------------------------------------------------------
4 * Copyright (c) 2003 Atmel.
5 *----------------------------------------------------------------------------
6 * RELEASE: snd1c-refd-nf-4_0_3
7 * REVISION: 1.3.2.16
8 *----------------------------------------------------------------------------
9 * PURPOSE:
10 * This file contains the keyboard task and attached routines
11 *
12 * NOTES:
13 * Global Variables:
14 * - gl_key_press: bit in bdata space
15 * - gl_key: byte in idata space
16 * - gl_kbd_tick: byte in data space
17 *****************************************************************************/
18
19 /*_____ I N C L U D E S ____________________________________________________*/
20
21 #include "config.h" /* system configuration */
22 #include "board.h" /* board definition */
23 #include "lib_mcu\kbd\kbd_drv.h" /* Keyboard driver definition */
24 #include "kbd_task.h" /* Keyboard task definition */
25
26 #include "modules\file\file.h" /* file definition */
27 #include "modules\mem\mem_task.h" /* memory task definition */
28 #include "modules\display\led.h" /* led definition */
29 #include "modules\mode\mode_task.h" /* mode task definition */
30
31 #define REF_STATE_SONG 0
32 #define REF_STATE_VOICE 1
33 #define REF_STATE_USB 2
34 #define REF_STATE_FORMAT 3
35
36
37 /*_____ M A C R O S ________________________________________________________*/
38
39
40 /*_____ D E F I N I T I O N ________________________________________________*/
41
42 extern bdata bit gl_key_press; /* set to TRUE if a key is decoded */
43 extern idata Byte gl_key; /* value of the key pressed */
44 extern data Byte gl_kbd_tick; /* keypad tick counter */
45
46 extern idata Uint16 gl_act_tick; /* Activity tick */
47 extern Byte song_state; /* task state */
48 extern data Byte mode_state; /* task state */
49
50 extern xdata Byte LED_ON;
51 extern xdata Byte LED_FAST;
52
53 xdata Byte func_state;
54 xdata Byte func_timeout; /* Time out special function */
C51 COMPILER V7.50 KBD_TASK 09/20/2005 21:47:42 PAGE 2
55 xdata Byte ref_state = REF_STATE_SONG;
56 bit playing = FALSE;
57 bit pause = FALSE;
58 bit recording = FALSE;
59 bit connected = FALSE;
60 bit bargraph = FALSE;
61
62 static Byte kbd_state; /* keyboard task state */
63
64
65 /*_____ D E C L A R A T I O N ______________________________________________*/
66
67 void usb_task_init (void);
68
69
70 /*F**************************************************************************
71 * NAME: kbd_task_init
72 *----------------------------------------------------------------------------
73 * PARAMS:
74 *
75 * return:
76 *----------------------------------------------------------------------------
77 * PURPOSE:
78 * Keyboard task initialisation
79 *----------------------------------------------------------------------------
80 * EXAMPLE:
81 *----------------------------------------------------------------------------
82 * NOTE:
83 *----------------------------------------------------------------------------
84 * REQUIREMENTS:
85 *****************************************************************************/
86 void kbd_task_init (void)
87 {
88 1 kbd_state = KBD_IDLE;
89 1 gl_key_press = FALSE; /* no key pressed */
90 1 gl_key = NO_KEY;
91 1 kbd_init(); /* keyboard initialization */
92 1 }
93
94
95 /*F**************************************************************************
96 * NAME: ref_mode_task
97 *----------------------------------------------------------------------------
98 * PARAMS:
99 *
100 * return:
101 *----------------------------------------------------------------------------
102 * PURPOSE:
103 * Mode task
104 *----------------------------------------------------------------------------
105 * EXAMPLE:
106 *----------------------------------------------------------------------------
107 * NOTE:
108 * STATES:
109 * MODE_BOOT boot state
110 * MODE_DOWNLOAD file download mode
111 * MODE_SONG song playing mode
112 * MODE_VOICE voice playing & recording mode
113 * MODE_TOOL tool mode
114 * MODE_IDLE idle mode (switch back to first task)
115 *----------------------------------------------------------------------------
116 * REQUIREMENTS:
C51 COMPILER V7.50 KBD_TASK 09/20/2005 21:47:42 PAGE 3
117 *****************************************************************************/
118 void ref_mode_task (void)
119 {
120 1 gl_key_press = FALSE;
121 1 func_timeout = 0;
122 1 gl_act_tick = 0;
123 1 if (connected)
124 1 {
125 2 if (gl_key != KEY_FUNC) return;
126 2 connected = FALSE;
127 2 mode_state = MODE_SONG;
128 2 ENA_USB = !connected;
129 2 goto Label_init_ihm;
130 2 }
131 1 else if (gl_key == KEY_PLUS)
132 1 {
133 2 gl_key_press = TRUE;
134 2 if (func_state) { gl_key = KEY_INC; bargraph=TRUE; }
135 2 else gl_key = KEY_NEXT;
136 2 }
137 1 else if (gl_key == KEY_MINUS)
138 1 {
139 2 gl_key_press = TRUE;
140 2 if (func_state) { gl_key = KEY_DEC; bargraph=TRUE; }
141 2 else gl_key = KEY_PREV;
142 2 }
143 1 else if (recording)
144 1 {
145 2 if (gl_key == KEY_FUNC)
146 2 {
147 3 gl_key_press = TRUE;
148 3 if (playing) gl_key = KEY_PAUSE;
149 3 else gl_key = KEY_REC;
150 3 SHUT_MIC = playing;
151 3 }
152 2 else if (gl_key == KEY_VALID)
153 2 {
154 3 if (pause || playing)
155 3 {
156 4 gl_key_press = TRUE;
157 4 gl_key = KEY_STOP;
158 4 }
159 3 else recording=FALSE;
160 3 LED_ON = (8 >> ref_state);
161 3 LED_FAST = 3;
162 3 }
163 2 }
164 1 else if (playing)
165 1 {
166 2 bargraph=FALSE;
167 2 if (gl_key == KEY_FUNC)
168 2 {
169 3 gl_key_press = TRUE;
170 3 if ((func_state == 2) && (ref_state == REF_STATE_VOICE)) gl_key = KEY_STOP;
171 3 else gl_key = KEY_PAUSE;
172 3 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -