[1-wire] Cosmetical cleanups

This commit is contained in:
barthess 2014-12-27 22:15:39 +03:00
parent 82b8855e83
commit 0c93d40779
8 changed files with 191 additions and 102 deletions

View File

@ -26,11 +26,11 @@
- --------------------------------------- master channel generates pulses
| / .
--............................. <---------- slave (not)pulls down bus here
- ----------------------------- sample channel reads pad state
| |
----------------
^
| read interrupt fires here
- -------------------------------- sample channel reads pad state
| |
-------------
^
| read interrupt fires here
For data write it is only master channel needed. Data bit width updates
on every timer overflow event.
@ -161,7 +161,7 @@ static const uint8_t onewire_crc_table[256] = {
/**
* @brief Put bus in idle mode.
*/
static void onewire_bus_idle(onewireDriver *owp) {
static void ow_bus_idle(onewireDriver *owp) {
#if defined(STM32F1XX)
palSetPadMode(owp->config->port, owp->config->pad,
owp->config->pad_mode_idle);
@ -172,7 +172,7 @@ static void onewire_bus_idle(onewireDriver *owp) {
/**
* @brief Put bus in active mode.
*/
static void onewire_bus_active(onewireDriver *owp) {
static void ow_bus_active(onewireDriver *owp) {
pwmStart(owp->config->pwmd, &owp->pwmcfg);
#if defined(STM32F1XX)
palSetPadMode(owp->config->port, owp->config->pad,
@ -184,7 +184,7 @@ static void onewire_bus_active(onewireDriver *owp) {
* @brief Function performing read of single bit.
* @note It must be callable from any context.
*/
static uint_fast8_t readBitX(onewireDriver *owp) {
static uint_fast8_t ow_read_bit(onewireDriver *owp) {
#if ONEWIRE_SYNTH_SEARCH_TEST
(void)owp;
return _synth_ow_read_bit();
@ -240,11 +240,11 @@ static void ow_write_bit_I(onewireDriver *owp, uint_fast8_t bit) {
osalSysLockFromISR();
if (0 == bit) {
pwmEnableChannelI(owp->config->pwmd, owp->config->master_channel,
ONEWIRE_ZERO_WIDTH);
ONEWIRE_ZERO_WIDTH);
}
else {
pwmEnableChannelI(owp->config->pwmd, owp->config->master_channel,
ONEWIRE_ONE_WIDTH);
ONEWIRE_ONE_WIDTH);
}
osalSysUnlockFromISR();
#endif
@ -261,7 +261,7 @@ static void ow_write_bit_I(onewireDriver *owp, uint_fast8_t bit) {
*/
static void ow_reset_cb(PWMDriver *pwmp, onewireDriver *owp) {
owp->reg.slave_present = (PAL_LOW == readBitX(owp));
owp->reg.slave_present = (PAL_LOW == ow_read_bit(owp));
osalSysLockFromISR();
pwmDisableChannelI(pwmp, owp->config->sample_channel);
@ -288,7 +288,7 @@ static void ow_read_bit_cb(PWMDriver *pwmp, onewireDriver *owp) {
return;
}
else {
*owp->buf |= readBitX(owp) << owp->reg.bit;
*owp->buf |= ow_read_bit(owp) << owp->reg.bit;
owp->reg.bit++;
if (8 == owp->reg.bit) {
owp->reg.bit = 0;
@ -364,7 +364,7 @@ static void store_bit(onewire_search_rom_t *sr, uint_fast8_t bit) {
size_t rb = sr->reg.rombit;
/* / 8 % 8 */
/* / 8 % 8 */
sr->retbuf[rb >> 3] |= bit << (rb & 7);
sr->reg.rombit++;
}
@ -378,7 +378,7 @@ static void store_bit(onewire_search_rom_t *sr, uint_fast8_t bit) {
* @param[in] bit number of bit [0..63]
*/
static uint_fast8_t extract_path_bit(const uint8_t *path, uint_fast8_t bit) {
/* / 8 % 8 */
/* / 8 % 8 */
return (path[bit >> 3] >> (bit & 7)) & 1;
}
@ -449,11 +449,11 @@ static void ow_search_rom_cb(PWMDriver *pwmp, onewireDriver *owp) {
onewire_search_rom_t *sr = &owp->search_rom;
if (0 == sr->reg.bit_step) { /* read direct bit */
sr->reg.bit_buf |= readBitX(owp);
sr->reg.bit_buf |= ow_read_bit(owp);
sr->reg.bit_step++;
}
else if (1 == sr->reg.bit_step) { /* read complement bit */
sr->reg.bit_buf |= readBitX(owp) << 1;
sr->reg.bit_buf |= ow_read_bit(owp) << 1;
sr->reg.bit_step++;
switch(sr->reg.bit_buf){
case 0b11:
@ -494,7 +494,6 @@ static void ow_search_rom_cb(PWMDriver *pwmp, onewireDriver *owp) {
sr->reg.result = ONEWIRE_SEARCH_ROM_LAST;
goto THE_END;
}
return; /* next search bit iteration */
THE_END:
@ -620,7 +619,7 @@ void onewireStart(onewireDriver *owp, const onewireConfig *config) {
palSetPadMode(owp->config->port, owp->config->pad,
owp->config->pad_mode_active);
#endif
onewire_bus_idle(owp);
ow_bus_idle(owp);
owp->reg.state = ONEWIRE_READY;
}
@ -636,7 +635,7 @@ void onewireStop(onewireDriver *owp) {
#if ONEWIRE_USE_STRONG_PULLUP
owp->config->pullup_release();
#endif
onewire_bus_idle(owp);
ow_bus_idle(owp);
pwmStop(owp->config->pwmd);
owp->config = NULL;
owp->reg.state = ONEWIRE_STOP;
@ -658,7 +657,7 @@ bool onewireReset(onewireDriver *owp) {
osalDbgAssert(owp->reg.state == ONEWIRE_READY, "Invalid state");
/* short circuit on bus or any other device transmit data */
if (PAL_LOW == readBitX(owp))
if (PAL_LOW == ow_read_bit(owp))
return false;
pwmd = owp->config->pwmd;
@ -672,7 +671,7 @@ bool onewireReset(onewireDriver *owp) {
owp->pwmcfg.channels[sch].callback = pwm_reset_cb;
owp->pwmcfg.channels[sch].mode = PWM_OUTPUT_ACTIVE_LOW;
onewire_bus_active(owp);
ow_bus_active(owp);
pwmEnableChannel(pwmd, mch, ONEWIRE_RESET_LOW_WIDTH);
pwmEnableChannel(pwmd, sch, ONEWIRE_RESET_SAMPLE_WIDTH);
pwmEnableChannelNotification(pwmd, sch);
@ -681,11 +680,11 @@ bool onewireReset(onewireDriver *owp) {
osalThreadSuspendS(&owp->thread);
osalSysUnlock();
onewire_bus_idle(owp);
ow_bus_idle(owp);
/* wait until slave release bus to discriminate short circuit condition */
osalThreadSleepMicroseconds(500);
return (PAL_HIGH == readBitX(owp)) && (true == owp->reg.slave_present);
return (PAL_HIGH == ow_read_bit(owp)) && (true == owp->reg.slave_present);
}
/**
@ -723,7 +722,7 @@ void onewireRead(onewireDriver *owp, uint8_t *rxbuf, size_t rxbytes) {
owp->pwmcfg.channels[sch].callback = pwm_read_bit_cb;
owp->pwmcfg.channels[sch].mode = PWM_OUTPUT_ACTIVE_LOW;
onewire_bus_active(owp);
ow_bus_active(owp);
pwmEnableChannel(pwmd, mch, ONEWIRE_ONE_WIDTH);
pwmEnableChannel(pwmd, sch, ONEWIRE_SAMPLE_WIDTH);
pwmEnableChannelNotification(pwmd, sch);
@ -732,7 +731,7 @@ void onewireRead(onewireDriver *owp, uint8_t *rxbuf, size_t rxbytes) {
osalThreadSuspendS(&owp->thread);
osalSysUnlock();
onewire_bus_idle(owp);
ow_bus_idle(owp);
}
/**
@ -780,7 +779,7 @@ void onewireWrite(onewireDriver *owp, uint8_t *txbuf,
}
#endif
onewire_bus_active(owp);
ow_bus_active(owp);
pwmEnablePeriodicNotification(pwmd);
osalSysLock();
@ -788,7 +787,7 @@ void onewireWrite(onewireDriver *owp, uint8_t *txbuf,
osalSysUnlock();
pwmDisablePeriodicNotification(pwmd);
onewire_bus_idle(owp);
ow_bus_idle(owp);
#if ONEWIRE_USE_STRONG_PULLUP
if (pullup_time > 0) {
@ -855,7 +854,7 @@ size_t onewireSearchRom(onewireDriver *owp, uint8_t *result,
owp->pwmcfg.channels[sch].callback = pwm_search_rom_cb;
owp->pwmcfg.channels[sch].mode = PWM_OUTPUT_ACTIVE_LOW;
onewire_bus_active(owp);
ow_bus_active(owp);
pwmEnableChannel(pwmd, mch, ONEWIRE_ONE_WIDTH);
pwmEnableChannel(pwmd, sch, ONEWIRE_SAMPLE_WIDTH);
pwmEnableChannelNotification(pwmd, sch);
@ -864,10 +863,10 @@ size_t onewireSearchRom(onewireDriver *owp, uint8_t *result,
osalThreadSuspendS(&owp->thread);
osalSysUnlock();
onewire_bus_idle(owp);
ow_bus_idle(owp);
if (ONEWIRE_SEARCH_ROM_ERROR != owp->search_rom.reg.result) {
/* check CRC and return 0 (error status) if mismatch */
/* check CRC and return 0 (0 == error) if mismatch */
if (owp->search_rom.retbuf[7] != onewireCRC(owp->search_rom.retbuf, 7))
return 0;
/* store cached result for usage in next iteration */

View File

@ -115,7 +115,7 @@
#define STM32_ICU_USE_TIM1 FALSE
#define STM32_ICU_USE_TIM2 FALSE
#define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_USE_TIM4 TRUE
#define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM5 FALSE
#define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7
@ -131,8 +131,8 @@
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM3 TRUE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7

View File

@ -24,35 +24,48 @@
******************************************************************************
*/
#if defined(BOARD_ST_STM32F4_DISCOVERY)
#if ONEWIRE_USE_STRONG_PULLUP
#error "F4 Discovery board has not enough voltage for this feature"
#endif
#if defined(BOARD_ST_STM32F4_DISCOVERY) || \
defined(BOARD_ST_STM32F0_DISCOVERY) || \
defined(BOARD_ST_STM32F0308_DISCOVERY)
#if ONEWIRE_USE_STRONG_PULLUP
#error "This board has not enough voltage for this feature"
#endif
#endif
#if defined(BOARD_ST_STM32F4_DISCOVERY)
#define GPIOB_ONEWIRE GPIOB_PIN8
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOD, GPIOD_LED4))
#define search_led_on() (palSetPad(GPIOD, GPIOD_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#if defined(BOARD_ST_STM32F0308_DISCOVERY)
#define ONEWIRE_PORT GPIOB
#define ONEWIRE_PIN GPIOB_PIN0
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(1) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOC, GPIOC_LED4))
#define search_led_on() (palSetPad(GPIOC, GPIOC_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#elif defined(BOARD_ST_STM32F4_DISCOVERY)
#define ONEWIRE_PORT GPIOB
#define ONEWIRE_PIN GPIOB_PIN0
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOD, GPIOD_LED4))
#define search_led_on() (palSetPad(GPIOD, GPIOD_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#elif defined(BOARD_OLIMEX_STM32_103STK)
#define GPIOB_ONEWIRE 8
#define ONEWIRE_PAD_MODE_IDLE PAL_MODE_INPUT
#define ONEWIRE_PAD_MODE_ACTIVE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
#define search_led_on() (palClearPad(GPIOC, GPIOC_LED))
#define search_led_off() (palSetPad(GPIOC, GPIOC_LED))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#define ONEWIRE_PORT GPIOB
#define ONEWIRE_PIN 0
#define ONEWIRE_PAD_MODE_IDLE PAL_MODE_INPUT
#define ONEWIRE_PAD_MODE_ACTIVE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
#define search_led_on() (palClearPad(GPIOC, GPIOC_LED))
#define search_led_off() (palSetPad(GPIOC, GPIOC_LED))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#else
#define GPIOB_ONEWIRE GPIOB_TACHOMETER
#include "pads.h"
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_on red_led_on
#define search_led_off red_led_off
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#define ONEWIRE_PORT GPIOB
#define GPIOB_ONEWIRE GPIOB_TACHOMETER
#include "pads.h"
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_on red_led_on
#define search_led_off red_led_off
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#endif
/*
@ -82,17 +95,17 @@ static void strong_pullup_release(void);
static uint8_t testbuf[12];
static float temperature[3];
static int32_t temperature[3];
/*
*
*/
static const onewireConfig ow_cfg = {
&PWMD4,
&PWMD3,
ONEWIRE_MASTER_CHANNEL,
ONEWIRE_SAMPLE_CHANNEL,
GPIOB,
GPIOB_ONEWIRE,
ONEWIRE_PORT,
ONEWIRE_PIN,
#if defined(STM32F1XX)
ONEWIRE_PAD_MODE_IDLE,
#endif
@ -140,11 +153,11 @@ static void strong_pullup_release(void) {
*/
void onewireTest(void) {
uint16_t tmp;
int16_t tmp;
uint8_t rombuf[24];
size_t devices_on_bus = 0;
size_t i = 0;
volatile bool presence;
bool presence;
onewireObjectInit(&OWD1);
onewireStart(&OWD1, &ow_cfg);
@ -209,11 +222,11 @@ void onewireTest(void) {
osalDbgCheck(testbuf[8] == onewireCRC(testbuf, 8));
tmp = 0;
tmp |= (testbuf[1] << 8) | testbuf[0];
temperature[i] = tmp * 0.0625;
temperature[i] = (tmp * 625) / 10;
}
}
else {
osalSysHalt("");
osalSysHalt("No devices found");
}
osalThreadSleep(1); /* enforce ChibiOS's stack overflow check */
}

View File

@ -0,0 +1,32 @@
*****************************************************************************
** ChibiOS/RT HAL - 1-Wire driver demo for STM32F1xx. **
*****************************************************************************
** TARGET **
The demo will on an Olimex STM32_103STK board.
** The Demo **
The application demonstrates the use of the STM32F1xx 1-Wire driver.
** Board Setup **
To use demo you have to power your 1-wire device from 5V bus on board
and connect DQ line to PB0 pin. Do not forget about external pullup
resistor to 5V (4k7 recommended).
** Build Procedure **
The demo has been tested using the free Codesourcery GCC-based toolchain
and YAGARTO.
Just modify the TRGT line in the makefile in order to use different GCC ports.
** Notes **
Some files used by the demo are not part of ChibiOS/RT but are copyright of
ST Microelectronics and are licensed under a different license.
Also note that not all the files present in the ST library are distributed
with ChibiOS/RT, you can find the whole library on the ST web site:
http://www.st.com

View File

@ -65,7 +65,7 @@ endif
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = softfp
USE_FPU = no
endif
#

View File

@ -189,8 +189,8 @@
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM3 TRUE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM9 FALSE

View File

@ -24,35 +24,48 @@
******************************************************************************
*/
#if defined(BOARD_ST_STM32F4_DISCOVERY)
#if ONEWIRE_USE_STRONG_PULLUP
#error "F4 Discovery board has not enough voltage for this feature"
#endif
#if defined(BOARD_ST_STM32F4_DISCOVERY) || \
defined(BOARD_ST_STM32F0_DISCOVERY) || \
defined(BOARD_ST_STM32F0308_DISCOVERY)
#if ONEWIRE_USE_STRONG_PULLUP
#error "This board has not enough voltage for this feature"
#endif
#endif
#if defined(BOARD_ST_STM32F4_DISCOVERY)
#define GPIOB_ONEWIRE GPIOB_PIN8
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOD, GPIOD_LED4))
#define search_led_on() (palSetPad(GPIOD, GPIOD_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#if defined(BOARD_ST_STM32F0308_DISCOVERY)
#define ONEWIRE_PORT GPIOB
#define ONEWIRE_PIN GPIOB_PIN0
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(1) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOC, GPIOC_LED4))
#define search_led_on() (palSetPad(GPIOC, GPIOC_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#elif defined(BOARD_ST_STM32F4_DISCOVERY)
#define ONEWIRE_PORT GPIOB
#define ONEWIRE_PIN GPIOB_PIN0
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOD, GPIOD_LED4))
#define search_led_on() (palSetPad(GPIOD, GPIOD_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#elif defined(BOARD_OLIMEX_STM32_103STK)
#define GPIOB_ONEWIRE 8
#define ONEWIRE_PAD_MODE_IDLE PAL_MODE_INPUT
#define ONEWIRE_PAD_MODE_ACTIVE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
#define search_led_on() (palClearPad(GPIOC, GPIOC_LED))
#define search_led_off() (palSetPad(GPIOC, GPIOC_LED))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#define ONEWIRE_PORT GPIOB
#define ONEWIRE_PIN 0
#define ONEWIRE_PAD_MODE_IDLE PAL_MODE_INPUT
#define ONEWIRE_PAD_MODE_ACTIVE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
#define search_led_on() (palClearPad(GPIOC, GPIOC_LED))
#define search_led_off() (palSetPad(GPIOC, GPIOC_LED))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#else
#define GPIOB_ONEWIRE GPIOB_TACHOMETER
#include "pads.h"
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_on red_led_on
#define search_led_off red_led_off
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#define ONEWIRE_PORT GPIOB
#define GPIOB_ONEWIRE GPIOB_TACHOMETER
#include "pads.h"
#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_on red_led_on
#define search_led_off red_led_off
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#endif
/*
@ -82,17 +95,17 @@ static void strong_pullup_release(void);
static uint8_t testbuf[12];
static float temperature[3];
static int32_t temperature[3];
/*
*
*/
static const onewireConfig ow_cfg = {
&PWMD4,
&PWMD3,
ONEWIRE_MASTER_CHANNEL,
ONEWIRE_SAMPLE_CHANNEL,
GPIOB,
GPIOB_ONEWIRE,
ONEWIRE_PORT,
ONEWIRE_PIN,
#if defined(STM32F1XX)
ONEWIRE_PAD_MODE_IDLE,
#endif
@ -140,11 +153,11 @@ static void strong_pullup_release(void) {
*/
void onewireTest(void) {
uint16_t tmp;
int16_t tmp;
uint8_t rombuf[24];
size_t devices_on_bus = 0;
size_t i = 0;
volatile bool presence;
bool presence;
onewireObjectInit(&OWD1);
onewireStart(&OWD1, &ow_cfg);
@ -209,11 +222,11 @@ void onewireTest(void) {
osalDbgCheck(testbuf[8] == onewireCRC(testbuf, 8));
tmp = 0;
tmp |= (testbuf[1] << 8) | testbuf[0];
temperature[i] = tmp * 0.0625;
temperature[i] = (tmp * 625) / 10;
}
}
else {
osalSysHalt("");
osalSysHalt("No devices found");
}
osalThreadSleep(1); /* enforce ChibiOS's stack overflow check */
}

View File

@ -0,0 +1,32 @@
*****************************************************************************
** ChibiOS/RT HAL - 1-Wire driver demo for STM32F4xx. **
*****************************************************************************
** TARGET **
The demo will on an STMicroelectronics STM32F4-Discovery board.
** The Demo **
The application demonstrates the use of the STM32F4xx 1-Wire driver.
** Board Setup **
To use demo you have to power your 1-wire device from 5V bus on board
and connect DQ line to PB0 pin. Do not forget about external pullup
resistor to 5V (4k7 recommended).
** Build Procedure **
The demo has been tested using the free Codesourcery GCC-based toolchain
and YAGARTO.
Just modify the TRGT line in the makefile in order to use different GCC ports.
** Notes **
Some files used by the demo are not part of ChibiOS/RT but are copyright of
ST Microelectronics and are licensed under a different license.
Also note that not all the files present in the ST library are distributed
with ChibiOS/RT, you can find the whole library on the ST web site:
http://www.st.com