[peripherals] ignore cast-qual for mpu9250 as well

This commit is contained in:
Gautier Hattenberger
2014-11-18 10:05:46 +01:00
parent fadb06771f
commit b17322ecd5
2 changed files with 18 additions and 4 deletions
+9 -2
View File
@@ -114,8 +114,15 @@ void mpu9250_i2c_event(struct Mpu9250_I2c *mpu)
mpu->data_rates.rates.r = Int16FromBuf(mpu->i2c_trans.buf, 13);
// if we are reading slaves through the mpu, copy the ext_sens_data
if ((mpu->config.i2c_bypass == FALSE) && (mpu->config.nb_slaves > 0))
memcpy(mpu->data_ext, (void *) &(mpu->i2c_trans.buf[15]), mpu->config.nb_bytes - 15);
if ((mpu->config.i2c_bypass == FALSE) && (mpu->config.nb_slaves > 0)) {
/* the buffer is volatile, since filled from ISR
* but we know it's ok to use it here so we silence the warning
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
memcpy(mpu->data_ext, (uint8_t *) &(mpu->i2c_trans.buf[15]), mpu->config.nb_bytes - 15);
#pragma GCC diagnostic pop
}
mpu->data_available = TRUE;
}
+9 -2
View File
@@ -114,8 +114,15 @@ void mpu9250_spi_event(struct Mpu9250_Spi *mpu)
mpu->data_rates.rates.r = Int16FromBuf(mpu->rx_buf, 14);
// if we are reading slaves, copy the ext_sens_data
if (mpu->config.nb_slaves > 0)
memcpy(mpu->data_ext, (void *) &(mpu->rx_buf[16]), mpu->config.nb_bytes - 15);
if (mpu->config.nb_slaves > 0) {
/* the buffer is volatile, since filled from ISR
* but we know it's ok to use it here so we silence the warning
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
memcpy(mpu->data_ext, (uint8_t *) &(mpu->rx_buf[16]), mpu->config.nb_bytes - 15);
#pragma GCC diagnostic pop
}
mpu->data_available = TRUE;
}