X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fstrat_utils.c;h=1f19904a6f3322d41735c74c25722b9ac1cdbb51;hp=33c1474ee5e995a7e6a52bfe26f266873a9ea566;hb=51418f44261edc59d818ca990456726027e366ad;hpb=85d56c363e7e984ab9c5e96786d42de8f8310f20 diff --git a/projects/microb2010/mainboard/strat_utils.c b/projects/microb2010/mainboard/strat_utils.c index 33c1474..1f19904 100644 --- a/projects/microb2010/mainboard/strat_utils.c +++ b/projects/microb2010/mainboard/strat_utils.c @@ -263,33 +263,34 @@ uint8_t get_opponent_color(void) return I2C_COLOR_YELLOW; } -/* get the xy pos of the opponent robot */ -int8_t get_opponent_xy(int16_t *x, int16_t *y) +/* get the da pos of the opponent robot */ +int8_t get_opponent_da(int16_t *d, int16_t *a) { uint8_t flags; - return -1; // XXX + int16_t x; + IRQ_LOCK(flags); -/* *x = ballboard.opponent_x; */ -/* *y = ballboard.opponent_y; */ + *d = beaconboard.oppd; + *a = beaconboard.oppa; + x = beaconboard.oppx; IRQ_UNLOCK(flags); - if (*x == I2C_OPPONENT_NOT_THERE) + if (x == I2C_OPPONENT_NOT_THERE) return -1; return 0; } -/* get the da pos of the opponent robot */ -int8_t get_opponent_da(int16_t *d, int16_t *a) +/* get the xy pos of the opponent robot */ +int8_t get_opponent_xy(int16_t *x, int16_t *y) { uint8_t flags; - int16_t x_tmp; - return -1; // XXX + IRQ_LOCK(flags); -/* x_tmp = ballboard.opponent_x; */ -/* *d = ballboard.opponent_d; */ -/* *a = ballboard.opponent_a; */ + *x = beaconboard.oppx; + *y = beaconboard.oppy; IRQ_UNLOCK(flags); - if (x_tmp == I2C_OPPONENT_NOT_THERE) + if (*x == I2C_OPPONENT_NOT_THERE) return -1; + return 0; } @@ -297,25 +298,16 @@ int8_t get_opponent_da(int16_t *d, int16_t *a) int8_t get_opponent_xyda(int16_t *x, int16_t *y, int16_t *d, int16_t *a) { uint8_t flags; - return -1; // XXX + IRQ_LOCK(flags); -/* *x = ballboard.opponent_x; */ -/* *y = ballboard.opponent_y; */ -/* *d = ballboard.opponent_d; */ -/* *a = ballboard.opponent_a; */ + *x = beaconboard.oppx; + *y = beaconboard.oppy; + *d = beaconboard.oppd; + *a = beaconboard.oppa; IRQ_UNLOCK(flags); if (*x == I2C_OPPONENT_NOT_THERE) return -1; - return 0; -} -uint8_t opponent_is_behind(void) -{ -/* int8_t opp_there; */ -/* int16_t opp_d, opp_a; */ -/* opp_there = get_opponent_da(&opp_d, &opp_a); */ -/* if (opp_there && (opp_a < 215 && opp_a > 145) && opp_d < 600) */ -/* return 1; */ return 0; }