PaulStoffregen / CapacitiveSensor

Detect touch or proximity by capacitve sensing
http://www.pjrc.com/teensy/td_libs_CapacitiveSensor.html
391 stars 146 forks source link

does it support ESP32 board ? #24

Open adrianmak opened 6 years ago

adrianmak commented 6 years ago

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.

#include "CapacitiveSensor.h"

CapacitiveSensor cs_4_2 = CapacitiveSensor(4, 2);

void setup() {
    cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);
    Serial.begin(9600);

}

void loop() {

    long start = millis();
    long total1 = cs_4_2.capacitiveSensor(30);

    Serial.print(millis() - start);
    Serial.print("\t");
    Serial.print(total1);
    Serial.print("\t");
    delay(10);
}

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;

PaulStoffregen commented 6 years ago

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.

ba58smith commented 6 years ago

@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)

define PIN_TO_BASEREG(pin) (&(digitalPinToPort(pin)->PIO_PER))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, mask) (((*((base)+15)) & (mask)) ? 1 : 0)

define DIRECT_MODE_INPUT(base, mask) ((*((base)+5)) = (mask))

define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+4)) = (mask))

define DIRECT_WRITE_LOW(base, mask) ((*((base)+13)) = (mask))

define DIRECT_WRITE_HIGH(base, mask) ((*((base)+12)) = (mask))

PaulStoffregen commented 6 years ago

That should be it. Look at OneWire's headers. Sorry, I can't answer more questions or guide you.

ba58smith commented 6 years ago

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?

jonmacd commented 5 years ago

@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)

define PIN_TO_BASEREG(pin) (&(digitalPinToPort(pin)->PIO_PER))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECTREAD(base, mask) (((((base)+15)) & (mask)) ? 1 : 0) #define DIRECT_MODEINPUT(base, mask) ((((base)+5)) = (mask))

define DIRECT_MODEOUTPUT(base, mask) ((((base)+4)) = (mask)) #define DIRECT_WRITELOW(base, mask) ((((base)+13)) = (mask))

define DIRECT_WRITE_HIGH(base, mask) ((*((base)+12)) = (mask))

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: #elif defined(ESP32) and then just paste in say the contents from the ESP8266 section that's in the header?

Edit: That seems to resolve the errors when compiling. But I'm assuming those GPIO addresses all still need to be corrected for the ESP32.

ba58smith commented 5 years ago

@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.

jonmacd commented 5 years ago

@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 #elif defined(ARDUINO_ARCH_ESP32) section in the OneWire header file Paul mentioned. I just pasted that entire section into the CapacitiveSensor.h file with all the other #elif defined sections. Everything compiles no problem. Using a 10Mohm resistor, at first I couldn't get any readings using a few combinations of touch pins 0-3 on my ESP32 (not sure what's going on there). Moved my resistor to the other side of the board using pins 27 and 12 and I've got nice looking data streaming in.

Thanks!

ba58smith commented 5 years ago

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.

06GitHub commented 4 years ago

[jonmacd] I managed to track down the #elif defined(ARDUINO_ARCH_ESP32) section in the OneWire header file Paul mentioned. I just pasted that entire section into the CapacitiveSensor.h file with all the other #elif defined sections. Everything compiles no problem. Using a 10Mohm resistor, at first I couldn't get any readings using a few combinations of touch pins 0-3 on my ESP32 (not sure what's going on there). Moved my resistor to the other side of the board using pins 27 and 12 and I've got nice looking data streaming in.

Thanks!

