fix: compile error in keil c51

This commit is contained in:
IOsetting 2022-06-06 02:02:24 +08:00
parent 43424ca5be
commit a41cba9eec
2 changed files with 8 additions and 2 deletions

View File

@ -77,7 +77,10 @@ uint8_t DS18B20_ReadByte(void)
while (i--) while (i--)
{ {
byte >>= 1; byte >>= 1;
byte |= (DS18B20_ReadBit() << 7); if (DS18B20_ReadBit())
{
byte |= 0x80;
}
} }
return byte; return byte;
} }

View File

@ -77,7 +77,10 @@ uint8_t DS18B20_ReadByte(void)
while (i--) while (i--)
{ {
byte >>= 1; byte >>= 1;
byte |= (DS18B20_ReadBit() << 7); if (DS18B20_ReadBit())
{
byte |= 0x80;
}
} }
return byte; return byte;
} }