aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/STM32F0xx/onewire/.project8
-rw-r--r--testhal/STM32/STM32F0xx/onewire/onewire_test.c6
-rw-r--r--testhal/STM32/STM32F0xx/onewire/search_rom_synth.c16
-rw-r--r--testhal/STM32/STM32F1xx/onewire/onewire_test.c6
-rw-r--r--testhal/STM32/STM32F1xx/onewire/search_rom_synth.c16
-rw-r--r--testhal/STM32/STM32F4xx/onewire/onewire_test.c6
-rw-r--r--testhal/STM32/STM32F4xx/onewire/search_rom_synth.c16
7 files changed, 37 insertions, 37 deletions
diff --git a/testhal/STM32/STM32F0xx/onewire/.project b/testhal/STM32/STM32F0xx/onewire/.project
index 8180131..6599a83 100644
--- a/testhal/STM32/STM32F0xx/onewire/.project
+++ b/testhal/STM32/STM32F0xx/onewire/.project
@@ -25,14 +25,14 @@
</natures>
<linkedResources>
<link>
- <name>os-contrib</name>
+ <name>os-community</name>
<type>2</type>
- <locationURI>CHIBIOS_CONTRIB</locationURI>
+ <locationURI>PARENT-4-PROJECT_LOC/os</locationURI>
</link>
<link>
- <name>os</name>
+ <name>os-git</name>
<type>2</type>
- <locationURI>CHIBIOS</locationURI>
+ <locationURI>PARENT-5-PROJECT_LOC/ChibiOS-RT/os</locationURI>
</link>
</linkedResources>
</projectDescription>
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 {
diff --git a/testhal/STM32/STM32F0xx/onewire/search_rom_synth.c b/testhal/STM32/STM32F0xx/onewire/search_rom_synth.c
index 98f097d..cd2528f 100644
--- a/testhal/STM32/STM32F0xx/onewire/search_rom_synth.c
+++ b/testhal/STM32/STM32F0xx/onewire/search_rom_synth.c
@@ -41,7 +41,7 @@ typedef struct {
OWSynthDevice devices[SYNTH_DEVICES_MAX];
size_t dev_present;
bool complement_bit;
- uint_fast8_t rom_bit;
+ ioline_t rom_bit;
} OWSynthBus;
/*
@@ -86,12 +86,12 @@ static uint64_t detected_devices[SYNTH_DEVICES_MAX];
/**
*
*/
-void _synth_ow_write_bit(onewireDriver *owp, uint8_t bit) {
+void _synth_ow_write_bit(onewireDriver *owp, ioline_t bit) {
(void)owp;
size_t i;
for (i=0; i<SYNTH_DEVICES_MAX; i++) {
- if (((synth_bus.devices[i].id >> synth_bus.rom_bit) & 1) != bit) {
+ if (((synth_bus.devices[i].id >> synth_bus.rom_bit) & 1U) != bit) {
synth_bus.devices[i].active = false;
}
}
@@ -101,16 +101,16 @@ void _synth_ow_write_bit(onewireDriver *owp, uint8_t bit) {
/**
*
*/
-uint_fast8_t _synth_ow_read_bit(void) {
- uint_fast8_t ret = 0xFF;
+ioline_t _synth_ow_read_bit(void) {
+ ioline_t ret = 0xFF;
size_t i;
- uint_fast8_t bit;
+ ioline_t bit;
for (i=0; i<SYNTH_DEVICES_MAX; i++) {
if (synth_bus.devices[i].active){
- bit = (synth_bus.devices[i].id >> synth_bus.rom_bit) & 1;
+ bit = (synth_bus.devices[i].id >> synth_bus.rom_bit) & 1U;
if (synth_bus.complement_bit){
- bit ^= 1;
+ bit ^= 1U;
}
if (0xFF == ret)
ret = bit;
diff --git a/testhal/STM32/STM32F1xx/onewire/onewire_test.c b/testhal/STM32/STM32F1xx/onewire/onewire_test.c
index 719420a..be20dbc 100644
--- a/testhal/STM32/STM32F1xx/onewire/onewire_test.c
+++ b/testhal/STM32/STM32F1xx/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 {
diff --git a/testhal/STM32/STM32F1xx/onewire/search_rom_synth.c b/testhal/STM32/STM32F1xx/onewire/search_rom_synth.c
index 98f097d..cd2528f 100644
--- a/testhal/STM32/STM32F1xx/onewire/search_rom_synth.c
+++ b/testhal/STM32/STM32F1xx/onewire/search_rom_synth.c
@@ -41,7 +41,7 @@ typedef struct {
OWSynthDevice devices[SYNTH_DEVICES_MAX];
size_t dev_present;
bool complement_bit;
- uint_fast8_t rom_bit;
+ ioline_t rom_bit;
} OWSynthBus;
/*
@@ -86,12 +86,12 @@ static uint64_t detected_devices[SYNTH_DEVICES_MAX];
/**
*
*/
-void _synth_ow_write_bit(onewireDriver *owp, uint8_t bit) {
+void _synth_ow_write_bit(onewireDriver *owp, ioline_t bit) {
(void)owp;
size_t i;
for (i=0; i<SYNTH_DEVICES_MAX; i++) {
- if (((synth_bus.devices[i].id >> synth_bus.rom_bit) & 1) != bit) {
+ if (((synth_bus.devices[i].id >> synth_bus.rom_bit) & 1U) != bit) {
synth_bus.devices[i].active = false;
}
}
@@ -101,16 +101,16 @@ void _synth_ow_write_bit(onewireDriver *owp, uint8_t bit) {
/**
*
*/
-uint_fast8_t _synth_ow_read_bit(void) {
- uint_fast8_t ret = 0xFF;
+ioline_t _synth_ow_read_bit(void) {
+ ioline_t ret = 0xFF;
size_t i;
- uint_fast8_t bit;
+ ioline_t bit;
for (i=0; i<SYNTH_DEVICES_MAX; i++) {
if (synth_bus.devices[i].active){
- bit = (synth_bus.devices[i].id >> synth_bus.rom_bit) & 1;
+ bit = (synth_bus.devices[i].id >> synth_bus.rom_bit) & 1U;
if (synth_bus.complement_bit){
- bit ^= 1;
+ bit ^= 1U;
}
if (0xFF == ret)
ret = bit;
diff --git a/testhal/STM32/STM32F4xx/onewire/onewire_test.c b/testhal/STM32/STM32F4xx/onewire/onewire_test.c
index 719420a..be20dbc 100644
--- a/testhal/STM32/STM32F4xx/onewire/onewire_test.c
+++ b/testhal/STM32/STM32F4xx/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 {
diff --git a/testhal/STM32/STM32F4xx/onewire/search_rom_synth.c b/testhal/STM32/STM32F4xx/onewire/search_rom_synth.c
index 98f097d..cd2528f 100644
--- a/testhal/STM32/STM32F4xx/onewire/search_rom_synth.c
+++ b/testhal/STM32/STM32F4xx/onewire/search_rom_synth.c
@@ -41,7 +41,7 @@ typedef struct {
OWSynthDevice devices[SYNTH_DEVICES_MAX];
size_t dev_present;
bool complement_bit;
- uint_fast8_t rom_bit;
+ ioline_t rom_bit;
} OWSynthBus;
/*
@@ -86,12 +86,12 @@ static uint64_t detected_devices[SYNTH_DEVICES_MAX];
/**
*
*/
-void _synth_ow_write_bit(onewireDriver *owp, uint8_t bit) {
+void _synth_ow_write_bit(onewireDriver *owp, ioline_t bit) {
(void)owp;
size_t i;
for (i=0; i<SYNTH_DEVICES_MAX; i++) {
- if (((synth_bus.devices[i].id >> synth_bus.rom_bit) & 1) != bit) {
+ if (((synth_bus.devices[i].id >> synth_bus.rom_bit) & 1U) != bit) {
synth_bus.devices[i].active = false;
}
}
@@ -101,16 +101,16 @@ void _synth_ow_write_bit(onewireDriver *owp, uint8_t bit) {
/**
*
*/
-uint_fast8_t _synth_ow_read_bit(void) {
- uint_fast8_t ret = 0xFF;
+ioline_t _synth_ow_read_bit(void) {
+ ioline_t ret = 0xFF;
size_t i;
- uint_fast8_t bit;
+ ioline_t bit;
for (i=0; i<SYNTH_DEVICES_MAX; i++) {
if (synth_bus.devices[i].active){
- bit = (synth_bus.devices[i].id >> synth_bus.rom_bit) & 1;
+ bit = (synth_bus.devices[i].id >> synth_bus.rom_bit) & 1U;
if (synth_bus.complement_bit){
- bit ^= 1;
+ bit ^= 1U;
}
if (0xFF == ret)
ret = bit;