Advertisement
teplofizik

main.c (9)

Aug 11th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. // ***********************************************************
  2. // **                    NyaOS Sample                       **
  3. // ***********************************************************
  4. // http://teplofizik.diary.ru/p179560849.htm
  5.  
  6. #include "nyaos.h"
  7.  
  8. volatile int A = 0;
  9.  
  10. // Процесс 1
  11. int Process1(uint32_t Argument)
  12. {
  13.     while(1)
  14.     {
  15.         delay(1000000UL);
  16.        
  17.         LedOn(0);
  18.        
  19.         delay(1200000UL);
  20.        
  21.         LedOff(0);
  22.     }
  23. }
  24.  
  25. // Процесс 2
  26. int Process2(uint32_t Argument)
  27. {
  28.     while(1)
  29.     {
  30.         delay(300000UL);
  31.        
  32.         LedOn(1);
  33.        
  34.         delay(1500000UL);
  35.        
  36.         LedOff(1);
  37.     }
  38. }
  39.  
  40. int main(void)
  41. {
  42.     LedInit();
  43.    
  44.     // Инициализация и настройка ОС
  45.     nyaos_Init();
  46.    
  47.     // Процесс 1
  48.     nyaos_AddProcess("Process1", &Process1, 0, 0);
  49.    
  50.     // Процесс 2
  51.     nyaos_AddProcess("Process2", &Process2, 0, 0);
  52.    
  53.     // Запуск ОС
  54.     nyaos_Start();
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement