Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 8 months ago.
How does one disable/re-enable serial RX interrupts on a nRF51822 ?
Hello,
How is this done for a nRF51822? Below is an example for LPC1768, KL25Z and K64F (assuming UART0):
void PcRxIRQcallback(void){ pcRxIRQCnt++; #if defined(TARGET_KL25Z) NVIC_DisableIRQ(UART0_IRQn); // n=0, 1 or 2 Disable Rx interrupt on kl25z #endif #if defined(TARGET_K64F) NVIC_DisableIRQ(UART0_RX_TX_IRQn); // n=0, 1 or 2 Disable Rx interrupt on k64f #endif #if defined(TARGET_LPC1768) LPC_UART0->IER = 0; //Disable Rx interrupt on mbed1768 #endif while (pc.readable()) { inchar = pc.getc(); //read data from USB PcRxChar(inchar); //go process char } #if defined(TARGET_KL25Z) NVIC_EnableIRQ(UART0_IRQn); // n=0, 1 or 2 Re-enable Rx interrupt on kl25z #endif #if defined(TARGET_K64F) NVIC_EnableIRQ(UART0_RX_TX_IRQn); // n=0, 1 or 2 Re-enable Rx interrupt on k64f #endif #if defined(TARGET_LPC1768) LPC_UART0->IER = 1; //RE-enable Rx interrupt on mbed1768 #endif }