@@ -78,7 +78,7 @@ void assert_failed(char const * const module, int_t const id) {
7878 Q_onError (module , id );
7979}
8080
81- // ISRs used in the application ============================================
81+ // ISRs used in the application ==============================================
8282
8383void SysTick_Handler (void ); // prototype
8484void SysTick_Handler (void ) {
@@ -203,8 +203,6 @@ void QF_onStartup(void) {
203203 // ...
204204
205205 // enable IRQs...
206- NVIC_EnableIRQ (EXTI0_1_IRQn );
207-
208206#ifdef Q_SPY
209207 NVIC_EnableIRQ (USART2_IRQn ); // UART2 interrupt used for QS-RX
210208#endif
@@ -216,16 +214,15 @@ void QF_onCleanup(void) {
216214void QXK_onIdle (void ) {
217215 // toggle an LED on and then off (not enough LEDs, see NOTE02)
218216 //QF_INT_DISABLE();
219- //QF_MEM_SYS();
220217 //GPIOA->BSRR = (1U << LD4_PIN); // turn LED[n] on
221218 //GPIOA->BSRR = (1U << (LD4_PIN + 16U)); // turn LED[n] off
222- //QF_MEM_APP();
223219 //QF_INT_ENABLE();
224220
225221#ifdef Q_SPY
226222 QS_rxParse (); // parse all the received bytes
227223
228- if ((USART2 -> ISR & (1U << 7U )) != 0U ) { // TXE empty?
224+ // while Transmit Data Register Empty or TX-FIFO Not Full
225+ if ((USART2 -> ISR & USART_ISR_TXE_TXFNF_Msk ) != 0U ) { // TXE empty?
229226 QF_INT_DISABLE ();
230227 uint16_t b = QS_getByte ();
231228 QF_INT_ENABLE ();
@@ -238,7 +235,6 @@ void QXK_onIdle(void) {
238235 // Put the CPU and peripherals to the low-power mode.
239236 // you might need to customize the clock management for your application,
240237 // see the datasheet for your particular Cortex-M MCU.
241- //
242238 __WFI (); // Wait-For-Interrupt
243239#endif
244240}
@@ -305,7 +301,7 @@ void QS_onCleanup(void) {
305301}
306302//............................................................................
307303QSTimeCtr QS_onGetTime (void ) { // NOTE: invoked with interrupts DISABLED
308- if ((SysTick -> CTRL & 0x00010000U ) == 0U ) { // not set?
304+ if ((SysTick -> CTRL & SysTick_CTRL_COUNTFLAG_Msk ) == 0U ) { // not set?
309305 return QS_tickTime_ - (QSTimeCtr )SysTick -> VAL ;
310306 }
311307 else { // the rollover occurred, but the SysTick_ISR did not run yet
@@ -320,7 +316,7 @@ void QS_onFlush(void) {
320316 for (;;) {
321317 uint16_t b = QS_getByte ();
322318 if (b != QS_EOD ) {
323- while ((USART2 -> ISR & ( 1U << 7U ) ) == 0U ) { // while TXE not empty
319+ while ((USART2 -> ISR & USART_ISR_TXE_TXFNF_Msk ) == 0U ) { // while TXE not empty
324320 }
325321 USART2 -> TDR = b ;
326322 }
@@ -346,13 +342,13 @@ void QS_onCommand(uint8_t cmdId,
346342//............................................................................
347343// ISR for receiving bytes from the QSPY Back-End
348344// NOTE: This ISR is "QF-unaware" meaning that it does not interact with
349- // the QF/QXK and is not disabled. Such ISRs don't need to call
350- // QXK_ISR_ENTRY/QXK_ISR_EXIT and they cannot post or publish events.
345+ // the QF/QK and is not disabled. Such ISRs don't need to call
346+ // QK_ISR_ENTRY/QK_ISR_EXIT and they cannot post or publish events.
351347
352348void USART2_IRQHandler (void ); // prototype
353349void USART2_IRQHandler (void ) { // used in QS-RX (kernel UNAWARE interrupt)
354350 // is RX register NOT empty?
355- if ((USART2 -> ISR & ( 1U << 5U ) ) != 0U ) {
351+ if ((USART2 -> ISR & USART_ISR_RXNE_RXFNE_Msk ) != 0U ) {
356352 uint32_t b = USART2 -> RDR ;
357353 QS_RX_PUT (b );
358354 }
@@ -361,7 +357,6 @@ void USART2_IRQHandler(void) { // used in QS-RX (kernel UNAWARE interrupt)
361357}
362358
363359#endif // Q_SPY
364- //----------------------------------------------------------------------------
365360
366361//============================================================================
367362// NOTE1:
0 commit comments