Skip to content

Commit

Permalink
hx711: Fix incorrect spinlock usage
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleRus committed Dec 10, 2020
1 parent d5c79ac commit a2b9fc5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/hx711/hx711.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)

#if HELPER_TARGET_IS_ESP32
static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
#endif

static uint32_t read_raw(gpio_num_t dout, gpio_num_t pd_sck, hx711_gain_t gain)
{
#if HELPER_TARGET_IS_ESP32
portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL(&mux);
#elif HELPER_TARGET_IS_ESP8266
portENTER_CRITICAL();
Expand Down

0 comments on commit a2b9fc5

Please sign in to comment.