Baixe o app para aproveitar ainda mais
Prévia do material em texto
Page 1 Table of Contents Introduction................................................................................................................................51 Important Documentation Notes – ESP8266 and ESP32...........................................................52 Overview....................................................................................................................................52 The ESP32............................................................................................................................53 The ESP32 specification.......................................................................................................54 Modules.................................................................................................................................55 ESP-WROOM-32..............................................................................................................55 ESP32-DevKitC................................................................................................................56 ESP-WROVER-KIT..........................................................................................................58 The SparkFun ESP32 thing..............................................................................................63 Connecting to the ESP32...........................................................................................................64 Assembling circuits....................................................................................................................65 USB to UART converters.......................................................................................................66 Breadboards..........................................................................................................................67 Power....................................................................................................................................68 Multi-meter / Logic probe / Logic Analyzer.............................................................................69 Sundry components..............................................................................................................69 Physical construction.............................................................................................................69 Configuration for flashing the device.....................................................................................70 Programming for ESP32............................................................................................................71 Espressif IoT Development framework..................................................................................71 Application entry point......................................................................................................74 How ESP-IDF works.........................................................................................................75 Error handling...................................................................................................................78 The build environment menu configuration.......................................................................78 Adding a custom ESP-IDF component.............................................................................85 Working with memory.......................................................................................................88 Compiling..............................................................................................................................89 Compilation.......................................................................................................................90 Flashing............................................................................................................................92 Loading a program............................................................................................................94 Programming environments..............................................................................................96 Compilation tools..............................................................................................................96 xntensa-esp32-elf-ar....................................................................................................97 esptool.py.....................................................................................................................98 xtensa-esp32-elf-gcc..................................................................................................100 gen_appbin.py............................................................................................................101 make..........................................................................................................................102 xtensa-esp32-elf-strip.................................................................................................102 xtensa-esp32-elf-nm...................................................................................................102 Page 2 xtensa-esp32-elf-objcopy...........................................................................................103 xtensa-esp32-elf-objdump..........................................................................................103 xxd.............................................................................................................................103 Linking.................................................................................................................................104 Sizes of images..............................................................................................................107 Debugging...........................................................................................................................108 ESP-IDF logging.............................................................................................................108 Exception handling..........................................................................................................111 Address to source line.....................................................................................................112 Core dump processing....................................................................................................112 Using a debugger (GDB).................................................................................................118 OpenOCD and JTAG......................................................................................................119 Using the ESP-WROVER-KIT for JTAG.....................................................................121 Dumping IP Addresses...................................................................................................121 Debugging and testing TCP and UDP connections.........................................................122 Android – Socket Protocol..........................................................................................122 Android – UDP Sender/Receiver................................................................................122 Windows – Hercules...................................................................................................122 SocketTest..................................................................................................................122 Linux – netcat (nc)......................................................................................................122 Curl............................................................................................................................123 Eclipse – TCP/MON...................................................................................................123 httpbin.org..................................................................................................................126RequestBin.................................................................................................................126 tcpdump.....................................................................................................................126 ESP-IDF component debugging.....................................................................................126 LWIP..........................................................................................................................126 Run a Blinky....................................................................................................................126 WiFi subsystem........................................................................................................................127 WiFi Theory.........................................................................................................................127 Initializing the WiFi environment..........................................................................................129 Setting the operation mode.................................................................................................129 Scanning for access points..................................................................................................130 Handling WiFi events..........................................................................................................133 Station configuration............................................................................................................139 Starting up the WiFi environment........................................................................................140 Connecting to an access point............................................................................................140 Being an access point.........................................................................................................143 Working with connected stations.........................................................................................147 WiFi at boot time.................................................................................................................147 The DHCP client..................................................................................................................148 The DHCP server................................................................................................................149 Page 3 Current IP Address, netmask and gateway..........................................................................149 WiFi Protected Setup – WPS..............................................................................................150 Designs for bootstrapping WiFi...........................................................................................150 Working with TCP/IP................................................................................................................151 The Lightweight IP Stack – lwip...........................................................................................152 TCP.....................................................................................................................................153 TCP/IP Sockets...................................................................................................................154 Handling errors...............................................................................................................158 Configuration settings.....................................................................................................161 Using select()..................................................................................................................162 Differences from "standard" sockets...............................................................................163 UDP/IP Sockets...................................................................................................................163 TLS, SSL and security.........................................................................................................164 Keys files........................................................................................................................167 PEM files....................................................................................................................167 mbedTLS client app structure.........................................................................................167 mbedTLS client example................................................................................................170 mbedTLS server app structure.......................................................................................172 mbedTLS Debugging......................................................................................................173 OpenSSL........................................................................................................................174 RSA encryption/decryption..............................................................................................174 Name Service......................................................................................................................175 Multicast Domain Name Systems........................................................................................176 mDNS API programming.................................................................................................177 Installing Bonjour............................................................................................................177 Avahi...............................................................................................................................180 Working with SNTP.............................................................................................................182 Java Sockets.......................................................................................................................183 Bluetooth..................................................................................................................................186 Bluetooth specification........................................................................................................187 Bluetooth UUIDs.............................................................................................................189 Bluetooth GAP................................................................................................................190 Low level packet.........................................................................................................191 GAP Advertizing data.................................................................................................191 Advertisability – limited and general...........................................................................195 Directed advertising....................................................................................................195 Non-connectable advertising......................................................................................195 Filtering devices.........................................................................................................195 Performing a scan......................................................................................................196 Performing advertising...............................................................................................199 Bluetooth GATT..............................................................................................................200 GATT Characteristic...................................................................................................202 Being a GATT client...................................................................................................203 Being a GATT Server.................................................................................................205Page 4 Notifications and indications.......................................................................................205 GATT XML descriptions..............................................................................................206 Service Discovery Protocol.............................................................................................206 ESP32 and Bluetooth..........................................................................................................207 GATT Server – Read request..........................................................................................208 Debugging ESP32 Bluetooth..........................................................................................209 Bluetooth C Programming in Linux......................................................................................209 hci_get_route..................................................................................................................209 hci_open_dev.................................................................................................................209 hci_inquiry......................................................................................................................210 hci_read_remote_name..................................................................................................211 str2ba..............................................................................................................................211 ba2str..............................................................................................................................211 Bluetooth programming in Node.js......................................................................................212 Using Noble....................................................................................................................212 Using Bleno....................................................................................................................217 Bluetooth Audio...................................................................................................................218 Bluetooth RFCOMM............................................................................................................219 Bluetooth tools.....................................................................................................................221 l2ping..............................................................................................................................221 rfcomm............................................................................................................................221 bluetoothctl.....................................................................................................................222 hciconfig.........................................................................................................................223 hcidump..........................................................................................................................224 hcitool.............................................................................................................................224 gatttool............................................................................................................................225 Bluetooth examples.............................................................................................................226 The iTag peripheral.........................................................................................................226 Smart Watch / The TW64 Band......................................................................................228 Web Bluetooth.....................................................................................................................230 The Physical Web...............................................................................................................237 BLE beacons.......................................................................................................................237 Hardware interfacing................................................................................................................237 GPIOs.................................................................................................................................238 Pull up and pull down settings........................................................................................240 GPIO Interrupt handling..................................................................................................240 Expanding the number of available GPIOs.....................................................................244 PCF8574....................................................................................................................244 PCF8575....................................................................................................................248 MCP23017.................................................................................................................249 Interrupt Service Routines – ISRs.......................................................................................254 Working with I2C.................................................................................................................256 Page 5 Using the ESP-IDF I2C driver.........................................................................................258 Common I2C devices......................................................................................................261 Working with SPI – Serial Peripheral Interface....................................................................261 Using the ESP-IDF SPI driver.........................................................................................264 The Arduino Hardware Abstraction Layer SPI.................................................................267 Common SPI devices.....................................................................................................269 Working with UART/serial....................................................................................................270 Using the VFS component with serial.............................................................................273 I2S Bus................................................................................................................................273 I2S – Camera..................................................................................................................274 I2S – LCD.......................................................................................................................274 I2S – DMA......................................................................................................................274 RMT – The Remote Peripheral............................................................................................279 Timers and time...................................................................................................................285 LEDC – Pulse Width Modulation – PWM.............................................................................288 Automated PWM fading..................................................................................................292 Analog to digital conversion.................................................................................................293 Digital to analog conversion................................................................................................296 Sleep modes.......................................................................................................................297 Security...............................................................................................................................298Working with flash memory.................................................................................................298 Working with RAM memory.................................................................................................300 RAM Utilization...............................................................................................................301 Heap diagnosis / memory leaks......................................................................................303 Heap corruption..........................................................................................................304 Using PSRAM.................................................................................................................307 EFUSE................................................................................................................................309 EFuse #1........................................................................................................................310 EFuse #2........................................................................................................................310 EFuse #3 – 0x6001a00c.................................................................................................310 Button press detection.........................................................................................................310 GPS....................................................................................................................................312 GPS decoding.................................................................................................................315 Temperature and pressure – BMP180.................................................................................315 Using the Arduino APIs...................................................................................................318 NeoPixels............................................................................................................................318 NeoPixel theory..............................................................................................................318 NeoPixels and the ESP32...............................................................................................321 APA102...........................................................................................................................322 LED 7-Segment displays.....................................................................................................322 MAX7219/MAX7221 – Serial interface, 8-digit, led display drivers..................................323 The U8g2 library..................................................................................................................327 LCD display – Nokia 5110 – PCD8544................................................................................328 OLED 128x32, 128x64 – SSD1306.....................................................................................330 Page 6 TFT displays........................................................................................................................332 Ambient light level sensor – BH1750FVI.............................................................................333 Ambient light and proximity sensor......................................................................................335 Infrared receivers................................................................................................................336 RFID MFRC522...................................................................................................................338 MFRC522 – Low levels...................................................................................................341 Initialization................................................................................................................344 AntennaOn.................................................................................................................344 Cameras..............................................................................................................................344 Ivan's sample..................................................................................................................344 OV7670..........................................................................................................................346 Accelerometer and Gyroscope – MPU-6050 (aka GY-521).................................................346 The math of accelerometers...........................................................................................352 Visualizing orientation.....................................................................................................354 Compass – HMC5883L (aka GY-271) (aka CJ-M49)...........................................................354 Tilt compensation of the compass...................................................................................360 Real time clocks..................................................................................................................361 Servos.................................................................................................................................364 The Mini/Micro SG90......................................................................................................366 Audio...................................................................................................................................366 PCM5102 – I2S DAC......................................................................................................366 Graphic Equalizer...........................................................................................................367 External networking.............................................................................................................370 The nRF24......................................................................................................................370 Using the Arduino APIs...............................................................................................376 Integrating the nRF24 with the ESP32.......................................................................383 Programming using Eclipse.....................................................................................................386 Installing the Eclipse Serial terminal....................................................................................396 Web development using Eclipse..........................................................................................401 Programming using the Arduino IDE........................................................................................402 Mapping from the Arduino to the ESP32.............................................................................403 Implications of Arduino IDE support.....................................................................................404 Installing the Arduino IDE with ESP32 support....................................................................405 Using the Arduino libraries as an ESP-IDF component.......................................................407 Tips for working in the Arduino environment........................................................................408 Initialize global classes in setup()....................................................................................408 Invoking Espressif SDK API from a sketch......................................................................408 Reasons to consider using Eclipse over Arduino IDE.....................................................409 Programming with JavaScript..................................................................................................409 Duktape...............................................................................................................................410Compiling code...............................................................................................................411 Building for ESP32..........................................................................................................411 Page 7 Integrating Duktape in an ESP32 application..................................................................411 The Duktape stack..........................................................................................................412 Working with object properties........................................................................................412 Calling C from a JavaScript program..............................................................................412 JerryScript...........................................................................................................................413 Platform specific files......................................................................................................413 JerryScript life-cycle........................................................................................................414 Accessing the global environment..................................................................................414 The jerry_value_t............................................................................................................414 Handling errors...............................................................................................................415 Interfacing JerryScript with C..........................................................................................415 IoT.js....................................................................................................................................416 Programming with Python........................................................................................................416 Pycom Micropython.............................................................................................................416 Programming with Lua.............................................................................................................416 Lua-RTOS for ESP32..........................................................................................................416 Integration with Web Apps.......................................................................................................417 HTTP Protocol.....................................................................................................................417 HTTP Headers................................................................................................................417 Accept header............................................................................................................417 Authorization header..................................................................................................417 Connection header.....................................................................................................418 Content-Length header..............................................................................................418 Content-Type header..................................................................................................418 Host header................................................................................................................418 User-Agent header.....................................................................................................418 Web Servers........................................................................................................................418 Mongoose networking library..........................................................................................419 Setting up Mongoose on an ESP32...........................................................................422 Sending a request from Mongoose............................................................................423 The Mongoose struct mg_connection........................................................................423 Handling file uploads..................................................................................................423 GoAhead Web Server.....................................................................................................424 JavaScript Webserver.....................................................................................................425 REST Services....................................................................................................................425 REST protocol................................................................................................................425 ESP32 as a REST client.................................................................................................426 Making a REST request using Curl............................................................................426 Making a REST request using Mongoose..................................................................431 ESP32 as a REST service provider................................................................................431 WebSockets........................................................................................................................431 A WebSocket browser app..............................................................................................432 Mongoose WebSocket....................................................................................................434 Other Websocket implementations.................................................................................435 Page 8 Tasker..................................................................................................................................435 AutoRemote........................................................................................................................435 DuckDNS............................................................................................................................437 Networking protocols...............................................................................................................438 MQTT..................................................................................................................................438 Mosquitto MQTT.............................................................................................................440 Installing on Windows.................................................................................................442 Writing ESP32 MQTT clients..........................................................................................444 Using Mongoose as an MQTT client..........................................................................444 Using Espruino as an MQTT client.............................................................................446 Writing non ESP32 MQTT clients...................................................................................446 Eclipse paho...............................................................................................................447 C – Mosquitto client library.........................................................................................448 Node.js JavaScript – MQTT.......................................................................................450 Browser JavaScript – MQTT......................................................................................451 CoAP – Constrained Application Protocol............................................................................453 FTP.....................................................................................................................................455 TFTP...................................................................................................................................455Telnet...................................................................................................................................456 DNS Protocol......................................................................................................................458 Mobile apps.............................................................................................................................461 Blynk...................................................................................................................................461 Cloud environments.................................................................................................................465 IBM Bluemix........................................................................................................................465 If This Then That – IFTTT....................................................................................................466 ESP Mesh................................................................................................................................467 Storage programming..............................................................................................................468 Partition table......................................................................................................................468 Non Volatile Storage............................................................................................................472 Virtual File System..............................................................................................................473 VFS Implementations......................................................................................................474 FATFS File System..............................................................................................................475 Spiffs File System................................................................................................................476 Building SPIFFs for the ESP32.......................................................................................478 mkspiffs tool....................................................................................................................478 The ESP File System – EspFs............................................................................................480 SD, MMC and SDIO interfacing...........................................................................................481 ZIP files...............................................................................................................................482 zlib..................................................................................................................................482 miniz...............................................................................................................................482 kuba--/zip........................................................................................................................483 Charting data...........................................................................................................................483 Page 9 Kst.......................................................................................................................................484 Sample Snippets......................................................................................................................485 Sample applications.................................................................................................................485 Sample – Ultrasonic distance measurement.......................................................................486 Sample – WiFi Scanner.......................................................................................................489 Sample – A changeable mood light.....................................................................................490 Using FreeRTOS.....................................................................................................................494 The architecture of a task in FreeRTOS..............................................................................495 Stacks and FreeRTOS tasks...........................................................................................497 Timers in FreeRTOS............................................................................................................500 Blocking and synchronization within FreeRTOS..................................................................501 Semaphores and Mutices within FreeRTOS........................................................................502 Queues within FreeRTOS...................................................................................................504 Ring buffer withing FreeRTOS.............................................................................................505 Working with queue sets.....................................................................................................506 Monitoring capabilities.........................................................................................................506 Running untested functions.................................................................................................507 The Serial AT command processor..........................................................................................508 Mongoose OS..........................................................................................................................508 The Mongoose OS file system............................................................................................510 Setting up Mongoose OS WiFi............................................................................................510 Building a Mongoose OS App..............................................................................................510 AWS IoT...................................................................................................................................511 The ESP-IDF aws_iot component.......................................................................................513 Using the TI CC2650 SensorTag..............................................................................................513 IR Temperature Sensor.......................................................................................................516 Humidity Service.................................................................................................................517 Ambient light sensor............................................................................................................518 Key Press............................................................................................................................518 Developing solutions on Linux.................................................................................................519 Building a Linux environment..........................................................................................519 Hardware architecture..............................................................................................................521 The CPU and cores.............................................................................................................521 Intrinsic data types..............................................................................................................521 Native byte order, endian and network byte order...............................................................521 Memory mapping and address spaces................................................................................522 Reading and writing registers..............................................................................................524 Pads and multiplexing.........................................................................................................525Register based GPIO..........................................................................................................528 GPIO_OUT_REG...........................................................................................................530 GPIO_OUT_W1TS_REG................................................................................................530 GPIO_OUT_W1TC_REG...............................................................................................530 GPIO_OUT1_REG.........................................................................................................531 GPIO_OUT1_W1TS_REG..............................................................................................531 Page 10 GPIO_OUT1_W1TC_REG.............................................................................................531 GPIO_ENABLE_REG.....................................................................................................531 GPIO_ENABLE_W1TS_REG.........................................................................................531 GPIO_ENABLE_W1TC_REG.........................................................................................531 GPIO_ENABLE1_REG...................................................................................................531 GPIO_ENABLE1_W1TS_REG.......................................................................................532 GPIO_ENABLE1_W1TC_REG.......................................................................................532 GPIO_STRAP_REG.......................................................................................................532 GPIO_IN_REG...............................................................................................................532 GPIO_IN1_REG.............................................................................................................532 GPIO_STATUS_REG.....................................................................................................532 GPIO_STATUS_W1TS_REG..........................................................................................533 GPIO_STATUS_W1TC_REG.........................................................................................533 GPIO_STATUS1_REG...................................................................................................533 GPIO_STATUS1_W1TS_REG........................................................................................533 GPIO_STATUS1_W1TC_REG.......................................................................................533 GPIO_PCPU_NMI_INT1_REG.......................................................................................533 GPIO_PCPU_NMI_INT1_REG.......................................................................................533 GPIO_PINn_REG...........................................................................................................533 GPIO_FUNCm_IN_SEL_CFG_REG..............................................................................533 GPIO_FUNCn_OUT_SEL_CFG_REG...........................................................................534 Strapping pins.....................................................................................................................534 Boot mode source...........................................................................................................535 Debugging on U0TX0 at boot.........................................................................................535 Timing of SDIO slave......................................................................................................535 Boot-loader..........................................................................................................................535 Power modes......................................................................................................................537 Bootloader...........................................................................................................................538 Peripherals..........................................................................................................................538 Remote Control Peripheral – RMT..................................................................................538 SPI..................................................................................................................................542 PID Controller.................................................................................................................542 UART..............................................................................................................................542 I2S..................................................................................................................................543 I2S Clock....................................................................................................................543 Camera mode............................................................................................................543 Registers....................................................................................................................547 I2S_CONF_REG........................................................................................................549 I2S_CONF2_REG......................................................................................................549 I2S_CLKM_CONF_REG............................................................................................550 I2S_CONF_CHAN_REG............................................................................................550 I2S_LC_CONF_REG.................................................................................................550 Page 11 I2S_FIFO_CONF_REG..............................................................................................550 I2S_IN_LINK_REG....................................................................................................551 I2S_RXEOF_NUM_REG............................................................................................551 I2S_CONF_CHAN_REG............................................................................................551 I2S_SAMPLE_RATE_CONF_REG............................................................................552 I2S_INT_RAW_REG..................................................................................................552 I2S_INT_ENA_REG...................................................................................................552 I2S_INT_CLR_REG...................................................................................................553 RTC................................................................................................................................554 RTCIO_RTC_GPIO_OUT_DATA...............................................................................554 RTCIO_RTC_GPIO_OUT_DATA_W1TS....................................................................554 RTCIO_RTC_GPIO_OUT_DATA_W1TC...................................................................554 RTCIO_RTC_GPIO_ENABLE....................................................................................554 RTCIO_RTC_GPIO_ENABLE_W1TS........................................................................554 RTCIO_RTC_GPIO_ENABLE_W1TC........................................................................554 RTCIO_RTC_GPIO_STATUS_INT.............................................................................554 RTCIO_RTC_GPIO_STATUS_INT_W1TS.................................................................554 RTCIO_RTC_GPIO_STATUS_INT_W1TC.................................................................554 RTCIO_RTC_GPIO_IN_NEXT...................................................................................554 RTCIO_RTC_GPIO_PINn_WAKEUP_ENABLE.........................................................555RTCIO_RTC_GPIO_PINn_INT_TYPE.......................................................................555 RTCIO_RTC_GPIO_PINn_PAD_DRIVER..................................................................555 RTCIO_DIG_PAD_HOLD_REG.................................................................................555 RTCIO_HALL_XPD_HALL.........................................................................................555 RTCIO_HALL_PHASE...............................................................................................555 RTCIO_SENSOR_SENSEn_HOLD...........................................................................555 RTCIO_SENSOR_SENSEn_MUX_SEL....................................................................555 RTCIO_SENSOR_SENSEn_FUN_SEL.....................................................................555 RTCIO_SENSOR_SENSEn_SLP_SEL......................................................................555 RTCIO_SENSOR_SENSEn_SLP_IE.........................................................................555 RTCIO_SENSOR_SENSEn_FUN_IE........................................................................555 RTCIO_ADC_ADCn_HOLD.......................................................................................555 RTCIO_ADC_ADCn_MUX_SEL................................................................................555 RTCIO_ADC_ADCn_FUN_SEL.................................................................................555 RTCIO_ADC_ADCn_SLP_SEL..................................................................................555 RTCIO_ADC_ADCn_SLP_IE.....................................................................................555 RTCIO_ADC_ADCn_FUN_IE....................................................................................555 RTCIO_PAD_PDAC1_DRV........................................................................................555 RTCIO_PAD_PDAC1_HOLD.....................................................................................555 RTCIO_PAD_PDAC1_RDE........................................................................................555 RTCIO_PAD_PDAC1_RUE........................................................................................555 RTCIO_PAD_PDAC1_DAC........................................................................................555 RTCIO_PAD_PDAC1_XPD_DAC..............................................................................555 RTCIO_PAD_PDAC1_MUX_SEL...............................................................................555 Page 12 RTCIO_PAD_PDAC1_FUN_SEL...............................................................................555 RTCIO_PAD_PDAC1_SLP_SEL................................................................................555 RTCIO_PAD_PDAC1_SLP_IE...................................................................................556 RTCIO_PAD_PDAC1_SLP_OE.................................................................................556 RTCIO_PAD_PDAC1_FUN_IE..................................................................................556 RTCIO_PAD_PDAC1_DAC_XPD_FORCE................................................................556 ULP Processor.........................................................................................................................556 Preparing a ULP co-processor environment........................................................................557 ULP Instruction set..............................................................................................................557 NOP – No operation........................................................................................................559 ADD – Add to a register..................................................................................................559 SUB – Subtract from register..........................................................................................559 AND – Logical AND of two operands..............................................................................560 OR – Logical OR of two operands..................................................................................560 LSH – Logical Shift Left..................................................................................................560 RSH – Logical Shift Right...............................................................................................560 MOVE – Move to register................................................................................................560 ST – Store data to memory.............................................................................................561 LD – Load data from memory.........................................................................................561 JUMP – Jump to an absolute address............................................................................561 JUMPR – Jump relative with condition............................................................................561 JUMPS – Jump relative based on stage count...............................................................562 STAGE_RST – Reset the stage count register...............................................................562 STAGE_INC – Increment the stage count register..........................................................562 STAGE_DEC – Decrement the stage count register.......................................................562 HALT – End the program................................................................................................562 WAKE – Wakeup the chip...............................................................................................562 SLEEP – Set the ULP wakeup timer period....................................................................562 WAIT – Wait some number of cycles..............................................................................562 TSENS – Do measurement with the temperature sensor...............................................563 ADC – Do measurement with ADC.................................................................................563 REG_RD – Read from peripheral register.......................................................................563 REG_WR – Write to peripheral register..........................................................................563 ULP co-processor assembler coding...................................................................................564 Loading and starting a ULP co-processor application..........................................................565 Waking up the ULP co-processor........................................................................................566 Peripheral registers for ULP co-processor...........................................................................566 SENS_ULP_CP_SLEEP_CYC0_REG...........................................................................566 SENS_ULP_CP_SLEEP_CYC1_REG...........................................................................566 SENS_ULP_CP_SLEEP_CYC2_REG...........................................................................566 SENS_ULP_CP_SLEEP_CYC3_REG...........................................................................566 SENS_ULP_CP_SLEEP_CYC4_REG...........................................................................567 Page 13 SENS_SAR_START_FORCE_REG...............................................................................567 Electronics...............................................................................................................................568 Transistors as switches.......................................................................................................568 Logic Level Shifting.............................................................................................................569 Projects....................................................................................................................................571JerryScript library for ESP32...............................................................................................571 The "require" capability...................................................................................................571 API Reference.........................................................................................................................571 Configuration, status and operational retrieval....................................................................572 Arduino Mapping.................................................................................................................573 bitRead...........................................................................................................................573 bitWrite...........................................................................................................................573 delay...............................................................................................................................573 digitalWrite......................................................................................................................573 pinMode..........................................................................................................................574 SPI.begin........................................................................................................................574 SPI.setBitOrder...............................................................................................................574 SPI.setClockDivider........................................................................................................575 SPI.setDataMode............................................................................................................575 SPI.transfer.....................................................................................................................575 Wire.begin......................................................................................................................575 Wire.beginTransmission..................................................................................................576 Wire.endTransmission....................................................................................................576 Wire.read........................................................................................................................576 Wire.requestFrom...........................................................................................................576 Wire.write........................................................................................................................576 FreeRTOS API reference....................................................................................................576 portENABLE_INTERRUPTS...........................................................................................576 portDISABLE_INTERRUPTS..........................................................................................577 xPortGetCoreID..............................................................................................................577 pvPortMalloc...................................................................................................................577 pvPortFree......................................................................................................................577 xPortGetFreeHeapSize()................................................................................................577 xEventGroupClearBits....................................................................................................577 xEventGroupCreate........................................................................................................578 xEventGroupCreateStatic...............................................................................................578 xEventGroupSetBits.......................................................................................................578 xEventGroupWaitBits......................................................................................................579 xQueueAddToSet............................................................................................................579 xQueueCreate................................................................................................................580 xQueueCreateSet...........................................................................................................580 xQueueCreateStatic.......................................................................................................580 vQueueDelete.................................................................................................................581 xQueueGenericReceive..................................................................................................581 Page 14 uxQueueMessagesWaiting.............................................................................................581 xQueueOverwrite............................................................................................................582 xQueuePeek...................................................................................................................582 xQueuePeekFromISR.....................................................................................................582 xQueueReceive..............................................................................................................582 xQueueReceiveFromISR................................................................................................583 xQueueRemoveFromSet................................................................................................583 xQueueReset..................................................................................................................583 xQueueSelectFromSet....................................................................................................583 xQueueSelectFromSetFromISR.....................................................................................583 xQueueSend...................................................................................................................584 xQueueSendFromISR.....................................................................................................584 xQueueSendToBack.......................................................................................................584 xQueueSendToBackFromISR.........................................................................................584 xQueueSendToFront.......................................................................................................585 xQueueSendToFrontFromISR........................................................................................586 uxQueueSpacesAvailable...............................................................................................586 xRingbufferAddToQueueSetRead...................................................................................586 xRingbufferAddToQueueSetWrite...................................................................................586 xRingbufferCreate...........................................................................................................586 vRingbufferDelete...........................................................................................................587 xRingbufferGetMaxItemSize...........................................................................................587 xRingBufferPrintInfo........................................................................................................587 xRingbufferReceive.........................................................................................................587 xRingbufferReceiveFromISR..........................................................................................588xRingbufferReceiveUpTo................................................................................................588 xRingbufferReceiveUpToFromISR..................................................................................588 xRingbufferRemoveFromQueueSetRead.......................................................................588 xRingbufferRemoveFromQueueSetWrite........................................................................588 vRingbufferReturnItem....................................................................................................588 vRingbufferReturnItemFromISR......................................................................................589 xRingbufferSend.............................................................................................................589 xRingbufferSendFromISR...............................................................................................589 vSemaphoreCreateBinary...............................................................................................590 xSemaphoreCreateCounting..........................................................................................590 xSemaphoreCreateMutex...............................................................................................590 vSemaphoreDelete.........................................................................................................590 uxSemaphoreGetCount..................................................................................................591 xSemaphoreGive............................................................................................................591 xSemaphoreGiveFromISR..............................................................................................591 xSemaphoreTake............................................................................................................591 xTaskCreate....................................................................................................................592 Page 15 xTaskCreatePinnedToCore.............................................................................................593 vTaskDelay.....................................................................................................................594 vTaskDelayUntil..............................................................................................................594 vTaskDelete....................................................................................................................595 vTaskGetInfo...................................................................................................................595 xTaskGetCurrentTaskHandle..........................................................................................596 pcTaskGetTaskName......................................................................................................596 uxTaskGetNumberOfTasks.............................................................................................596 eTaskGetState................................................................................................................596 uxTaskGetSystemState...................................................................................................597 xTaskGetTickCount.........................................................................................................598 xTaskGetTickCountFromISR...........................................................................................598 vEventGroupDelete........................................................................................................598 vTaskList.........................................................................................................................598 uxTaskPriorityGet............................................................................................................599 vTaskPrioritySet..............................................................................................................599 vTaskResume.................................................................................................................599 xTaskResumeAll.............................................................................................................599 vTaskResumeFromISR...................................................................................................599 vTaskSuspend................................................................................................................600 vTaskSuspendAll............................................................................................................600 xTimerChangePeriod......................................................................................................600 xTimerChangePeriodFromISR........................................................................................601 xTimerCreate..................................................................................................................601 xTimerCreateStatic.........................................................................................................602 xTimerDelete..................................................................................................................602 pcTimerGetName............................................................................................................602 xTimerGetExpiryTime.....................................................................................................602 xTimerGetPeriod.............................................................................................................603 pvTimerGetTimerDaemonTaskHandle............................................................................603 pvTimerGetTimerID.........................................................................................................604 xTimerIsTimerActive.......................................................................................................604 xTimerPendFunctionCall.................................................................................................604 xTimerPendFunctionCallFromISR...................................................................................605 xTimerReset...................................................................................................................605 xTimerResetFromISR.....................................................................................................605 vTimerSetTimerID...........................................................................................................605 xTimerStart.....................................................................................................................606 xTimerStartFromISR.......................................................................................................606 xTimerStop.....................................................................................................................606 xTimerStopFromISR.......................................................................................................607 List Processing...............................................................................................................607 vListInitialise...............................................................................................................607 vListInitialiseItem........................................................................................................607 Page 16 vListInsert...................................................................................................................607 vListInsertEnd............................................................................................................607 Sockets APIs.......................................................................................................................607
Compartilhar