Exemplo n.º 1
0
// handles key presses for setting the alarm time
void handle_key_press_alarm_set() {
	// Key 2 increments minutes
	if (edge_capture == 4) {
		increment_minutes(bot_row, &alarm_minutes);
		alt_up_character_lcd_set_cursor_pos(char_lcd_dev, 0, 1);
		alt_up_character_lcd_string(char_lcd_dev, bot_row);
	}
	// Key 3 increments hours
	else if (edge_capture == 8) {
		increment_hours(bot_row, &alarm_hours, am_pm_mode);
		alt_up_character_lcd_set_cursor_pos(char_lcd_dev, 0, 1);
		alt_up_character_lcd_string(char_lcd_dev, bot_row);
	}
	// Reset our edge capture back to 0
	edge_capture = 0;
}
Exemplo n.º 2
0
//handle key press when alarm is going off
void handle_key_press_alarm() {
	// Key 1 then snooze for one minute
	if (edge_capture == 2) {
		//1 minute because when you're sleeping 1 minute feels like 5
		//and 5 minutes is a typical snooze time
		increment_minutes(bot_row, &alarm_minutes);
		hex_off();
		alarm = 0;
	}
	// Key 3 then turn off
	else if (edge_capture == 8) {
		alarm = 0;
		hex_off();
	}
	// Reset our edge capture back to 0
	edge_capture = 0;
}
Exemplo n.º 3
0
/* Our function that handles the key presses for time setting*/
void handle_key_press_time() {
	// Key 1 increments the seconds
	if (edge_capture == 2) {
		increment_seconds(top_row, &seconds);
		alt_up_character_lcd_set_cursor_pos(char_lcd_dev, 0, 0);
		alt_up_character_lcd_string(char_lcd_dev, top_row);
	}
	// Key 2 increments the minutes
	else if (edge_capture == 4) {
		increment_minutes(top_row, &minutes);
		alt_up_character_lcd_set_cursor_pos(char_lcd_dev, 0, 0);
		alt_up_character_lcd_string(char_lcd_dev, top_row);
	}
	// Key 3 increments the hours
	else if (edge_capture == 8) {
		increment_hours(top_row, &hours, am_pm_mode);
		alt_up_character_lcd_set_cursor_pos(char_lcd_dev, 0, 0);
		alt_up_character_lcd_string(char_lcd_dev, top_row);
	}
	
	// Reset our edge capture back to 0
	edge_capture = 0;
}
Exemplo n.º 4
0
__interrupt void Timer_A (void)
{
	P1OUT ^= BIT6;
	increment_hours(increment_minutes(increment_seconds()));

	if(hours < 10)
		sprintf(msg_buffer, "0%d:", hours);
	else
		sprintf(msg_buffer, "%d:", hours);

	if(minutes < 10)
		sprintf(msg_buffer + 3, "0%d:", minutes);
	else
	    sprintf(msg_buffer + 3, "%d:", minutes);

	if(seconds < 10)
		sprintf(msg_buffer + 6, "0%d", seconds);
	else
		sprintf(msg_buffer + 6, "%d", seconds);

	write_cmd(BIT1);
	write_msg(msg_buffer);

}