diff --git a/drivers/bh1750fvi/bh1750fvi.c b/drivers/bh1750fvi/bh1750fvi.c index 226f9cfa04604425ace0b08210f5a00cddb342c0..cba0f70c49c99b661dcb8779eaeb700a5827ea06 100644 --- a/drivers/bh1750fvi/bh1750fvi.c +++ b/drivers/bh1750fvi/bh1750fvi.c @@ -71,7 +71,7 @@ uint16_t bh1750fvi_sample(const bh1750fvi_t *dev) i2c_release(dev->i2c); /* and finally we calculate the actual LUX value */ - tmp = (raw[0] << 24) | (raw[1] << 16); + tmp = ((uint32_t)raw[0] << 24) | ((uint32_t)raw[1] << 16); tmp /= RES_DIV; return (uint16_t)(tmp); } diff --git a/drivers/bmp180/bmp180.c b/drivers/bmp180/bmp180.c index ff4c7e0485fb4591d20f3099ccbaa422418628c9..1927c6e797b9fae1b9ef1f20a1e70694f1cb6e22 100644 --- a/drivers/bmp180/bmp180.c +++ b/drivers/bmp180/bmp180.c @@ -198,7 +198,7 @@ static int _read_ut(const bmp180_t *dev, int32_t *output) i2c_release(DEV_I2C); return -1; } - *output = ( ut[0] << 8 ) | ut[1]; + *output = ((uint16_t)ut[0] << 8) | ut[1]; DEBUG("UT: %i\n", (int)*output); @@ -234,7 +234,8 @@ static int _read_up(const bmp180_t *dev, int32_t *output) return -1; } - *output = ((up[0] << 16) | (up[1] << 8) | up[2]) >> (8 - OVERSAMPLING); + *output = (((uint32_t)up[0] << 16) | + ((uint32_t)up[1] << 8) | up[2]) >> (8 - OVERSAMPLING); DEBUG("UP: %i\n", (int)*output); diff --git a/drivers/hih6130/hih6130.c b/drivers/hih6130/hih6130.c index 1f476a0d97103a328a416181385b542020a494a4..0428240875d60c286d22eae10df0d2da350e2d0c 100644 --- a/drivers/hih6130/hih6130.c +++ b/drivers/hih6130/hih6130.c @@ -52,7 +52,7 @@ enum { }; /** @brief Delay between requesting a measurement and data becoming ready */ -#define MEASUREMENT_DELAY (50*1000) +#define MEASUREMENT_DELAY (50LU * US_PER_MS) /** @brief Trigger a new measurement on the sensor */ static inline int hih6130_measurement_request(const hih6130_t *dev) diff --git a/drivers/mpu9150/mpu9150.c b/drivers/mpu9150/mpu9150.c index d30d9bcf2c0ebf6cca9ec9a5d655293ab3e19bfb..bbc74c630c9228dd28fe1ae2d9d125d5e7749fd0 100644 --- a/drivers/mpu9150/mpu9150.c +++ b/drivers/mpu9150/mpu9150.c @@ -375,8 +375,8 @@ int mpu9150_read_temperature(const mpu9150_t *dev, int32_t *output) /* Release the bus */ i2c_release(dev->i2c_dev); - temp = (data[0] << 8) | data[1]; - *output = ((((int32_t)temp) * 1000) / 340) + (35*1000); + temp = ((uint16_t)data[0] << 8) | data[1]; + *output = (((int32_t)temp * 1000LU) / 340) + (35 * 1000LU); return 0; } diff --git a/drivers/pn532/pn532.c b/drivers/pn532/pn532.c index d5d2476a962aa9348e9ba571645d473fea9963c6..7039691ba56b2be0aa60d9f6b16e86fdf3dde75d 100644 --- a/drivers/pn532/pn532.c +++ b/drivers/pn532/pn532.c @@ -379,10 +379,10 @@ int pn532_fw_version(pn532_t *dev, uint32_t *fw_ver) buff[BUFF_CMD_START] = CMD_FIRMWARE_VERSION; if (send_rcv(dev, buff, 0, 4) == 4) { - *fw_ver = (buff[0] << 24); /* ic version */ - *fw_ver += (buff[1] << 16); /* fw ver */ - *fw_ver += (buff[2] << 8); /* fw rev */ - *fw_ver += (buff[3]); /* feature support */ + *fw_ver = ((uint32_t)buff[0] << 24); /* ic version */ + *fw_ver += ((uint32_t)buff[1] << 16); /* fw ver */ + *fw_ver += ((uint32_t)buff[2] << 8); /* fw rev */ + *fw_ver += (buff[3]); /* feature support */ ret = 0; }