Api Conventions; Error Handling; Configuration Structures - Espressif ESP32-S2 Programming Manual

Hide thumbs Also See for ESP32-S2:
Table of Contents

Advertisement

Chapter 2. API Reference
void esp_rom_install_uart_printf(void)
Install UART1 as the default console channel, equivalent to esp_rom_install_channel_putc(1,
esp_rom_uart_putc)
soc_reset_reason_t esp_rom_get_reset_reason(int cpu_no)
Get reset reason of CPU.
Return Reset reason code (see in soc/reset_reasons.h)
Parameters
• cpu_no: CPU number
Code examples for this API section are provided in the

2.7 API Conventions

This document describes conventions and assumptions common to ESP-IDF Application Programming Interfaces
(APIs).
ESP-IDF provides several kinds of programming interfaces:
• C functions, structures, enums, type definitions and preprocessor macros declared in public header files of ESP-
IDF components. Various pages in the API Reference section of the programming guide contain descriptions
of these functions, structures and types.
• Build system functions, predefined variables and options. These are documented in the
Kconfig
options can can be used in code and in the build system (CMakeLists.txt) files.
Host tools
and their command line parameters are also part of ESP-IDF interface.
ESP-IDF consists of components written specifically for ESP-IDF as well as third-party libraries. In some cases, an
ESP-IDF-specific wrapper is added to the third-party library, providing an interface that is either simpler or better
integrated with the rest of ESP-IDF facilities. In other cases, the original API of the third-party library is presented
to the application developers.
Following sections explain some of the aspects of ESP-IDF APIs and their usage.

2.7.1 Error handling

Most ESP-IDF APIs return error codes defined with esp_err_t type. See
mation about error handling approaches.
components.
2.7.2 Configuration structures
Important: Correct initialization of configuration structures is an important part in making the application com-
patible with future versions of ESP-IDF.
Most initialization or configuration functions in ESP-IDF take as an argument a pointer to a configuration structure.
For example:
const
esp_timer_create_args_t my_timer_args
.callback
=
&my_timer_callback,
.arg
=
callback_arg,
.name
=
"my_timer"
};
esp_timer_handle_t my_timer;
esp_err_t err
=
esp_timer_create(&my_timer_args, &my_timer);
Espressif Systems
system
directory of ESP-IDF examples.
Error Code Reference
contains the list of error codes returned by ESP-IDF
=
{
1055
Submit Document Feedback
build system
Error Handling
section for more infor-
Release v4.4
guide.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF