* feat(esp32p4): Initial changes required for ESP32-P4 * esp32-p4: Initial changes to build with Arduino Signed-off-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> * fix(esp32p4): Fix lib builder errors * change(esp32p4): Unhide board * ci(esp32p4): Add ESP32-P4 to workflow * change(esptool): Update esptool to 4.8.0 * fix(build): Fix redefinition errors * fix(build): Remove old commands * change(esptool): Remove unsupported 32-bit tools * fix(get.py): Force exe generation * Revert "fix(get.py): Force exe generation" This reverts commit 979b16b3b19d02917ddccf0139c6913cca618714. * fix(get.py): Fix system check * change(tools): Push generated binaries to PR * ci(esp32p4): Add missing ESP32-P4 entries * fix(esp32p4): Add chip info * fix(esp32p4): Fix build commands * docs(esp32p4): Add missing references to P4 * fix(esp32p4): Fix clock sources definitions * fix(esp32p4): Set CPU frequency to 360 MHz so it is stable in all chips * refactor(esp32p4): Change preprocessor conditionals for maintainability Co-authored-by: me-no-dev <hristo@espressif.com> * fix(esp32p4): Add missing menu options * fix(esp32p4): Mark as not in development json in readme * fix(esp32p4): Add P4 to ci.json files * ci(pre-commit): Apply automatic fixes * fix(get.py): Remove unused include * ci(pre-commit): Apply automatic fixes * change(tools): Push generated binaries to PR * ci(pre-commit): Apply automatic fixes * fix(ci.json): Fix formatting --------- Signed-off-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: me-no-dev <hristo@espressif.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
103 lines
3.4 KiB
C
103 lines
3.4 KiB
C
/*
|
|
Arduino.h - Main include file for the Arduino SDK
|
|
Copyright (c) 2005-2013 Arduino Team. All right reserved.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef MAIN_ESP32_HAL_TOUCH_H_
|
|
#define MAIN_ESP32_HAL_TOUCH_H_
|
|
|
|
#include "soc/soc_caps.h"
|
|
#if SOC_TOUCH_SENSOR_SUPPORTED
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "esp32-hal.h"
|
|
|
|
#if !SOC_TOUCH_SENSOR_SUPPORTED
|
|
#error Touch IDF driver Not supported!
|
|
#endif
|
|
|
|
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
|
|
typedef uint16_t touch_value_t;
|
|
#elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2 ESP32S3
|
|
typedef uint32_t touch_value_t;
|
|
#elif SOC_TOUCH_SENSOR_VERSION == 3 // ESP32P4
|
|
typedef uint32_t touch_value_t;
|
|
#endif
|
|
|
|
/*
|
|
* Set cycles that measurement operation takes
|
|
* The result from touchRead, threshold and detection
|
|
* accuracy depend on these values. Defaults are
|
|
* 0x1000 for measure and 0x1000 for sleep.
|
|
* With default values touchRead takes 0.5ms
|
|
* */
|
|
void touchSetCycles(uint16_t measure, uint16_t sleep);
|
|
|
|
/*
|
|
* Read touch pad (for ESP32 values close to 0 mean touch detected /
|
|
* for ESP32-S2/S3 higher values mean touch detected)
|
|
* You can use this method to chose a good threshold value
|
|
* to use as value for touchAttachInterrupt
|
|
* */
|
|
touch_value_t touchRead(uint8_t pin);
|
|
|
|
/*
|
|
* Set function to be called if touch pad value falls (ESP32)
|
|
* below the given threshold / rises (ESP32-S2/S3) by given increment (threshold).
|
|
* Use touchRead to determine a proper threshold between touched and untouched state
|
|
* */
|
|
void touchAttachInterrupt(uint8_t pin, void (*userFunc)(void), touch_value_t threshold);
|
|
void touchAttachInterruptArg(uint8_t pin, void (*userFunc)(void *), void *arg, touch_value_t threshold);
|
|
void touchDetachInterrupt(uint8_t pin);
|
|
|
|
/*
|
|
* Specific functions to ESP32
|
|
* Tells the driver if it shall activate the ISR if the sensor is Lower or Higher than the Threshold
|
|
* Default if Lower.
|
|
**/
|
|
|
|
#if SOC_TOUCH_SENSOR_VERSION == 1 // Only for ESP32 SoC
|
|
void touchInterruptSetThresholdDirection(bool mustbeLower);
|
|
#endif
|
|
|
|
/*
|
|
* Specific functions to ESP32-S2 and ESP32-S3
|
|
* Returns true when the latest ISR status for the Touchpad is that it is touched (Active)
|
|
* and false when the Touchpad is untoouched (Inactive)
|
|
* This function can be used in conjunction with ISR User callback in order to take action
|
|
* as soon as the touchpad is touched and/or released
|
|
**/
|
|
|
|
#if SOC_TOUCH_SENSOR_VERSION == 2 // Only for ESP32S2 and ESP32S3
|
|
// returns true if touch pad has been and continues pressed and false otherwise
|
|
bool touchInterruptGetLastStatus(uint8_t pin);
|
|
#endif
|
|
|
|
/*
|
|
* Setup touch pad wake up from deep sleep with given threshold.
|
|
**/
|
|
void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SOC_TOUCH_SENSOR_SUPPORTED */
|
|
#endif /* MAIN_ESP32_HAL_TOUCH_H_ */
|