Dining Philosophers Problem (DPP) example for the QP active object framework. Demonstrates: event-driven programming, hierarchical state machines in C++, modeling and graphical state machine design, code generation, preemptive multitasking, software tracing, power saving mode, direct event posting, publish-subscribe. More information available in the [[/users/QL/notebook|Quantum Leaps Notebook pages]]. See also [[http://www.state-machine.com|state-machine.com]].
Diff: bsp.cpp
- Revision:
- 2:2e62e514f323
- Parent:
- 0:efb9ac8d1a88
- Child:
- 3:81ceb3127876
diff -r c7711e751cf6 -r 2e62e514f323 bsp.cpp --- a/bsp.cpp Mon Feb 14 01:24:01 2011 +0000 +++ b/bsp.cpp Wed Feb 16 17:12:38 2011 +0000 @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////// // Product: BSP for "Dining Philosophers Problem" example, QK kernel // Last Updated for Version: 4.1.06 -// Date of the Last Update: Feb 10, 2011 +// Date of the Last Update: Feb 16, 2011 // // Q u a n t u m L e a P s // --------------------------- @@ -131,7 +131,11 @@ void QK::onIdle(void) { QF_INT_LOCK(dummy); - LED_PORT->FIOSET = LED4_BIT; // turn the LED4 on + LED_PORT->FIOSET = LED4_BIT; // turn the LED4 on + __NOP(); // delay a bit to see some light intensity + __NOP(); + __NOP(); + __NOP(); LED_PORT->FIOCLR = LED4_BIT; // turn the LED4 off QF_INT_UNLOCK(dummy); @@ -145,9 +149,15 @@ } } #else - // 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. + // 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. + // + // Specifially for the mbed board, see the articles: + // * "Power Management" http://mbed.org/cookbook/Power-Management; and + // * "Interface Powerdown" at + // http://mbed.org/users/simon/notebook/interface-powerdown/ + // __WFI(); #endif }