/Demo/CORTEX_M0_STM32F0518_IAR/ParTest.c

https://github.com/ransford/freertos-moo · C · 126 lines · 38 code · 11 blank · 77 comment · 4 complexity · 0f29e21086723276c2b312b4ec84f562 MD5 · raw file

  1. /*
  2. FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.
  3. ***************************************************************************
  4. * *
  5. * FreeRTOS tutorial books are available in pdf and paperback. *
  6. * Complete, revised, and edited pdf reference manuals are also *
  7. * available. *
  8. * *
  9. * Purchasing FreeRTOS documentation will not only help you, by *
  10. * ensuring you get running as quickly as possible and with an *
  11. * in-depth knowledge of how to use FreeRTOS, it will also help *
  12. * the FreeRTOS project to continue with its mission of providing *
  13. * professional grade, cross platform, de facto standard solutions *
  14. * for microcontrollers - completely free of charge! *
  15. * *
  16. * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
  17. * *
  18. * Thank you for using FreeRTOS, and thank you for your support! *
  19. * *
  20. ***************************************************************************
  21. This file is part of the FreeRTOS distribution.
  22. FreeRTOS is free software; you can redistribute it and/or modify it under
  23. the terms of the GNU General Public License (version 2) as published by the
  24. Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
  25. >>>NOTE<<< The modification to the GPL is included to allow you to
  26. distribute a combined work that includes FreeRTOS without being obliged to
  27. provide the source code for proprietary components outside of the FreeRTOS
  28. kernel. FreeRTOS is distributed in the hope that it will be useful, but
  29. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  30. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  31. more details. You should have received a copy of the GNU General Public
  32. License and the FreeRTOS license exception along with FreeRTOS; if not it
  33. can be viewed here: http://www.freertos.org/a00114.html and also obtained
  34. by writing to Richard Barry, contact details for whom are available on the
  35. FreeRTOS WEB site.
  36. 1 tab == 4 spaces!
  37. ***************************************************************************
  38. * *
  39. * Having a problem? Start by reading the FAQ "My application does *
  40. * not run, what could be wrong? *
  41. * *
  42. * http://www.FreeRTOS.org/FAQHelp.html *
  43. * *
  44. ***************************************************************************
  45. http://www.FreeRTOS.org - Documentation, training, latest information,
  46. license and contact details.
  47. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  48. including FreeRTOS+Trace - an indispensable productivity tool.
  49. Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
  50. the code with commercial support, indemnification, and middleware, under
  51. the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
  52. provide a safety engineered and independently SIL3 certified version under
  53. the SafeRTOS brand: http://www.SafeRTOS.com.
  54. */
  55. /*-----------------------------------------------------------
  56. * Simple GPIO (parallel port) IO routines.
  57. *-----------------------------------------------------------*/
  58. /* Kernel includes. */
  59. #include "FreeRTOS.h"
  60. #include "task.h"
  61. /* Standard demo include. */
  62. #include "partest.h"
  63. /* Hardware includes. */
  64. #include "stm320518_eval.h"
  65. /* Only the LEDs on one of the two seven segment displays are used. */
  66. #define partstMAX_LEDS 4
  67. static const Led_TypeDef xLEDs[ partstMAX_LEDS ] = { LED1, LED2, LED3, LED4 };
  68. /*-----------------------------------------------------------*/
  69. void vParTestInitialise( void )
  70. {
  71. /* Initialise all four LEDs that are built onto the starter kit. */
  72. STM_EVAL_LEDInit( LED1 );
  73. STM_EVAL_LEDInit( LED2 );
  74. STM_EVAL_LEDInit( LED3 );
  75. STM_EVAL_LEDInit( LED4 );
  76. }
  77. /*-----------------------------------------------------------*/
  78. void vParTestSetLED( unsigned long ulLED, signed portBASE_TYPE xValue )
  79. {
  80. if( ulLED < partstMAX_LEDS )
  81. {
  82. if( xValue == pdTRUE )
  83. {
  84. STM_EVAL_LEDOn( xLEDs[ ulLED ] );
  85. }
  86. else
  87. {
  88. STM_EVAL_LEDOff( xLEDs[ ulLED ] );
  89. }
  90. }
  91. }
  92. /*-----------------------------------------------------------*/
  93. void vParTestToggleLED( unsigned long ulLED )
  94. {
  95. if( ulLED < partstMAX_LEDS )
  96. {
  97. taskENTER_CRITICAL();
  98. {
  99. STM_EVAL_LEDToggle( xLEDs[ ulLED ] );
  100. }
  101. taskEXIT_CRITICAL();
  102. }
  103. }
  104. /*-----------------------------------------------------------*/