semestralna praca

Dependencies:   FRDM_MMA8451Q

Files at this revision

API Documentation at this revision

Comitter:
seyfrid_L
Date:
Tue Jan 09 15:04:40 2018 +0000
Parent:
7:f906eb062d36
Commit message:
dokoncena semestralnma praca

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f906eb062d36 -r 3edf2e10899d main.cpp
--- a/main.cpp	Tue Jan 09 14:30:54 2018 +0000
+++ b/main.cpp	Tue Jan 09 15:04:40 2018 +0000
@@ -6,6 +6,8 @@
 Serial term(USBTX, USBRX);
 DigitalOut led1(LED2);
 
+/*********************hlavna cas programu*****************************************/
+
 int main() {
     
     term.baud(57600);
@@ -25,9 +27,12 @@
     tlacitka();
     }
 }
-
+/*********************riadneie komunikacie*****************************************/
 
+/*
+vypocet CRC
 
+*/
 
 int getCrc(int addrRx, int addrTx, int dataSize, int aData[])
 {
@@ -57,6 +62,10 @@
     return crc;    
 }
 
+/*
+odoslanie spravy
+*/
+
 void posliSpravu(int addrRx, int addrTx,int dataSize, int aData[])
  {
      
@@ -80,7 +89,9 @@
         term.putc(aPacket[i]);       
     }
 }
-
+/*
+prijatie spavy 
+*/
 void prijmiSpravu()
 {
    
@@ -106,7 +117,11 @@
        logikaRiadenia();
    
 }
+/*********************bezpecnost*****************************************/
 
+/*
+uvolnenie EM
+*/
 void uvolniEM()
 {
     int aDataIn[] = {0x00};
@@ -115,6 +130,9 @@
     
     }
     
+    /*
+        spustenie EM
+    */
     void EM()
     {
         
@@ -122,6 +140,10 @@
     int dataSize1 = ARRAY_SIZE(aDataIn);
     posliSpravu(EM_BRAKE,0xAA,dataSize1,aDataIn);
         }
+        
+        /*
+        resetovanie watchdog pri spusteny programu
+        */
     
     void resWatch()
     {
@@ -130,7 +152,11 @@
         posliSpravu(WATCHDOG,0xAA,dataSize1,aDataIn);
         
         }
-
+        
+        /*
+        celkova logika riadenia vytahu
+        */
+/*********************riadneie obsluhy vytahu*****************************************/
 void logikaRiadenia(){
     
     if(init_flag == 1){
@@ -210,7 +236,9 @@
     }
 
 
-
+/*
+obsluha tlacitok vo vytahu a na stene poschodia
+*/
 
 void tlacitka()
 {
@@ -417,6 +445,10 @@
  
     }
     
+    
+   /*
+   posiela watchdogu ze zije logika
+   */ 
 void watchdog()
 {
         int aDataIn[] = {0x03};
@@ -425,6 +457,10 @@
     }    
 
 
+/*
+vratenie poschodia
+*/
+
 int dajPoschodie()
 {
      int poschodie;
@@ -473,7 +509,9 @@
     }
 
 
-
+/*
+inicializcia vytahu
+*/
 
 
 void init(){
@@ -483,6 +521,10 @@
     smerDole();
     }
 
+
+/*
+zastavenie vytahu
+*/
 void stop()
 {
     int aDataIn[] = {0x1};
@@ -491,6 +533,10 @@
     odomkniVytah();
     }
 
+/*
+pohyb hore postupne pridavanie rychlosti
+*/
+
 void smerHore()
 {
       zamkniVytah();
@@ -517,13 +563,13 @@
      
 }
 
+/*
+pohyb hore postupne pridavanie rychlosti
+*/
 
 void smerDole()
 {
-    //int aDataIn[] = {0x2, 0x9C, 0xff, 0xff, 0xff};
-    //int dataSize1 = ARRAY_SIZE(aDataIn);
-     //posliSpravu(MOTOR,0xAA,dataSize1,aDataIn);
-     
+         
      zamkniVytah();
      
      pohyb++;
@@ -550,8 +596,9 @@
 }
 
 
-
-
+/*
+uzamknutie vytahu
+*/
  void zamkniVytah()
  {
      int adata[1] = {0x01};
@@ -560,6 +607,10 @@
      
 }
 
+/*
+odomknutie vytahu
+*/
+
 void odomkniVytah()
 {
     int adata[1] = {0x00};
@@ -567,6 +618,10 @@
      posliSpravu(0xF0,0xAA,dataSize,adata);
     }
     
+    /*
+    obsluha displeja vytahu
+    */
+    
 void disp_Vyt()
 {
         int aDataIn[2];
@@ -615,7 +670,7 @@
     disp_poschodie = cisloPochodia_dislpej; 
     display_smer = pohyb_flag; 
 }
-/*************************************************************/
+/**********************raiadenie lediek vytahu*********************************/
 void ledPon()
 {
     int aDataIn[] = {0x1};