コード例 #1
0
/*..........................................................................*/
void QF_onClockTickISR(void) {
    QF_tickXISR(0U);           /* perform the QF-nano clock tick processing */

    if (_kbhit()) {                                     /* any key pressed? */
        BSP_onKeyboardInputISR(_getch());
    }
}
コード例 #2
0
ファイル: bsp.c プロジェクト: QuantumLeaps/qpn
/* ISRs --------------------------------------------------------------------*/
__ramfunc
static void ISR_tick(void) {
    /* state of the button debouncing, see below */
    static struct ButtonsDebouncing {
        uint32_t depressed;
        uint32_t previous;
    } buttons = { ~0U, ~0U };
    uint32_t current;
    uint32_t volatile tmp;

    /* clear the interrupt source */
    tmp = AT91C_BASE_PITC->PITC_PIVR;

    QF_tickXISR(0U); /* process time events for rate 0 */

    /* Perform the debouncing of buttons. The algorithm for debouncing
    * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle
    * and Michael Barr, page 71.
    */
    current = ~AT91C_BASE_PIOA->PIO_PDSR;/* read PIOA with state of Buttons */
    tmp = buttons.depressed; /* save the debounced depressed buttons */
    buttons.depressed |= (buttons.previous & current); /* set depressed */
    buttons.depressed &= (buttons.previous | current); /* clear released */
    buttons.previous   = current; /* update the history */
    tmp ^= buttons.depressed;     /* changed debounced depressed */
    if ((tmp & l_btn[0]) != 0U) {  /* debounced BTN_P1 state changed? */
        if ((buttons.depressed & l_btn[0]) != 0U) { /* is BTN_P1 depressed? */
            QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U);
        }
        else {            /* the button is released */
            QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U);
        }
    }
}
コード例 #3
0
/*..........................................................................*/
void QF_onClockTickISR(void) {
    QF_tickXISR(0U);                /* perform the QF clock tick processing */

    if (_kbhit()) {                                     /* any key pressed? */
        switch (_getch()) {
            case '\33':                                     /* ESC pressed? */
                QACTIVE_POST_ISR((QActive *)&AO_Pelican, TERMINATE_SIG, 0U);
                break;
            case 'p':
                printf("-----> PEDS_WAITING\n");
                QACTIVE_POST_ISR((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0U);
                break;
            case 'f':
                printf("-----> OFF\n");
                QACTIVE_POST_ISR((QActive *)&AO_Pelican, OFF_SIG, 0U);
                break;
            case 'o':
                printf("-----> ON\n");
                QACTIVE_POST_ISR((QActive *)&AO_Pelican, ON_SIG, 0U);
                break;
            default:
                break;
        }
    }
}
コード例 #4
0
ファイル: bsp.c プロジェクト: QuantumLeaps/qpn
__interrupt void timer2_ISR(void) {
    /* state of the button debouncing, see below */
    static struct ButtonsDebouncing {
        uint8_t depressed;
        uint8_t previous;
    } buttons = { 0xFFU, 0xFFU };
    uint8_t current;
    uint8_t tmp;

    QF_tickXISR(0U); /* process time events for rate 0 */

    /* Perform the debouncing of buttons. The algorithm for debouncing
    * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle
    * and Michael Barr, page 71.
    */
    current = PIND; /* read PORTD with the state of BTN_EXT */
    tmp = buttons.depressed; /* save the debounced depressed buttons */
    buttons.depressed |= (buttons.previous & current); /* set depressed */
    buttons.depressed &= (buttons.previous | current); /* clear released */
    buttons.previous   = current; /* update the history */
    tmp ^= buttons.depressed;     /* changed debounced depressed */
    if ((tmp & BTN_EXT) != 0U) {  /* debounced BTN_EXT state changed? */
        if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */
            QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U);
        }
        else {            /* the button is released */
            QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U);
        }
    }
}
コード例 #5
0
/*..........................................................................*/
void QF_onClockTickISR(void) {
    QF_tickXISR(0U);           /* perform the QF-nano clock tick processing */

    if (_kbhit()) {                                     /* any key pressed? */
        int ch = _getch();
        if (ch == 0x1B) {                     /* see if the ESC key pressed */
            QACTIVE_POST_ISR((QActive *)&AO_Table, TERMINATE_SIG, 0U);
        }
        else if (ch == 'p') {
            QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U);
        }
    }
}
コード例 #6
0
ファイル: qp.c プロジェクト: henrychoi/realtime
void Timer1_handler(nrf_timer_event_t event_type, void* p_context) {
    if (event_type != NRF_TIMER_EVENT_COMPARE0) return;

	//QS_BEGIN(TRACE_SDK_EVT, NULL)
	//	QS_U8(0, 0);
	//QS_END() QS_FLUSH();

#ifdef Q_SPY
    QS_tickTime_ += 1000/BSP_TICKS_PER_SEC;
    QS_i_getTime = 0;//reset
#endif
    QF_tickXISR(0U); /* process time events for rate 0 */
}
コード例 #7
0
/*..........................................................................*/
void QF_onClockTickISR(void) {
    struct timeval timeout = { 0 };                 /* timeout for select() */
    fd_set con;                          /* FD set representing the console */

    QF_tickXISR(0U);                /* perform the QF clock tick processing */

    FD_ZERO(&con);
    FD_SET(0, &con);
    /* check if a console input is available, returns immediately */
    if (0 != select(1, &con, 0, 0, &timeout)) {      /* any descriptor set? */
        char ch;
        read(0, &ch, 1);
        if (ch == '\33') {                                  /* ESC pressed? */
            QACTIVE_POST_ISR((QActive *)&AO_Table, TERMINATE_SIG, 0U);
        }
        else if (ch == 'p') {
            QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U);
        }
    }
}
コード例 #8
0
ファイル: blinky.c プロジェクト: QuantumLeaps/qpn
void QF_onClockTickISR(void) {
    QF_tickXISR(0U); /* QF-nano clock tick processing for rate 0 */
}
コード例 #9
0
/*..........................................................................*/
void SysTick_Handler(void) {
    QF_tickXISR(0U);                       /* process time events at rate 0 */
}
コード例 #10
0
ファイル: bsp.c プロジェクト: QuantumLeaps/qpn
/* ISRs used in this project ===============================================*/
void SysTick_Handler(void) {
    QK_ISR_ENTRY();  /* inform QK about entering an ISR */
    QF_tickXISR(0U); /* process time events for rate 0 */
    QK_ISR_EXIT();   /* inform QK about exiting an ISR */
}