Skip to content

Commit

Permalink
Added adjustable pin mode for pcnt
Browse files Browse the repository at this point in the history
  • Loading branch information
steadramon committed Aug 17, 2024
1 parent 061e721 commit 0558524
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ESPGeiger/src/GeigerInput/Type/Pulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void GeigerPulse::begin() {
pcnt_set_filter_value(PCNT_UNIT, PCNT_FILTER);
pcnt_filter_enable(PCNT_UNIT);
#endif
gpio_set_pull_mode((gpio_num_t)_rx_pin, GPIO_PULLDOWN_ONLY);
gpio_set_pull_mode((gpio_num_t)_rx_pin, PCNT_PIN_PULL_MODE);
pcnt_counter_clear(PCNT_UNIT);
pcnt_counter_resume(PCNT_UNIT);
#else
Expand Down
7 changes: 6 additions & 1 deletion ESPGeiger/src/GeigerInput/Type/Pulse.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ extern "C" {

#define PCNT_UNIT PCNT_UNIT_0
#define PCNT_CHANNEL PCNT_CHANNEL_0
#ifdef PCNT_FLOATING_PIN
#define PCNT_PIN_PULL_MODE GPIO_FLOATING
#else
#define PCNT_PIN_PULL_MODE GPIO_PULLDOWN_ONLY
#endif
#endif

#include "../GeigerInput.h"
Expand All @@ -54,4 +59,4 @@ class GeigerPulse : public GeigerInput
int collect();
#endif
};
#endif
#endif

0 comments on commit 0558524

Please sign in to comment.