#include "task.h"\r
#include "semphr.h"\r
\r
+/* TI includes. */\r
+#include "gpio.h"\r
+\r
/* Priorities at which the tasks are created. */\r
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
*/\r
static void prvConfigureClocks( void );\r
\r
+/* \r
+ * Configure a button to generate interrupts (for test purposes). This is done\r
+ * to test waking on an interrupt other than the systick interrupt in tickless\r
+ * idle mode.\r
+ */\r
+static void prvConfigureButton( void );\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* The queue used by both tasks. */\r
/* The full demo configures the clocks for maximum frequency, wheras this\r
blinky demo uses a slower clock as it also uses low power features. */\r
prvConfigureClocks();\r
+ \r
+ /* Configure a button to generate interrupts (for test purposes). */\r
+ prvConfigureButton();\r
\r
/* Create the queue. */\r
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vPreSleepProcessing( uint32_t ulExpectedIdleTime )\r
+static void prvConfigureButton( void )\r
+{\r
+volatile uint8_t ucPin;\r
+\r
+ /* Configure button S1 to generate interrupts. This is done to test the\r
+ code path were low power mode is exited for a reason other than a tick\r
+ interrupt. */\r
+ GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P1, GPIO_PIN1 );\r
+ GPIO_enableInterrupt( GPIO_PORT_P1, GPIO_PIN1 );\r
+ Interrupt_enableInterrupt( INT_PORT1 );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void PORT1_IRQHandler( void )\r
{\r
+static volatile uint32_t ux = 0;\r
+ \r
+ /* This is the handler for interrupt generated by the button. The \r
+ interrupt is only used to bring the MCU out of low power mode. It\r
+ doesn't perform any other function. The ux increment is just to\r
+ have something to set breakpoints on and check the interrupt is\r
+ executing. */\r
+ ux++;\r
+ \r
+ /* Clear the interrupt. */\r
+ ( void ) P1->IV;\r
+}\r
+/*-----------------------------------------------------------*/\r
\r
+void vPreSleepProcessing( uint32_t ulExpectedIdleTime )\r
+{\r
}\r
/*-----------------------------------------------------------*/\r
\r
extern void vUART_Handler( void );\r
extern void vT32_0_Handler( void );\r
extern void vT32_1_Handler( void );\r
+extern void PORT1_IRQHandler( void );\r
//*****************************************************************************\r
//\r
// The entry point for the application startup code.\r
IntDefaultHandler, // DMA_INT2 ISR\r
IntDefaultHandler, // DMA_INT1 ISR\r
IntDefaultHandler, // DMA_INT0 ISR\r
- IntDefaultHandler, // PORT1 ISR\r
+ PORT1_IRQHandler, // PORT1 ISR\r
IntDefaultHandler, // PORT2 ISR\r
IntDefaultHandler, // PORT3 ISR\r
IntDefaultHandler, // PORT4 ISR\r