Skip to content

Commit f791ebf

Browse files
committed
Bug fix
1 parent 0fb2814 commit f791ebf

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

74165_platform.c

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,16 @@ void IC74165_SetGPIO_IN(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
7272
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
7373
}
7474
#elif defined(IC74165_PLATFORM_ESP32_IDF)
75-
void IC74165_SetGPIO_OUT(uint64_t GPIO_Pad)
75+
void IC74165_SetGPIO_OUT(gpio_num_t GPIO_Pad)
7676
{
77-
gpio_config_t IC74165_GPIO_CONF;
78-
IC74165_GPIO_CONF.pin_bit_mask = GPIO_Pad;
79-
IC74165_GPIO_CONF.mode = GPIO_MODE_OUTPUT;
80-
IC74165_GPIO_CONF.pull_up_en = GPIO_PULLUP_DISABLE;
81-
IC74165_GPIO_CONF.pull_down_en = GPIO_PULLDOWN_DISABLE;
82-
IC74165_GPIO_CONF.intr_type = GPIO_INTR_DISABLE;
83-
gpio_config(&IC74165_GPIO_CONF);
77+
gpio_reset_pin(GPIO_Pad);
78+
gpio_set_direction(GPIO_Pad, GPIO_MODE_OUTPUT);
8479
}
8580

86-
void IC74165_SetGPIO_IN(uint64_t GPIO_Pad)
81+
void IC74165_SetGPIO_IN(gpio_num_t GPIO_Pad)
8782
{
88-
gpio_config_t IC74165_GPIO_CONF;
89-
IC74165_GPIO_CONF.pin_bit_mask = GPIO_Pad;
90-
IC74165_GPIO_CONF.mode = GPIO_MODE_DEF_INPUT;
91-
IC74165_GPIO_CONF.pull_up_en = GPIO_PULLUP_DISABLE;
92-
IC74165_GPIO_CONF.pull_down_en = GPIO_PULLDOWN_DISABLE;
93-
IC74165_GPIO_CONF.intr_type = GPIO_INTR_DISABLE;
94-
gpio_config(&IC74165_GPIO_CONF);
83+
gpio_reset_pin(GPIO_Pad);
84+
gpio_set_direction(GPIO_Pad, GPIO_MODE_INPUT);
9585
}
9686
#endif
9787

@@ -107,13 +97,9 @@ IC74165_PlatformInit(void)
10797
IC74165_SetGPIO_OUT(IC74165_SHLD_GPIO, IC74165_SHLD_PIN);
10898
IC74165_SetGPIO_IN(IC74165_QH_GPIO, IC74165_QH_PIN);
10999
#elif defined(IC74165_PLATFORM_ESP32_IDF)
110-
uint64_t GPIO_Pad = 0;
111-
GPIO_Pad = (1 << IC74165_CLK_GPIO) |
112-
(1 << IC74165_SHLD_GPIO);
113-
IC74165_SetGPIO_OUT(GPIO_Pad);
114-
115-
GPIO_Pad = (1 << IC74165_QH_GPIO);
116-
IC74165_SetGPIO_IN(GPIO_Pad);
100+
IC74165_SetGPIO_OUT(IC74165_CLK_GPIO);
101+
IC74165_SetGPIO_OUT(IC74165_SHLD_GPIO);
102+
IC74165_SetGPIO_IN(IC74165_QH_GPIO);
117103
#endif
118104
}
119105

0 commit comments

Comments
 (0)