Skip to content

Commit

Permalink
Support ESP32 critical sections
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Jan 21, 2018
1 parent f54f2a9 commit ac0ea9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions OneWire.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,9 @@ class OneWire
#undef DIRECT_MODE_OUTPUT
#undef DIRECT_WRITE_LOW
#undef DIRECT_WRITE_HIGH
#ifdef ARDUINO_ARCH_ESP32
#undef noInterrupts()
#undef interrupts()
#endif

#endif
4 changes: 4 additions & 0 deletions util/OneWire_direct_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ void directModeOutput(IO_REG_TYPE pin)
#define DIRECT_WRITE_HIGH(base, pin) directWriteHigh(pin)
#define DIRECT_MODE_INPUT(base, pin) directModeInput(pin)
#define DIRECT_MODE_OUTPUT(base, pin) directModeOutput(pin)
// https://github.com/PaulStoffregen/OneWire/pull/47
// https://github.com/stickbreaker/OneWire/commit/6eb7fc1c11a15b6ac8c60e5671cf36eb6829f82c
#define noInterrupts() {portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;portENTER_CRITICAL(&mux)
#define interrupts() portEXIT_CRITICAL(&mux);}
#warning "ESP32 OneWire testing"

#elif defined(__SAMD21G18A__)
Expand Down

0 comments on commit ac0ea9a

Please sign in to comment.