コード例 #1
0
ファイル: driver_alarm.c プロジェクト: sektor1986/SHP-8099
void alarm_update(void)
{
	unsigned char val = 23;
	if (al_cursor_pos)
		val = 59;

	if (keyboard_Up(KEY1) || keyboard_TimePressed(KEY1,KEYBOARD_TIMEPRESSED))
	{
		if (alarm_time_toSet[al_cursor_pos]<val)
			alarm_time_toSet[al_cursor_pos]++;
		else
			alarm_time_toSet[al_cursor_pos]=0;
	}
	else if (keyboard_Up(KEY2) || keyboard_TimePressed(KEY2,KEYBOARD_TIMEPRESSED))
	{
		if (alarm_time_toSet[al_cursor_pos])
			alarm_time_toSet[al_cursor_pos]--;
		else
			alarm_time_toSet[al_cursor_pos] = val;
	}
	else if (keyboard_TimeUp(KEY4,KEYBOARD_TIMEOUT))
	{
		Display_mode = MODE_PARAMS;
		keyboard_Reset();
	}
	else if (keyboard_Up(KEY4))
		al_cursor_pos++;
	else if (keyboard_Up(KEY3))
	{
		alarm_time[0] = alarm_time_toSet[0];
		alarm_time[1] = alarm_time_toSet[1];
		alarm_enabled = 1;
		mem_Write(0x0009,&alarm_enabled,1);			
		mem_Write(0x000A,alarm_time,2);
		Display_mode = MODE_PARAMS;
		keyboard_Reset();
	}

	if (al_cursor_pos==2)
		al_cursor_pos = 0;


	al_time--;
	if (!al_time)
	{
		al_time = AL_TIME;
		al_flush = ~al_flush;
	}
	
}
コード例 #2
0
ファイル: driver_params.c プロジェクト: hegangmas/SHP-8107
void params_update(void)
{
	if (keyboard_Up(KEY1) || keyboard_TimePressed(KEY1,KEYBOARD_TIMEPRESSED))
	{
		if (cur_line_abs)
			cur_line_abs--;
		else
			cur_line_abs = NUM_LINES-1;
			
		if (cur_line)
			cur_line--;
		else
		{
			if (window_pos)
				window_pos--;
			else
			{
				window_pos = NUM_LINES-4;
				cur_line = 3;
				cur_line_abs = NUM_LINES-1;
			}
		}
	}
	else if (keyboard_Up(KEY2) || keyboard_TimePressed(KEY2,KEYBOARD_TIMEPRESSED))
	{
		if (cur_line_abs<NUM_LINES-1)
			cur_line_abs++;
		else
			cur_line_abs = 0;	

		if (cur_line<WINDOW_SIZE-1)
			cur_line++;
		else
		{
			if (window_pos<NUM_LINES-4)
			{
				window_pos++;
			}
			else
			{
				cur_line = 0;
				window_pos = 0;
				cur_line_abs = 0;
			}
		}
	}
	else if (keyboard_Up(KEY4))
	{
		Display_mode = prev_Display_mode;
		keyboard_Reset();		
	}
	else if (keyboard_Up(KEY3))
	{
		switch (cur_line_abs)
		{
			case 0:
			{
				speed_OnInit();
				Display_mode = MODE_SPEED;
				keyboard_Reset();
			} break;
			case 1:
			{
				brightness_OnInit();
				Display_mode = MODE_BRIGHTNESS;
				keyboard_Reset();
			} break;
			case 2:
			{
				clock_OnInit();
				Display_mode = MODE_CLOCK;
				keyboard_Reset();
			} break;
			case 3:
			{
				day_OnInit();
				Display_mode = MODE_DAY;
				keyboard_Reset();
			} break;
			case 4:
			{
				date_OnInit();
				Display_mode = MODE_DATE;
				keyboard_Reset();
			} break;
			case 5:
			{
				volume_OnInit();
				Display_mode = MODE_VOLUME;
				keyboard_Reset();
			} break;
			case 6:
			{
				Display_mode = MODE_LANGUAGE;
				keyboard_Reset();
			} break;
			case 7:
			{
				password_OnInit();
				Display_mode = MODE_PASSWORD;
				keyboard_Reset();
			} break;
			case 8:
			{
				tahomk_OnInit();
				Display_mode = MODE_TAHOMK;
				keyboard_Reset();
			} break;
		/*	case 9:
			{
				datchik_OnInit();
				Display_mode = MODE_DATCHIK;
				keyboard_Reset();
			} break;*/
			case 9:
			{
				diagnostics_OnInit();				
				Display_mode = MODE_DIAGN;
				keyboard_Init();
			} break;
		}
	}	
}