From bc1ca9a4c44e019638adc51af66db1a578c851b6 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 16 May 2012 22:04:50 +0200 Subject: digital/beacon: fix bad crc computation for TXbuffer --- digital/beacon/src/twi_specific.c | 2 +- digital/beacon/src/twi_specific.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/digital/beacon/src/twi_specific.c b/digital/beacon/src/twi_specific.c index 5def1a2b..30da73d9 100644 --- a/digital/beacon/src/twi_specific.c +++ b/digital/beacon/src/twi_specific.c @@ -62,7 +62,7 @@ void twi_task(void) TXbuffer[TWI_TX_TRUST2_FIELD] = position_get_trust(OPPONENT_2); /* Compute CRC */ - TXbuffer[TWI_TX_CRC_FIELD] = crc_compute (&TXbuffer[1], sizeof (TXbuffer) - 1); + TXbuffer[TWI_TX_CRC_FIELD] = crc_compute (&TXbuffer[1],TWI_TX_FIELD_NB-1); /* data to be communicated to the master */ twi_slave_update (TXbuffer, sizeof (TXbuffer)); diff --git a/digital/beacon/src/twi_specific.h b/digital/beacon/src/twi_specific.h index ee244cb7..76c6b42a 100644 --- a/digital/beacon/src/twi_specific.h +++ b/digital/beacon/src/twi_specific.h @@ -56,7 +56,8 @@ typedef enum TWI_TX_X2_LSB_FIELD, TWI_TX_Y2_MSB_FIELD, TWI_TX_Y2_LSB_FIELD, - TWI_TX_TRUST2_FIELD + TWI_TX_TRUST2_FIELD, + TWI_TX_FIELD_NB } TTWI_TX_field; /* This function manages the TWI RX/RX transferts */ -- cgit v1.2.3