]> jspc29.x-matter.uni-frankfurt.de Git - coral.git/commitdiff
both interrupt for touchpad and motor control, don't seem to work, so I disabled...
authorMichael Wiebusch <m.wiebusch@gsi.de>
Mon, 15 Dec 2014 17:17:19 +0000 (18:17 +0100)
committerMichael Wiebusch <m.wiebusch@gsi.de>
Mon, 15 Dec 2014 17:17:19 +0000 (18:17 +0100)
firmware/main.c
firmware/plate.c
firmware/plate.h

index 56bc262aeab4ff134b815b62c6b2c955b22dfce9..3dcae35b44c1536c46af48a7f11ad3184f80c916 100644 (file)
@@ -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();
     }
index e1d3274f6f3fbb07223a7ff582d640c532152676..b5b15ee270ab90c7ad5d48c4a61071bd9f20d42a 100644 (file)
@@ -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<<CS10) | (1<<CS12) | (1<<WGM12);
   TCCR1C |= (1<<FOC1A);
-  OCR1A = 32;
+  OCR1A = TIMER_SETTING;
   TIMSK1 |= (1<<OCIE1A);
   
 }
index 7a57922f1b83a7d324e74c52fb0bebe989137c4d..a5dba600eb5aa4c3c8ebae1f09908530a0ff364a 100644 (file)
@@ -1,5 +1,8 @@
-#define PHASE_DELAY_US 0
+#define PHASE_DELAY_US 1500
 
+#define TIMER_STEP 6.4e-5
+
+#define TIMER_SETTING PHASE_DELAY_US*1e-6/TIMER_STEP