comparison 1wire-config.h @ 86:345a42f6151b

Catch up with change to new board
author Daniel O'Connor <darius@dons.net.au>
date Thu, 12 Mar 2015 23:22:35 +1030
parents 38869c474104
children
comparison
equal deleted inserted replaced
85:18b154c447bb 86:345a42f6151b
47 47
48 /* Set the port up to allow reading from the 1 wire bus */ 48 /* Set the port up to allow reading from the 1 wire bus */
49 #define OWSETREAD() do { \ 49 #define OWSETREAD() do { \
50 GPIO_InitTypeDef GPIO_InitStructure; \ 50 GPIO_InitTypeDef GPIO_InitStructure; \
51 \ 51 \
52 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; \ 52 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; \
53 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \ 53 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \
54 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; \ 54 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; \
55 GPIO_Init(GPIOE, &GPIO_InitStructure); \ 55 GPIO_Init(GPIOC, &GPIO_InitStructure); \
56 } while (0) 56 } while (0)
57 57
58 58
59 /* Read the 1-wire bus, non-inverting logic */ 59 /* Read the 1-wire bus, non-inverting logic */
60 #define OWREADBUS() (GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_3) ? 1 : 0) 60 #define OWREADBUS() (GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_0) ? 1 : 0)
61 61
62 /* Set the 1-wire bus to 0 62 /* Set the 1-wire bus to 0
63 */ 63 */
64 #define OWSETBUSLOW() do { \ 64 #define OWSETBUSLOW() do { \
65 GPIO_InitTypeDef GPIO_InitStructure; \ 65 GPIO_InitTypeDef GPIO_InitStructure; \
66 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; \ 66 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; \
67 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \ 67 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; \
68 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; \ 68 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; \
69 GPIO_Init(GPIOE, &GPIO_InitStructure); \ 69 GPIO_Init(GPIOC, &GPIO_InitStructure); \
70 GPIO_ResetBits(GPIOE, GPIO_Pin_3); \ 70 GPIO_ResetBits(GPIOC, GPIO_Pin_0); \
71 } while (0) 71 } while (0)
72 72
73 /* Set the 1-wire bus to 1 73 /* Set the 1-wire bus to 1
74 * Change to input and let the pull up do its job 74 * Change to input and let the pull up do its job
75 */ 75 */
76 #define OWSETBUSHIGH() do { \ 76 #define OWSETBUSHIGH() do { \
77 GPIO_InitTypeDef GPIO_InitStructure; \ 77 GPIO_InitTypeDef GPIO_InitStructure; \
78 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; \ 78 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; \
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(GPIOC, &GPIO_InitStructure); \
82 } while (0) 82 } while (0)
83 83
84 #define OWDELAY_A delay(6) /* 6 usec */ 84 #define OWDELAY_A delay(6) /* 6 usec */
85 #define OWDELAY_B delay(65) /* 64 usec */ 85 #define OWDELAY_B delay(65) /* 64 usec */
86 #define OWDELAY_C delay(60) /* 60 usec */ 86 #define OWDELAY_C delay(60) /* 60 usec */