Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. ProcessKeyEvent.h -> ne rabiš kaj delat
  2. VisualizeData.h -> ne rabiš kaj delat
  3.  
  4. ProcessKeyEvent.cpp
  5. // Process input key event
  6. void ProcessKeyEvent::ProcessKeyCodePortE(long keyCode)
  7. {
  8.   // Napišeš kaj ti naj se izvede ko je na portu E vhod
  9. }
  10.  
  11. // Process input key event
  12. void ProcessKeyEvent::ProcessKeyCodePortF(long keyCode)
  13. {
  14.   // Napišeš kaj ti naj se izvede ko je na portu F vhod
  15. }
  16.  
  17. VisualizeData.cpp
  18.  
  19. //tu nisem ziher ka je 0x1? Je to kak oshiftanje bitov al samo število pač eno?
  20. // Toggle on/off display state
  21. void VisualizeData::ToggleDisplay()
  22. {
  23.     // vkalplaš/izkalpaš display
  24.     if(_displayState == 0x1)
  25.     {
  26.         //spremeni _displayState na izkloplen
  27.     }
  28.     else
  29.     {
  30.         //vklopi display (_displayState = 0x1)?
  31.     }
  32.    
  33. }
  34.  
  35. // Refresh display contents if display is enabled
  36. void VisualizeData::RefreshDisplay(const ProcessKeyEvent* keyHandler)
  37. {
  38.     if(_displayState==0x1)
  39.     {
  40.         //refreshaj display
  41.         //z keyHandler lahko kličeš metode razreda ProcessKeyEvent
  42.     }
  43. }
  44.  
  45. v mainu:
  46.  
  47. while (true)
  48.   {
  49.     //TODO - read port E and handle response
  50.     //tu nevem keri port nam pove kak dolgo je LED vgasnjena pa kak dolgo prižgana
  51.     //naret morš vrjetno nekaj takega
  52.     keyEventHandler->ProcessKeyCodePortE( vrednostPortaE );     //kličeš metodo iz ProcessKeyEvent.cpp
  53.  
  54.     //TODO - read port F and handle port F response
  55.     keyEventHandler->ProcessKeyCodePortF( vrednostPortaF );     //kličeš metodo iz ProcessKeyEvent.cpp
  56.  
  57.     if(gumb_select_stisnjen)
  58.     {
  59.     boardDisplay->ToggleDisplay();  //vklaplaš/izklaplaš zaslon (v VisualizeData.cpp se nahaja telo funkcije)
  60.     }
  61.    
  62.     //TODO - show values to display if it is turned ON    
  63.     boardDisplay->RefreshDisplay(keyEventHandler);  //kličeš metodo ki refresha (v VisualizeData.cpp se nahaja)
  64.  
  65.     // write 1 to PORTF pin 0 and delay
  66.     GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 1);
  67.     ArmDelay::InsertDelay(keyEventHandler->GetLedOnDelay());
  68.  
  69.     // write 0 to PORTF pin 0 and delay
  70.     GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);
  71.     ArmDelay::InsertDelay(keyEventHandler->GetLedOffDelay());
  72.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement