Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. /general libraries
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. //FreeRTOS
  6. #include "FreeRTOS.h"
  7. #include "task.h"
  8.  
  9. #include "app_config.h"
  10.  
  11. //target.h contains general initialization of MCU, LP2378 microcontroller
  12. #include "target.h"
  13.  
  14. //general purpose I/O
  15. #include "gpio.h"
  16.  
  17. //typedef sht_t* shtHANDLE;
  18. //shtHANDLE shth;
  19. portTASK_FUNCTION_PROTO(LEDTest, pvParameters);
  20.  
  21. //uint8_t measureInd = 0;
  22. portTASK_FUNCTION(LEDTest, pvParameters)
  23. {
  24. portTickType xPrevTick = xTaskGetTickCount();
  25.  
  26. while(1)
  27. {
  28.  
  29. LED2_OFF();
  30. LED1_ON();
  31. vTaskDelayUntil(&xPrevTick, 500);
  32. }
  33. }
  34. portTASK_FUNCTION(LEDTest2, pvParameters)
  35. {
  36. portTickType xPrevTick2 = xTaskGetTickCount();
  37.  
  38. while(1)
  39. {
  40. LED1_OFF();
  41. LED2_ON();
  42. vTaskDelayUntil(&xPrevTick2, 2000);
  43. }
  44. }
  45.  
  46. int main()
  47. {
  48. //alustus funktio
  49. target_init();
  50.  
  51.  
  52. //luo taskin joka vilkuttaa lediä
  53. xTaskCreate((pdTASK_CODE)LEDTest, "LEDTEST", configMINIMAL_STACK_SIZE, NULL,
  54. (tskIDLE_PRIORITY + 2 ), ( xTaskHandle * )NULL);
  55.  
  56. xTaskCreate((pdTASK_CODE)LEDTest2, "LEDTEST2", configMINIMAL_STACK_SIZE, NULL,
  57. (tskIDLE_PRIORITY + 1 ), ( xTaskHandle * )NULL);
  58.  
  59. //aloittaa taskin suorittamisen
  60. vTaskStartScheduler();
  61. return 1;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement