当前位置:网站首页>ESP32_ Arduino
ESP32_ Arduino
2022-04-23 15:55:00 【Sola_ Ex】
ESP32_Arduino
ESP32 GPIO Configuration of
From the official manual provided by Lexin ,ESP32 Of GPIO Basically universal GPIO, That is, except for a few special pins , Basically, each pin can be multiplexed into various functions , such as SPI/I2C wait .
-
Please note that ,GPIO6-11 Usually used for SPI Flash memory .
-
GPIO34-39 Can only be set to input mode , There is no software pull-up or pull-down function .
-
A separate “ RTC GPIO” Support , When GPIO Route to “ RTC” Low power consumption and analog subsystem , That support works . These pin functions can be used in the following cases :
- In deep sleep
- stay Ultra low power coprocessor function
- Analog functions such as ADC / DAC / Etc. in use .
The above paragraph is from the official of Lexin API course .
about ESP32 SDK Come on , contain GPIO Related are contained in gpio.c/gpio.h On , The use of correlation functions is similar to that of ordinary STM32 or NXP Our library is similar .
ESP32 GPIO_Arduino
Arduino It is a good set of hardware abstraction Library , be based on SDK On the basis of , Let all kinds of initialization functions do a unified encapsulation , Standardize interfaces . In fact, you just need to know what's relevant API Just call it .
frequently-used API Function has :
- pinMode(uint8_t pin, uint8_t mode)
- digitalWrite(uint8_t pin, uint8_t val)
- digitalRead(uint8_t pin)
- attachInterrupt(uint8_t pin, void ()(void), int mode);
- attachInterruptArg(uint8_t pin, void ()(void), void * arg, int mode);
- detachInterrupt(uint8_t pin);
pinMode It can make GPIO Initialize to the required mode , Such as input / Output, etc .
//GPIO FUNCTIONS
#define INPUT 0x01
#define OUTPUT 0x02
#define PULLUP 0x04
#define INPUT_PULLUP 0x05
#define PULLDOWN 0x08
#define INPUT_PULLDOWN 0x09
#define OPEN_DRAIN 0x10
#define OUTPUT_OPEN_DRAIN 0x12
#define SPECIAL 0xF0
#define FUNCTION_1 0x00
#define FUNCTION_2 0x20
#define FUNCTION_3 0x40
#define FUNCTION_4 0x60
#define FUNCTION_5 0x80
#define FUNCTION_6 0xA0
#define ANALOG 0xC0
about GPIO Come on , Simple input and output is not enough , It also needs to be used with interrupts , therefore Arduino The following interrupt mode options are provided .
//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
For additional reuse , Additional functions are also provided :
#define digitalPinIsValid(pin) ((pin) < 40 && esp32_gpioMux[(pin)].reg)
#define digitalPinCanOutput(pin) ((pin) < 34 && esp32_gpioMux[(pin)].reg)
#define digitalPinToRtcPin(pin) (((pin) < 40)?esp32_gpioMux[(pin)].rtc:-1)
#define digitalPinToAnalogChannel(pin) (((pin) < 40)?esp32_gpioMux[(pin)].adc:-1)
#define digitalPinToTouchChannel(pin) (((pin) < 40)?esp32_gpioMux[(pin)].touch:-1)
#define digitalPinToDacChannel(pin) (((pin) == 25)?0:((pin) == 26)?1:-1)
版权声明
本文为[Sola_ Ex]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231554163710.html
边栏推荐
猜你喜欢
[AI weekly] NVIDIA designs chips with AI; The imperfect transformer needs to overcome the theoretical defect of self attention
Single architecture system re architecture
ESP32编译环境的搭建
R语言中实现作图对象排列的函数总结
Method 2 of drawing ROC curve in R language: proc package
R语言中绘制ROC曲线方法二:pROC包
Config learning notes component
Cap theorem
布隆过滤器在亿级流量电商系统的应用
One brush 314 sword finger offer 09 Implement queue (E) with two stacks
随机推荐
VIM specifies the line comment and reconciliation comment
捡起MATLAB的第(2)天
Application case of GPS Beidou high precision satellite time synchronization system
MySQL集群模式與應用場景
The length of the last word of the string
How do you think the fund is REITs? Is it safe to buy the fund through the bank
C, calculation method and source program of bell number
Compile, connect -- Notes
js正则判断域名或者IP的端口路径是否正确
Interview questions of a blue team of Beijing Information Protection Network
糖尿病眼底病变综述概要记录
How can poor areas without networks have money to build networks?
Upgrade MySQL 5.1 to 5.611
捡起MATLAB的第(5)天
捡起MATLAB的第(6)天
Do we media make money now? After reading this article, you will understand
Deletes the least frequently occurring character in the string
【自娱自乐】构造笔记 week 2
js正則判斷域名或者IP的端口路徑是否正確
捡起MATLAB的第(4)天