aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F0xx/onewire/search_rom_synth.c
diff options
context:
space:
mode:
authorbarthess <barthess@yandex.ru>2016-05-31 00:04:19 +0300
committerbarthess <barthess@yandex.ru>2016-05-31 00:04:19 +0300
commitb10e42340675dfb915be881b45053aeccf1dcbe4 (patch)
tree513acfeb99700d71100b9b9b10b5d2e996d1c872 /testhal/STM32/STM32F0xx/onewire/search_rom_synth.c
parent0fb26389ea53d4e2a4b0587886e6970f8c5ad102 (diff)
downloadChibiOS-Contrib-b10e42340675dfb915be881b45053aeccf1dcbe4.tar.gz
ChibiOS-Contrib-b10e42340675dfb915be881b45053aeccf1dcbe4.tar.bz2
ChibiOS-Contrib-b10e42340675dfb915be881b45053aeccf1dcbe4.zip
1-wire improvements.
1) Functions reading bit from PAL now return ioline_t type. 2) Functions that handle acquired buffer with acquired bits now use uint8_t type because it corresponds to buffer type. 3) Cryptic bit shifting in bit storage functions replaced by dividion operations because all modern compilers perfectly optimise such operations.
Diffstat (limited to 'testhal/STM32/STM32F0xx/onewire/search_rom_synth.c')
-rw-r--r--testhal/STM32/STM32F0xx/onewire/search_rom_synth.c16
1 files changed, 8 insertions, 8 deletions
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;