@jonmacd Could you please share your CapacitiveSensor.h file which is ok for ESP32 ? Errors below occur when importing the CapacitiveSensor Library (#include ) and compiling for ESP32. Those errors are identical to ones described in https://github.com/PaulStoffregen/CapacitiveSensor/issues/24#issue-287302477 Thanks !

[Nov 11, 2020]C:\Users\Admin\Documents\Arduino\libraries\CapacitiveSensor/CapacitiveSensor.h:222:2: error: 'IO_REG_TYPE' does not name a type IO_REG_TYPE sBit; // send pin's ports and bitmask ^ C:\Users\Admin\Documents\Arduino\libraries\CapacitiveSensor/CapacitiveSensor.h:223:11: error: 'IO_REG_TYPE' does not name a type volatile IO_REG_TYPE sReg; ^ C:\Users\Admin\Documents\Arduino\libraries\CapacitiveSensor/CapacitiveSensor.h:224:2: error: 'IO_REG_TYPE' does not name a type IO_REG_TYPE rBit; // receive pin's ports and bitmask ^ C:\Users\Admin\Documents\Arduino\libraries\CapacitiveSensor/CapacitiveSensor.h:225:11: error: 'IO_REG_TYPE' does not name a type volatile IO_REG_TYPE rReg; ^ Using the CapacitiveSensor version 0.5.1 library

MIKHANYA commented 2 years ago

Same question, how to make this library work on ESP32 ? (I use esp-c3-32s) Guide described here https://github.com/PaulStoffregen/CapacitiveSensor/issues/24#issuecomment-444718037 don't work.

PaulStoffregen commented 2 years ago

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.

arjuna-dev commented 2 years ago

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:

`/ CapacitiveSense.h v.04 - Capacitive Sensing Library for 'duino / Wiring https://github.com/PaulStoffregen/CapacitiveSensor http://www.pjrc.com/teensy/td_libs_CapacitiveSensor.html http://playground.arduino.cc/Main/CapacitiveSensor Copyright (c) 2008 Paul Bagder All rights reserved. Version 05 by Paul Stoffregen - Support non-AVR board: Teensy 3.x, Arduino Due Version 04 by Paul Stoffregen - Arduino 1.0 compatibility, issue 146 fix vim: set ts=4: /

// ensure this library description is only included once

ifndef CapacitiveSensor_h

define CapacitiveSensor_h

if ARDUINO >= 100

include "Arduino.h"

else

include "WProgram.h"

endif

// Direct I/O through registers and bitmask (from OneWire library)

if defined(AVR)

define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint8_t

define DIRECT_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0)

define DIRECT_MODE_INPUT(base, mask) ((((base)+1)) &= ~(mask), (((base)+2)) &= ~(mask))

define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+1)) |= (mask))

define DIRECT_WRITE_LOW(base, mask) ((*((base)+2)) &= ~(mask))

define DIRECT_WRITE_HIGH(base, mask) ((*((base)+2)) |= (mask))

elif defined(MK20DX128) || defined(MK20DX256) || defined(MK66FX1M0) || defined(MK64FX512)

define PIN_TO_BASEREG(pin) (portOutputRegister(pin))

define PIN_TO_BITMASK(pin) (1)

define IO_REG_TYPE uint8_t

define IO_REG_ASM

define DIRECT_READ(base, mask) (*((base)+512))

define DIRECT_MODE_INPUT(base, mask) (*((base)+640) = 0)

define DIRECT_MODE_OUTPUT(base, mask) (*((base)+640) = 1)

define DIRECT_WRITE_LOW(base, mask) (*((base)+256) = 1)

define DIRECT_WRITE_HIGH(base, mask) (*((base)+128) = 1)

elif defined(MKL26Z64)

define PIN_TO_BASEREG(pin) (portOutputRegister(pin))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint8_t

define IO_REG_ASM

define DIRECT_READ(base, mask) ((*((base)+16) & (mask)) ? 1 : 0)

define DIRECT_MODE_INPUT(base, mask) (*((base)+20) &= ~(mask))

define DIRECT_MODE_OUTPUT(base, mask) (*((base)+20) |= (mask))

define DIRECT_WRITE_LOW(base, mask) (*((base)+8) = (mask))

define DIRECT_WRITE_HIGH(base, mask) (*((base)+4) = (mask))

elif defined(SAM3X8E)

define PIN_TO_BASEREG(pin) (&(digitalPinToPort(pin)->PIO_PER))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, mask) (((*((base)+15)) & (mask)) ? 1 : 0)

define DIRECT_MODE_INPUT(base, mask) ((*((base)+5)) = (mask))

define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+4)) = (mask))

define DIRECT_WRITE_LOW(base, mask) ((*((base)+13)) = (mask))

define DIRECT_WRITE_HIGH(base, mask) ((*((base)+12)) = (mask))

elif defined(PIC32MX)

define PIN_TO_BASEREG(pin) (portModeRegister(digitalPinToPort(pin)))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, mask) (((*(base+4)) & (mask)) ? 1 : 0) //PORTX + 0x10

define DIRECT_MODE_INPUT(base, mask) ((*(base+2)) = (mask)) //TRISXSET + 0x08

define DIRECT_MODE_OUTPUT(base, mask) ((*(base+1)) = (mask)) //TRISXCLR + 0x04

define DIRECT_WRITE_LOW(base, mask) ((*(base+8+1)) = (mask)) //LATXCLR + 0x24

define DIRECT_WRITE_HIGH(base, mask) ((*(base+8+2)) = (mask)) //LATXSET + 0x28

elif defined(ARDUINO_ARCH_ESP8266)

define PIN_TO_BASEREG(pin) (portOutputRegister(digitalPinToPort(pin)))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, mask) (((*(base+6)) & (mask)) ? 1 : 0) //GPIO_IN_ADDRESS

define DIRECT_MODE_INPUT(base, mask) ((*(base+5)) = (mask)) //GPIO_ENABLE_W1TC_ADDRESS

define DIRECT_MODE_OUTPUT(base, mask) ((*(base+4)) = (mask)) //GPIO_ENABLE_W1TS_ADDRESS

define DIRECT_WRITE_LOW(base, mask) ((*(base+2)) = (mask)) //GPIO_OUT_W1TC_ADDRESS

define DIRECT_WRITE_HIGH(base, mask) ((*(base+1)) = (mask)) //GPIO_OUT_W1TS_ADDRESS

elif defined(ARDUINO_ARCH_ESP32)

include <driver/rtc_io.h>

define PIN_TO_BASEREG(pin) (0)

define PIN_TO_BITMASK(pin) (pin)

define IO_REG_TYPE uint32_t

define IO_REG_BASE_ATTR

define IO_REG_MASK_ATTR

static inline attribute((always_inline)) IO_REG_TYPE directRead(IO_REG_TYPE pin) {

if CONFIG_IDF_TARGET_ESP32C3

return (GPIO.in.val >> pin) & 0x1;

else // plain ESP32

if ( pin < 32 )
    return (GPIO.in >> pin) & 0x1;
else if ( pin < 46 )
    return (GPIO.in1.val >> (pin - 32)) & 0x1;

endif

return 0;

}

static inline attribute((always_inline)) void directWriteLow(IO_REG_TYPE pin) {

if CONFIG_IDF_TARGET_ESP32C3

GPIO.out_w1tc.val = ((uint32_t)1 << pin);

else // plain ESP32

if ( pin < 32 )
    GPIO.out_w1tc = ((uint32_t)1 << pin);
else if ( pin < 46 )
    GPIO.out1_w1tc.val = ((uint32_t)1 << (pin - 32));

endif

}

static inline attribute((always_inline)) void directWriteHigh(IO_REG_TYPE pin) {

if CONFIG_IDF_TARGET_ESP32C3

GPIO.out_w1ts.val = ((uint32_t)1 << pin);

else // plain ESP32

if ( pin < 32 )
    GPIO.out_w1ts = ((uint32_t)1 << pin);
else if ( pin < 46 )
    GPIO.out1_w1ts.val = ((uint32_t)1 << (pin - 32));

endif

}

static inline attribute((always_inline)) void directModeInput(IO_REG_TYPE pin) {

if CONFIG_IDF_TARGET_ESP32C3

GPIO.enable_w1tc.val = ((uint32_t)1 << (pin));

else

if ( digitalPinIsValid(pin) )
{

if ESP_IDF_VERSION_MAJOR < 4 // IDF 3.x ESP32/PICO-D4

    uint32_t rtc_reg(rtc_gpio_desc[pin].reg);

    if ( rtc_reg ) // RTC pins PULL settings
    {
        ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_gpio_desc[pin].mux);
        ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_gpio_desc[pin].pullup | rtc_gpio_desc[pin].pulldown);
    }

endif

// Input
    if ( pin < 32 )
        GPIO.enable_w1tc = ((uint32_t)1 << pin);
    else
        GPIO.enable1_w1tc.val = ((uint32_t)1 << (pin - 32));
}

endif

}

static inline attribute((always_inline)) void directModeOutput(IO_REG_TYPE pin) {

if CONFIG_IDF_TARGET_ESP32C3

GPIO.enable_w1ts.val = ((uint32_t)1 << (pin));

else

if ( digitalPinIsValid(pin) && pin <= 33 ) // pins above 33 can be only inputs
{

if ESP_IDF_VERSION_MAJOR < 4 // IDF 3.x ESP32/PICO-D4

    uint32_t rtc_reg(rtc_gpio_desc[pin].reg);

    if ( rtc_reg ) // RTC pins PULL settings
    {
        ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_gpio_desc[pin].mux);
        ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_gpio_desc[pin].pullup | rtc_gpio_desc[pin].pulldown);
    }

endif

    // Output
    if ( pin < 32 )
        GPIO.enable_w1ts = ((uint32_t)1 << pin);
    else // already validated to pins <= 33
        GPIO.enable1_w1ts.val = ((uint32_t)1 << (pin - 32));
}

endif

}

define DIRECT_READ(base, pin) directRead(pin)

define DIRECT_WRITE_LOW(base, pin) directWriteLow(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)

elif defined(SAMD21G18A)

// runs extremely slow/unreliable on Arduino Zero - help wanted....

define PIN_TO_BASEREG(pin) portModeRegister(digitalPinToPort(pin))

define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, mask) (((*((base)+8)) & (mask)) ? 1 : 0)

define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) = (mask))

define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+2)) = (mask))

define DIRECT_WRITE_LOW(base, mask) ((*((base)+5)) = (mask))

define DIRECT_WRITE_HIGH(base, mask) ((*((base)+6)) = (mask))

elif defined(RBL_NRF51822)

define PIN_TO_BASEREG(pin) (0)

define PIN_TO_BITMASK(pin) (pin)

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, pin) nrf_gpio_pin_read(pin)

define DIRECT_WRITE_LOW(base, pin) nrf_gpio_pin_clear(pin)

define DIRECT_WRITE_HIGH(base, pin) nrf_gpio_pin_set(pin)

define DIRECT_MODE_INPUT(base, pin) nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL)

define DIRECT_MODE_OUTPUT(base, pin) nrf_gpio_cfg_output(pin)

elif defined(arc)

include "scss_registers.h"

include "portable.h"

include "avr/pgmspace.h"

define GPIO_ID(pin) (g_APinDescription[pin].ulGPIOId)

define GPIO_TYPE(pin) (g_APinDescription[pin].ulGPIOType)

define GPIO_BASE(pin) (g_APinDescription[pin].ulGPIOBase)

define DIR_OFFSET_SS 0x01

define DIR_OFFSET_SOC 0x04

define EXT_PORT_OFFSET_SS 0x0A

define EXT_PORT_OFFSET_SOC 0x50

/ GPIO registers base address /

define PIN_TO_BASEREG(pin) ((volatile uint32_t *)g_APinDescription[pin].ulGPIOBase)

define PIN_TO_BITMASK(pin) pin

define IO_REG_TYPE uint32_t

define IO_REG_ASM

static inline attribute((always_inline)) IO_REG_TYPE directRead(volatile IO_REG_TYPE *base, IO_REG_TYPE pin) { IO_REG_TYPE ret; if (SS_GPIO == GPIO_TYPE(pin)) { ret = READ_ARC_REG(((IO_REG_TYPE)base + EXT_PORT_OFFSET_SS)); } else { ret = MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, EXT_PORT_OFFSET_SOC); } return ((ret >> GPIO_ID(pin)) & 0x01); }

static inline attribute((always_inline)) void directModeInput(volatile IO_REG_TYPE *base, IO_REG_TYPE pin) { if (SS_GPIO == GPIO_TYPE(pin)) { WRITE_ARC_REG(READ_ARC_REG((((IO_REG_TYPE)base) + DIR_OFFSET_SS)) & ~(0x01 << GPIO_ID(pin)), ((IO_REG_TYPE)(base) + DIR_OFFSET_SS)); } else { MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, DIR_OFFSET_SOC) &= ~(0x01 << GPIO_ID(pin)); } }

static inline attribute((always_inline)) void directModeOutput(volatile IO_REG_TYPE *base, IO_REG_TYPE pin) { if (SS_GPIO == GPIO_TYPE(pin)) { WRITE_ARC_REG(READ_ARC_REG(((IO_REG_TYPE)(base) + DIR_OFFSET_SS)) | (0x01 << GPIO_ID(pin)), ((IO_REG_TYPE)(base) + DIR_OFFSET_SS)); } else { MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, DIR_OFFSET_SOC) |= (0x01 << GPIO_ID(pin)); } }

static inline attribute((always_inline)) void directWriteLow(volatile IO_REG_TYPE *base, IO_REG_TYPE pin) { if (SS_GPIO == GPIO_TYPE(pin)) { WRITE_ARC_REG(READ_ARC_REG(base) & ~(0x01 << GPIO_ID(pin)), base); } else { MMIO_REG_VAL(base) &= ~(0x01 << GPIO_ID(pin)); } }

static inline attribute((always_inline)) void directWriteHigh(volatile IO_REG_TYPE *base, IO_REG_TYPE pin) { if (SS_GPIO == GPIO_TYPE(pin)) { WRITE_ARC_REG(READ_ARC_REG(base) | (0x01 << GPIO_ID(pin)), base); } else { MMIO_REG_VAL(base) |= (0x01 << GPIO_ID(pin)); } }

define DIRECT_READ(base, pin) directRead(base, pin)

define DIRECT_MODE_INPUT(base, pin) directModeInput(base, pin)

define DIRECT_MODE_OUTPUT(base, pin) directModeOutput(base, pin)

define DIRECT_WRITE_LOW(base, pin) directWriteLow(base, pin)

define DIRECT_WRITE_HIGH(base, pin) directWriteHigh(base, pin)

endif

// some 3.3V chips with 5V tolerant pins need this workaround //

if defined(MK20DX256)

define FIVE_VOLT_TOLERANCE_WORKAROUND

endif

// library interface description class CapacitiveSensor { // user-accessible "public" interface public: // methods CapacitiveSensor(uint8_t sendPin, uint8_t receivePin); long capacitiveSensorRaw(uint8_t samples); long capacitiveSensor(uint8_t samples); void set_CS_Timeout_Millis(unsigned long timeout_millis); void reset_CS_AutoCal(); void set_CS_AutocaL_Millis(unsigned long autoCal_millis); // library-accessible "private" interface private: // variables int error; unsigned long leastTotal; unsigned int loopTimingFactor; unsigned long CS_Timeout_Millis; unsigned long CS_AutocaL_Millis; unsigned long lastCal; unsigned long total; IO_REG_TYPE sBit; // send pin's ports and bitmask volatile IO_REG_TYPE sReg; IO_REG_TYPE rBit; // receive pin's ports and bitmask volatile IO_REG_TYPE rReg; // methods int SenseOneCycle(void); };

endif

`

arjuna-dev commented 2 years ago

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

tradeJmark commented 1 year ago

@arjuna-dev Are you sure about that? When I try using the latest master to compile for ESP32 boards, I get 'rtc_gpio_desc' was not declared in this scope and 'esp32_gpioMux' was not declared in this scope and it fails to build.

tradeJmark commented 1 year ago

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.

callagga commented 1 year ago

no updates to this I don't suppose (re fixing the 'rtc_gpio_desc' was not declared in this scope) issue