Class EspClass
ESP Arduino Core compatibility class. More...
#include <ESP.h>
Public Functions
Type | Name |
---|---|
bool | flashEraseSector (uint32_t sector) Erase a single block of flash (usually 4 KiB). |
bool | flashRead (uint32_t address, uint8_t * data, size_t size) Read data from the flash. |
bool | flashWrite (uint32_t address, const uint8_t * data, size_t size) Write data to the flash. |
uint8_t | getBootMode () |
uint8_t | getBootVersion () |
uint32_t | getChipId () Get CPU ID based on the last three octets of MAC address. Note: the number is 24-bit (with the MSB being zero). The 3rd-to-last octet is least-significant, the last octet is most-significant. |
String | getCoreVersion () |
uint8_t | getCpuFreqMHz () Get CPU frequency in MHz. |
uint32_t | getCycleCount () Get CPU cycle count. |
uint32_t | getFlashChipId () Flash chip ID structure. |
uint32_t | getFlashChipMode () |
uint32_t | getFlashChipRealSize () Get flash chip total size. |
uint32_t | getFlashChipSize () Get flash chip total size. |
uint32_t | getFlashChipSizeByChipId () Get flash chip total size. |
uint8_t | getFlashChipVendorId () Flash chip ID structure. |
uint32_t | getFreeHeap () Get free heap size. |
String | getFullVersion () |
uint16_t | getMaxFreeBlockSize () Get largest block of heap that can be allocated at once. |
String | getResetInfo () Get a textual representation of a reboot reason. |
String | getResetReason () Get a textual representation of a reboot reason. |
const char * | getSdkVersion () |
uint16_t | getVcc () |
uint8_t * | random (uint8_t * resultArray, const size_t outputSizeBytes) Generate random bytes using rand(). |
uint32_t | random () Generate random bytes using rand(). |
void | rebootIntoUartDownloadMode () Reboot the CPU and stay in download mode (if possible). |
void | reset () Reboot the CPU. |
void | restart () Reboot the CPU. |
void | wdtDisable () Disable the hardware watchdog. |
void | wdtEnable (uint32_t timeout_ms=0) Enable the hardware watchdog. |
void | wdtFeed () Feed/reset the hardware watchdog timer. |
Detailed Description
This class only consists of inline functions, which wrap the LibreTiny C API (lt_api.h). Refer to the docs of the C API for more information.
The class is accessible using the ESP
global object.
Public Functions Documentation
function flashEraseSector
Erase a single block of flash (usually 4 KiB).
Parameters:
offset
offset of the block (in bytes); must be multiple of the flash chip's block size
Returns:
whether erasing was successful
function flashRead
Read data from the flash.
Parameters:
offset
starting offset (in bytes)data
pointer to where to store the datalength
length of data to read
Returns:
length of data successfully read (should equal 'length')
function flashWrite
Write data to the flash.
Parameters:
offset
starting offset (in bytes)data
pointer to data to writelength
length of data to write
Returns:
length of data successfully written (should equal 'length')
function getBootMode
function getBootVersion
function getChipId
function getCoreVersion
function getCpuFreqMHz
function getCycleCount
function getFlashChipId
function getFlashChipMode
function getFlashChipRealSize
Get flash chip total size.
The default implementation uses the least significant byte of the chip ID to determine the size.
function getFlashChipSize
Get flash chip total size.
The default implementation uses the least significant byte of the chip ID to determine the size.
function getFlashChipSizeByChipId
Get flash chip total size.
The default implementation uses the least significant byte of the chip ID to determine the size.
function getFlashChipVendorId
function getFreeHeap
function getFullVersion
function getMaxFreeBlockSize
function getResetInfo
Get a textual representation of a reboot reason.
Parameters:
reason
value to convert to text, pass 0 to read from lt_reboot_get_reason()
function getResetReason
Get a textual representation of a reboot reason.
Parameters:
reason
value to convert to text, pass 0 to read from lt_reboot_get_reason()
function getSdkVersion
function getVcc
function random [1/2]
Generate random bytes using rand().
Parameters:
buf
destination pointerlen
how many bytes to generate
function random [2/2]
Generate random bytes using rand().
Parameters:
buf
destination pointerlen
how many bytes to generate
function rebootIntoUartDownloadMode
Reboot the CPU and stay in download mode (if possible).
Returns:
whether download-mode reboot is possible
function reset
function restart
function wdtDisable
function wdtEnable
Enable the hardware watchdog.
Parameters:
timeout
watchdog timeout, milliseconds
Returns:
whether the chip has a hardware watchdog
function wdtFeed
The documentation for this class was generated from the following file cores/common/arduino/libraries/inline/ESP/ESP.h