aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F0xx
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F0xx')
-rw-r--r--testhal/STM32/STM32F0xx/onewire/onewire_test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/testhal/STM32/STM32F0xx/onewire/onewire_test.c b/testhal/STM32/STM32F0xx/onewire/onewire_test.c
index 719420a..be20dbc 100644
--- a/testhal/STM32/STM32F0xx/onewire/onewire_test.c
+++ b/testhal/STM32/STM32F0xx/onewire/onewire_test.c
@@ -95,6 +95,7 @@ static void strong_pullup_release(void);
static uint8_t testbuf[12];
+/* stores 3 temperature values in millicelsius */
static int32_t temperature[3];
/*
@@ -242,9 +243,8 @@ void onewireTest(void) {
onewireRead(&OWD1, testbuf, 9);
osalDbgCheck(testbuf[8] == onewireCRC(testbuf, 8));
- tmp = 0;
- tmp |= (testbuf[1] << 8) | testbuf[0];
- temperature[i] = (tmp * 625) / 10;
+ memcpy(&tmp, &testbuf, 2);
+ temperature[i] = ((int32_t)tmp * 625) / 10;
}
}
else {