diff --git a/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c b/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c index f024b23..85ed096 100644 --- a/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c +++ b/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c @@ -77,7 +77,10 @@ uint8_t DS18B20_ReadByte(void) while (i--) { byte >>= 1; - byte |= (DS18B20_ReadBit() << 7); + if (DS18B20_ReadBit()) + { + byte |= 0x80; + } } return byte; } diff --git a/demo/gpio/ds18b20/single-ds18b20/ds18b20.c b/demo/gpio/ds18b20/single-ds18b20/ds18b20.c index f024b23..85ed096 100644 --- a/demo/gpio/ds18b20/single-ds18b20/ds18b20.c +++ b/demo/gpio/ds18b20/single-ds18b20/ds18b20.c @@ -77,7 +77,10 @@ uint8_t DS18B20_ReadByte(void) while (i--) { byte >>= 1; - byte |= (DS18B20_ReadBit() << 7); + if (DS18B20_ReadBit()) + { + byte |= 0x80; + } } return byte; }