Mercurial > ~darius > hgwebdir.cgi > avr-lib
changeset 15:a50a054d060c
- Make OWREADBUS work properly.
- Fix debug commands.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Wed, 08 Feb 2012 10:36:26 +1030 |
parents | d8002c716678 |
children | 3aac1bb54918 |
files | 1wire-config-stm32.h |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/1wire-config-stm32.h Wed Feb 08 10:35:13 2012 +1030 +++ b/1wire-config-stm32.h Wed Feb 08 10:36:26 2012 +1030 @@ -37,7 +37,7 @@ #include "stm32f10x.h" /* GPIO* */ #include "hw.h" /* For _usleep16() */ -/* No need for this on ARM */ +/* Fudge AVR stuff for ARM */ #define PROGMEM #define PSTR(x) x #define pgm_read_byte(x) *(x) @@ -48,6 +48,7 @@ /* Set the port up to allow reading from the 1 wire bus */ #define OWSETREAD() do { \ GPIO_InitTypeDef GPIO_InitStructure; \ + \ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; \ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; \ @@ -56,7 +57,7 @@ /* Read the 1-wire bus, non-inverting logic */ -#define OWREADBUS() (GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_3)) +#define OWREADBUS() (GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_3) ? 1 : 0) /* Set the 1-wire bus to 0 */ @@ -89,11 +90,12 @@ #define OWDELAY_G /* 0 usec */ #define OWDELAY_H _usleep16(480) /* 480 usec */ #define OWDELAY_I _usleep16(70) /* 70 usec */ +#define OWDELAY_J _usleep16(410) /* 410 usec */ #ifdef OW_DEBUG -#define OWPUTS(x) puts_P(x) -#define OWPUTSP(x) puts_P(x) -#define OWPRINTFP(fmt, ...) printf_P(fmt, ## __VA_ARGS__) +#define OWPUTS(x) puts(x) +#define OWPUTSP(x) puts(x) +#define OWPRINTFP(fmt, ...) printf(fmt, ## __VA_ARGS__) #else #define OWPUTS(x) #define OWPUTSP(x)