#define mainQUEUE_LENGTH ( 1 )\r
\r
/* The LED toggle by the queue receive task. */\r
-#define mainTASK_CONTROLLED_LED 0x0100UL\r
+#define mainTASK_CONTROLLED_LED 0x8000UL\r
\r
/* The LED turned on by the button interrupt, and turned off by the LED timer. */\r
-#define mainTIMER_CONTROLLED_LED 0x0200UL\r
+#define mainTIMER_CONTROLLED_LED 0x8000UL\r
\r
/*-----------------------------------------------------------*/\r
\r
function. */\r
static xTimerHandle xLEDTimer = NULL;\r
\r
-/* Maintains the current LED output state. */\r
-static volatile unsigned long ulGPIOState = 0xffffUL;\r
-\r
/*-----------------------------------------------------------*/\r
\r
int main(void)\r
a critical section because it is accessed from multiple tasks, and the\r
button interrupt - in this trivial case, for simplicity, the critical\r
section is omitted. */\r
- ulGPIOState |= mainTIMER_CONTROLLED_LED;\r
- FM3_GPIO->PDOR3 = ulGPIOState;\r
+ FM3_GPIO->PDOR1 |= mainTIMER_CONTROLLED_LED;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* The button was pushed, so ensure the LED is on before resetting the\r
LED timer. The LED timer will turn the LED off if the button is not\r
pushed within 5000ms. */\r
- ulGPIOState &= ~mainTIMER_CONTROLLED_LED;\r
- FM3_GPIO->PDOR3 = ulGPIOState;\r
+ FM3_GPIO->PDOR1 &= ~mainTIMER_CONTROLLED_LED;\r
\r
/* This interrupt safe FreeRTOS function can be called from this interrupt\r
because the interrupt priority is below the\r
because it is accessed from multiple tasks, and the button interrupt\r
- in this trivial case, for simplicity, the critical section is\r
omitted. */\r
- if( ( ulGPIOState & mainTASK_CONTROLLED_LED ) != 0 )\r
+ if( ( FM3_GPIO->PDOR3 & mainTASK_CONTROLLED_LED ) != 0 )\r
{\r
- ulGPIOState &= ~mainTASK_CONTROLLED_LED;\r
+ FM3_GPIO->PDOR3 &= ~mainTASK_CONTROLLED_LED;\r
}\r
else\r
{\r
- ulGPIOState |= mainTASK_CONTROLLED_LED;\r
+ FM3_GPIO->PDOR3 |= mainTASK_CONTROLLED_LED;\r
}\r
- FM3_GPIO->PDOR3 = ulGPIOState;\r
}\r
}\r
}\r
static void prvSetupHardware( void )\r
{\r
const unsigned short usButtonInputBit = 0x01U;\r
+const unsigned short usGPIOState = 0xFF00U;\r
\r
SystemInit();\r
SystemCoreClockUpdate();\r
\r
+ /* Analog inputs are not used on the LED outputs. */\r
+ FM3_GPIO->ADE = 0x00FF;\r
+ \r
/* LED seg1 to GPIO output (P18->P1F). */\r
FM3_GPIO->DDR1 = 0xFF00;\r
FM3_GPIO->PFR1 = 0x0000;\r
FM3_GPIO->PFR3 = 0x0000;\r
\r
/* Start with all LEDs off. */\r
- FM3_GPIO->PDOR3 = ulGPIOState;\r
- FM3_GPIO->PDOR1 = ulGPIOState;\r
+ FM3_GPIO->PDOR3 = usGPIOState;\r
+ FM3_GPIO->PDOR1 = usGPIOState;\r
\r
/* Set the switches to input (P18->P1F). */\r
FM3_GPIO->DDR5 = 0x0000;\r