Exemplo n.º 1
0
void TIM1_UP_TIM10_irq(void)
{
    HAL_System_Interrupt_Trigger(SysInterrupt_TIM1_UP_TIM10_IRQ, NULL);

    uint8_t result =
    handle_timer(TIM1, TIM_IT_Update, SysInterrupt_TIM1_Update) ||
    handle_timer(TIM10, TIM_IT_CC1, SysInterrupt_TIM10_Compare) ||
    handle_timer(TIM10, TIM_IT_Update, SysInterrupt_TIM10_Update);
    UNUSED(result);
}
Exemplo n.º 2
0
void TIM1_TRG_COM_TIM11_irq(void)
{
    HAL_System_Interrupt_Trigger(SysInterrupt_TIM1_TRG_COM_TIM11_IRQ, NULL);

    uint8_t result =
    handle_timer(TIM1, TIM_IT_Trigger, SysInterrupt_TIM1_Trigger) ||
    handle_timer(TIM1, TIM_IT_COM, SysInterrupt_TIM1_COM) ||
    handle_timer(TIM11, TIM_IT_CC1, SysInterrupt_TIM11_Compare) ||
    handle_timer(TIM11, TIM_IT_Update, SysInterrupt_TIM11_Update);
    UNUSED(result);
}
Exemplo n.º 3
0
void TIM1_BRK_TIM9_irq(void)
{
    HAL_System_Interrupt_Trigger(SysInterrupt_TIM1_BRK_TIM9_IRQ, NULL);

    uint8_t result =
    handle_timer(TIM1, TIM_IT_Break, SysInterrupt_TIM1_Break) ||
    handle_timer(TIM9, TIM_IT_CC1, SysInterrupt_TIM9_Compare1) ||
    handle_timer(TIM9, TIM_IT_CC2, SysInterrupt_TIM9_Compare2) ||
    handle_timer(TIM9, TIM_IT_Update, SysInterrupt_TIM9_Update) ||
    handle_timer(TIM9, TIM_IT_Trigger, SysInterrupt_TIM9_Trigger);
    UNUSED(result);
}
Exemplo n.º 4
0
/**
 * @brief  This function handles TIM1_CC_IRQ Handler.
 * @param  None
 * @retval None
 */
void TIM1_CC_irq(void)
{
    if(NULL != HAL_TIM1_Handler)
    {
        HAL_TIM1_Handler();
    }

    HAL_System_Interrupt_Trigger(SysInterrupt_TIM1_CC_IRQ, NULL);
    uint8_t result =
    handle_timer(TIM1, TIM_IT_CC1, SysInterrupt_TIM1_Compare1) ||
    handle_timer(TIM1, TIM_IT_CC2, SysInterrupt_TIM1_Compare2) ||
    handle_timer(TIM1, TIM_IT_CC3, SysInterrupt_TIM1_Compare3) ||
    handle_timer(TIM1, TIM_IT_CC4, SysInterrupt_TIM1_Compare4);
    UNUSED(result);
}
Exemplo n.º 5
0
int Handle_Login(char* buf, struct sockaddr_in *cliaddr) {
		
	user_t *user = Sch_Userbysock(cliaddr);
	if(user) {
		char *err = "User already exist!";
		int len = strlen(err);
		Error_Handler(err,user->cliaddr,len);
		free(cliaddr);
		handle_timer(NULL);
		return -1;
	}
	char* ptr = ((struct request_login*)buf)->req_username;
	printf("*server:user %s login server\n",ptr);
	printf("%s:%d %s:%d recv Request login %s\n",inet_ntoa(servaddr.sin_addr),ntohs(servaddr.sin_port),inet_ntoa(cliaddr->sin_addr),ntohs(cliaddr->sin_port),ptr);
	
	if(Sch_channel_list("Common")==NULL){
		s2s_join(cliaddr,"Common",0); //s2s 
		Add_channel_list("Common");
	}
	Add_user_users(ptr,cliaddr);
	Add_user_channel(ptr,"Common");
	user = Sch_Userbysock(cliaddr);
	add_timer(user);
	
	return 0;
}
Exemplo n.º 6
0
void TIM8_CC_irq(void)
{
#if PLATFORM_ID == 10 // Electron
    if(NULL != HAL_TIM8_Handler)
    {
        HAL_TIM8_Handler();
    }
#endif

    HAL_System_Interrupt_Trigger(SysInterrupt_TIM8_IRQ, NULL);

    uint8_t result =
    handle_timer(TIM8, TIM_IT_CC1, SysInterrupt_TIM8_Compare1) ||
    handle_timer(TIM8, TIM_IT_CC2, SysInterrupt_TIM8_Compare2) ||
    handle_timer(TIM8, TIM_IT_CC3, SysInterrupt_TIM8_Compare3) ||
    handle_timer(TIM8, TIM_IT_CC4, SysInterrupt_TIM8_Compare4);
    UNUSED(result);
}
Exemplo n.º 7
0
/**
 * @brief  This function handles TIM2_IRQ Handler.
 * @param  None
 * @retval None
 */
