Enable button interrupts in the MSP432 demos in order to test code paths when an MCU exits low power mode for a reason other than a tick interrupt.

pull/4/head
Richard Barry 8 years ago
parent aa810cb926
commit 7ee26c1b5e

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

@ -100,6 +100,7 @@ extern void SVC_Handler( void );
extern void vUART_Handler( void );
extern void vT32_0_Handler( void );
extern void vT32_1_Handler( void );
extern void PORT1_IRQHandler( void );
//*****************************************************************************
//
// The entry point for the application startup code.
@ -188,7 +189,7 @@ __root const uVectorEntry __vector_table[] @ ".intvec" =
IntDefaultHandler, // DMA_INT2 ISR
IntDefaultHandler, // DMA_INT1 ISR
IntDefaultHandler, // DMA_INT0 ISR
IntDefaultHandler, // PORT1 ISR
PORT1_IRQHandler, // PORT1 ISR
IntDefaultHandler, // PORT2 ISR
IntDefaultHandler, // PORT3 ISR
IntDefaultHandler, // PORT4 ISR

Loading…
Cancel
Save