From 123f059880d7d9ebd0ed25768d7b41a07e0280f1 Mon Sep 17 00:00:00 2001 From: schodet Date: Wed, 4 May 2005 07:51:13 +0000 Subject: Support des socles. --- n/asserv/src/main.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'n/asserv/src/main.c') diff --git a/n/asserv/src/main.c b/n/asserv/src/main.c index ef607b3..d437f24 100644 --- a/n/asserv/src/main.c +++ b/n/asserv/src/main.c @@ -75,7 +75,7 @@ uint8_t motor_print_pinc, motor_print_pinc_cpt; /** Print Sharps. */ uint8_t motor_print_sharps, motor_print_sharps_cpt; -uint16_t motor_sharps[3]; +uint16_t motor_sharps[5]; /** Record timer value at different stage of computing. Used for performance * analisys. */ @@ -97,7 +97,7 @@ int main (void) { DDRD = 0x60; - PORTA = _BV (0) | _BV (7); + PORTA = _BV (7) | _BV (1) | _BV (0); pwm_init (); timer_init (); counter_init (); @@ -189,9 +189,10 @@ main_loop (void) { if (twi_master_is_finished ()) { - proto_send3w ('H', motor_sharps[0], motor_sharps[1], - motor_sharps[2]); - twi_master_read (0x02, (uint8_t *) motor_sharps, 6); + proto_send5w ('H', motor_sharps[0], motor_sharps[1], + motor_sharps[2], motor_sharps[3], + motor_sharps[4]); + twi_master_read (0x02, (uint8_t *) motor_sharps, 10); } motor_print_sharps_cpt = motor_print_sharps; } @@ -223,6 +224,17 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) taz_max_state = args[0]; taz_max_substate = args[1]; break; + case c ('t', 3): + taz_state = args[0]; + taz_substate = args[1]; + motor_taz = args[2]; + break; + case c ('o', 8): + taz_socles_left_min = v8_to_v16 (args[0], args[1]); + taz_socles_left_max = v8_to_v16 (args[2], args[3]); + taz_socles_right_min = v8_to_v16 (args[4], args[5]); + taz_socles_right_max = v8_to_v16 (args[6], args[7]); + break; case c ('l', 2): /* Linear move. * - w: distance (negative to go backward). */ @@ -316,7 +328,7 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) break; case c ('H', 1): /* Sharps stats. */ - twi_master_read (0x02, (uint8_t *) motor_sharps, 6); + twi_master_read (0x02, (uint8_t *) motor_sharps, 10); motor_print_sharps_cpt = motor_print_sharps = args[0]; break; default: -- cgit v1.2.3