void interrupt VectorNumber_Vsci2rx SCI2RX_ISR(void){ // copy received by into buffer *uart_vars.rxBufWrPtr = SCI2D; // shift pointer uart_vars.rxBufWrPtr++; if (uart_vars.rxBufWrPtr>=uart_vars.rxBuf+uart_vars.rxBufLen) { uart_vars.rxBufWrPtr = uart_vars.rxBuf; } // increment fill uart_vars.rxBufFill++; if (uart_vars.rxBufFill>=uart_vars.rxBufLen) { // buffer has overflown // reset buffer reset_rxBuf(); if (uart_vars.rx_cb!=NULL) { // call the callback uart_vars.rx_cb(UART_EVENT_OVERFLOW); // make sure CPU restarts after leaving interrupt } } else if (uart_vars.rxBufFill>=uart_vars.rxBufFillThres) { // buffer above threshold if (uart_vars.rx_cb!=NULL) { // call the callback uart_vars.rx_cb(UART_EVENT_THRES); } } }
kick_scheduler_t uart_rx_isr() { uart_clearRxInterrupts(); // TODO: do not clear, but disable when done if (uart_vars.rxCb != NULL) { uart_vars.rxCb(); } return DO_NOT_KICK_SCHEDULER; }
/* * @brief uart_rx_isr This function will be called from usart * interrupt when RTXC interrupt flag is set * * @param return kick_scheduler_t * */ kick_scheduler_t uart_rx_isr(void) { uart_clearRxInterrupts(); if (uart_vars.rxCb != NULL) { uart_vars.rxCb(); } return DO_NOT_KICK_SCHEDULER; }
void interrupt VectorNumber_Vsci2tx SCI2TX_int(void) { // one byte less to go uart_vars.txBufLen--; uart_vars.txBuf++; if (uart_vars.txBufLen>0) { // send next byte sci2_PutChar(*uart_vars.txBuf); } else { if (uart_vars.txDone_cb!=NULL) { // disable UART1 TX interrupt SCI2C2_TIE = 0x0; // call the callback uart_vars.txDone_cb(); }//poipoi } }
kick_scheduler_t uart_rx_isr() { uart_vars.rxCb(); return DO_NOT_KICK_SCHEDULER; }
uint8_t uart_isr_rx() { uart_clearRxInterrupts(); // TODO: do not clear, but disable when done uart_vars.rxCb(); return 0; }
kick_scheduler_t uart_tx_isr() { uart_clearTxInterrupts(); // TODO: do not clear, but disable when done uart_vars.txCb(); return DO_NOT_KICK_SCHEDULER; }
kick_scheduler_t uart_rx_isr() { uart_clearRxInterrupts(); uart_vars.rxCb(); return DO_NOT_KICK_SCHEDULER; }