]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
reupload from backup, this files are newer than if in git
authorJiri Kubias <kubiaj1@felk.cvut.cz>
Tue, 27 May 2008 11:40:45 +0000 (13:40 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 28 Jul 2008 11:23:52 +0000 (13:23 +0200)
src/robobagr/Makefile.omk
src/robobagr/main.c
src/robobagr/robobagr.c
src/robobagr/robobagr.h

index f8a8a326904a8f9d607498c5a8960d819358fa75..950ae27061db83e9b312addf12e47583c334fccd 100644 (file)
@@ -5,4 +5,6 @@ bin_PROGRAMS = eb_robobagr
 eb_robobagr_SOURCES = main.c robobagr.c 
 eb_robobagr_LIBS = can ebb uart_nozen
 
+link_VARIANTS = flash
+
 
index a58e0d01bfca1d91dd90377baff6d0e2184ab73e..6dc23612413afeed509d1417727092b153e95d3a 100644 (file)
@@ -10,7 +10,7 @@
 #include <servo.h>
 #include <powswitch.h>
 #include <engine.h>
-#include <adc.h>
+#include <adc_filtr.h>
 #include <uart_nozen.h>
 #include "robobagr.h"
 
@@ -70,7 +70,7 @@ void can_rx(can_msg_t *msg) {
 void init_perip(void)     // inicializace periferii mikroprocesoru
 {
        init_servo(SERVO_ISR);
-       init_adc(ADC_ISR);
+       init_adc_filter(ADC_ISR);
        init_pow_switch();
 
        init_engine_A();
@@ -150,6 +150,8 @@ int a = 0;
 
                led_blik();
                send_adc();
+               start_button();
+               adc_filter(adc_update_adc);
 
                if(time_ms > time_timeout) engine_A_pwm(0);     
 
@@ -207,7 +209,7 @@ int a = 0;
                                ++error_counter;
                                if (error_counter > ERROR_CMU_MAX)
                                {
-                                       send_status(BAGR_STAT_CMU_ERROR);
+                       //              send_status(BAGR_STAT_CMU_ERROR);
                                        error_counter = 0;
                                }
 
index 5984496ca99561036fdda181ed19443d7dd0b6fb..2d24d330ec49b558ab864868c09e1c51863ec39e 100644 (file)
 #include <adc.h>
 #include <uart_nozen.h>
 #include "robobagr.h"
+#include <string.h>
+
 
+#define START_PIN      15
 
 int time_blink;
 
@@ -19,10 +22,51 @@ unsigned int cmu_buff[30];
 unsigned int cmu_buff_p = 0;
 
 
+
 can_msg_t msg;
 
 struct Color color;
 
+unsigned char star_bt = 0;
+unsigned int time_start = 0;
+
+void start_button(void)
+{
+       if (star_bt > 10) 
+       {
+               if ((IO0PIN & (1<<START_PIN))==0) star_bt=0;
+               return;
+       }
+       if (time_start == 0) time_start = time_ms + START_TIME; 
+       
+       IO0DIR &= ~ (1<<START_PIN);
+
+       if (time_ms > time_start)
+       {
+               time_start = time_ms + START_TIME;
+               
+               if (IO0PIN & (1<<START_PIN)) 
+               {
+                       ++star_bt;
+                       msg.data[0] = 1;
+                       deb_led_off(LEDY);
+               }
+               else 
+               {
+                       deb_led_on(LEDY);
+                       msg.data[0] = 0;
+               }
+
+               msg.id = CAN_ROBOT_CMD;
+               msg.flags = 0;
+               msg.dlc = 1;
+               //msg.data[0] = (~(IO0PIN >> START_PIN)) & 1;
+               while (can_tx_msg(&msg));
+
+               
+               
+       }
+}
 
 
 void led_blik()
@@ -165,7 +209,7 @@ void cmu_set_param(void)
        
        for( i = 0 ; i < 9; i++){
                write_UART_data( UART1, param[i] );
-               write_UART_data( UART0, param[i] );
+       //      write_UART_data( UART0, param[i] );
        }
 
 }
@@ -177,7 +221,7 @@ int cmu_ack(void)
        while (UART_new_data(UART1))
        {
                cmu_buff[cmu_buff_p]= read_UART_data(UART1);
-               write_UART_data( UART0, cmu_buff[cmu_buff_p]);
+       //      write_UART_data( UART0, cmu_buff[cmu_buff_p]);
                
                if (cmu_buff[cmu_buff_p] == ':') 
                {
@@ -215,7 +259,7 @@ int cmu_ack_gm()
        while (UART_new_data(UART1))
        {
                cmu_buff[cmu_buff_p]= read_UART_data(UART1);
-               write_UART_data( UART0, cmu_buff[cmu_buff_p]);
+               //write_UART_data( UART0, cmu_buff[cmu_buff_p]);
                
                if (cmu_buff[cmu_buff_p] == '\r') 
                {
@@ -223,7 +267,7 @@ int cmu_ack_gm()
                        int i =0;
                        for ( i = 0; i <= cmu_buff_p ; i++)
                        {                               
-                               write_UART_data( UART0, cmu_buff[i]);
+                               //write_UART_data( UART0, cmu_buff[i]);
                
                                if (cmu_buff[i] == 'N') { cmu_buff_p = 0; return 2;}
                                if (cmu_buff[i] == 'A') { cmu_buff_p = 0; return 1;}
index 287feb928a27474cb4bc22b2dd77a7a50a431fb6..f0f70d009b6dfd913e970f501da793265ee6bfb0 100644 (file)
@@ -3,7 +3,9 @@
 
 
 
-#define ADC_TIME       60;
+#define ADC_TIME       60
+#define BUMPER_TIME    300
+#define START_TIME     50
 
 unsigned int cmu_timeout;
 
@@ -12,6 +14,7 @@ unsigned int cmu_timeout;
 
 
 //void send_status(unsigned char status);
+void start_button(void);
 void led_blik();
 void set_robobagr( unsigned char pwm);
 void go_to_sleep();