Народ помогите разобраться с кодом под mega161

 

Tolin

новичок
code text
  1.  
  2. extern u32 sys_time;            // main system time, incremented every 100 mS
  3.  
  4. static u08 playing = 1;         // indicates if player is playing
  5. static u08 display = 0;         // indicates if it's okay to display information
  6.  
  7. static u32 t_announce = 0;      // timer for announce message  
  8. static u32 t_area = 0;          // timer for main area update
  9. static u32 t_index = 0;         // timer for index area update
  10. static u32 t_start = 0;         // timer for sending startplaying message
  11. static u32 t_time = 0;          // timer for updating time in main area
  12.  
  13.  
  14.  
  15.  
  16.  
  17. event_e get_bmw_event(void)
  18. {
  19.  
  20.  
  21.         if (t_announce == 0)                                            // first time here ?
  22.         {
  23.                 t_announce = sys_time + 50;             вот тут ругается  // set first announce in 5 seconds     
  24.         }
  25.  
  26.                                // и вообше постояно ругаетя на sys_time
  27.        
  28.         while ( uart_haschar() )                                        // loop while there is data to parse
  29.         {
  30.                 ch = uart_getchar();                                    // get character to global var
  31.                
  32.                 //
  33.                 // Does the radio poll us ?
  34.                 //
  35.                 //      NOTE! this never happens on my E46
  36.                 //
  37.                 if ( lexer(&cdpoll) )  
  38.                 {
  39.                         SendCDMsg(cd_pollresp_msg);                     // send poll response
  40.                         continue;                                                       // parse more messages
  41.                 }
  42.  
  43.                 //
  44.                 // Request to start playing
  45.                 //
  46.                 if ( lexer(&play) )  
  47.                 {
  48.                         SendCDMsg(cd_statusplaying_msg);        // send status message
  49.                         t_start = sys_time + 1;                         // send start playing msg in 100 mS
  50.                         playing = 1;                                            // set playing mode
  51.                         display = 1;                                            // allow display updates
  52.                         t_index = sys_time + 5;                         // update index area in 500 mS
  53.                         return EV_PLAY;                
  54.                 }
  55.                
  56.  
  57.                 //
  58.                 // Request to activate after mode change or system power up
  59.                 //
  60.                 if ( lexer(&play2) )  
  61.                 {
  62.                         t_start = sys_time + 3;                         // send startplaying in 300 mS
  63.                         playing = 1;                                            // set playing mode
  64.                         display = 1;                                            // allow display updates
  65.                         return EV_PLAY;                                         // start player
  66.                 }
  67.                
  68.  
  69.                 //
  70.                 // When stop, send the current status to the radio
  71.                 // The stop command is initiated by changing the mode,
  72.                 // by radio or ignition off.
  73.                 //
  74.                 if ( lexer(&stop) )  
  75.                 {
  76.                         SendCDMsg(cd_statusnotplaying_msg);     // send stopplaying message
  77.                         playing = 0;                                            // clear playing flag
  78.                         return EV_STOP;                                         // stop player, disc will spin down after 10 seconds
  79.                 }
  80.                
  81.                
  82.                 //
  83.                 // When the radio request the current CD and track,
  84.                 // Always respond CD 1, Track 1. That will help us
  85.                 // to recognize writes to MID,NAV or OBC screen commands later.
  86.                 //
  87.                 if ( lexer(&getcurtk) )  
  88.                 {
  89.                         if (playing)
  90.                         {
  91.                                 SendCDMsg(cd_startplaying01_msg);       // send startplaying message
  92.                         }
  93.                         else
  94.                         {
  95.                                 SendCDMsg(cd_statusnotplaying_msg);     // send not playing status message
  96.                         }
  97.                         continue;                                                               // parse more messages
  98.                 }
  99.                
  100.  
  101.                 //
  102.                 // Check if the "CDC" string were sent to the nav screen
  103.                 // That means the CD player is active and can display
  104.                 //     
  105.                 if ( lexer(&stringcdno) )
  106.                 {
  107.                         display = 1;                                            // allow display updates
  108.                         t_area = sys_time + 2;                          // update main area in 200 mS
  109.                         continue;                                                       // parse more messages
  110.                 }
  111.                
  112.                 // Check if the CD No and track number were sent to the nav screen
  113.                 if ( lexer(&refresh) )
  114.                 {
  115.                         t_index = sys_time + 5;                         // update index area in 500 mS
  116.                         continue;                                                       // parse more messages
  117.                 }      
  118.  
  119.                 //
  120.                 // Check if a MENU display was requested by the radio
  121.                 // If yes, then disable display  
  122.                 //     
  123.                 if ( lexer(&navmenuset) || lexer(&navmenutimed) )
  124.                 {
  125.                         display = 0;                                            // stop display updates
  126.                         continue;                                                       // parse more messages
  127.                 }
  128.                
  129.                
  130.                 //
  131.                 // Commands to be processed if the CD Mode is active only
  132.                 //
  133.                 if (playing)
  134.                 {
  135.                         //
  136.                         // Next and previous track including steering wheel
  137.                         //
  138.                         if ( lexer(&prev) || lexer(&prevstw) )  
  139.                         {
  140.                                 SendCDMsg(cd_endplaying_msg);   // send endplaying message
  141.                                 return EV_PREV;                                 // start previous song
  142.                         }
  143.                        
  144.                         if ( lexer(&next) || lexer(&nextstw) )
  145.                         {
  146.                                 SendCDMsg(cd_endplaying_msg);   // send endplaying message
  147.                                 return EV_NEXT;                                 // start next song
  148.                         }
  149.  
  150.                        
  151.                         // Next and previous PLAYLIST
  152.                         // Use button 1 for previous, 2, for next.
  153.                         // Use also "fast scan" to do that : usefull on the steering wheel
  154.                         // as we can change track and playlist with only one finger.
  155.                         //     
  156.                         if ( lexer(&but1) || lexer(&fwd) )      // if PREV PLAYLIST
  157.                         {
  158.                                 SendCDMsg(cd_endplaying_msg);   // send endplaying message
  159.                                 t_start = sys_time + 1;                 // send startplaying in 100 mS
  160.                                 return EV_PREVPL;                               // start previous playlist
  161.                         }
  162.                        
  163.                         if ( lexer(&but2) || lexer(&rev) )      // if NEXT PLAYLIST
  164.                         {
  165.                                 SendCDMsg(cd_endplaying_msg);   // send endplaying message
  166.                                 t_start = sys_time + 1;                 // send startplaying in 100 mS
  167.                                 return EV_NEXTPL;                               // start next playlist
  168.                         }
  169.  
  170.                         //
  171.                         // currently not used
  172.                         //
  173.                         if ( lexer(&but3) )  
  174.                         {
  175.                                 SendCDMsg(cd_startplaying03_msg);       // send startplaying to keep system happy
  176.                                 continue;                                                       // parse more messages
  177.                         }
  178.                        
  179.                         //
  180.                         // currently not used
  181.                         //
  182.                         if ( lexer(&but4) )
  183.                         {
  184.                                 SendCDMsg(cd_startplaying04_msg);       // send startplaying to keep system happy
  185.                                 continue;                                                       // parse more messages
  186.                         }
  187.  
  188.                         //
  189.                         // Button 5 controls Repeat mode
  190.                         //
  191.                         if (lexer(&but5))
  192.                         {
  193.                                 SendCDMsg(cd_startplaying05_msg);       // send startplaying to keep system happy
  194.                                 t_area = sys_time + 1;                          // update main area in 100 mS
  195.                                 return EV_REPEAT;                                       // switch repeat mode
  196.                         }
  197.                        
  198.                         //
  199.                         // Button 6 controls Random mode
  200.                         //
  201.                         if (lexer(&but6))
  202.                         {
  203.                                 SendCDMsg(cd_startplaying06_msg);       // send startplaying to keep system happy
  204.                                 t_area = sys_time + 1;                          // update main area in 100 mS
  205.                                 return EV_RANDOM;                                       // switch random mode
  206.                         }
  207.  
  208.                 }// end if playing
  209.  
  210.  
  211.         } // while             
  212.  
  213.  
  214.  
  215.         //
  216.         // Timer expiration checks
  217.         //
  218.  
  219.  
  220.         //
  221.         // check if it's time to send an announce message
  222.         //
  223.         if (sys_time > t_announce)
  224.         {
  225.                 t_announce += 100;                                      // set next update in 10 seconds
  226.                 SendCDMsg(cd_announce_msg);                     // send announce message
  227.         }
  228.  
  229.         //
  230.         // check if it's time to send an startplaying message
  231.         //
  232.         if (sys_time > t_start)
  233.         {
  234.                 t_start = (u32) -1;                                     // no more updates
  235.                 SendCDMsg(cd_startplaying01_msg);       // send startplaying message
  236.         }
  237.  
  238.         //
  239.         // check if it's time to update the index area
  240.         //
  241.         if (sys_time > t_index)
  242.         {
  243.                 t_index = (u32) -1;                                     // no more updates
  244.                 if (display)                                            // if displaying allowed
  245.                 {
  246.                         DisplayIndex();                                 // update index area
  247.                 }
  248.         }
  249.  
  250.         //
  251.         // check if it's time to update the main area
  252.         // also start time area update
  253.         //
  254.         if (sys_time > t_area)
  255.         {
  256.                 t_area = (u32) -1;                                      // no more updates
  257.                 t_time = sys_time + 5;                          // set next update in  500 mS
  258.                 if (display)                                            // if displaying allowed
  259.                 {
  260.                         DisplayInfo();                                  // update main area
  261.                 }
  262.         }
  263.  
  264.         //
  265.         // check if it's time to update the time area
  266.         //
  267. /*      if (sys_time > t_time)
  268.         {
  269.                 t_area = sys_time + 5;                          // set next update in 500 mS
  270.                 if (display)                                            // if displaying allowed
  271.                 {      
  272.                         DisplayTime();                                  // display time in main area
  273.                 }
  274.         }
  275. */
  276.  
  277.  
  278.  
  279.         //
  280.         // Nothing happened, return idle
  281.         //
  282.         return EV_IDLE;
  283. }
  284.  
  285.  


и вообше постояно ругаетя на sys_time

WinAvr 20030312
вот прикладываю все исходники
[attachmentid=7490]
[attachmentid=7491]

Прикреплённые файлы:
bmw.rar (скачать) [7,4 кБ]
 
 
 

в начало страницы | новое
 
Поиск
Настройки
Твиттер сайта
Статистика
Рейтинг@Mail.ru