]> rtime.felk.cvut.cz Git - mirosot.git/commitdiff
Updated to the actual version of libraries
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 28 Apr 2008 13:06:00 +0000 (13:06 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 28 Apr 2008 13:06:00 +0000 (13:06 +0000)
darcs-hash:20080428130620-f2ef6-1cb364f689182070aeb75a027570de20b4385d60.gz

autodemo/Makefile.omk
autodemo/mirosot_autodemo.c

index 7b091131bc2f5dc591547b8ce8ab43274b82384a..da1632bf80220584a5aae4f25e35f8ad2bb8cc4d 100644 (file)
@@ -4,5 +4,5 @@ bin_PROGRAMS  = miroautodemo
 
 miroautodemo_SOURCES = mirosot_autodemo.c cmd_pxmc.c timer3.c
 
-miroautodemo_LIBS = boot_fn arch_drivers excptvec misc pxmc m sci_channels
+miroautodemo_LIBS = boot_fn arch_drivers excptvec misc pxmcbsp pxmc m sci_channels cmdproc cmdprocio
 miroautodemo_MOREOBJS = $(USER_LIB_DIR)/system_stub.o
index b512e1fb3eb4055e97f87fd16a9e03e2e936085f..d170999be6f5f882f3bafd77a1e45a75bff6595d 100644 (file)
 #include <string.h>
 
 #include <pxmc.h>
-#include <pxmc_h2638.h>
+#include <pxmcbsp.h>
 
 #include <cmd_proc.h>
 #include "cmd_pxmc.h"
 #include "timer3.h"
 #include <stdio.h>
 
+cmd_des_t const *cmd_rs232_default[];
 
 /*struktury prikazu cmd*/
 cmd_des_t const cmd_des_help={0, 0,"HELP","prints help for commands",
-                        cmd_do_help,{(char*)&cmd_rs232}};
+                        cmd_do_help,{(char*)&cmd_rs232_default}};
                         
 cmd_des_t const *cmd_rs232_default[]={
 
   &cmd_des_help,
-  CMD_DES_CONTINUE_AT,   /* list continues at new address */
-  (cmd_des_t*)cmd_pxmc_default,
+  CMD_DES_CONTINUE_AT(cmd_pxmc_default),
   NULL
 };
 cmd_des_t const **cmd_bth=cmd_rs232_default;       /*cmd prikazy pro bth*/
@@ -113,39 +113,7 @@ void  unhandled_exception(void)
 };
 //********************************************************
 
-
-int cmd_rs232_processor_run(void)
-{
-  int val;
-  cmd_io_t* cmd_io;
-   
-  cmd_io=&cmd_io_rs232;
-  if(cmd_rs232_line_out(cmd_io))
-    return 1;
-       
-  if(cmd_rs232_line_in(cmd_io)<=0)
-    return 0;
-
-  if(cmd_rs232){
-    val=proc_cmd_line(cmd_io, cmd_rs232, cmd_io->priv.ed_line.in->buf);
-  }else{
-    val=-CMDERR_BADCMD;
-  }
-
-  if(cmd_io->priv.ed_line.out->inbuf){
-    cmd_io_putc(cmd_io,'\r');
-    cmd_io_putc(cmd_io,'\n');
-    
-  }else if(val<0){
-    char s[20];
-    cmd_io_write(&cmd_io_rs232,"ERROR ",6);
-    i2str(s,-val,0,0);
-    cmd_io_write(cmd_io,s,strlen(s));
-    cmd_io_putc(cmd_io,'\r');
-    cmd_io_putc(cmd_io,'\n');
-  }
-  return 1;
-}
+extern cmd_io_t cmd_io_rs232_line;
 
 extern void _print(char *str);
 
@@ -178,11 +146,7 @@ init(void)
 
   _print("Start\n");
 
-  /*nastaveni HW (TPU, PWM)*/
-  pxmc_set_pwm_tpu();
-
-  /*nastaveni DC motoru*/
-  pxmc_add_pservice_and_mode(4); /*Macro -  mod=4 tj. all motors are DC*/
+  pxmc_initialize();
 
   if (init_timer3((long long)200/*ms*/*1000*1000) < 0) {
     /* ERROR */
@@ -223,16 +187,16 @@ main_loop(void)
   int speed = 3000;
   int radius = 0;
   while (1) {
-    cmd_rs232_processor_run();  /*sber + odesilani cmd prikazu PC*/
+    cmd_processor_run(&cmd_io_rs232_line, cmd_rs232_default);
 
     long int now = get_timer();
 
     if (now > before) {
       before = now;
-      DEB_LED_XOR(1);
+//      DEB_LED_XOR(1);
     }
     if (now >= next) {
-      DEB_LED_XOR(3);
+//      DEB_LED_XOR(3);
       next = now + 1 + (rand() % 5);
       //printf("%5ld->%5ld ", now, next);
       if (rand() % 100 < 20)