void TIM2_irq(void)
{
    if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET)
    {
        if (BUTTON_GetState(BUTTON1) == BUTTON1_PRESSED)
        {
            if (!BUTTON_DEBOUNCED_TIME[BUTTON1])
            {
            BUTTON_DEBOUNCED_TIME[BUTTON1] += BUTTON_DEBOUNCE_INTERVAL;
                HAL_Notify_Button_State(BUTTON1, true);
        }
            BUTTON_DEBOUNCED_TIME[BUTTON1] += BUTTON_DEBOUNCE_INTERVAL;
        }
        else
        {
            HAL_Core_Mode_Button_Reset();
        }
    }

    HAL_System_Interrupt_Trigger(SysInterrupt_TIM2_IRQ, NULL);
    uint8_t result =
    handle_timer(TIM2, TIM_IT_CC1, SysInterrupt_TIM2_Compare1) ||
    handle_timer(TIM2, TIM_IT_CC2, SysInterrupt_TIM2_Compare2) ||
    handle_timer(TIM2, TIM_IT_CC3, SysInterrupt_TIM2_Compare3) ||
    handle_timer(TIM2, TIM_IT_CC4, SysInterrupt_TIM2_Compare4) ||
    handle_timer(TIM2, TIM_IT_Update, SysInterrupt_TIM2_Update) ||
    handle_timer(TIM2, TIM_IT_Trigger, SysInterrupt_TIM2_Trigger);
    UNUSED(result);
}
void handle_tap(AccelAxisType axis, int32_t direction) {
	static BatteryChargeState chargeState;
	int i, s;
	
    if (splashEnded) {
	
		if (showBattery) {
			showBattery = false;
			app_timer_cancel(timerBattery);
			handle_timer(NULL);
		} else {
			if (animation_is_scheduled(anim)) {
				animation_unschedule(anim);
			}
			
			for (i=0; i<NUMSLOTS; i++) {
				slot[i].prevDigit = slot[i].curDigit;
			}
			
			chargeState = battery_state_service_peek();
			s = chargeState.charge_percent / 10;
					
			if (s<1) {
				s = 1;
			} else if (s>9) {
				s = 9;
			}
			
			s--;
			
			//for (i=0; i<4; i++) {
			//	slot[i].curDigit = BATTERYOFFSET + 4*s + i;
			//}
			
			slot[4].curDigit = 'B' - '0';
			slot[5].curDigit = 'A' - '0';
			slot[6].curDigit = 'T' - '0';
			slot[7].curDigit = 'T' - '0';
			slot[8].curDigit = SPACE_D;
			slot[9].curDigit = s+1;
			slot[10].curDigit = 0;
			slot[11].curDigit = PERCENT;
			
			showBattery = true;
			
			animation_schedule(anim);
			timerBattery = app_timer_register(BATTERYDELAY, handle_timer, NULL);
		}
	}	
}
Exemplo n.º 9
0
Bit32u bx_pit_c::read(Bit32u address, unsigned io_len)
{
#else
  UNUSED(this_ptr);
#endif  // !BX_USE_PIT_SMF

  Bit8u value = 0;

  handle_timer();

  Bit64u my_time_usec = bx_virt_timer.time_usec();

  switch (address) {

    case 0x40: /* timer 0 - system ticks */
      value = BX_PIT_THIS s.timer.read(0);
      break;
    case 0x41: /* timer 1 read */
      value = BX_PIT_THIS s.timer.read(1);
      break;
    case 0x42: /* timer 2 read */
      value = BX_PIT_THIS s.timer.read(2);
      break;
    case 0x43: /* timer 1 read */
      value = BX_PIT_THIS s.timer.read(3);
      break;

    case 0x61:
      /* AT, port 61h */
      BX_PIT_THIS s.refresh_clock_div2 = (bx_bool)((my_time_usec / 15) & 1);
      value = (BX_PIT_THIS s.timer.read_OUT(2)  << 5) |
              (BX_PIT_THIS s.refresh_clock_div2 << 4) |
              (BX_PIT_THIS s.speaker_data_on    << 1) |
              (BX_PIT_THIS s.timer.read_GATE(2) ? 1 : 0);
      break;

    default:
      BX_PANIC(("unsupported io read from port 0x%04x", address));
  }

  BX_DEBUG(("read from port 0x%04x, value = 0x%02x", address, value));
  return value;
}
Exemplo n.º 10
0
static void __noreturn main_loop(void)
{
    /* main loop */
    while (1) {
        handle_fw();

        /*
         * Due to frame order persevation, the wlan subroutines
         * must be executed before handle_host_interface.
         */
        handle_wlan();

        handle_host_interface();

        handle_usb();

        handle_timer();

        tally_update();
    }
}
Exemplo n.º 11
0
GPSWindow::GPSWindow(QWidget * parent)
	: QWidget(parent, Qt::Window)
{
	setupUi(this);

	latitude->setText(System::gps_latitude().str().c_str());
	longitude->setText(System::gps_longitude().str().c_str());
	datetime_utc->setText(System::gps_time().str().c_str());

	timer = new QTimer(this);
	timer->setSingleShot(false);
	timer->stop();

	handle_timer(true);

	connect(button_toggle, &QPushButton::clicked, this, &GPSWindow::toggle_active);
	connect(button_close, &QPushButton::clicked, this, &QWidget::hide);
	connect(latitude, &QLineEdit::editingFinished, this, &GPSWindow::latitude_edit_finished);
	connect(longitude, &QLineEdit::editingFinished, this, &GPSWindow::longitude_edit_finished);
	connect(
		datetime_utc, &QLineEdit::editingFinished, this, &GPSWindow::datetime_edit_finished);
	connect(timer, &QTimer::timeout, this, &GPSWindow::timeout);
}
Exemplo n.º 12
0
void time_event()
{
    handle_timer();

}
Exemplo n.º 13
0
/**
  * @brief AsyncServer框架要求实现的接口之一。 
  *
  */
