📄 kbd_task.lst
字号:
C51 COMPILER V7.06 KBD_TASK 05/05/2005 12:12:04 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE KBD_TASK
OBJECT MODULE PLACED IN kbd_task.obj
COMPILER INVOKED BY: C:\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)
stmt 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
35
36 /*_____ M A C R O S ________________________________________________________*/
37
38
39 /*_____ D E F I N I T I O N ________________________________________________*/
40
41 extern bdata bit gl_key_press; /* set to TRUE if a key is decoded */
42 extern idata Byte gl_key; /* value of the key pressed */
43 extern data Byte gl_kbd_tick; /* keypad tick counter */
44 extern data Byte power_tick;
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.06 KBD_TASK 05/05/2005 12:12:04 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 bit independence =TRUE;
62
63 static Byte kbd_state; /* keyboard task state */
64
65
66 /*_____ D E C L A R A T I O N ______________________________________________*/
67
68 void usb_task_init (void);
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 mode_select (void)
87 { if (P_KBD==0xf7)
88 1 {
89 2 independence =TRUE;
90 2 gl_key_press = TRUE;
91 2 gl_key = KEY_PLAY;
92 2 mode_state = MODE_SONG;
93 2 KBSTA=KBSTA;
94 2 }
95 1 else
96 1 {
97 2 independence =FALSE;
98 2 ref_state = REF_STATE_USB;
99 2 gl_key_press = TRUE;
100 2 gl_key = KEY_FUNC;
101 2 }
102 1 }
103 /*F**************************************************************************
104 * NAME: kbd_task_init
105 *----------------------------------------------------------------------------
106 * PARAMS:
107 *
108 * return:
109 *----------------------------------------------------------------------------
110 * PURPOSE:
111 * Keyboard task initialisation
112 *----------------------------------------------------------------------------
113 * EXAMPLE:
114 *----------------------------------------------------------------------------
115 * NOTE:
116 *----------------------------------------------------------------------------
C51 COMPILER V7.06 KBD_TASK 05/05/2005 12:12:04 PAGE 3
117 * REQUIREMENTS:
118 *****************************************************************************/
119 void kbd_task_init (void)
120 {
121 1 kbd_state = KBD_IDLE;
122 1 gl_key_press = FALSE; /* no key pressed */
123 1 gl_key = NO_KEY;
124 1 kbd_init(); /* keyboard initialization */
125 1 }
126
127
128 /*F**************************************************************************
129 * NAME: ref_mode_task
130 *----------------------------------------------------------------------------
131 * PARAMS:
132 *
133 * return:
134 *----------------------------------------------------------------------------
135 * PURPOSE:
136 * Mode task
137 *----------------------------------------------------------------------------
138 * EXAMPLE:
139 *----------------------------------------------------------------------------
140 * NOTE:
141 * STATES:
142 * MODE_BOOT boot state
143 * MODE_DOWNLOAD file download mode
144 * MODE_SONG song playing mode
145 * MODE_VOICE voice playing & recording mode
146 * MODE_TOOL tool mode
147 * MODE_IDLE idle mode (switch back to first task)
148 *----------------------------------------------------------------------------
149 * REQUIREMENTS:
150 *****************************************************************************/
151 void ref_mode_task (void)
152 {
153 1 gl_key_press = FALSE;
154 1 func_timeout = 0;
155 1 gl_act_tick = 0;
156 1 if (connected)
157 1 {
158 2 if (gl_key != KEY_FUNC) return;
159 2 connected = FALSE;
160 2 mode_state = MODE_SONG;
161 2 ENA_USB = !connected;
162 2 goto Label_init_ihm;
163 2 }
164 1 else if (gl_key == KEY_INC)
165 1 {
166 2 gl_key_press = TRUE;
167 2 }
168 1 else if (gl_key == KEY_DEC)
169 1 {
170 2 gl_key_press = TRUE;
171 2 }
172 1 else if (gl_key == KEY_PLUS)
173 1 {
174 2 gl_key_press = TRUE;
175 2 gl_key = KEY_NEXT;
176 2 }
177 1 else if (gl_key == KEY_MINUS)
178 1 {
C51 COMPILER V7.06 KBD_TASK 05/05/2005 12:12:04 PAGE 4
179 2 gl_key_press = TRUE;
180 2 gl_key = KEY_PREV;
181 2 }
182 1 else if (recording)
183 1 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -