From: Michael Wiebusch Date: Mon, 15 Dec 2014 17:17:19 +0000 (+0100) Subject: both interrupt for touchpad and motor control, don't seem to work, so I disabled... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=d4c1237780a79a5c2fa865ef3ebf97006c3ece06;p=coral.git both interrupt for touchpad and motor control, don't seem to work, so I disabled touchpad. Can now configure the timer delay in microseconds --- diff --git a/firmware/main.c b/firmware/main.c index 56bc262..3dcae35 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -227,11 +227,11 @@ int main(void){ SetupHardware(); init_plate_timer(); - touchpad_init(); // you need to call this to setup the I/O pin! +// touchpad_init(); // you need to call this to setup the I/O pin! _delay_ms(500); sei(); - touchpad_set_rel_mode_100dpi();// use touchpad in relative mode +// touchpad_set_abs_mode();// use touchpad in relative mode while (1) { Usb2SerialTask(); @@ -239,6 +239,9 @@ int main(void){ // touchpad_read(); // read data from touchpad // inc_target_plate_pos_x(4*delta_x()); // inc_target_plate_pos_y(-4*delta_y()); +// uart_print_number(x_abs(),5); +// uart_puts("\n\r"); +// _delay_ms(200); if(plate_ready()){ pos_report(); } diff --git a/firmware/plate.c b/firmware/plate.c index e1d3274..b5b15ee 100644 --- a/firmware/plate.c +++ b/firmware/plate.c @@ -11,8 +11,8 @@ // plate stuff -int32_t plate_pos_x = 0,plate_pos_y = 0; -int32_t target_plate_pos_x = 0,target_plate_pos_y = 0; +volatile int32_t plate_pos_x = 0,plate_pos_y = 0; +volatile int32_t target_plate_pos_x = 0,target_plate_pos_y = 0; uint8_t ready = 0; @@ -105,7 +105,7 @@ uint8_t move_plate(void){ - _delay_us(PHASE_DELAY_US); +// _delay_us(PHASE_DELAY_US); if( busy && (todo_x==0) && (todo_y==0) ){ busy=0; @@ -116,12 +116,12 @@ uint8_t move_plate(void){ } - +// the following is only needed if used with interrupt void init_plate_timer(void){ TCCR1B |= (1<