extern "C" void proc_events()
{
	handle_timer();
}
Exemplo n.º 14
0
int
main(void)
{
	uint8_t state = 0;

	serial_baud_9600();
	serial_mode_8e1();
	serial_transmitter_enable();

	sleep_mode_idle();

	pin13_mode_output();
	pin13_low();

	/* setup timer2 to trigger interrupt a
	 * once every millisecond
	 * 128 * (124 + 1) / 16MHz = 1ms */
	timer2_mode_ctc();
	timer2_clock_d128();
	timer2_compare_a_set(124);
	timer2_interrupt_a_enable();

	ow_timer_init();

	adc_reference_internal_5v();
	adc_pin_select(5);
	adc_clock_d128();
	adc_trigger_freerunning();
	adc_trigger_enable();
	adc_interrupt_enable();
	adc_enable();

	sei();
	start_temp_measure();

	while (1) {
		uint16_t value;

		cli();
		if (!new_value && !ev_timer) {
			sleep_enable();
			sei();
			sleep_cpu();
			sleep_disable();
			continue;
		}
		sei();

		if (new_value) {
			value = adc_data();
			new_value = 0;

			if (state && value < BOUND_LOW) {
				uint16_t now = time;
				char *p, *q;

				timer2_clock_reset();
				time = 0;

				pin13_low();

				p = sprint_uint16_b10(buf, now);
				*p++ = ' ';
				q= last_temp_buf;
				while (*q)
					*p++ = *q++;
				*p++ = '\n';
				*p = '\0';
				serial_puts(buf);

				state = 0;
				continue;
			}

			if (value > BOUND_HIGH) {
				pin13_high();
				state = 1;
			}
		}

		if (ev_timer)
			handle_timer();
	}
}
Exemplo n.º 15
0
void GPSWindow::toggle_active() { handle_timer(timer->isActive()); }
Exemplo n.º 16
0
void proc_events()
{
	handle_cmd_busy_sprite();
	handle_timer();
}
Exemplo n.º 17
0
void proc_events()
{
	handle_timer();
}
Exemplo n.º 18
0
void TIM6_DAC_irq(void)
{
    HAL_System_Interrupt_Trigger(SysInterrupt_TIM6_DAC_IRQ, NULL);
    handle_timer(TIM6, TIM_IT_Update, SysInterrupt_TIM6_Update);
}
Exemplo n.º 19
0
void TIM7_override(void)
{
    HAL_System_Interrupt_Trigger(SysInterrupt_TIM7_IRQ, NULL);
    handle_timer(TIM7, TIM_IT_Update, SysInterrupt_TIM7_Update);
}
void applyConfig() {
	if (splashEnded) {
		handle_timer(NULL);
	}
}
Exemplo n.º 21
0
/**
 * @brief proc_events 异步框架要求实现的接口之一
 */
void proc_events()
{
    handle_timer();
    g_shop.create_shop();
}