/* Demo application includes. */\r
#include "partest.h"\r
#include "flash.h"\r
+#include "dynamic.h"\r
\r
/* ST driver includes. */\r
#include "stm32l1xx_usart.h"\r
#define mainMESSAGE_BUTTON_LEFT ( 3 )\r
#define mainMESSAGE_BUTTON_RIGHT ( 4 )\r
#define mainMESSAGE_BUTTON_SEL ( 5 )\r
+#define mainMESSAGE_STATUS ( 6 )\r
\r
/*\r
* System configuration is performed prior to main() being called, this function\r
{\r
xTaskCreate( prvLCDTask, ( signed char * ) "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );\r
xTaskCreate( vTempTask, ( signed char * ) "Temp", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+ vStartDynamicPriorityTasks();\r
+ vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
+ \r
+ vTaskStartScheduler();\r
}\r
\r
- vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
- \r
- vTaskStartScheduler();\r
- \r
for( ;; );\r
}\r
/*-----------------------------------------------------------*/\r
{\r
xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );\r
\r
- if( lLine >= Line9 )\r
+ if( lLine > Line9 )\r
{\r
LCD_Clear( Blue );\r
lLine = 0;\r
{\r
case mainMESSAGE_BUTTON_UP : sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue );\r
break;\r
- case mainMESSAGE_BUTTON_DOWN :\r
+ case mainMESSAGE_BUTTON_DOWN : sprintf( cBuffer, "Button down = %d", xReceivedMessage.lMessageValue );\r
break;\r
- case mainMESSAGE_BUTTON_LEFT :\r
+ case mainMESSAGE_BUTTON_LEFT : sprintf( cBuffer, "Button left = %d", xReceivedMessage.lMessageValue );\r
break;\r
- case mainMESSAGE_BUTTON_RIGHT :\r
+ case mainMESSAGE_BUTTON_RIGHT : sprintf( cBuffer, "Button right = %d", xReceivedMessage.lMessageValue );\r
break;\r
- case mainMESSAGE_BUTTON_SEL :\r
+ case mainMESSAGE_BUTTON_SEL : sprintf( cBuffer, "Select interrupt!" );\r
+ break;\r
+ case mainMESSAGE_STATUS : sprintf( cBuffer, "Task status = %s", ( ( xReceivedMessage.lMessageValue ) ? "PASS" : "FAIL" ) );\r
break;\r
default : sprintf( cBuffer, "Unknown message" );\r
break;\r
}\r
/*-----------------------------------------------------------*/\r
\r
+void EXTI9_5_IRQHandler( void )\r
+{\r
+const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, 0 };\r
+long lHigherPriorityTaskWoken = pdFALSE;\r
+\r
+ xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken );\r
+ EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE );\r
+ portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationTickHook( void )\r
+{\r
+static unsigned long ulCounter = 0;\r
+static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS;\r
+static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };\r
+long lHigherPriorityTaskWoken = pdFALSE; /* Not used in this case as this is the tick hook. */\r
+\r
+ ulCounter++;\r
+ if( ulCounter >= ulCheckFrequency )\r
+ {\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.lMessageValue = pdFAIL;\r
+ }\r
+ \r
+ xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken );\r
+ ulCounter = 0;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
static void vTempTask( void *pv )\r
{\r
-long lLastState = pdFALSE;\r
+long lLastState = pdTRUE;\r
long lState;\r
xQueueMessage xMessage;\r
\r
/* Initialise the LEDs. */\r
vParTestInitialise();\r
\r
- //BUTTON_MODE_EXTI\r
+ //\r
/* Initialise the joystick inputs. */\r
STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO );\r
STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO );\r
STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO );\r
STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO );\r
- STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_GPIO );\r
+ \r
+ /* The select button in the middle of the joystick is configured to generate\r
+ an interrupt. The Eval board library will configure the interrupt\r
+ priority to be the lowest priority available - this is important as the\r
+ interrupt service routine makes use of a FreeRTOS API function so must\r
+ therefore use a priority equal to or below that set by the\r
+ configMAX_SYSCALL_INTERRUPT_PRIORITY() value set in FreeRTOSConfig.h. */\r
+ STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI );\r
\r
#if 0 \r
USART_InitTypeDef USART_InitStructure;\r
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log></Static>\r
<Windows>\r
\r
- <Wnd2>\r
+ <Wnd0>\r
<Tabs>\r
<Tab>\r
<Identity>TabID-27630-4718</Identity>\r
<Factory>Workspace</Factory>\r
<Session>\r
\r
- <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode></NodeDict></Session>\r
+ <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source</ExpandedNode><ExpandedNode>RTOSDemo/Standard_Demo_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode></NodeDict></Session>\r
</Tab>\r
</Tabs>\r
\r
- <SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-10002-7709</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-18437-21512</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
+ <SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-10002-7709</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-18437-21512</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>\r
<Editor>\r
\r
\r
\r
\r
- <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>11</YPos><SelStart>3083</SelStart><SelEnd>3083</SelEnd></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+ <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>58</YPos><SelStart>3560</SelStart><SelEnd>3560</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c</Filename><XPos>0</XPos><YPos>269</YPos><SelStart>10954</SelStart><SelEnd>10954</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_syscfg.c</Filename><XPos>0</XPos><YPos>125</YPos><SelStart>4815</SelStart><SelEnd>4815</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\startup_stm32l1xx_md.s</Filename><XPos>0</XPos><YPos>309</YPos><SelStart>10065</SelStart><SelEnd>10083</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portmacro.h</Filename><XPos>0</XPos><YPos>91</YPos><SelStart>4341</SelStart><SelEnd>4381</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s</Filename><XPos>0</XPos><YPos>92</YPos><SelStart>4644</SelStart><SelEnd>4644</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\queue.c</Filename><XPos>0</XPos><YPos>794</YPos><SelStart>29177</SelStart><SelEnd>29177</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\dynamic.c</Filename><XPos>0</XPos><YPos>388</YPos><SelStart>15479</SelStart><SelEnd>15515</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>1107</YPos><SelStart>38209</SelStart><SelEnd>38209</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>50</YPos><SelStart>3695</SelStart><SelEnd>3695</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval_lcd.c</Filename><XPos>0</XPos><YPos>6</YPos><SelStart>1224</SelStart><SelEnd>1224</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_gpio.c</Filename><XPos>0</XPos><YPos>302</YPos><SelStart>9524</SelStart><SelEnd>9524</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_spi.c</Filename><XPos>0</XPos><YPos>20</YPos><SelStart>1472</SelStart><SelEnd>1472</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</Filename><XPos>0</XPos><YPos>162</YPos><SelStart>7128</SelStart><SelEnd>7128</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
<Positions>\r
\r
\r
\r
\r
\r
- <Top><Row0><Sizes><Toolbar-012aae80><key>iaridepm.enu1</key></Toolbar-012aae80></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>285</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>170833</sizeVertCX><sizeVertCY>755601</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+ <Top><Row0><Sizes><Toolbar-012aae88><key>iaridepm.enu1</key></Toolbar-012aae88></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>285</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>170833</sizeVertCX><sizeVertCY>755601</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
</Desktop>\r
</Workspace>\r
\r