2021-03-11 10:11:53 +00:00
|
|
|
/*
|
|
|
|
Arduino.h - Main include file for the Arduino SDK
|
|
|
|
Copyright (c) 2005-2013 Arduino Team. All right reserved.
|
2016-10-06 11:21:30 +00:00
|
|
|
|
2021-03-11 10:11:53 +00:00
|
|
|
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
|
|
|
|
*/
|
2016-10-06 11:21:30 +00:00
|
|
|
|
|
|
|
#ifndef MAIN_ESP32_HAL_GPIO_H_
|
|
|
|
#define MAIN_ESP32_HAL_GPIO_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "esp32-hal.h"
|
2021-04-05 11:23:58 +00:00
|
|
|
#include "soc/soc_caps.h"
|
2022-06-24 11:04:03 +00:00
|
|
|
#include "pins_arduino.h"
|
2021-04-05 11:23:58 +00:00
|
|
|
|
|
|
|
#if (CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)
|
2021-04-15 11:31:41 +00:00
|
|
|
#define NUM_OUPUT_PINS 46
|
2021-04-05 11:23:58 +00:00
|
|
|
#define PIN_DAC1 17
|
|
|
|
#define PIN_DAC2 18
|
|
|
|
#else
|
|
|
|
#define NUM_OUPUT_PINS 34
|
|
|
|
#define PIN_DAC1 25
|
|
|
|
#define PIN_DAC2 26
|
|
|
|
#endif
|
2016-10-06 11:21:30 +00:00
|
|
|
|
|
|
|
#define LOW 0x0
|
|
|
|
#define HIGH 0x1
|
|
|
|
|
|
|
|
//GPIO FUNCTIONS
|
|
|
|
#define INPUT 0x01
|
2022-04-21 14:49:54 +00:00
|
|
|
// Changed OUTPUT from 0x02 to behave the same as Arduino pinMode(pin,OUTPUT)
|
|
|
|
// where you can read the state of pin even when it is set as OUTPUT
|
|
|
|
#define OUTPUT 0x03
|
2016-10-06 11:21:30 +00:00
|
|
|
#define PULLUP 0x04
|
|
|
|
#define INPUT_PULLUP 0x05
|
|
|
|
#define PULLDOWN 0x08
|
|
|
|
#define INPUT_PULLDOWN 0x09
|
|
|
|
#define OPEN_DRAIN 0x10
|
|
|
|
#define OUTPUT_OPEN_DRAIN 0x12
|
2016-12-08 21:43:41 +00:00
|
|
|
#define ANALOG 0xC0
|
2016-10-06 11:21:30 +00:00
|
|
|
|
|
|
|
//Interrupt Modes
|
|
|
|
#define DISABLED 0x00
|
|
|
|
#define RISING 0x01
|
|
|
|
#define FALLING 0x02
|
|
|
|
#define CHANGE 0x03
|
|
|
|
#define ONLOW 0x04
|
|
|
|
#define ONHIGH 0x05
|
|
|
|
#define ONLOW_WE 0x0C
|
|
|
|
#define ONHIGH_WE 0x0D
|
|
|
|
|
2022-06-24 11:04:03 +00:00
|
|
|
|
2022-02-16 12:43:38 +00:00
|
|
|
#define digitalPinIsValid(pin) GPIO_IS_VALID_GPIO(pin)
|
|
|
|
#define digitalPinCanOutput(pin) GPIO_IS_VALID_OUTPUT_GPIO(pin)
|
|
|
|
|
|
|
|
#define digitalPinToRtcPin(pin) ((RTC_GPIO_IS_VALID_GPIO(pin))?rtc_io_number_get(pin):-1)
|
|
|
|
#define digitalPinToDacChannel(pin) (((pin) == DAC_CHANNEL_1_GPIO_NUM)?0:((pin) == DAC_CHANNEL_2_GPIO_NUM)?1:-1)
|
2016-12-08 21:43:41 +00:00
|
|
|
|
2016-10-06 11:21:30 +00:00
|
|
|
void pinMode(uint8_t pin, uint8_t mode);
|
|
|
|
void digitalWrite(uint8_t pin, uint8_t val);
|
|
|
|
int digitalRead(uint8_t pin);
|
|
|
|
|
|
|
|
void attachInterrupt(uint8_t pin, void (*)(void), int mode);
|
2018-09-17 21:10:13 +00:00
|
|
|
void attachInterruptArg(uint8_t pin, void (*)(void*), void * arg, int mode);
|
2016-10-06 11:21:30 +00:00
|
|
|
void detachInterrupt(uint8_t pin);
|
|
|
|
|
2022-02-05 09:54:01 +00:00
|
|
|
int8_t digitalPinToTouchChannel(uint8_t pin);
|
2022-02-16 12:43:38 +00:00
|
|
|
int8_t digitalPinToAnalogChannel(uint8_t pin);
|
|
|
|
int8_t analogChannelToDigitalPin(uint8_t channel);
|
2022-02-05 09:54:01 +00:00
|
|
|
|
2016-10-06 11:21:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* MAIN_ESP32_HAL_GPIO_H_ */
|