/*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE2 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef Q_SPY QF_INT_ENABLE(); if ((UCSR0A & (1U << UDRE0)) != 0U) { uint16_t b; QF_INT_DISABLE(); b = QS_getByte(); QF_INT_ENABLE(); if (b != QS_EOD) { UDR0 = (uint8_t)b; /* stick the byte to the TX UDR0 */ } } #elif defined NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif }
//............................................................................ void QV::onIdle(void) { // CATION: called with interrupts DISABLED, NOTE01 // toggle LED2 on and then off, see NOTE01 GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; GPIOF->DATA_Bits[LED_BLUE] = 0x00U; #ifdef NDEBUG // Put the CPU and peripherals to the low-power mode. // you might need to customize the clock management for your application, // see the datasheet for your particular Cortex-M3 MCU. // QV_CPU_SLEEP(); // atomically go to sleep and enable interrupts #else QF_INT_ENABLE(); // just enable interrupts #endif }
/*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif }
/*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ /* toggle the LED on and then off, see NOTE02 */ QF_INT_DISABLE(); LPC_GPIO1->FIOSET = LED_4; /* turn LED on */ __NOP(); /* a couple of NOPs to actually see the LED glow */ __NOP(); __NOP(); __NOP(); LPC_GPIO1->FIOCLR = LED_4; /* turn LED off */ QF_INT_ENABLE(); #ifdef Q_SPY if ((LPC_UART0->LSR & 0x20U) != 0U) { /* TX Holding Register empty? */ uint16_t fifo = UART_TXFIFO_DEPTH; /* max bytes we can accept */ uint8_t const *block; QF_INT_DISABLE(); block = QS_getBlock(&fifo); /* try to get next block to transmit */ QF_INT_ENABLE(); while (fifo-- != 0) { /* any bytes in the block? */ LPC_UART0->THR = *block++; /* put into the FIFO */ } } #elif defined NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif }