-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does it support ESP32 board ? #24
Comments
I do not use ESP. I'm depending on the ESP community to resolve problems and submit pull requests for this open source software, to improve its support for ESP. |
@PaulStoffregen - if you can describe the process of making it work with a new controller (ESP8266 or ESP32, in particular), I will take a stab at it. Is it ONLY adding a section like this one for the particular controller, or is there more to it? #elif defined(SAM3X8E) |
That should be it. Look at OneWire's headers. Sorry, I can't answer more questions or guide you. |
Thanks. One more quickie - if you can. Can I assume that the Arduino IDE (when you select the Board you are using) takes care of defining the controller you're using? IOW, if I properly define the PIN_TO_BASEREG, etc. (above) for a particular board (Wemos D1 mini, for example), and then select the Wemos D1 mini in the Arduino IDE... that OUGHT to do it? |
Did you end up getting this working? I've got capacitive touch working just using touchRead(). But for the particular project I'm currently working on I'd like to be able to have more control over the sensitivity which is possible with CapacitiveSense. Is it just a matter of creating a section started with: Edit: |
@jonmacd - I haven't gotten to it. Not sure I will. I have gone off in a different direction for my project for the time being. I'm hoping that Paul's reply above ("That should be it. Look at OneWire's headers.") is all you need to do, though. I did look at the headers for OneWire, and did find a section for ESP8266, so if I were going to try to get this to work, I think I'd make the #elif defined section look like the ESP8266 section for the OneWire header. Good luck. |
Thanks for the reply. Yeah, sorry, I was just using the ESP8266 as an example in my comment because I figured it would be similar (it appears the CapacitiveSensor library already supports the ESP8266). I am trying to use this with an ESP32. I managed to track down the Thanks! |
Glad you got it working! I think you can make a pull request on this GitHub page to add what you did, for future reference. I think Paul will accept it and update it - he just isn't doing any active development. |
@jonmacd Could you please share your CapacitiveSensor.h file which is ok for ESP32 ? Errors below occur when importing the CapacitiveSensor Library (#include <CapacitiveSensor.h>) and compiling for ESP32. Those errors are identical to ones described in #24 (comment)
|
Same question, how to make this library work on ESP32 ? (I use esp-c3-32s) Guide described here #24 (comment) don't work. |
First, you must find someone from the ESP community with knowledge of using the ESP's hardware registers. The abstraction layer this library uses is nearly the same as OneWire. So perhaps an expert in ESP hardware registers could copy the OneWire defines and get this library to work? If so, please send a pull request when it is confirmed working. I do not personally use ESP, so I'm depending on the ESP community to submit pull requests. This generic guidance to copy the nearly-identical defines from OneWire is as much as I can do to help. |
The suggestion from @jonmacd worked for me. The modified lines are from 89 to 188. I'll try to get to do a pull request for it. This should be your CapacitiveSensor.h file's code: `/* // ensure this library description is only included once #if ARDUINO >= 100 // Direct I/O through registers and bitmask (from OneWire library) #if defined(AVR) #elif defined(MK20DX128) || defined(MK20DX256) || defined(MK66FX1M0) || defined(MK64FX512) #elif defined(MKL26Z64) #elif defined(SAM3X8E) #elif defined(PIC32MX) #elif defined(ARDUINO_ARCH_ESP8266) #elif defined(ARDUINO_ARCH_ESP32) static inline attribute((always_inline))
} static inline attribute((always_inline)) static inline attribute((always_inline)) static inline attribute((always_inline))
#endif static inline attribute((always_inline))
#endif #define DIRECT_READ(base, pin) directRead(pin) #elif defined(SAMD21G18A) #elif defined(RBL_NRF51822) #elif defined(arc) #include "scss_registers.h" #define GPIO_ID(pin) (g_APinDescription[pin].ulGPIOId) /* GPIO registers base address */ static inline attribute((always_inline)) static inline attribute((always_inline)) static inline attribute((always_inline)) static inline attribute((always_inline)) static inline attribute((always_inline)) #define DIRECT_READ(base, pin) directRead(base, pin) #endif // some 3.3V chips with 5V tolerant pins need this workaround // library interface description #endif |
Actually the code is already updated to work properly with esp32 boards in the master branch of this repo but in the released version you can get from within the Arduino IDE there is still no support for esp32 |
@arjuna-dev Are you sure about that? When I try using the latest master to compile for ESP32 boards, I get |
Update: It will compile for ESP32... on pre-v2 versions of the ESP board manager. It doesn't work on recent versions. I think we need to do something like this, but I'm not sure I understand it intimately enough to do it myself. |
no updates to this I don't suppose (re fixing the 'rtc_gpio_desc' was not declared in this scope) issue |
I owned this board
https://www.banggood.com/ESP32-Development-Board-WiFiBluetooth-Ultra-Low-Power-Consumption-Dual-Cores-ESP-32-ESP-32S-Board-p-1109512.html
I tried to copy from demo code for testing but firmware ha built error.
In file included from src\main.cpp:3:0:
lib\CapacitiveSensor/CapacitiveSensor.h:239:2: error: 'IO_REG_TYPE' does not name a type
IO_REG_TYPE sBit; // send pin's ports and bitmask
^
lib\CapacitiveSensor/CapacitiveSensor.h:240:11: error: 'IO_REG_TYPE' does not name a type
volatile IO_REG_TYPE *sReg;
^
lib\CapacitiveSensor/CapacitiveSensor.h:241:2: error: 'IO_REG_TYPE' does not name a type
IO_REG_TYPE rBit; // receive pin's ports and bitmask
^
lib\CapacitiveSensor/CapacitiveSensor.h:242:11: error: 'IO_REG_TYPE' does not name a type
volatile IO_REG_TYPE *rReg;
The text was updated successfully, but these errors were encountered: