forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dallas] Fix Dallas 1Wire plugins on ESP32
Apparently the `pinMode` call on ESP SDK 2.0.3 and 2.0.4 now takes 16 usec to complete, compared to 4 msec before. The [OneWire library maintained by PaulStoffregen](https://github.com/PaulStoffregen/OneWire/blob/master/OneWire.cpp) does perform direct GPIO handling on the registers instead of searching for the pins. This is apparently working as reported [here by @Jason2866](espressif/arduino-esp32#7049 (comment)) So I replaced all time critical calls for the Dallas plugins with the macros from Paul's library.
- Loading branch information
Showing
5 changed files
with
589 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#ifndef DATATYPES_GPIO_DIRECT_REGTYPE_H | ||
#define DATATYPES_GPIO_DIRECT_REGTYPE_H | ||
|
||
// Original code from Paul Stoffregen | ||
// See: https://github.com/PaulStoffregen/OneWire/blob/master/util/OneWire_direct_regtype.h | ||
|
||
|
||
#include <stdint.h> | ||
|
||
// Platform specific I/O register type | ||
|
||
#if defined(__AVR__) | ||
#define IO_REG_TYPE uint8_t | ||
|
||
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK66FX1M0__) || defined(__MK64FX512__) | ||
#define IO_REG_TYPE uint8_t | ||
|
||
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(__MKL26Z64__) | ||
#define IO_REG_TYPE uint8_t | ||
|
||
#elif defined(__SAM3X8E__) || defined(__SAM3A8C__) || defined(__SAM3A4C__) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(__PIC32MX__) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(ARDUINO_ARCH_ESP8266) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(ARDUINO_ARCH_ESP32) | ||
#define IO_REG_TYPE uint32_t | ||
#define IO_REG_MASK_ATTR | ||
|
||
#elif defined(ARDUINO_ARCH_STM32) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(__SAMD21G18A__) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(__ASR6501__) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(RBL_NRF51822) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(__arc__) /* Arduino101/Genuino101 specifics */ | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#elif defined(__riscv) | ||
#define IO_REG_TYPE uint32_t | ||
|
||
#else | ||
#define IO_REG_TYPE unsigned int | ||
|
||
#endif | ||
|
||
|
||
#endif |
Oops, something went wrong.