实例介绍
【实例截图】
Programming for ESP32WiFi蓝牙编程_2018P1063.pdf
【核心代码】
Table of Contents Introduction................................................................................................................................48 Important Documentation Notes – ESP8266 and ESP32...........................................................49 Overview....................................................................................................................................49 The ESP32............................................................................................................................50 The ESP32 specification.......................................................................................................51 Modules.................................................................................................................................52 ESP-WROOM-32..............................................................................................................52 ESP32-DevKitC................................................................................................................53 ESP-WROVER-KIT..........................................................................................................55 The SparkFun ESP32 thing..............................................................................................60 Connecting to the ESP32...........................................................................................................61 Assembling circuits....................................................................................................................62 USB to UART converters.......................................................................................................63 Breadboards..........................................................................................................................64 Power....................................................................................................................................65 Multi-meter / Logic probe / Logic Analyzer.............................................................................66 Sundry components..............................................................................................................66 Physical construction.............................................................................................................66 Configuration for flashing the device.....................................................................................67 Programming for ESP32............................................................................................................68 Espressif IoT Development framework..................................................................................68 Application entry point......................................................................................................71 How ESP-IDF works.........................................................................................................72 Error handling...................................................................................................................75 The build environment menu configuration.......................................................................75 Adding a custom ESP-IDF component.............................................................................82 Working with memory.......................................................................................................85 Compiling..............................................................................................................................86 Compilation.......................................................................................................................87 Flashing............................................................................................................................89 Loading a program............................................................................................................91 Programming environments..............................................................................................93 Compilation tools..............................................................................................................93 xntensa-esp32-elf-ar....................................................................................................94 esptool.py.....................................................................................................................95 xtensa-esp32-elf-gcc....................................................................................................97 gen_appbin.py..............................................................................................................98 make............................................................................................................................99 xtensa-esp32-elf-strip...................................................................................................99 xtensa-esp32-elf-nm...................................................................................................100 Page 2 xtensa-esp32-elf-objcopy...........................................................................................100 xtensa-esp32-elf-objdump..........................................................................................100 xxd.............................................................................................................................100 Linking.................................................................................................................................101 Sizes of images..............................................................................................................104 Debugging...........................................................................................................................105 ESP-IDF logging.............................................................................................................105 Exception handling.........................................................................................................108 Address to source line....................................................................................................109 Core dump processing....................................................................................................110 Using a debugger (GDB).................................................................................................115 OpenOCD and JTAG......................................................................................................116 Using the ESP-WROVER-KIT for JTAG.....................................................................118 Dumping IP Addresses....................................................................................................119 Debugging and testing TCP and UDP connections.........................................................119 Android – Socket Protocol..........................................................................................119 Android – UDP Sender/Receiver................................................................................119 Windows – Hercules...................................................................................................120 SocketTest..................................................................................................................120 Linux – netcat (nc)......................................................................................................120 Curl............................................................................................................................120 Eclipse – TCP/MON...................................................................................................121 httpbin.org..................................................................................................................123 RequestBin.................................................................................................................123 tcpdump.....................................................................................................................124 ESP-IDF component debugging.....................................................................................124 LWIP..........................................................................................................................124 Run a Blinky....................................................................................................................124 WiFi subsystem........................................................................................................................125 WiFi Theory.........................................................................................................................125 Initializing the WiFi environment..........................................................................................127 Setting the operation mode.................................................................................................127 Scanning for access points..................................................................................................128 Handling WiFi events..........................................................................................................130 Station configuration............................................................................................................137 Starting up the WiFi environment........................................................................................138 Connecting to an access point............................................................................................138 Being an access point.........................................................................................................141 Working with connected stations.........................................................................................145 WiFi at boot time.................................................................................................................145 The DHCP client..................................................................................................................146 The DHCP server................................................................................................................146 Page 3 Current IP Address, netmask and gateway..........................................................................147 WiFi Protected Setup – WPS..............................................................................................147 Designs for bootstrapping WiFi...........................................................................................148 Working with TCP/IP................................................................................................................149 The Lightweight IP Stack – lwip...........................................................................................150 TCP.....................................................................................................................................151 TCP/IP Sockets...................................................................................................................152 Handling errors...............................................................................................................155 Configuration settings.....................................................................................................159 Using select()..................................................................................................................160 Differences from "standard" sockets...............................................................................160 UDP/IP Sockets...................................................................................................................160 TLS, SSL and security.........................................................................................................162 mbedTLS client app structure.........................................................................................164 mbedTLS client example................................................................................................166 mbedTLS server app structure.......................................................................................168 mbedTLS Debugging......................................................................................................170 OpenSSL........................................................................................................................171 RSA encryption/decryption..............................................................................................171 Name Service......................................................................................................................171 Multicast Domain Name Systems........................................................................................172 mDNS API programming.................................................................................................173 Installing Bonjour............................................................................................................174 Avahi...............................................................................................................................177 Working with SNTP.............................................................................................................178 Java Sockets.......................................................................................................................180 Bluetooth..................................................................................................................................183 Bluetooth specification........................................................................................................183 Bluetooth UUIDs.............................................................................................................186 Bluetooth GAP................................................................................................................186 Low level packet.........................................................................................................187 GAP Advertizing data.................................................................................................188 Advertisability – limited and general...........................................................................191 Directed advertising....................................................................................................191 Non-connectable advertising......................................................................................192 Filtering devices.........................................................................................................192 Performing a scan......................................................................................................192 Performing advertising...............................................................................................195 Bluetooth GATT..............................................................................................................196 GATT Characteristic...................................................................................................198 Being a GATT client...................................................................................................199 Being a GATT Server.................................................................................................201 Notifications and indications.......................................................................................201 GATT XML descriptions..............................................................................................202 Page 4 Service Discovery Protocol.............................................................................................202 ESP32 and Bluetooth..........................................................................................................203 GATT Server – Read request..........................................................................................204 Debugging ESP32 Bluetooth..........................................................................................205 Bluetooth C Programming in Linux......................................................................................205 hci_get_route..................................................................................................................205 hci_open_dev.................................................................................................................205 hci_inquiry......................................................................................................................206 hci_read_remote_name..................................................................................................207 str2ba..............................................................................................................................207 ba2str..............................................................................................................................207 Bluetooth programming in Node.js......................................................................................208 Using Noble....................................................................................................................208 Using Bleno....................................................................................................................213 Bluetooth Audio...................................................................................................................214 Bluetooth RFCOMM............................................................................................................215 Bluetooth tools.....................................................................................................................217 l2ping..............................................................................................................................217 rfcomm............................................................................................................................217 bluetoothctl.....................................................................................................................218 hciconfig.........................................................................................................................219 hcidump..........................................................................................................................220 hcitool.............................................................................................................................220 gatttool............................................................................................................................221 Bluetooth examples.............................................................................................................222 The iTag peripheral.........................................................................................................222 Smart Watch / The TW64 Band......................................................................................224 Web Bluetooth.....................................................................................................................226 The Physical Web...............................................................................................................233 BLE beacons.......................................................................................................................233 Hardware interfacing................................................................................................................233 GPIOs.................................................................................................................................234 Pull up and pull down settings........................................................................................236 GPIO Interrupt handling..................................................................................................236 Expanding the number of available GPIOs.....................................................................240 PCF8574....................................................................................................................240 PCF8575....................................................................................................................244 MCP23017.................................................................................................................245 Interrupt Service Routines – ISRs.......................................................................................250 Working with I2C.................................................................................................................252 Using the ESP-IDF I2C driver.........................................................................................254 Common I2C devices......................................................................................................257 Page 5 Working with SPI – Serial Peripheral Interface....................................................................257 Using the ESP-IDF SPI driver.........................................................................................260 The Arduino Hardware Abstraction Layer SPI.................................................................263 Common SPI devices.....................................................................................................265 Working with UART/serial....................................................................................................266 Using the VFS component with serial.............................................................................269 I2S Bus................................................................................................................................269 I2S – Camera..................................................................................................................270 I2S – LCD.......................................................................................................................270 I2S – DMA......................................................................................................................270 RMT – The Remote Peripheral............................................................................................275 Timers and time...................................................................................................................281 LEDC – Pulse Width Modulation – PWM.............................................................................284 Automated PWM fading..................................................................................................288 Analog to digital conversion.................................................................................................289 Sleep modes.......................................................................................................................292 Security...............................................................................................................................294 Working with flash memory.................................................................................................294 Working with RAM memory.................................................................................................295 RAM Utilization...............................................................................................................297 Heap diagnosis / memory leaks......................................................................................298 Heap corruption..........................................................................................................300 Using PSRAM.................................................................................................................303 EFUSE................................................................................................................................305 EFuse #3 – 0x6001a00c.................................................................................................306 Button press detection.........................................................................................................306 GPS....................................................................................................................................308 GPS decoding.................................................................................................................310 Temperature and pressure – BMP180.................................................................................311 Using the Arduino APIs...................................................................................................313 NeoPixels............................................................................................................................313 NeoPixel theory..............................................................................................................313 NeoPixels and the ESP32...............................................................................................316 APA102...........................................................................................................................317 LED 7-Segment displays.....................................................................................................317 MAX7219/MAX7221 – Serial interface, 8-digit, led display drivers..................................318 The U8g2 library..................................................................................................................322 LCD display – Nokia 5110 – PCD8544................................................................................323 OLED 128x32, 128x64 – SSD1306.....................................................................................325 TFT displays........................................................................................................................327 Ambient light level sensor – BH1750FVI.............................................................................328 Ambient light and proximity sensor......................................................................................330 Infrared receivers................................................................................................................331 RFID MFRC522...................................................................................................................333 Page 6 MFRC522 – Low levels...................................................................................................335 Initialization................................................................................................................338 AntennaOn.................................................................................................................339 Cameras..............................................................................................................................339 Ivan's sample..................................................................................................................339 OV7670..........................................................................................................................341 Accelerometer and Gyroscope – MPU-6050 (aka GY-521).................................................341 The math of accelerometers...........................................................................................347 Visualizing orientation.....................................................................................................348 Compass – HMC5883L (aka GY-271) (aka CJ-M49)...........................................................348 Tilt compensation of the compass...................................................................................354 Real time clocks..................................................................................................................355 Servos.................................................................................................................................358 The Mini/Micro SG90......................................................................................................360 Audio...................................................................................................................................360 PCM5102 – I2S DAC......................................................................................................360 Graphic Equalizer...........................................................................................................361 External networking.............................................................................................................364 The nRF24......................................................................................................................364 Using the Arduino APIs...............................................................................................370 Integrating the nRF24 with the ESP32.......................................................................377 Programming using Eclipse.....................................................................................................380 Installing the Eclipse Serial terminal....................................................................................390 Web development using Eclipse..........................................................................................395 Programming using the Arduino IDE........................................................................................396 Mapping from the Arduino to the ESP32.............................................................................397 Implications of Arduino IDE support.....................................................................................398 Installing the Arduino IDE with ESP32 support....................................................................399 Using the Arduino libraries as an ESP-IDF component.......................................................401 Tips for working in the Arduino environment........................................................................402 Initialize global classes in setup()....................................................................................402 Invoking Espressif SDK API from a sketch......................................................................402 Reasons to consider using Eclipse over Arduino IDE.....................................................403 Programming with JavaScript..................................................................................................403 Duktape...............................................................................................................................404 Compiling code...............................................................................................................405 Building for ESP32..........................................................................................................405 Integrating Duktape in an ESP32 application..................................................................405 The Duktape stack..........................................................................................................406 Working with object properties........................................................................................406 Calling C from a JavaScript program..............................................................................406 JerryScript...........................................................................................................................407 Page 7 Platform specific files......................................................................................................407 JerryScript life-cycle........................................................................................................408 Accessing the global environment..................................................................................408 The jerry_value_t............................................................................................................408 Handling errors...............................................................................................................409 Interfacing JerryScript with C..........................................................................................409 IoT.js....................................................................................................................................410 Programming with Python........................................................................................................410 Pycom Micropython.............................................................................................................410 Programming with Lua.............................................................................................................410 Lua-RTOS for ESP32..........................................................................................................410 Integration with Web Apps........................................................................................................411 HTTP Protocol.....................................................................................................................411 HTTP Headers................................................................................................................411 Accept header............................................................................................................411 Authorization header..................................................................................................411 Connection header.....................................................................................................412 Content-Length header..............................................................................................412 Content-Type header..................................................................................................412 Host header................................................................................................................412 User-Agent header.....................................................................................................412 Web Servers........................................................................................................................412 Mongoose networking library..........................................................................................413 Setting up Mongoose on an ESP32...........................................................................416 Sending a request from Mongoose............................................................................417 The Mongoose struct mg_connection........................................................................417 Handling file uploads..................................................................................................417 GoAhead Web Server.....................................................................................................418 JavaScript Webserver.....................................................................................................419 REST Services....................................................................................................................419 REST protocol................................................................................................................419 ESP32 as a REST client.................................................................................................420 Making a REST request using Curl............................................................................420 Making a REST request using Mongoose..................................................................425 ESP32 as a REST service provider................................................................................425 WebSockets........................................................................................................................425 A WebSocket browser app..............................................................................................426 Mongoose WebSocket....................................................................................................428 Other Websocket implementations.................................................................................429 Tasker..................................................................................................................................429 AutoRemote........................................................................................................................429 DuckDNS............................................................................................................................431 Networking protocols...............................................................................................................432 MQTT..................................................................................................................................432 Page 8 Mosquitto MQTT.............................................................................................................434 Installing on Windows.................................................................................................436 Writing ESP32 MQTT clients..........................................................................................438 Using Mongoose as an MQTT client..........................................................................438 Using Espruino as an MQTT client.............................................................................440 Writing non ESP32 MQTT clients...................................................................................440 Eclipse paho...............................................................................................................441 C – Mosquitto client library.........................................................................................442 Node.js JavaScript – MQTT.......................................................................................444 Browser JavaScript – MQTT......................................................................................445 CoAP – Constrained Application Protocol............................................................................447 FTP.....................................................................................................................................449 TFTP...................................................................................................................................449 Telnet...................................................................................................................................450 DNS Protocol......................................................................................................................452 Mobile apps.............................................................................................................................455 Blynk...................................................................................................................................455 Cloud environments.................................................................................................................459 IBM Bluemix........................................................................................................................459 If This Then That – IFTTT....................................................................................................460 Storage programming..............................................................................................................461 Partition table......................................................................................................................461 Non Volatile Storage............................................................................................................465 Virtual File System..............................................................................................................466 VFS Implementations......................................................................................................467 FATFS File System..............................................................................................................468 Spiffs File System................................................................................................................469 Building SPIFFs for the ESP32.......................................................................................471 mkspiffs tool....................................................................................................................471 The ESP File System – EspFs............................................................................................472 SD, MMC and SDIO interfacing...........................................................................................474 ZIP files...............................................................................................................................475 zlib..................................................................................................................................475 miniz...............................................................................................................................475 kuba--/zip........................................................................................................................476 Charting data...........................................................................................................................476 Kst.......................................................................................................................................477 Sample Snippets......................................................................................................................478 Sample applications.................................................................................................................478 Sample – Ultrasonic distance measurement.......................................................................479 Sample – WiFi Scanner.......................................................................................................482 Sample – A changeable mood light.....................................................................................482 Page 9 Using FreeRTOS.....................................................................................................................487 The architecture of a task in FreeRTOS..............................................................................488 Stacks and FreeRTOS tasks...........................................................................................490 Timers in FreeRTOS............................................................................................................493 Blocking and synchronization within FreeRTOS..................................................................493 Semaphores and Mutices within FreeRTOS........................................................................495 Queues within FreeRTOS...................................................................................................496 Ring buffer withing FreeRTOS.............................................................................................497 Working with queue sets.....................................................................................................498 Monitoring capabilities.........................................................................................................499 Running untested functions.................................................................................................500 The Serial AT command processor..........................................................................................500 Mongoose OS..........................................................................................................................501 The Mongoose OS file system............................................................................................503 Setting up Mongoose OS WiFi............................................................................................503 Building a Mongoose OS App..............................................................................................503 AWS IoT..................................................................................................................................503 The ESP-IDF aws_iot component.......................................................................................505 Using the TI CC2650 SensorTag..............................................................................................506 IR Temperature Sensor.......................................................................................................509 Humidity Service.................................................................................................................510 Ambient light sensor............................................................................................................510 Key Press............................................................................................................................510 Developing solutions on Linux..................................................................................................511 Building a Linux environment..........................................................................................512 Hardware architecture..............................................................................................................513 The CPU and cores.............................................................................................................513 Intrinsic data types..............................................................................................................513 Native byte order, endian and network byte order...............................................................513 Memory mapping and address spaces................................................................................515 Reading and writing registers..............................................................................................516 Pads and multiplexing.........................................................................................................517 Register based GPIO..........................................................................................................520 GPIO_OUT_REG...........................................................................................................522 GPIO_OUT_W1TS_REG................................................................................................522 GPIO_OUT_W1TC_REG...............................................................................................522 GPIO_OUT1_REG.........................................................................................................523 GPIO_OUT1_W1TS_REG..............................................................................................523 GPIO_OUT1_W1TC_REG.............................................................................................523 GPIO_ENABLE_REG.....................................................................................................523 GPIO_ENABLE_W1TS_REG.........................................................................................523 GPIO_ENABLE_W1TC_REG.........................................................................................523 GPIO_ENABLE1_REG...................................................................................................523 GPIO_ENABLE1_W1TS_REG.......................................................................................524 Page 10 GPIO_ENABLE1_W1TC_REG.......................................................................................524 GPIO_STRAP_REG.......................................................................................................524 GPIO_IN_REG...............................................................................................................524 GPIO_IN1_REG.............................................................................................................524 GPIO_STATUS_REG.....................................................................................................524 GPIO_STATUS_W1TS_REG..........................................................................................525 GPIO_STATUS_W1TC_REG.........................................................................................525 GPIO_STATUS1_REG...................................................................................................525 GPIO_STATUS1_W1TS_REG........................................................................................525 GPIO_STATUS1_W1TC_REG.......................................................................................525 GPIO_PCPU_NMI_INT1_REG.......................................................................................525 GPIO_PCPU_NMI_INT1_REG.......................................................................................525 GPIO_PINn_REG...........................................................................................................525 GPIO_FUNCm_IN_SEL_CFG_REG..............................................................................525 GPIO_FUNCn_OUT_SEL_CFG_REG...........................................................................526 Strapping pins.....................................................................................................................526 Boot mode source...........................................................................................................527 Debugging on U0TX0 at boot.........................................................................................527 Timing of SDIO slave......................................................................................................527 Boot-loader..........................................................................................................................527 Power modes......................................................................................................................529 Bootloader...........................................................................................................................530 Peripherals..........................................................................................................................530 Remote Control Peripheral – RMT..................................................................................530 SPI..................................................................................................................................534 PID Controller.................................................................................................................534 UART..............................................................................................................................534 I2S..................................................................................................................................535 I2S Clock....................................................................................................................535 Camera mode............................................................................................................535 Registers....................................................................................................................539 I2S_CONF_REG........................................................................................................541 I2S_CONF2_REG......................................................................................................541 I2S_CLKM_CONF_REG............................................................................................542 I2S_CONF_CHAN_REG............................................................................................542 I2S_LC_CONF_REG.................................................................................................542 I2S_FIFO_CONF_REG..............................................................................................542 I2S_IN_LINK_REG....................................................................................................543 I2S_RXEOF_NUM_REG............................................................................................543 I2S_CONF_CHAN_REG............................................................................................543 I2S_SAMPLE_RATE_CONF_REG............................................................................544 I2S_INT_RAW_REG..................................................................................................544 Page 11 I2S_INT_ENA_REG...................................................................................................544 I2S_INT_CLR_REG...................................................................................................545 RTC................................................................................................................................546 RTCIO_RTC_GPIO_OUT_DATA...............................................................................546 RTCIO_RTC_GPIO_OUT_DATA_W1TS....................................................................546 RTCIO_RTC_GPIO_OUT_DATA_W1TC...................................................................546 RTCIO_RTC_GPIO_ENABLE....................................................................................546 RTCIO_RTC_GPIO_ENABLE_W1TS........................................................................546 RTCIO_RTC_GPIO_ENABLE_W1TC........................................................................546 RTCIO_RTC_GPIO_STATUS_INT.............................................................................546 RTCIO_RTC_GPIO_STATUS_INT_W1TS.................................................................546 RTCIO_RTC_GPIO_STATUS_INT_W1TC.................................................................546 RTCIO_RTC_GPIO_IN_NEXT...................................................................................546 RTCIO_RTC_GPIO_PINn_WAKEUP_ENABLE.........................................................547 RTCIO_RTC_GPIO_PINn_INT_TYPE.......................................................................547 RTCIO_RTC_GPIO_PINn_PAD_DRIVER..................................................................547 RTCIO_DIG_PAD_HOLD_REG.................................................................................547 RTCIO_HALL_XPD_HALL.........................................................................................547 RTCIO_HALL_PHASE...............................................................................................547 RTCIO_SENSOR_SENSEn_HOLD...........................................................................547 RTCIO_SENSOR_SENSEn_MUX_SEL....................................................................547 RTCIO_SENSOR_SENSEn_FUN_SEL.....................................................................547 RTCIO_SENSOR_SENSEn_SLP_SEL......................................................................547 RTCIO_SENSOR_SENSEn_SLP_IE.........................................................................547 RTCIO_SENSOR_SENSEn_FUN_IE........................................................................547 RTCIO_ADC_ADCn_HOLD.......................................................................................547 RTCIO_ADC_ADCn_MUX_SEL................................................................................547 RTCIO_ADC_ADCn_FUN_SEL.................................................................................547 RTCIO_ADC_ADCn_SLP_SEL..................................................................................547 RTCIO_ADC_ADCn_SLP_IE.....................................................................................547 RTCIO_ADC_ADCn_FUN_IE....................................................................................547 RTCIO_PAD_PDAC1_DRV........................................................................................547 RTCIO_PAD_PDAC1_HOLD.....................................................................................547 RTCIO_PAD_PDAC1_RDE........................................................................................547 RTCIO_PAD_PDAC1_RUE........................................................................................547 RTCIO_PAD_PDAC1_DAC........................................................................................547 RTCIO_PAD_PDAC1_XPD_DAC..............................................................................547 RTCIO_PAD_PDAC1_MUX_SEL...............................................................................547 RTCIO_PAD_PDAC1_FUN_SEL...............................................................................547 RTCIO_PAD_PDAC1_SLP_SEL................................................................................547 RTCIO_PAD_PDAC1_SLP_IE...................................................................................548 RTCIO_PAD_PDAC1_SLP_OE.................................................................................548 RTCIO_PAD_PDAC1_FUN_IE..................................................................................548 RTCIO_PAD_PDAC1_DAC_XPD_FORCE................................................................548 Page 12 ULP Processor.........................................................................................................................548 Preparing a ULP co-processor environment........................................................................549 ULP Instruction set..............................................................................................................549 NOP – No operation........................................................................................................551 ADD – Add to a register..................................................................................................551 SUB – Subtract from register..........................................................................................551 AND – Logical AND of two operands..............................................................................552 OR – Logical OR of two operands..................................................................................552 LSH – Logical Shift Left..................................................................................................552 RSH – Logical Shift Right...............................................................................................552 MOVE – Move to register................................................................................................552 ST – Store data to memory.............................................................................................553 LD – Load data from memory.........................................................................................553 JUMP – Jump to an absolute address............................................................................553 JUMPR – Jump relative with condition............................................................................553 JUMPS – Jump relative based on stage count...............................................................554 STAGE_RST – Reset the stage count register...............................................................554 STAGE_INC – Increment the stage count register..........................................................554 STAGE_DEC – Decrement the stage count register.......................................................554 HALT – End the program................................................................................................554 WAKE – Wakeup the chip...............................................................................................554 SLEEP – Set the ULP wakeup timer period....................................................................554 WAIT – Wait some number of cycles..............................................................................554 TSENS – Do measurement with the temperature sensor...............................................555 ADC – Do measurement with ADC.................................................................................555 REG_RD – Read from peripheral register.......................................................................555 REG_WR – Write to peripheral register..........................................................................555 ULP co-processor assembler coding...................................................................................556 Loading and starting a ULP co-processor application..........................................................557 Waking up the ULP co-processor........................................................................................558 Peripheral registers for ULP co-processor...........................................................................558 SENS_ULP_CP_SLEEP_CYC0_REG...........................................................................558 SENS_ULP_CP_SLEEP_CYC1_REG...........................................................................558 SENS_ULP_CP_SLEEP_CYC2_REG...........................................................................558 SENS_ULP_CP_SLEEP_CYC3_REG...........................................................................558 SENS_ULP_CP_SLEEP_CYC4_REG...........................................................................559 SENS_SAR_START_FORCE_REG...............................................................................559 Electronics...............................................................................................................................560 Transistors as switches.......................................................................................................560 Logic Level Shifting.............................................................................................................561 Projects....................................................................................................................................563 JerryScript library for ESP32...............................................................................................563 Page 13 The "require" capability...................................................................................................563 API Reference.........................................................................................................................563 Configuration, status and operational retrieval....................................................................564 Arduino Mapping.................................................................................................................565 bitRead...........................................................................................................................565 bitWrite...........................................................................................................................565 delay...............................................................................................................................565 digitalWrite......................................................................................................................565 pinMode..........................................................................................................................566 SPI.begin........................................................................................................................566 SPI.setBitOrder...............................................................................................................566 SPI.setClockDivider........................................................................................................567 SPI.setDataMode............................................................................................................567 SPI.transfer.....................................................................................................................567 Wire.begin......................................................................................................................567 Wire.beginTransmission..................................................................................................568 Wire.endTransmission....................................................................................................568 Wire.read........................................................................................................................568 Wire.requestFrom...........................................................................................................568 Wire.write........................................................................................................................568 FreeRTOS API reference....................................................................................................568 portENABLE_INTERRUPTS...........................................................................................568 portDISABLE_INTERRUPTS..........................................................................................569 xPortGetCoreID..............................................................................................................569 pvPortMalloc...................................................................................................................569 pvPortFree......................................................................................................................569 xPortGetFreeHeapSize()................................................................................................569 xEventGroupClearBits....................................................................................................569 xEventGroupCreate........................................................................................................570 xEventGroupCreateStatic...............................................................................................570 xEventGroupSetBits.......................................................................................................570 xEventGroupWaitBits......................................................................................................571 xQueueAddToSet............................................................................................................571 xQueueCreate................................................................................................................572 xQueueCreateSet...........................................................................................................572 xQueueCreateStatic.......................................................................................................572 vQueueDelete.................................................................................................................573 xQueueGenericReceive..................................................................................................573 uxQueueMessagesWaiting.............................................................................................573 xQueueOverwrite............................................................................................................574 xQueuePeek...................................................................................................................574 xQueuePeekFromISR.....................................................................................................574 xQueueReceive..............................................................................................................574 xQueueReceiveFromISR................................................................................................575 Page 14 xQueueRemoveFromSet................................................................................................575 xQueueReset..................................................................................................................575 xQueueSelectFromSet....................................................................................................575 xQueueSelectFromSetFromISR.....................................................................................575 xQueueSend...................................................................................................................576 xQueueSendFromISR.....................................................................................................576 xQueueSendToBack.......................................................................................................576 xQueueSendToBackFromISR.........................................................................................576 xQueueSendToFront.......................................................................................................577 xQueueSendToFrontFromISR........................................................................................578 uxQueueSpacesAvailable...............................................................................................578 xRingbufferAddToQueueSetRead...................................................................................578 xRingbufferAddToQueueSetWrite...................................................................................578 xRingbufferCreate...........................................................................................................578 vRingbufferDelete...........................................................................................................579 xRingbufferGetMaxItemSize...........................................................................................579 xRingBufferPrintInfo........................................................................................................579 xRingbufferReceive.........................................................................................................579 xRingbufferReceiveFromISR..........................................................................................580 xRingbufferReceiveUpTo................................................................................................580 xRingbufferReceiveUpToFromISR..................................................................................580 xRingbufferRemoveFromQueueSetRead.......................................................................580 xRingbufferRemoveFromQueueSetWrite........................................................................580 vRingbufferReturnItem....................................................................................................580 vRingbufferReturnItemFromISR......................................................................................581 xRingbufferSend.............................................................................................................581 xRingbufferSendFromISR...............................................................................................581 vSemaphoreCreateBinary...............................................................................................582 xSemaphoreCreateCounting..........................................................................................582 xSemaphoreCreateMutex...............................................................................................582 vSemaphoreDelete.........................................................................................................582 uxSemaphoreGetCount..................................................................................................583 xSemaphoreGive............................................................................................................583 xSemaphoreGiveFromISR..............................................................................................583 xSemaphoreTake............................................................................................................583 xTaskCreate....................................................................................................................584 xTaskCreatePinnedToCore.............................................................................................585 vTaskDelay.....................................................................................................................586 vTaskDelayUntil..............................................................................................................586 vTaskDelete....................................................................................................................587 vTaskGetInfo...................................................................................................................587 xTaskGetCurrentTaskHandle..........................................................................................588 Page 15 pcTaskGetTaskName......................................................................................................588 uxTaskGetNumberOfTasks.............................................................................................588 eTaskGetState................................................................................................................588 uxTaskGetSystemState...................................................................................................589 xTaskGetTickCount.........................................................................................................590 xTaskGetTickCountFromISR...........................................................................................590 vEventGroupDelete........................................................................................................590 vTaskList.........................................................................................................................590 uxTaskPriorityGet............................................................................................................591 vTaskPrioritySet..............................................................................................................591 vTaskResume.................................................................................................................591 xTaskResumeAll.............................................................................................................591 vTaskResumeFromISR...................................................................................................591 vTaskSuspend................................................................................................................592 vTaskSuspendAll............................................................................................................592 xTimerChangePeriod......................................................................................................592 xTimerChangePeriodFromISR........................................................................................593 xTimerCreate..................................................................................................................593 xTimerCreateStatic.........................................................................................................594 xTimerDelete..................................................................................................................594 pcTimerGetName............................................................................................................594 xTimerGetExpiryTime.....................................................................................................594 xTimerGetPeriod.............................................................................................................595 pvTimerGetTimerDaemonTaskHandle............................................................................595 pvTimerGetTimerID.........................................................................................................596 xTimerIsTimerActive.......................................................................................................596 xTimerPendFunctionCall.................................................................................................596 xTimerPendFunctionCallFromISR...................................................................................597 xTimerReset...................................................................................................................597 xTimerResetFromISR.....................................................................................................597 vTimerSetTimerID...........................................................................................................597 xTimerStart.....................................................................................................................598 xTimerStartFromISR.......................................................................................................598 xTimerStop.....................................................................................................................598 xTimerStopFromISR.......................................................................................................599 List Processing...............................................................................................................599 vListInitialise...............................................................................................................599 vListInitialiseItem........................................................................................................599 vListInsert...................................................................................................................599 vListInsertEnd............................................................................................................599 Sockets APIs.......................................................................................................................599 accept.............................................................................................................................600 bind.................................................................................................................................600 close...............................................................................................................................601 Page 16 closesocket.....................................................................................................................601 connect...........................................................................................................................602 fcntl.................................................................................................................................602 freeaddrinfo....................................................................................................................602 getaddrinfo......................................................................................................................603 gethostbyname...............................................................................................................604 gethostbyname_r............................................................................................................605 getpeername...................................................................................................................605 getsockname..................................................................................................................605 getsockopt......................................................................................................................606 htonl................................................................................................................................606 htons...............................................................................................................................606 inet_ntop.........................................................................................................................606 inet_pton.........................................................................................................................607 ioctlsocket.......................................................................................................................607 listen...............................................................................................................................607 read................................................................................................................................608 recv.................................................................................................................................608 recvfrom..........................................................................................................................609 select..............................................................................................................................610 send................................................................................................................................610 sendmsg.........................................................................................................................611 sendto.............................................................................................................................611 setsockopt.......................................................................................................................611 shutdown........................................................................................................................612 socket.............................................................................................................................612 write................................................................................................................................613 writev..............................................................................................................................613 Socket data structures....................................................................................................613 Sockets – struct sockaddr..........................................................................................613 Sockets – struct sockaddr_in.....................................................................................613 Working with WiFi................................................................................................................614 DNS.....................................................................................................................................615 dns_getserver.................................................................................................................615 dns_setserver.................................................................................................................615 System Functions................................................................................................................616 esp_chip_info..................................................................................................................616 esp_cpu_in_ocd_debug_mode.......................................................................................616 esp_deregister_freertos_idle_hook.................................................................................617 esp_deregister_freertos_tick_hook.................................................................................617 esp_efuse_read_mac.....................................................................................................617 esp_get_free_heap_size.................................................................................................617 Page 17 esp_get_idf_version........................................................................................................617 esp_ipc_call....................................................................................................................618 esp_ipc_call_blocking.....................................................................................................618 esp_random....................................................................................................................618 esp_register_freertos_idle_hook.....................................................................................618 esp_register_freertos_idle_hook_for_cpu.......................................................................619 esp_register_freertos_tick_hook.....................................................................................619 esp_register_freertos_tick_hook_for_cpu.......................................................................619 esp_restart......................................................................................................................619 esp_sleep_get_wakeup_cause.......................................................................................619 ets_delay_us...................................................................................................................620 system_rtc_mem_write...................................................................................................620 rtc_get_reset_reason......................................................................................................620 software_reset................................................................................................................621 software_reset_cpu........................................................................................................621 system_deep_sleep........................................................................................................621 system_get_time.............................................................................................................622 system_restore...............................................................................................................622 system_rtc_mem_read...................................................................................................622 system_rtc_mem_write...................................................................................................623 system_rtc_mem_read...................................................................................................623 WiFi.....................................................................................................................................623 esp_event_loop_init........................................................................................................623 esp_event_loop_set_cb..................................................................................................623 esp_wifi_ap_get_sta_list.................................................................................................624 esp_wifi_clear_fast_connect...........................................................................................624 esp_wifi_connect............................................................................................................624 esp_wifi_deauth_sta.......................................................................................................625 esp_wifi_deinit................................................................................................................625 esp_wifi_disconnect........................................................................................................625 esp_wifi_free_station_list................................................................................................626 esp_wifi_get_auto_connect............................................................................................626 esp_wifi_get_bandwidth..................................................................................................626 esp_wifi_get_channel.....................................................................................................626 esp_wifi_get_config........................................................................................................627 esp_wifi_get_country......................................................................................................627 esp_wifi_get_mac...........................................................................................................628 esp_wifi_get_mode.........................................................................................................628 esp_wifi_get_promiscuous..............................................................................................628 esp_wifi_get_protocol.....................................................................................................629 esp_wifi_get_ps..............................................................................................................629 esp_wifi_get_station_list.................................................................................................630 esp_wifi_init....................................................................................................................630 esp_wifi_restore..............................................................................................................631 Page 18 esp_wifi_reg_rxcb...........................................................................................................631 esp_wifi_scan_get_ap_records.......................................................................................631 esp_wifi_scan_get_ap_num...........................................................................................632 esp_wifi_scan_start........................................................................................................633 esp_wifi_scan_stop........................................................................................................633 esp_wifi_set_auto_connect.............................................................................................634 esp_wifi_set_bandwidth..................................................................................................634 esp_wifi_set_channel......................................................................................................634 esp_wifi_set_config........................................................................................................635 esp_wifi_set_country......................................................................................................637 esp_wifi_set_mac...........................................................................................................637 esp_wifi_set_mode.........................................................................................................638 esp_wifi_set_promiscuous_rx_cb...................................................................................638 esp_wifi_set_promiscuous..............................................................................................638 esp_wifi_set_protocol.....................................................................................................639 esp_wifi_set_ps..............................................................................................................639 esp_wifi_set_storage......................................................................................................639 esp_wifi_set_vendor_ie..................................................................................................640 esp_wifi_set_vendor_ie_cb.............................................................................................640 esp_wifi_sta_get_ap_info...............................................................................................640 esp_wifi_start..................................................................................................................641 esp_wifi_stop..................................................................................................................641 WiFi WPS............................................................................................................................641 wifi_wps_enable.............................................................................................................641 wifi_wps_disable.............................................................................................................642 wifi_wps_start.................................................................................................................642 wifi_set_wps_cb..............................................................................................................642 mbed TLS............................................................................................................................642 mbedtls_ctr_drbg_free....................................................................................................643 mbedtls_ctr_drbg_init......................................................................................................643 mbedtls_ctr_drbg_seed..................................................................................................643 mbedtls_debug_set_threshold........................................................................................643 mbedtls_entropy_free.....................................................................................................644 mbedtls_entropy_init.......................................................................................................644 mbedtls_net_accept........................................................................................................644 mbedtls_net_bind...........................................................................................................645 mbedtls_net_connect......................................................................................................645 mbedtls_net_free............................................................................................................645 mbedtls_net_init..............................................................................................................646 mbedtls_net_recv...........................................................................................................646 mbedtls_net_recv_timeout..............................................................................................646 mbedtls_net_send..........................................................................................................647 Page 19 mbedtls_net_set_block...................................................................................................647 mbedtls_net_set_nonblock.............................................................................................647 mbedtls_pk_get_name....................................................................................................647 mbedtls_pk_parse_key...................................................................................................647 mbedtls_printf.................................................................................................................648 mbedtls_sha1.................................................................................................................648 mbedtls_rsa_init..............................................................................................................648 mbedtls_ssl_close_notify................................................................................................648 mbedtls_ssl_conf_authmode..........................................................................................648 mbedtls_ssl_conf_ca_chain............................................................................................649 mbedtls_ssl_conf_dbg....................................................................................................649 mbedtls_ssl_conf_rng.....................................................................................................649 mbedtls_ssl_config_defaults...........................................................................................650 mbedtls_ssl_config_free.................................................................................................650 mbedtls_ssl_config_init...................................................................................................650 mbedtls_ssl_free.............................................................................................................651 mbedtls_ssl_get_verify_result.........................................................................................651 mbedtls_ssl_handshake.................................................................................................651 mbedtls_ssl_init..............................................................................................................651 mbedtls_ssl_read............................................................................................................651 mbedtls_ssl_session_reset.............................................................................................652 mbedtls_ssl_set_bio.......................................................................................................652 mbedtls_ssl_set_hostname............................................................................................652 mbedtls_ssl_setup..........................................................................................................653 mbedtls_ssl_write...........................................................................................................653 mbedtls_strerror..............................................................................................................653 mbedtls_x509_crt_init.....................................................................................................654 mbedtls_x509_crt_parse.................................................................................................654 mbedtls_x509_crt_veryify_info.......................................................................................654 Bluetooth LE........................................................................................................................654 esp_bt_uuid_t.................................................................................................................654 esp_attr_value_t.............................................................................................................655 esp_gatt_id_t..................................................................................................................655 esp_gatt_srvc_id_t..........................................................................................................655 esp_gatt_status_t...........................................................................................................656 esp_gattc_char_elem_t...................................................................................................657 esp_gattc_db_elem_t.....................................................................................................658 esp_gattc_descr_elem_t.................................................................................................658 esp_gattc_service_elem_t..............................................................................................658 esp_ble_gap_config_adv_data.......................................................................................659 esp_ble_gap_config_adv_data_raw...............................................................................661 esp_ble_gap_config_scan_rsp_data_raw.......................................................................661 esp_ble_gap_config_local_privacy.................................................................................661 esp_ble_gap_disconnect................................................................................................661 Page 20 esp_ble_gap_get_whitelist_size.....................................................................................661 esp_ble_gap_read_rssi...................................................................................................662 esp_ble_gap_register_callback.......................................................................................662 ESP_GAP_BLE_ADD_WHITELIST_COMPLETE_EVT.............................................662 ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT..............................................662 ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT....................................663 ESP_GAP_BLE_ADV_START_COMPLETE_EVT.....................................................663 ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT......................................................663 ESP_GAP_BLE_AUTH_CMPL_EVT.........................................................................663 ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT........................................663 ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT.............................................664 ESP_GAP_BLE_KEY_EVT........................................................................................664 ESP_GAP_BLE_LOCAL_ER_EVT............................................................................664 ESP_GAP_BLE_LOCAL_IR_EVT..............................................................................664 ESP_GAP_BLE_NC_REQ_EVT................................................................................664 ESP_GAP_BLE_OOB_REQ_EVT.............................................................................664 ESP_GAP_BLE_PASSKEY_NOTIF_EVT..................................................................664 ESP_GAP_BLE_PASSKEY_REQ_EVT.....................................................................664 ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT.....................................................664 ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT....................................665 ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT........................................665 ESP_GAP_BLE_SCAN_RESULT_EVT.....................................................................665 ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT........................666 ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT..................................666 ESP_GAP_BLE_SCAN_START_COMPLETE_EVT..................................................667 ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT....................................................667 ESP_GAP_BLE_SEC_REQ_EVT..............................................................................667 ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT....................................668 ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT.........................................668 ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT..................................................668 ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT....................................................668 esp_ble_gap_security_rsp..............................................................................................669 esp_ble_gap_set_device_name.....................................................................................669 esp_ble_set_encryption..................................................................................................669 esp_ble_gap_set_pkt_data_len......................................................................................669 esp_ble_gap_set_prefer_conn_params..........................................................................670 esp_ble_gap_set_rand_addr..........................................................................................670 esp_ble_gap_set_security_param..................................................................................670 esp_ble_gap_set_scan_params.....................................................................................671 esp_ble_gap_start_advertising.......................................................................................672 esp_ble_gap_start_scanning..........................................................................................673 esp_ble_gap_stop_advertising.......................................................................................674 Page 21 esp_ble_gap_stop_scanning..........................................................................................674 esp_ble_gap_update_conn_params...............................................................................674 esp_ble_gap_update_whitelist........................................................................................675 esp_ble_gattc_app_register............................................................................................675 esp_ble_gattc_app_unregister........................................................................................675 esp_ble_gattc_close.......................................................................................................676 esp_ble_gattc_cache_refresh.........................................................................................676 esp_ble_gattc_config_mtu..............................................................................................676 esp_ble_gattc_execute_write.........................................................................................676 esp_ble_gattc_get_all_char............................................................................................676 esp_ble_gattc_get_all_descr..........................................................................................678 esp_ble_gattc_get_attr_count.........................................................................................678 esp_ble_gattc_get_char_by_uuid...................................................................................679 esp_ble_gattc_get_characteristic....................................................................................680 esp_ble_gattc_get_db.....................................................................................................681 esp_ble_gattc_get_descr_by_char_handle.....................................................................681 esp_ble_gattc_get_descr_by_uuid.................................................................................682 esp_ble_gattc_get_descriptor.........................................................................................682 esp_ble_gattc_get_include_service................................................................................683 esp_ble_gattc_get_included_service..............................................................................683 esp_ble_gattc_get_service.............................................................................................684 esp_ble_gattc_open.......................................................................................................684 esp_ble_gattc_prepare_write..........................................................................................685 esp_ble_gattc_prepare_write_char_descr......................................................................685 esp_ble_gattc_read_char...............................................................................................686 esp_ble_gattc_read_char_descr.....................................................................................686 esp_ble_gattc_read_multiple..........................................................................................687 esp_ble_gattc_register_callback.....................................................................................687 ESP_GATTC_ACL_EVT............................................................................................690 ESP_GATTC_ADV_DATA_EVT.................................................................................690 ESP_GATTC_ADV_VSC_EVT...................................................................................690 ESP_GATTC_BTH_SCAN_CFG_EVT.......................................................................690 ESP_GATTC_BTH_SCAN_DIS_EVT........................................................................690 ESP_GATTC_BTH_SCAN_ENB_EVT.......................................................................690 ESP_GATTC_BTH_SCAN_PARAM_EVT..................................................................690 ESP_GATTC_BTH_SCAN_RD_EVT.........................................................................690 ESP_GATTC_BTH_SCAN_THR_EVT.......................................................................690 ESP_GATTC_CANCEL_OPEN_EVT.........................................................................690 ESP_GATTC_CFG_MTU_EVT..................................................................................690 ESP_GATTC_CLOSE_EVT.......................................................................................690 ESP_GATTC_CONGEST_EVT..................................................................................691 ESP_GATTC_CONNECT_EVT..................................................................................691 ESP_GATTC_DISCONNECT_EVT............................................................................691 ESP_GATTC_ENC_CMPL_CB_EVT.........................................................................692 Page 22 ESP_GATTC_EXEC_EVT..........................................................................................692 ESP_GATTC_GET_CHAR_EVT................................................................................692 ESP_GATTC_GET_DESCR_EVT..............................................................................693 ESP_GATTC_GET_INCL_SRVC_EVT......................................................................693 ESP_GATTC_MULT_ADV_DATA_EVT......................................................................693 ESP_GATTC_MULT_ADV_DIS_EVT.........................................................................694 ESP_GATTC_MULT_ADV_ENB_EVT.......................................................................694 ESP_GATTC_MULT_ADV_UPD_EVT.......................................................................694 ESP_GATTC_NOTIFY_EVT......................................................................................694 ESP_GATTC_OPEN_EVT.........................................................................................694 ESP_GATTC_PREP_WRITE_EVT............................................................................695 ESP_GATTC_READ_CHAR_EVT.............................................................................695 ESP_GATTC_READ_DESC_EVT..............................................................................695 ESP_GATTC_REG_EVT............................................................................................695 ESP_GATTC_REG_FOR_NOTIFY_EVT...................................................................695 ESP_GATTC_SEARCH_CMPL_EVT.........................................................................696 ESP_GATTC_SEARCH_RES_EVT...........................................................................696 ESP_GATTC_SCAN_FLT_CFG_EVT........................................................................697 ESP_GATTC_SCAN_FLT_PARAM_EVT...................................................................697 ESP_GATTC_SCAN_FLT_STATUS_EVT..................................................................697 ESP_GATTC_SRVC_CHG_EVT................................................................................697 ESP_GATTC_UNREG_EVT......................................................................................697 ESP_GATTC_UNREG_FOR_NOTIFY_EVT..............................................................697 ESP_GATTC_WRITE_CHAR_EVT............................................................................697 esp_ble_gattc_register_for_notify...................................................................................698 esp_ble_gattc_unregister_for_notify...............................................................................698 esp_ble_gattc_search_service.......................................................................................699 esp_ble_gattc_write_char...............................................................................................699 esp_ble_gattc_write_char_descr....................................................................................700 esp_ble_gatts_add_char.................................................................................................701 esp_ble_gatts_add_char_descr......................................................................................703 esp_ble_gatts_add_included_service.............................................................................704 esp_ble_gatts_app_register............................................................................................704 esp_ble_gatts_app_unregister........................................................................................704 esp_ble_gatts_close.......................................................................................................704 esp_ble_gatts_create_attribute_tab................................................................................705 esp_ble_gatts_create_service........................................................................................705 esp_ble_gatts_delete_service........................................................................................708 esp_ble_gatts_get_attr_value.........................................................................................708 esp_ble_gatts_open.......................................................................................................708 esp_ble_gatts_register_callback.....................................................................................708 ESP_GATTS_ADD_CHAR_DESCR_EVT.................................................................709 Page 23 ESP_GATTS_ADD_CHAR_EVT................................................................................710 ESP_GATTS_ADD_INCL_SRVC_EVT......................................................................710 ESP_GATTS_CANCEL_OPEN_EVT.........................................................................710 ESP_GATTS_CLOSE_EVT.......................................................................................710 ESP_GATTS_CONF_EVT.........................................................................................710 ESP_GATTS_CONGEST_EVT..................................................................................711 ESP_GATTS_CONNECT_EVT..................................................................................711 ESP_GATTS_CREAT_ATTR_TAB_EVT....................................................................711 ESP_GATTS_CREATE_EVT.....................................................................................712 ESP_GATTS_DELETE_EVT......................................................................................712 ESP_GATTS_DISCONNECT_EVT............................................................................712 ESP_GATTS_EXEC_WRITE_EVT............................................................................713 ESP_GATTS_LISTEN_EVT.......................................................................................713 ESP_GATTS_MTU_EVT............................................................................................713 ESP_GATTS_OPEN_EVT.........................................................................................713 ESP_GATTS_READ_EVT..........................................................................................714 ESP_GATTS_REG_EVT............................................................................................714 ESP_GATTS_RESPONSE_EVT................................................................................714 ESP_GATTS_SET_ATTR_VAL_EVT.........................................................................714 ESP_GATTS_START_EVT........................................................................................715 ESP_GATTS_STOP_EVT..........................................................................................715 ESP_GATTS_UNREG_EVT.......................................................................................715 ESP_GATTS_WRITE_EVT........................................................................................715 esp_ble_gatts_send_indicate.........................................................................................717 esp_ble_gatts_send_response.......................................................................................717 esp_ble_gatts_set_attr_value.........................................................................................719 esp_ble_gatts_start_service...........................................................................................719 esp_ble_gatts_stop_service...........................................................................................719 esp_ble_resolve_adv_data.............................................................................................719 esp_ble_tx_power_get....................................................................................................721 esp_ble_tx_power_set....................................................................................................721 esp_bluedroid_deinit.......................................................................................................722 esp_bluedroid_disable....................................................................................................723 esp_bluedroid_enable.....................................................................................................723 esp_bluedroid_init...........................................................................................................723 esp_bt_controller_deinit..................................................................................................723 esp_bt_controller_disable...............................................................................................723 esp_bt_controller_enable................................................................................................724 esp_bt_controller_get_status..........................................................................................724 esp_bt_controller_init......................................................................................................724 esp_bt_controller_mem_release.....................................................................................724 esp_bt_dev_get_address................................................................................................725 esp_bt_dev_set_device_name.......................................................................................725 esp_vhci_host_check_send_available............................................................................725 Page 24 esp_vhci_host_register_callback....................................................................................725 esp_vhci_host_send_packet...........................................................................................726 Upgrade APIs......................................................................................................................726 system_upgrade_flag_check..........................................................................................726 system_upgrade_flag_set...............................................................................................726 system_upgrade_reboot.................................................................................................726 system_upgrade_start....................................................................................................726 system_upgrade_userbin_check....................................................................................727 Smart config APIs................................................................................................................727 smartconfig_start............................................................................................................727 smartconfig_stop............................................................................................................727 SNTP API............................................................................................................................727 sntp_enabled..................................................................................................................727 sntp_getoperatingmode..................................................................................................727 sntp_getserver................................................................................................................728 sntp_getservername.......................................................................................................728 sntp_init..........................................................................................................................728 sntp_servermode_dhcp..................................................................................................728 sntp_setoperatingmode..................................................................................................729 sntp_setserver................................................................................................................729 sntp_setservername.......................................................................................................729 sntp_stop........................................................................................................................730 Generic TCP/UDP APIs.......................................................................................................730 ipaddr_addr....................................................................................................................730 IP4_ADDR......................................................................................................................730 IP2STR...........................................................................................................................731 MAC2STR......................................................................................................................731 TCP Adapter APIs...............................................................................................................732 tcpip_adapter_ap_input..................................................................................................732 tcpip_adapter_ap_start...................................................................................................732 tcpip_adapter_create_ip6_linklocal.................................................................................732 tcpip_adapter_dhcpc_get_status....................................................................................732 tcpip_adapter_dhcpc_option...........................................................................................733 tcpip_adapter_dhcpc_start..............................................................................................733 tcpip_adapter_dhcpc_stop..............................................................................................734 tcpip_adapter_dhcps_get_status....................................................................................734 tcpip_adapter_dhcps_option...........................................................................................734 tcpip_adapter_dhcps_start..............................................................................................735 tcpip_adapter_dhcps_stop..............................................................................................736 tcpip_adapter_down.......................................................................................................736 tcpip_adapter_eth_input.................................................................................................736 tcpip_adapter_eth_start..................................................................................................736 Page 25 tcpip_adapter_free_sta_list.............................................................................................736 tcpip_adapter_get_esp_if................................................................................................737 tcpip_adapter_get_dns_info............................................................................................737 tcpip_adapter_get_hostname.........................................................................................737 tcpip_adapter_get_ip_info...............................................................................................737 tcpip_adapter_get_ip6_linklocal......................................................................................738 tcpip_adapter_get_netif..................................................................................................738 tcpip_adapter_get_old_ip_info........................................................................................738 tcpip_adapter_get_sta_list..............................................................................................738 tcpip_adapter_get_wifi_if................................................................................................739 tcpip_adapter_init...........................................................................................................739 tcpip_adapter_set_dns_info............................................................................................740 tcpip_adapter_set_hostname..........................................................................................740 tcpip_adapter_set_ip_info...............................................................................................740 tcpip_adapter_set_old_ip_info........................................................................................741 tcpip_adapter_sta_input..................................................................................................741 tcpip_adapter_sta_start..................................................................................................741 tcpip_adapter_start.........................................................................................................741 tcpip_adapter_stop.........................................................................................................742 tcpip_adapter_up............................................................................................................742 mdns...................................................................................................................................743 mdns_free.......................................................................................................................743 mdns_init........................................................................................................................743 mdns_query....................................................................................................................743 mdns_query_end............................................................................................................744 mdns_result_free............................................................................................................744 mdns_result_get.............................................................................................................744 mdns_result_get_count...................................................................................................744 mdns_service_add..........................................................................................................744 mdns_service_instance_set............................................................................................745 mdns_service_port_set...................................................................................................745 mdns_service_remove....................................................................................................745 mdns_service_remove_all..............................................................................................746 mdns_service_txt_set.....................................................................................................746 mdns_set_hostname......................................................................................................746 mdns_set_instance.........................................................................................................746 OTA.....................................................................................................................................747 esp_ota_begin................................................................................................................747 esp_ota_end...................................................................................................................747 esp_ota_get_boot_partition............................................................................................748 esp_ota_set_boot_partition.............................................................................................748 esp_ota_write.................................................................................................................748 GPIO Driver.........................................................................................................................749 gpio_config.....................................................................................................................749 Page 26 gpio_get_level.................................................................................................................750 gpio_install_isr_service...................................................................................................751 gpio_intr_enable.............................................................................................................751 gpio_intr_disable.............................................................................................................751 gpio_isr_handler_add.....................................................................................................752 gpio_isr_handler_remove...............................................................................................752 gpio_isr_register.............................................................................................................753 gpio_set_direction...........................................................................................................753 gpio_set_intr_type..........................................................................................................754 gpio_set_level.................................................................................................................755 gpio_set_pull_mode........................................................................................................755 gpio_uninstall_isr_service...............................................................................................756 gpio_wakeup_enable......................................................................................................756 gpio_wakeup_disable.....................................................................................................756 GPIO Low Level..................................................................................................................756 gpio_init..........................................................................................................................756 gpio_input_get................................................................................................................757 gpio_input_get_high.......................................................................................................757 gpio_intr_ack..................................................................................................................757 gpio_intr_ack_high..........................................................................................................757 gpio_intr_handler_register..............................................................................................758 gpio_intr_pending...........................................................................................................758 gpio_intr_pending_high...................................................................................................758 gpio_matrx_in.................................................................................................................758 gpio_matrix_out..............................................................................................................759 gpio_output_set..............................................................................................................759 gpio_output_set_high.....................................................................................................760 gpio_pad_hold................................................................................................................760 gpio_pad_pulldown.........................................................................................................760 gpio_pad_pullup.............................................................................................................760 gpio_pad_select_gpio.....................................................................................................761 gpio_pad_set_drv...........................................................................................................761 gpio_pad_unhold............................................................................................................761 gpio_pin_wakeup_disable...............................................................................................761 gpio_pin_wakeup_enable...............................................................................................762 GPIO RTC...........................................................................................................................762 rtc_gpio_init....................................................................................................................762 rtc_gpio_deinit................................................................................................................762 rtc_gpio_get_level...........................................................................................................762 rtc_gpio_set_level...........................................................................................................762 rtc_gpio_set_direction.....................................................................................................762 rtc_gpio_pullup_en.........................................................................................................762 Page 27 rtc_gpio_pulldown_en.....................................................................................................762 rtc_gpio_pullup_dis.........................................................................................................762 Analog to Digital Conversion...............................................................................................762 adc1_config_channel_atten............................................................................................763 adc1_config_width..........................................................................................................763 adc1_get_voltage...........................................................................................................764 hall_sensor_read............................................................................................................764 UART driver API..................................................................................................................764 uart_clear_intr_status.....................................................................................................764 uart_disable_intr_mask...................................................................................................764 uart_driver_delete...........................................................................................................765 uart_driver_install...........................................................................................................765 uart_disable_intr_mask...................................................................................................766 uart_disable_pattern_det_intr.........................................................................................767 uart_disable_rx_intr........................................................................................................767 uart_disable_tx_intr........................................................................................................767 uart_enable_intr_mask...................................................................................................767 uart_enable_pattern_det_intr..........................................................................................768 uart_enable_rx_intr.........................................................................................................768 uart_enable_tx_intr.........................................................................................................768 uart_flush........................................................................................................................769 uart_get_baudrate..........................................................................................................769 uart_get_buffered_data_len............................................................................................769 uart_get_hw_flow_ctrl.....................................................................................................770 uart_get_parity................................................................................................................770 uart_get_stop_bits..........................................................................................................771 uart_get_word_length.....................................................................................................771 uart_intr_config...............................................................................................................771 uart_isr_free....................................................................................................................773 uart_isr_register..............................................................................................................773 uart_param_config..........................................................................................................773 uart_read_bytes..............................................................................................................774 uart_set_baudrate...........................................................................................................774 uart_set_dtr....................................................................................................................775 uart_set_hw_flow_ctrl.....................................................................................................775 uart_set_line_inverse......................................................................................................776 uart_set_parity................................................................................................................776 uart_set_pin....................................................................................................................776 uart_set_rts.....................................................................................................................777 uart_set_stop_bits..........................................................................................................777 uart_set_word_length.....................................................................................................778 uart_tx_chars..................................................................................................................778 uart_wait_tx_done..........................................................................................................779 uart_write_bytes.............................................................................................................779 Page 28 uart_write_bytes_with_break..........................................................................................780 UART low level APIs............................................................................................................780 uartAttach.......................................................................................................................780 Uart_Init..........................................................................................................................780 uart_div_modify..............................................................................................................781 uart_buff_switch..............................................................................................................781 uart_tx_switch.................................................................................................................781 uart_baudrate_detect......................................................................................................781 uart_rx_one_char............................................................................................................781 uart_tx_wait_idle.............................................................................................................781 uart_tx_flush...................................................................................................................781 uart_tx_one_char............................................................................................................781 uart_tx_one_char2..........................................................................................................781 I2C APIs..............................................................................................................................781 i2c_cmd_link_create.......................................................................................................782 i2c_cmd_link_delete.......................................................................................................782 i2c_driver_delete............................................................................................................782 i2c_driver_install.............................................................................................................783 i2c_get_data_mode........................................................................................................783 i2c_get_data_timing........................................................................................................784 i2s_get_period................................................................................................................784 i2c_get_start_timing........................................................................................................784 i2c_get_stop_timing........................................................................................................785 i2c_isr_free.....................................................................................................................785 i2c_isr_register...............................................................................................................785 i2c_master_cmd_begin...................................................................................................786 i2c_master_read.............................................................................................................786 i2c_master_read_byte....................................................................................................787 i2c_master_start.............................................................................................................787 i2c_master_stop.............................................................................................................788 i2c_master_write.............................................................................................................788 i2c_master_write_byte....................................................................................................789 i2c_param_config...........................................................................................................789 i2c_reset_rx_fifo.............................................................................................................790 i2c_reset_tx_fifo..............................................................................................................790 i2c_set_data_mode........................................................................................................790 i2c_set_data_timing........................................................................................................791 i2c_set_period................................................................................................................791 i2c_set_pin.....................................................................................................................792 i2c_set_start_timing........................................................................................................792 i2c_set_stop_timing........................................................................................................792 i2c_slave_read_buffer.....................................................................................................793 Page 29 i2c_slave_write_buffer....................................................................................................793 SPI APIs..............................................................................................................................793 spi_bus_add_device.......................................................................................................793 spi_bus_free...................................................................................................................795 spi_bus_initialize.............................................................................................................795 spi_bus_remove_device.................................................................................................796 spi_device_get_trans_result...........................................................................................797 spi_device_queue_trans.................................................................................................797 spi_device_transmit........................................................................................................798 I2S APIs..............................................................................................................................800 i2s_driver_install.............................................................................................................800 i2s_driver_uninstall.........................................................................................................800 i2s_pop_sample..............................................................................................................800 i2s_push_sample............................................................................................................800 i2s_read_bytes...............................................................................................................800 i2s_set_pin.....................................................................................................................800 i2s_set_sample_rates.....................................................................................................800 i2s_start..........................................................................................................................801 i2s_stop..........................................................................................................................801 i2s_write_bytes...............................................................................................................801 i2s_zero_dma_buffer......................................................................................................801 RMT APIs............................................................................................................................801 rmt_clr_intr_enable_mask...............................................................................................801 rmt_config.......................................................................................................................801 rmt_driver_install............................................................................................................803 rmt_driver_uninstall........................................................................................................803 rmt_fill_tx_items..............................................................................................................803 rmt_get_clk_div...............................................................................................................804 rmt_get_mem_block_num..............................................................................................804 rmt_get_mem_pd............................................................................................................804 rmt_get_memory_owner.................................................................................................805 rmt_get_ringbuf_handle..................................................................................................805 rmt_get_rx_idle_thresh...................................................................................................805 rmt_get_status................................................................................................................806 rmt_get_source_clk........................................................................................................806 rmt_get_tx_loop_mode...................................................................................................806 rmt_isr_deregister...........................................................................................................807 rmt_isr_register...............................................................................................................807 rmt_memory_rw_rst........................................................................................................808 rmt_rx_start....................................................................................................................808 rmt_rx_stop.....................................................................................................................808 rmt_set_clk_div...............................................................................................................808 rmt_set_err_intr_en........................................................................................................809 rmt_set_idle_level...........................................................................................................809 Page 30 rmt_set_intr_enable_mask..............................................................................................809 rmt_set_mem_block_num...............................................................................................810 rmt_set_mem_pd............................................................................................................810 rmt_set_memory_owner.................................................................................................810 rmt_set_pin.....................................................................................................................810 rmt_set_rx_filter..............................................................................................................811 rmt_set_rx_idle_thresh....................................................................................................811 rmt_set_rx_intr_en..........................................................................................................812 rmt_set_tx_carrier...........................................................................................................812 rmt_set_tx_intr_en..........................................................................................................812 rmt_set_tx_loop_mode...................................................................................................812 rmt_set_tx_thr_intr_en....................................................................................................813 rmt_set_source_clk.........................................................................................................813 rmt_tx_start.....................................................................................................................813 rmt_tx_stop.....................................................................................................................814 rmt_wait_tx_done...........................................................................................................814 rmt_write_items..............................................................................................................814 LEDC/PWM APIs.................................................................................................................815 ledc_bind_channel_timer................................................................................................815 ledc_channel_config.......................................................................................................815 ledc_fade_func_install....................................................................................................816 ledc_fade_start...............................................................................................................816 ledc_fade_func_uninstall................................................................................................816 ledc_get_duty.................................................................................................................817 ledc_get_freq..................................................................................................................817 ledc_set_duty..................................................................................................................817 ledc_isr_register.............................................................................................................818 ledc_set_fade.................................................................................................................818 ledc_set_fade_with_step................................................................................................819 ledc_set_fade_with_time................................................................................................819 ledc_set_freq..................................................................................................................820 ledc_stop........................................................................................................................820 ledc_timer_config............................................................................................................820 ledc_timer_pause...........................................................................................................821 ledc_timer_resume.........................................................................................................822 ledc_timer_rst.................................................................................................................822 ledc_timer_set................................................................................................................822 ledc_update_duty...........................................................................................................823 Pulse Counter......................................................................................................................823 pcnt_counter_clear.........................................................................................................823 pcnt_counter_pause.......................................................................................................823 pcnt_counter_resume.....................................................................................................823 Page 31 pcnt_event_disable.........................................................................................................824 pcnt_event_enable.........................................................................................................824 pcnt_filter_enable...........................................................................................................824 pcnt_filter_disable...........................................................................................................824 pcnt_get_counter_value..................................................................................................824 pcnt_get_event_value.....................................................................................................824 pcnt_get_filter_value.......................................................................................................824 pcnt_intr_enable.............................................................................................................824 pcnt_intr_disable.............................................................................................................825 pcnt_isr_register.............................................................................................................825 pcnt_set_event_value.....................................................................................................825 pcnt_set_filter_value.......................................................................................................825 pcnt_set_mode...............................................................................................................825 pcnt_set_pin...................................................................................................................825 pcnt_uint_config..............................................................................................................825 Logging...............................................................................................................................826 esp_log_level_set...........................................................................................................826 esp_log_set_vprintf.........................................................................................................826 esp_log_write..................................................................................................................827 Non Volatile Storage............................................................................................................827 nvs_close........................................................................................................................828 nvs_commit....................................................................................................................828 nvs_erase_all..................................................................................................................828 nvs_erase_key................................................................................................................829 nvs_flash_init..................................................................................................................829 nvs_flash_init_custom.....................................................................................................829 nvs_get_blob..................................................................................................................829 nvs_get_str.....................................................................................................................830 nvs_get_i8......................................................................................................................830 nvs_get_i16....................................................................................................................831 nvs_get_i32....................................................................................................................831 nvs_get_i64....................................................................................................................832 nvs_get_u8.....................................................................................................................832 nvs_get_u16...................................................................................................................832 nvs_get_u32...................................................................................................................833 nvs_get_u64...................................................................................................................833 nvs_open........................................................................................................................833 nvs_set_blob...................................................................................................................834 nvs_set_str.....................................................................................................................834 nvs_set_i8......................................................................................................................835 nvs_set_i16....................................................................................................................835 nvs_set_i32....................................................................................................................835 nvs_set_i64....................................................................................................................836 nvs_set_u8.....................................................................................................................836 Page 32 nvs_set_u16...................................................................................................................836 nvs_set_u32...................................................................................................................837 nvs_set_u64...................................................................................................................837 Partition API........................................................................................................................837 esp_partition_erase_range.............................................................................................837 esp_partition_find...........................................................................................................838 esp_partition_find_first....................................................................................................839 esp_partition_get............................................................................................................840 esp_partition_iterator_release........................................................................................841 esp_partition_mmap.......................................................................................................841 esp_partition_next..........................................................................................................842 esp_partition_read..........................................................................................................842 esp_partition_write..........................................................................................................842 Virtual File System..............................................................................................................843 esp_vfs_dev_uart_register..............................................................................................843 esp_vfs_dev_uart_set_rx_line_endings..........................................................................843 esp_vfs_dev_uart_set_tx_line_endings..........................................................................843 esp_vfs_dev_uart_use_nonblocking...............................................................................844 esp_vfs_dev_uart_use_driver.........................................................................................844 esp_vfs_spiffs_register...................................................................................................844 esp_vfs_spiffs_unregister...............................................................................................844 esp_vfs_register.............................................................................................................845 FatFs file system.................................................................................................................849 esp_vfs_fat_register.......................................................................................................849 esp_vfs_fat_sdmmc_mount............................................................................................849 esp_vfs_fat_sdmmc_unmount........................................................................................851 esp_vfs_fat_spiflash_mount...........................................................................................851 esp_vfs_fat_spiflash_unmount.......................................................................................853 esp_vfs_fat_unregister....................................................................................................853 esp_vfs_fat_unregister_path...........................................................................................853 f_mount...........................................................................................................................854 ff_diskio_register.............................................................................................................854 SPI Flash.............................................................................................................................854 spi_flash_erase_range....................................................................................................855 spi_flash_erase_sector...................................................................................................855 spi_flash_get_chip_size..................................................................................................855 spi_flash_get_counters...................................................................................................856 spi_flash_init...................................................................................................................856 spi_flash_mmap..............................................................................................................856 spi_flash_mmap_dump...................................................................................................857 spi_flash_munmap..........................................................................................................857 spi_flash_read................................................................................................................857 Page 33 spi_flash_reset_counters................................................................................................858 spi_flash_write................................................................................................................858 SDMMC...............................................................................................................................858 sdmmc_card_init.............................................................................................................858 sdmmc_card_print_info...................................................................................................858 sdmmc_host_deinit.........................................................................................................858 sdmmc_host_do_transaction..........................................................................................859 sdmmc_host_init.............................................................................................................859 sdmmc_host_init_slot.....................................................................................................859 sdmmc_host_set_bus_width...........................................................................................859 sdmmc_host_set_card_clk.............................................................................................859 sdmmc_read_sectors......................................................................................................860 sdmmc_write_sectors.....................................................................................................860 Cryptography.......................................................................................................................860 esp_sha..........................................................................................................................860 esp_sha_block................................................................................................................861 esp_sha_lock_engine.....................................................................................................861 esp_sha_lock_memory_block.........................................................................................861 esp_sha_read_digest_state............................................................................................861 esp_sha_try_lock_engine...............................................................................................861 esp_sha_unlock_engine.................................................................................................861 esp_sha_wait_idle..........................................................................................................861 Hardware Timers.................................................................................................................861 timer_disable_intr...........................................................................................................861 timer_enable_intr............................................................................................................862 timer_get_alarm_value...................................................................................................862 timer_get_config.............................................................................................................863 timer_get_counter_time_sec...........................................................................................863 timer_get_counter_value................................................................................................864 timer_group_intr_enable.................................................................................................864 timer_group_intr_disable................................................................................................865 timer_isr_register............................................................................................................865 timer_init.........................................................................................................................865 timer_pause....................................................................................................................866 timer_set_counter_value.................................................................................................866 timer_start.......................................................................................................................867 timer_set_alarm..............................................................................................................867 timer_set_alarm_value....................................................................................................868 timer_set_auto_reload....................................................................................................868 timer_set_counter_mode................................................................................................869 timer_set_divider............................................................................................................869 Pthreads..............................................................................................................................870 esp_pthread_init.............................................................................................................870 pthread_cancel...............................................................................................................870 Page 34 pthread_create................................................................................................................870 pthread_cond_broadcast................................................................................................871 pthread_cond_destroy....................................................................................................871 pthread_cond_init...........................................................................................................871 pthread_cond_signal......................................................................................................871 pthread_cond_timedwait.................................................................................................871 pthread_cond_wait.........................................................................................................872 pthread_condattr_init......................................................................................................872 pthread_detach...............................................................................................................872 pthread_equal.................................................................................................................872 pthread_getspecific.........................................................................................................872 pthread_join....................................................................................................................873 pthread_key_create........................................................................................................873 pthread_key_delete........................................................................................................873 pthread_once..................................................................................................................873 pthread_mutex_destroy..................................................................................................874 pthread_mutex_init.........................................................................................................874 pthread_mutexattr_destroy.............................................................................................874 pthread_mutexattr_gettype.............................................................................................875 pthread_mutexattr_init....................................................................................................875 pthread_mutexattr_settype.............................................................................................875 pthread_mutex_lock.......................................................................................................876 pthread_mutex_trylock....................................................................................................876 pthread_mutex_unlock....................................................................................................876 pthread_self....................................................................................................................876 pthread_setspecific.........................................................................................................877 sched_yield.....................................................................................................................877 Watchdog processing..........................................................................................................877 esp_int_wdt_init..............................................................................................................878 esp_task_wdt_init...........................................................................................................878 esp_task_wdt_feed.........................................................................................................878 esp_task_wdt_delete......................................................................................................878 Heap management..............................................................................................................879 heap_trace_record_t.......................................................................................................879 heap_caps_malloc..........................................................................................................879 heap_caps_check_integrity............................................................................................879 heap_caps_check_integrity_addr...................................................................................880 heap_caps_check_integrity_all.......................................................................................880 heap_caps_dump...........................................................................................................881 heap_caps_dump_all......................................................................................................881 heap_caps_free..............................................................................................................881 heap_caps_realloc..........................................................................................................881 Page 35 heap_caps_get_free_size...............................................................................................882 heap_caps_get_minimum_free_size..............................................................................882 heap_caps_get_largest_free_block................................................................................882 heap_caps_get_info.......................................................................................................883 heap_caps_print_heap_info............................................................................................883 heap_trace_dump...........................................................................................................883 heap_trace_get...............................................................................................................884 heap_trace_get_count....................................................................................................884 heap_trace_init_standalone............................................................................................885 heap_trace_resume........................................................................................................885 heap_trace_start.............................................................................................................885 heap_trace_stop.............................................................................................................886 ULP Co-processor...............................................................................................................886 RTC_SLOW_MEM..........................................................................................................886 ulp_process_macros_and_load......................................................................................886 ulp_load_binary..............................................................................................................887 ulp_run............................................................................................................................887 ulp_set_wakeup_period..................................................................................................888 AWS-IoT..............................................................................................................................888 aws_iot_is_autoreconnect_enabled................................................................................888 aws_iot_mqtt_attempt_reconnect...................................................................................888 aws_iot_mqtt_autoreconnect_set_status........................................................................888 aws_iot_mqtt_connect....................................................................................................888 aws_iot_mqtt_disconnect................................................................................................889 aws_iot_mqtt_get_client_state........................................................................................889 aws_iot_mqtt_get_network_disconnected_count............................................................890 aws_iot_mqtt_get_next_packet_id..................................................................................890 aws_iot_mqtt_init............................................................................................................890 aws_iot_mqtt_is_client_connected.................................................................................891 aws_iot_mqtt_publish.....................................................................................................891 aws_iot_mqtt_reset_network_disconnected_count.........................................................892 aws_iot_mqtt_resubscribe..............................................................................................892 aws_iot_mqtt_set_connect_params................................................................................892 aws_iot_mqtt_set_disconnect_handler...........................................................................893 aws_iot_mqtt_subscribe.................................................................................................893 aws_iot_mqtt_unsubscribe.............................................................................................894 aws_iot_mqtt_yield.........................................................................................................894 JSON processing................................................................................................................894 HTTP/2 processing..............................................................................................................896 Parsing XML – expat...........................................................................................................896 Arduino – ESP32 HAL for UART.........................................................................................897 uartAvailable...................................................................................................................897 uartBegin........................................................................................................................897 uartEnd...........................................................................................................................898 Page 36 uartFlush.........................................................................................................................898 uartGetBaudRate............................................................................................................898 uartGetDebug.................................................................................................................898 uartPeek.........................................................................................................................899 uartRead.........................................................................................................................899 uartSetBaudRate............................................................................................................899 uartSetDebug..................................................................................................................899 uartWrite.........................................................................................................................900 uartWriteBuf....................................................................................................................900 Arduino – ESP32 HAL for I2C.............................................................................................900 i2cAttachSCL..................................................................................................................900 i2cAttachSDA..................................................................................................................900 i2cDetachSCL.................................................................................................................901 i2cDetachSDA................................................................................................................901 i2cGetFrequency............................................................................................................901 i2cInit..............................................................................................................................901 i2cRead..........................................................................................................................901 i2cSetFrequency.............................................................................................................902 i2cWrite...........................................................................................................................902 Arduino – ESP32 HAL for SPI.............................................................................................902 spiAttachMISO................................................................................................................902 spiAttachMOSI................................................................................................................902 spiAttachSCK..................................................................................................................903 spiAttachSS....................................................................................................................903 spiClockDivToFrequency................................................................................................903 spiDetachMISO...............................................................................................................903 spiDetachMOSI...............................................................................................................903 spiDetachSCK................................................................................................................903 spiDetachSS...................................................................................................................903 spiDisableSSPins...........................................................................................................904 spiEnableSSPins............................................................................................................904 spiFrequencyToClockDiv................................................................................................904 spiGetBitOrder................................................................................................................904 spiGetClockDiv...............................................................................................................904 spiGetDataMode.............................................................................................................904 spiRead..........................................................................................................................905 spiReadByte...................................................................................................................905 spiReadLong...................................................................................................................905 spiReadWord..................................................................................................................905 spiSetBitOrder................................................................................................................905 spiSetClockDiv................................................................................................................905 spiSetDataMode.............................................................................................................906 Page 37 spiSSClear......................................................................................................................906 spiSSDisable..................................................................................................................906 spiSSEnable...................................................................................................................906 spiSSSet.........................................................................................................................906 spiStartBus.....................................................................................................................906 spiStopBus.....................................................................................................................907 spiTransferBits................................................................................................................907 spiTransferBytes.............................................................................................................908 spiWaitReady..................................................................................................................908 spiWrite...........................................................................................................................908 spiWriteByte....................................................................................................................908 spiWriteLong...................................................................................................................908 spiWriteWord..................................................................................................................909 Newlib.................................................................................................................................909 abort...............................................................................................................................909 abs..................................................................................................................................909 asctime...........................................................................................................................910 atoi..................................................................................................................................910 atol..................................................................................................................................910 bzero...............................................................................................................................911 calloc...............................................................................................................................911 check_pos.......................................................................................................................911 close...............................................................................................................................911 creat................................................................................................................................911 ctime...............................................................................................................................912 div...................................................................................................................................912 environ............................................................................................................................912 fclose..............................................................................................................................913 fflush...............................................................................................................................913 fmemopen.......................................................................................................................913 fprintf...............................................................................................................................913 fread...............................................................................................................................914 free.................................................................................................................................914 fscanf..............................................................................................................................914 fseek...............................................................................................................................915 fstat.................................................................................................................................915 fwrite...............................................................................................................................915 gettimeofday...................................................................................................................915 gmtime............................................................................................................................916 isalnum...........................................................................................................................916 isalpha............................................................................................................................917 isascii..............................................................................................................................917 isblank............................................................................................................................917 isdigit..............................................................................................................................917 Page 38 islower............................................................................................................................918 isprint..............................................................................................................................918 ispunct............................................................................................................................918 isspace...........................................................................................................................918 isupper............................................................................................................................918 itoa..................................................................................................................................919 labs.................................................................................................................................919 ldiv..................................................................................................................................919 localtime.........................................................................................................................919 lseek...............................................................................................................................920 malloc.............................................................................................................................920 memchr...........................................................................................................................920 memcmp.........................................................................................................................920 memcpy..........................................................................................................................921 memmove.......................................................................................................................921 memrchr.........................................................................................................................921 memset...........................................................................................................................922 mkdir...............................................................................................................................922 mktime............................................................................................................................922 open................................................................................................................................922 open_memstream...........................................................................................................923 printf................................................................................................................................924 qsort................................................................................................................................924 rand................................................................................................................................924 read................................................................................................................................925 readdir............................................................................................................................925 realloc.............................................................................................................................925 scanf...............................................................................................................................925 setenv.............................................................................................................................925 setlocale.........................................................................................................................926 settimeofday...................................................................................................................926 sprintf..............................................................................................................................926 srand...............................................................................................................................926 sscanf.............................................................................................................................926 stat..................................................................................................................................927 strcasecmp.....................................................................................................................927 strcasestr........................................................................................................................927 strcat...............................................................................................................................927 strchr...............................................................................................................................927 strcmp.............................................................................................................................928 strcoll..............................................................................................................................928 strcpy..............................................................................................................................928 Page 39 strcspn............................................................................................................................928 strdup..............................................................................................................................928 strerror............................................................................................................................929 strftime............................................................................................................................929 strlcat..............................................................................................................................929 strlcpy.............................................................................................................................929 strlen...............................................................................................................................930 strncasecmp...................................................................................................................930 strncat.............................................................................................................................930 strncmp...........................................................................................................................930 strncpy............................................................................................................................930 strndup............................................................................................................................930 strnlen.............................................................................................................................931 strrchr.............................................................................................................................931 strsep..............................................................................................................................931 strspn..............................................................................................................................931 strstr................................................................................................................................931 strtod...............................................................................................................................931 strtof................................................................................................................................931 strtol................................................................................................................................932 strtoul..............................................................................................................................932 strupr..............................................................................................................................932 time.................................................................................................................................932 times...............................................................................................................................932 toascii.............................................................................................................................933 tolower............................................................................................................................933 toupper...........................................................................................................................933 tzset................................................................................................................................933 ungetc.............................................................................................................................934 unlink..............................................................................................................................934 utoa.................................................................................................................................934 vprintf..............................................................................................................................934 vscanf.............................................................................................................................934 write................................................................................................................................935 SPIFFs API..........................................................................................................................935 esp_spiffs_format...........................................................................................................935 esp_spiffs_info................................................................................................................935 esp_spiffs_mounted........................................................................................................936 SPIFFS_check................................................................................................................936 SPIFFS_clearerr.............................................................................................................936 SPIFFS_close.................................................................................................................936 SPIFFS_closedir.............................................................................................................936 SPIFFS_creat.................................................................................................................937 SPIFFS_eof....................................................................................................................937 Page 40 SPIFFS_errno.................................................................................................................937 SPIFFS_fflush.................................................................................................................939 SPIFFS_format...............................................................................................................939 SPIFFS_fremove............................................................................................................939 SPIFFS_fstat..................................................................................................................939 SPIFFS_gc.....................................................................................................................940 SPIFFS_gc_quick...........................................................................................................940 SPIFFS_info...................................................................................................................940 SPIFFS_lseek.................................................................................................................941 SPIFFS_mount...............................................................................................................941 SPIFFS_mounted...........................................................................................................942 SPIFFS_open.................................................................................................................942 SPIFFS_open_by_dirent.................................................................................................943 SPIFFS_open_by_page..................................................................................................943 SPIFFS_opendir.............................................................................................................944 SPIFFS_read..................................................................................................................944 SPIFFS_readdir..............................................................................................................944 SPIFFS_remove.............................................................................................................945 SPIFFS_rename.............................................................................................................945 SPIFFS_stat...................................................................................................................945 SPIFFS_tell.....................................................................................................................946 SPIFFS_unmount...........................................................................................................946 SPIFFS_write..................................................................................................................946 Eclipse Paho – MQTT Embedded C....................................................................................947 MQTTClientInit................................................................................................................947 MQTTConnect................................................................................................................947 MQTTDisconnect............................................................................................................948 MQTTPublish..................................................................................................................949 MQTTRun.......................................................................................................................949 MQTTSubscribe..............................................................................................................949 MQTTUnsubscribe..........................................................................................................950 MQTTYield......................................................................................................................950 NetworkConnect.............................................................................................................950 Arduino ESP32 Libraries.....................................................................................................950 Arduino WiFi library........................................................................................................950 WiFi.begin..................................................................................................................951 WiFi.beingSmartConfig..............................................................................................952 WiFi.beginWPSConfig................................................................................................952 WiFi.BSSID................................................................................................................952 WiFi.BSSIDstr............................................................................................................952 WiFi.channel..............................................................................................................952 WiFi.config.................................................................................................................953 Page 41 WiFi.disconnect..........................................................................................................953 WiFi.dnsIP..................................................................................................................953 WiFi.enableAP...........................................................................................................953 WiFi.enableSTA.........................................................................................................953 WiFi.encryptionType...................................................................................................953 WiFi.gatewayIP..........................................................................................................954 WiFi.getAutoConnect.................................................................................................954 WiFi.getMode.............................................................................................................954 WiFi.getNetworkInfo...................................................................................................954 WiFi.hostByName......................................................................................................955 WiFi.hostname...........................................................................................................955 WiFi.isConnected.......................................................................................................955 WiFi.isHidden.............................................................................................................955 WiFi.localIP................................................................................................................955 WiFi.macAddress.......................................................................................................956 WiFi.mode..................................................................................................................956 Wifi.persistent.............................................................................................................956 WiFi.printDiag.............................................................................................................957 WiFi.psk.....................................................................................................................957 WiFi.RSSI...................................................................................................................957 WiFi.scanComplete....................................................................................................957 WiFi.scanDelete.........................................................................................................958 WiFi.scanNetworks.....................................................................................................958 WiFi.setAutoConnect..................................................................................................959 WiFi.setAutoReconnect..............................................................................................959 WiFi.smartConfigDone...............................................................................................959 WiFi.softAP................................................................................................................959 WiFi.softAPConfig......................................................................................................959 WiFi.softAPdisconnect...............................................................................................959 WiFi.softAPmacAddress.............................................................................................960 WiFi.softAPIP.............................................................................................................960 WiFi.SSID...................................................................................................................960 WiFi.status.................................................................................................................960 WiFi.stopSmartConfig................................................................................................961 WiFi.subnetMask........................................................................................................961 WiFi.waitForConnectResult........................................................................................961 Arduino WiFiClient..........................................................................................................962 WiFiClient...................................................................................................................962 WiFiClient.available....................................................................................................962 WiFiClient.connect.....................................................................................................962 WiFiClient.connected.................................................................................................962 WiFiClient.flush..........................................................................................................962 WiFiClient.getNoDelay...............................................................................................962 WiFiClient.peek..........................................................................................................963 Page 42 WiFiClient.read...........................................................................................................963 WiFiClient.remoteIP...................................................................................................963 WiFiClient.remotePort................................................................................................963 WiFiClient.setLocalPortStart......................................................................................963 WiFiClient.setNoDelay...............................................................................................963 WiFiClient.setOption...................................................................................................963 WiFiClient.status........................................................................................................964 WiFiClient.stop...........................................................................................................964 WiFiClient.stopAll.......................................................................................................964 WiFiClient.write..........................................................................................................964 Arduino WiFiServer.........................................................................................................964 WiFiServer.................................................................................................................964 WiFiServer.available...................................................................................................964 WiFiServer.begin........................................................................................................965 WiFiServer.getNoDelay..............................................................................................965 WiFiServer.hasClient..................................................................................................965 WiFiServer.setNoDelay..............................................................................................965 WiFiServer.status.......................................................................................................965 WiFiServer.write.........................................................................................................965 Arduino IPAddress..........................................................................................................965 Arduino SPI....................................................................................................................966 SPI.begin...................................................................................................................966 SPI.beginTransaction.................................................................................................966 SPI.end......................................................................................................................966 SPI.endTransaction....................................................................................................966 SPI.setBitOrder..........................................................................................................966 SPI.setClockDivider....................................................................................................966 SPI.setDataMode.......................................................................................................967 SPI.setFrequency.......................................................................................................967 SPI.setHwC................................................................................................................967 SPI.transfer................................................................................................................967 SPI.transfer16............................................................................................................967 SPI.transfer32............................................................................................................967 SPI.transferBytes.......................................................................................................967 SPI.transferBits..........................................................................................................967 SPI.write.....................................................................................................................967 SPI.wirite16................................................................................................................968 SPI.write32.................................................................................................................968 SPI.writeBytes............................................................................................................968 SPI.writePattern.........................................................................................................968 Arduino I2C – Wire.........................................................................................................968 Wire.available.............................................................................................................969 Page 43 Wire.begin..................................................................................................................969 Wire.beginTransmission.............................................................................................969 Wire.endTransmission................................................................................................970 Wire.flush...................................................................................................................970 Wire.onReceive..........................................................................................................970 Wire.onReceiveService..............................................................................................970 Wire.onRequest.........................................................................................................970 Wire.onRequestService..............................................................................................971 Wire.peek...................................................................................................................971 Wire.pins....................................................................................................................971 Wire.read...................................................................................................................971 Wire.requestFrom......................................................................................................972 Wire.setClock.............................................................................................................972 Wire.write...................................................................................................................972 Arduino Ticker library......................................................................................................972 Ticker.........................................................................................................................973 attach.........................................................................................................................973 attach_ms..................................................................................................................973 detach........................................................................................................................974 once...........................................................................................................................974 once_ms....................................................................................................................974 Arduino EEPROM library................................................................................................974 EEPROM.begin..........................................................................................................974 EEPROM.commit.......................................................................................................975 EEPROM.end.............................................................................................................975 EEPROM.get..............................................................................................................975 EEPROM.getDataPtr..................................................................................................975 EEPROM.put..............................................................................................................975 EEPROM.read...........................................................................................................975 EEPROM.write...........................................................................................................975 Arduino SPIFFS..............................................................................................................976 SPIFFS.begin.............................................................................................................976 SPIFFS.open..............................................................................................................976 SPIFFS.openDir.........................................................................................................976 SPIFFS.remove..........................................................................................................976 SPIFFS.rename.........................................................................................................977 File.available..............................................................................................................977 File.close....................................................................................................................977 File.flush.....................................................................................................................977 File.name...................................................................................................................977 File.peek....................................................................................................................977 File.position................................................................................................................977 File.read.....................................................................................................................978 File.seek.....................................................................................................................978 Page 44 File.size......................................................................................................................978 File.write.....................................................................................................................978 Dir.fileName................................................................................................................978 Dir.next.......................................................................................................................979 Dir.open......................................................................................................................979 Dir.openDir.................................................................................................................979 Dir.remove..................................................................................................................979 Dir.rename..................................................................................................................979 Arduino ESP library.........................................................................................................979 ESP.eraseConfig........................................................................................................979 ESP.getChipId............................................................................................................979 ESP.getCpuFreqMHz.................................................................................................979 ESP.getCycleCount....................................................................................................979 ESP.getFlashChipMode.............................................................................................979 ESP.getFlashChipSize...............................................................................................980 ESP.getFlashChipSpeed............................................................................................980 ESP.getFreeHeap.......................................................................................................980 ESP.getOption............................................................................................................980 ESP.getSdkVersion....................................................................................................980 ESP.flashEraseSector................................................................................................980 ESP.flashRead...........................................................................................................980 ESP.flashWrite............................................................................................................980 ESP.magicFlashChipSize...........................................................................................980 ESP.magicFlashChipSpeed........................................................................................980 ESP.restart.................................................................................................................980 Arduino String library......................................................................................................981 Constructor.................................................................................................................981 String.c_str.................................................................................................................981 String.reserve.............................................................................................................981 String.length...............................................................................................................981 String.concat..............................................................................................................981 String.equalsIgnoreCase............................................................................................982 String.startsWith.........................................................................................................982 String.endsWith..........................................................................................................982 String.charAt..............................................................................................................982 String.setCharAt.........................................................................................................982 String.getBytes...........................................................................................................982 String toCharArray.....................................................................................................982 String.indexOf............................................................................................................982 String.lastIndexOf.......................................................................................................982 String.substring..........................................................................................................982 String.replace.............................................................................................................983 Page 45 String.remove.............................................................................................................983 String.toLowerCase....................................................................................................983 String.toUpperCase....................................................................................................983 String.trim...................................................................................................................983 String.toInt..................................................................................................................983 String.toFloat..............................................................................................................983 Reference materials.................................................................................................................983 Internal structure of compiled code......................................................................................983 Using size.......................................................................................................................985 Using objdump................................................................................................................986 Using objcopy.................................................................................................................986 Using nm........................................................................................................................986 Linking............................................................................................................................987 Linker scripts..............................................................................................................988 Weak linkage..............................................................................................................990 Memory Map..............................................................................................................990 The Bootloader....................................................................................................................996 Runtime memory.................................................................................................................998 Cache memory processing...........................................................................................1000 MMU processing...........................................................................................................1000 C Programming.............................................................................................................1003 Eclipse configuration.....................................................................................................1003 Simple class definition..................................................................................................1004 Mixing C and C .........................................................................................................1005 Including stdc in your app.........................................................................................1006 C Specialized Data types..........................................................................................1006 String........................................................................................................................1006 List...........................................................................................................................1007 Map..........................................................................................................................1007 Queue......................................................................................................................1008 Stack........................................................................................................................1008 Vector.......................................................................................................................1008 Lambda functions.........................................................................................................1009 Designated initializers not available in C ...................................................................1009 Ignoring warnings.........................................................................................................1009 File I/O in C ...............................................................................................................1009 The Factory pattern......................................................................................................1010 Logging pre-defined symbols........................................................................................1011 The ESP-IDF C class libraries.......................................................................................1011 GPIO interactions..........................................................................................................1011 WiFi..............................................................................................................................1012 Task management........................................................................................................1014 Socket programming.....................................................................................................1014 Socket Server...............................................................................................................1014 Page 46 HttpServer....................................................................................................................1014 WebSocket...............................................................................................................1017 WebSocket File Transfer..........................................................................................1018 Performance.............................................................................................................1019 I2C Interaction..............................................................................................................1020 SPI Interaction..............................................................................................................1020 Pulse Width Modulation – PWM....................................................................................1021 Bluetooth BLE...............................................................................................................1021 A BLE Server............................................................................................................1023 A BLE Client.............................................................................................................1029 Non Volatile Storage.....................................................................................................1034 FAT FS..........................................................................................................................1034 Working with JSON.......................................................................................................1034 POSIX file system APIs.....................................................................................................1035 Documenting your code – Doxygen...................................................................................1036 Creating a build environment on the Raspberry Pi 3.........................................................1037 Windows Subsystem for Linux – WSL...............................................................................1039 Makefiles...........................................................................................................................1041 The component.mk settings..........................................................................................1043 The ESPTOOL protocol.....................................................................................................1045 0x02 – FLASH_BEGIN.................................................................................................1047 0x03 – FLASH_DATA...................................................................................................1048 0x05 – MEM_BEGIN.....................................................................................................1048 0x06 – MEM_END command........................................................................................1049 0x07 – MEM_DATA command......................................................................................1049 0x08 – SYNC command...............................................................................................1049 0x09 – WRITE_REG.....................................................................................................1049 0x0A – READ_REG......................................................................................................1050 The flasher_stub...........................................................................................................1050 Using Node-JS for an esptool.......................................................................................1051 Forums..............................................................................................................................1052 Reference documents.......................................................................................................1052 Github................................................................................................................................1052 Github quick cheats......................................................................................................1052 Installing Ubuntu on VirtualBox..............................................................................................1053 Single board computer comparisons......................................................................................1059 Areas to Research.................................................................................................................1060
标签: Programming编程 ESp32 wi-fi 2018年
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论