Skip to content

Commit

Permalink
Merge pull request #617 from UncleRus/fix/hx711_reset_gpio
Browse files Browse the repository at this point in the history
fix: reset gpio before use in hx711
  • Loading branch information
UncleRus authored Mar 8, 2024
2 parents 853f704 + e817941 commit 28007c1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions components/hx711/hx711.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,18 @@ esp_err_t hx711_init(hx711_t *dev)
{
CHECK_ARG(dev);

CHECK(gpio_set_direction(dev->dout, GPIO_MODE_INPUT));
CHECK(gpio_set_direction(dev->pd_sck, GPIO_MODE_OUTPUT));
gpio_config_t conf = {
.pin_bit_mask = BIT(dev->dout),
.mode = GPIO_MODE_INPUT,
.pull_up_en = 0,
.pull_down_en = 0,
.intr_type = GPIO_INTR_DISABLE
};
CHECK(gpio_config(&conf));

conf.pin_bit_mask = BIT(dev->pd_sck);
conf.mode = GPIO_MODE_OUTPUT;
CHECK(gpio_config(&conf));

CHECK(hx711_power_down(dev, false));

Expand Down

0 comments on commit 28007c1

Please sign in to comment.