C51 COMPILER V9.57.0.0 KEY 06/14/2024 11:09:11 PAGE 1 C51 COMPILER V9.57.0.0, COMPILATION OF MODULE KEY OBJECT MODULE PLACED IN .\Objects\key.obj COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE ..\UsrSrc\key\key.c ROM(COMPACT) OPTIMIZE(9,SIZE) BROWSE INCDIR(..\UsrIn -c\adc;..\UsrInc\charger;..\UsrInc\discharge;..\UsrInc\gpio;..\UsrInc\hall;..\UsrInc\i2c_simu;..\UsrInc\inc;..\UsrInc\key -;..\UsrInc\led;..\UsrInc\mtp;..\UsrInc\pwm;..\UsrInc\sleep;..\UsrInc\system;..\UsrInc\uart;..\UsrInc\userapp;..\UsrInc\v -ox;..\UsrInc\vox_comm;..\UsrInc\watchdog;..\UsrInc\bat;..\UsrInc\timer) DEBUG OBJECTEXTEND CODE PRINT(.\Listings\key.lst -) TABS(2) OBJECT(.\Objects\key.obj) line level source 1 /* 2 ****************************************************************************** 3 * 4 * @file key.c 5 * @brief key module 6 * 7 * 8 * @version 1.0 9 * @date 2022/08/04 15:00:40 10 * @author Alex Xu 11 * 12 * Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd. 13 * All Rights Reserved 14 * 15 * History: 16 * Revision Date Author Desc 17 * 1.0.0 2022/08/04 Alex build this file 18 ******************************************************************************/ 19 /*_____ I N C L U D E S ____________________________________________________*/ 20 #include "key.h" 21 #include "system.h" 22 #include "led.h" 23 #include "sleep.h" 24 #include "adc.h" 25 #include "bat.h" 26 #include "vox_module.h" 27 28 #if 1 29 /******************************************************************************\ 30 Macro definitions 31 \******************************************************************************/ 32 33 /******************************************************************************\ 34 Variables definitions 35 \******************************************************************************/ 36 37 bit Key_Press_short_irq = 0; 38 bit Key_Press_l_irq = 0; 39 bit Key_Press_ll_irq = 0; 40 41 bit Key_l_Flag = 0; 42 43 idata KEY_EVENT_E Event_key = 0; 44 45 /******************************************************************************\ 46 Functions definitions 47 \******************************************************************************/ 48 49 /* 50 ******************************************************************************* 51 * void Key_Init(void) C51 COMPILER V9.57.0.0 KEY 06/14/2024 11:09:11 PAGE 2 52 * 53 * Description : Hey Initialization 54 * 55 * Arguments : 56 57 * Returns : 58 59 * Notes : 60 * 61 ******************************************************************************* 62 */ 63 #if 0 void Key_Init(void) { SFRADDR = MFP_CTL1; //Set P05 as key Function SFRDATA &= ~0x3C; SFRDATA |= 0x14; SFRADDR = PMU_CTL0; SFRDATA |= 0x02; //Key Detect Enable //KEY_CTL = 0x04; //Set all of the functions about KEY are enable. } #endif 77 78 79 /* 80 ******************************************************************************* 81 * void Key_Handler(void) 82 * 83 * Description : Key Handler --- 主循环中调用,调用周期5ms。其中长按(按键时间大于2s)需要判断抬键动作才触发 -。 84 CoverStatus --- 充电仓盖子状态。(本函数提供对应Key事件标志位,后续应用待定) 85 * 86 * Arguments : NONE 87 88 * Returns : NONE 89 90 * Notes : NONE 91 * 92 ******************************************************************************* 93 */ 94 95 void Key_Handler(void) 96 { 97 1 if( Key_l_Flag ) 98 1 { 99 2 Key_Press_l_irq = 0; 100 2 Key_l_Flag = 0; 101 2 /*todo*/ 102 2 Event_key = KEY_EVENT_L_2S; 103 2 /*耳机配对*/ 104 2 105 2 #ifdef _DEBUG_KEY printf("long press\r\n"); #endif 108 2 } 109 1 110 1 if( Key_Press_ll_irq ) 111 1 { 112 2 Key_Press_ll_irq = 0; C51 COMPILER V9.57.0.0 KEY 06/14/2024 11:09:11 PAGE 3 113 2 /*todo*/ 114 2 Event_key = KEY_EVENT_LL_8S; 115 2 // Decnt_SleepDelay = ENTER_STANDBYMODE_CNT; 116 2 117 2 #ifdef _DEBUG_KEY printf("supper long press\r\n"); #endif 120 2 } 121 1 122 1 if( Key_Press_short_irq ) 123 1 { 124 2 Key_Press_short_irq = 0; 125 2 /*todo*/ 126 2 Event_key = KEY_EVENT_SHORT; 127 2 128 2 #ifdef _DEBUG_KEY printf("short press\r\n"); #endif 131 2 132 2 } 133 1 } 134 135 136 #endif C51 COMPILER V9.57.0.0 KEY 06/14/2024 11:09:11 PAGE 4 ASSEMBLY LISTING OF GENERATED OBJECT CODE ; FUNCTION Key_Handler (BEGIN) ; SOURCE LINE # 95 ; SOURCE LINE # 96 ; SOURCE LINE # 97 0000 300008 R JNB Key_l_Flag,?C0001 ; SOURCE LINE # 98 ; SOURCE LINE # 99 0003 C200 R CLR Key_Press_l_irq ; SOURCE LINE # 100 0005 C200 R CLR Key_l_Flag ; SOURCE LINE # 102 0007 7800 R MOV R0,#LOW Event_key 0009 7602 MOV @R0,#02H ; SOURCE LINE # 108 000B ?C0001: ; SOURCE LINE # 110 000B 300006 R JNB Key_Press_ll_irq,?C0002 ; SOURCE LINE # 111 ; SOURCE LINE # 112 000E C200 R CLR Key_Press_ll_irq ; SOURCE LINE # 114 0010 7800 R MOV R0,#LOW Event_key 0012 7603 MOV @R0,#03H ; SOURCE LINE # 120 0014 ?C0002: ; SOURCE LINE # 122 0014 300006 R JNB Key_Press_short_irq,?C0004 ; SOURCE LINE # 123 ; SOURCE LINE # 124 0017 C200 R CLR Key_Press_short_irq ; SOURCE LINE # 126 0019 7800 R MOV R0,#LOW Event_key 001B 7601 MOV @R0,#01H ; SOURCE LINE # 132 ; SOURCE LINE # 133 001D ?C0004: 001D 22 RET ; FUNCTION Key_Handler (END) MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 30 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = ---- ---- PDATA SIZE = ---- ---- DATA SIZE = ---- ---- IDATA SIZE = 1 ---- BIT SIZE = 4 ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)