comparison 1wire-config.h @ 38:38869c474104

Remove kludgy delays.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 01 Apr 2013 19:45:19 +1030
parents b12881051261
children 345a42f6151b
comparison
equal deleted inserted replaced
37:9456ceea4f07 38:38869c474104
79 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \ 79 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \
80 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; \ 80 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; \
81 GPIO_Init(GPIOE, &GPIO_InitStructure); \ 81 GPIO_Init(GPIOE, &GPIO_InitStructure); \
82 } while (0) 82 } while (0)
83 83
84 #if 0
85 #define OWDELAY_A delay(6) /* 6 usec */ 84 #define OWDELAY_A delay(6) /* 6 usec */
86 #define OWDELAY_B delay(64) /* 64 usec */ 85 #define OWDELAY_B delay(65) /* 64 usec */
87 #define OWDELAY_C delay(60) /* 60 usec */ 86 #define OWDELAY_C delay(60) /* 60 usec */
88 #define OWDELAY_D delay(10) /* 10 usec */ 87 #define OWDELAY_D delay(10) /* 10 usec */
89 #define OWDELAY_E delay(9) /* 9 usec */ 88 #define OWDELAY_E delay(9) /* 9 usec */
90 #define OWDELAY_F delay(55) /* 55 usec */ 89 #define OWDELAY_F delay(55) /* 55 usec */
91 #define OWDELAY_G /* 0 usec */ 90 #define OWDELAY_G /* 0 usec */
92 #define OWDELAY_H delay(480) /* 480 usec */ 91 #define OWDELAY_H delay(480) /* 480 usec */
93 #define OWDELAY_I delay(70) /* 70 usec */ 92 #define OWDELAY_I delay(70) /* 70 usec */
94 #define OWDELAY_J delay(410) /* 410 usec */ 93 #define OWDELAY_J delay(410) /* 410 usec */
95 #else 94
96 /* As measured by the cro delay() is correct, but the code does not work and I don't understand why.
97 * We need to use delays 2/3 the expected amount.
98 * Possibly due to use of GPIO_Init(), however the STM32 lib doesn't seem to have a function to
99 * just set the GPIO mode.
100 */
101 #define OWDELAY_A delay(4) /* 6 usec */
102 #define OWDELAY_B delay(43) /* 64 usec */
103 #define OWDELAY_C delay(40) /* 60 usec */
104 #define OWDELAY_D delay(7) /* 10 usec */
105 #define OWDELAY_E delay(6) /* 9 usec */
106 #define OWDELAY_F delay(37) /* 55 usec */
107 #define OWDELAY_G /* 0 usec */
108 #define OWDELAY_H delay(320) /* 480 usec */
109 #define OWDELAY_I delay(47) /* 70 usec */
110 #define OWDELAY_J delay(273) /* 410 usec */
111 #endif
112 //#define OW_DEBUG 95 //#define OW_DEBUG
113 #ifdef OW_DEBUG 96 #ifdef OW_DEBUG
114 #define OWPUTS(x) puts(x) 97 #define OWPUTS(x) puts(x)
115 #define OWPUTSP(x) puts(x) 98 #define OWPUTSP(x) puts(x)
116 #define OWPRINTFP(fmt, ...) printf(fmt, ## __VA_ARGS__) 99 #define OWPRINTFP(fmt, ...) printf(fmt, ## __VA_ARGS__)