From: Michal Sojka Date: Mon, 28 Apr 2008 13:06:00 +0000 (+0000) Subject: Updated to the actual version of libraries X-Git-Url: https://rtime.felk.cvut.cz/gitweb/mirosot.git/commitdiff_plain/50ed7bf49a153a023136605353c4ede1ef47632d Updated to the actual version of libraries darcs-hash:20080428130620-f2ef6-1cb364f689182070aeb75a027570de20b4385d60.gz --- diff --git a/autodemo/Makefile.omk b/autodemo/Makefile.omk index 7b09113..da1632b 100644 --- a/autodemo/Makefile.omk +++ b/autodemo/Makefile.omk @@ -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 diff --git a/autodemo/mirosot_autodemo.c b/autodemo/mirosot_autodemo.c index b512e1f..d170999 100644 --- a/autodemo/mirosot_autodemo.c +++ b/autodemo/mirosot_autodemo.c @@ -20,23 +20,23 @@ #include #include -#include +#include #include #include "cmd_pxmc.h" #include "timer3.h" #include +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)