⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.c

📁 智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder
💻 C
字号:
/*******************
 *  common.c
 *******************/
#include <string.h>
#include "api.h"
#include "lcd.h"
#include "common.h"
#include "display.h"
#include "ap_common.h"
#include "prefer.h"
#include "global_user.h"
#include "res.h"
#include "res_show.h"
 
UINT32 u16TimerCount=0; 
 
MUSIC_INFORMATION curr_music;
UINT16 curr_lyric_time;

INT8U _buf[256];
INT8U vol_flag=0;

FILE_INFORMATION curr_finfo, curr_dir, play_dir;
SCREENLEVEL screen_level;

UINT16 select;
UINT16 totdir, totfile, totitem;
UINT8 *search_extstr;


BOOLEAN bHotKeyHandle(UINT8 ekey)
{

    	switch(ekey)
    	{
       		case KEY_LONG_MENU:     
       			key_menu_long = 1;  		               		       
        		api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
        		//close_volume();
#ifdef dynamic_load
			api_vLoad(Code_USER1,1);
#else
			Print("Load Function\n");
#endif							
			break;
		case   KEY_LONG_PLAY:	
			api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));	    
		    	vShutDown();
		    	break;		  		    	
	    	default:
	    		return FALSE;
	}
}

void key_process(UINT8 key)
{
	u16TimerCount=0;

	//vOpenBackLight();
	if(bLCD_PIN_BACKLIGHT)
		return;
	
	//now handle hot key
	bHotKeyHandle(key);
	
	//deal other key now.
	if(curr_screen->main)
		curr_screen->main(key);
}





BOOLEAN close_volume(void)
{	
	api_bSetVolume(0-api_s8GetVolume()); 
	*(INT8U xdata*)(0xF96E) = 0x03;	
    	return 1;  	
}


//--------------------------------------------------------------------------
void vKeyTimeOut(void)
{
	if (u16TimerCount == 0) 
	{
	    if(tUserPreference.u8BackLightTime!=0) 
	        vOpenBackLight();
	}
	
	u16TimerCount++;
	
	if((u16TimerCount>=tUserPreference.u8BackLightTime*4) && (tUserPreference.u8BackLightTime>0))
		vCloseBackLight();	
	
	if((u16TimerCount>=tUserPreference.u8ShutDownTime*240) && (tUserPreference.u8ShutDownTime>0))
		vShutDown();

}

void vShutDown()
{
	INT16U i;	

    api_bSetVolume(0-api_s8GetVolume());
	for(i=0;i<9;i++)
	{
		delay(20);
		bResShowPic(GJI01+i,0,0);			
	}

	delay(20);
    vCloseBackLight();
    lcd_clear();
	delay(20);

	api_bSetPowerDownMode(POWER_DOWN_ADDA_OFF);
	delay(200);
	b_PIN_POWEROFF = 0;
    while(1){;}
}

void vOpenBackLight(void)
{
         bLCD_PIN_BACKLIGHT = 0;
}

void vCloseBackLight(void)
{
         bLCD_PIN_BACKLIGHT = 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -