Esempio n. 1
0
void ui_poll(void)
{
	uint8_t event = get_event();

	if (event == EV_NONE)
		return;

	switch (event) {
	case EV_ENCODER_CW:
		menu_button_forward();
		break;
	case EV_ENCODER_CCW:
		menu_button_back();
		break;
	case EV_ENCODER_PUSH:
		menu_activate();
		break;
	case EV_SMAUL_PUSH:
		menu_button_smaul();
		break;
	case EV_TICK:
		key_timer();
		count_ui_timer();
		smaul_pulse_update();
		break;
	case EV_KEY_CHANGE:
		key_change();
		break;
	}

	if (event != EV_TICK && event != EV_KEY_CHANGE) {
		enable_lcd_backlight();
		reset_ui_timer();
	}

	ui_repaint();
}
Esempio n. 2
0
/* Semantik: Event tasks are functions, that need to be called when a signal is set.
  In most cases the signal is set by an IRQ handler and the event task is the bottom half.
  Events therefore have a higher priority than normal tasks. Before a normal task is allowed to run,
  all pending events are handled.
  TODO priority within events is not implemented and fast recurring events are not handled here.
  TODO we could add some functions to attach/detach a handler to/from each signal
*/
static void 
handle_events(){

	if (signal_is_set(SIG_TIMER))
		timer_tick();
#if 0			
	if (signal_is_set(SIG_NEW_TIME))
		NewTimeTask();
#endif		
#if 0		
	if (signal_is_set(SIG_RTC))
		RtcTask();
#endif		
	
#if 0
	if (pending_tasks & (1<<5)){
			RTCget_busy = 0;
			RTCtest(task3_dat);
		};
#endif 
			

	if (signal_is_set(SIG_RX_PACKET)) {
		rfRcvPacket();
	};
#if 0		
		
		if (signal_is_set(SIG_NEW_PACKET)) {
		signal_clr(SIG_NEW_PACKET);
		pkt_cnt++;
		packet[packet_length] = 0;
		process_packet((char *)packet, packet_length);
	};
#endif
				
#if 0
	if (signal_is_set(SIG_TX)){
		do_tx();
	};
	
#endif

#if 0		
	if (signal_is_set(SIG_KEYSCAN)) {
		key_scan();
	};
#endif				

#if 1	
	if (signal_is_set(SIG_KEY_CHG)) {
		key_change();
	};
#endif	
#if 0
	if (signal_is_set(SIG_RTC_INT)) {
		Task30();
	};
#endif
#if 0
	if (signal_is_set(SIG_RTC_UNLOCK)) {
		rtc_unlock();
	};
#endif 
			
#if 1	
	// SIG_NONE is used, when the API needs a signal, but no handler needs to be invoked
	if (signal_is_set(SIG_NONE)) {
		signal_clr(SIG_NONE);
	};
#endif					
}