text
stringlengths
1
9.98k
__index_level_0__
int64
0
4.17k
radio_mode = RADIO_MODE_NATIVE, \ } #else #define ESP_ZB_DEFAULT_RADIO_CONFIG() \ { \ .radio_mode = RADIO_MODE_UART_RCP, \ .radio_uart_config = { \ .port = 1, \ .uart_config = \ { \ .baud_rate = 115200, \ .data_bits = UART_DATA_8_BITS, \ .parity = UART_PARITY_DISABLE, \ .stop_bits = UART_STOP_BITS_1, \ .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \ .rx_flow_ctrl_thresh = 0, \ .source_clk = UART_SCLK_DEFAULT, \ }, \ .
4,118
rx_pin = 4, \ .tx_pin = 5, \ }, \ } #endif #define ESP_ZB_DEFAULT_HOST_CONFIG() \ { \ .host_connection_mode = HOST_CONNECTION_MODE_NONE, \ }
4,118
/* This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /** */ void pretty_effect_calc_lines(uint16_t *dest, int line, int frame, int linect); /** */ esp_err_t pretty_effect_init(void); #ifdef __cplusplus } #endif
4,119
/* This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include #include "esp_err.h" #define IMAGE_W 320 #define IMAGE_H 240 #ifdef __cplusplus extern "C" { #endif /** */ esp_err_t decode_image(uint16_t **pixels); #ifdef __cplusplus } #endif
4,120
/* This code demonstrates how to use the SPI master half duplex mode to read/write a AT932C46D EEPROM (8-bit mode). This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include "driver/spi_master.h" #include "driver/gpio.h" #include "sdkconfig.h" /// Configurations of the spi_eeprom typedef struct { spi_host_device_t host; ///< The SPI host used, set before calling `spi_eeprom_init()` gpio_num_t cs_io; ///< CS gpio number, set before calling `spi_eeprom_init()` gpio_num_t miso_io; ///< MISO gpio number, set before calling `spi_eeprom_init()` bool intr_used; ///< Whether to use polling or interrupt when waiting for write to be done. Set before calling `spi_eeprom_init()`. } eeprom_config_t; typedef struct eeprom_context_t* eeprom_handle_t; /** */ esp_err_t spi_eeprom_init(const eeprom_config_t *config, eeprom_handle_t* out_handle); /** */ esp_err_t spi_eeprom_deinit(eeprom_handle_t handle); /** */ esp_err_t spi_eeprom_read(eeprom_handle_t handle, uint8_t addr, uint8_t* out_data); /** */ esp_err_t spi_eeprom_erase(eeprom_handle_t handle, uint8_t addr); /** */ esp_err_t spi_eeprom_write(eeprom_handle_t handle, uint8_t addr, uint8_t data); /** */ esp_err_t spi_eeprom_write_enable(eeprom_handle_t handle); /** */ esp_err_t spi_eeprom_write_disable(eeprom_handle_t handle); #if CONFIG_EXAMPLE_5V_COMMANDS /** */ esp_err_t spi_eeprom_erase_all(eeprom_handle_t handle); /** */ esp_err_t spi_eeprom_write_all(eeprom_handle_t handle, uint8_t data); #endif //CONFIG_EXAMPLE_5V_COMMANDS
4,121
/* */ #pragma once #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef enum { SOFT_I2C_100KHZ, SOFT_I2C_200KHZ, SOFT_I2C_300KHZ, SOFT_I2C_FREQ_END } soft_i2c_master_freq_t; /** */ typedef struct { uint32_t scl_pin; uint32_t sda_pin; soft_i2c_master_freq_t freq; } soft_i2c_master_config_t; /** */ typedef struct i2c_master_bus_impl_t* soft_i2c_master_bus_t; /** */ esp_err_t soft_i2c_master_new(soft_i2c_master_config_t *config, soft_i2c_master_bus_t *bus); /** */ esp_err_t soft_i2c_master_del(soft_i2c_master_bus_t bus); /** */ esp_err_t soft_i2c_master_write(soft_i2c_master_bus_t bus, uint8_t device_address, const uint8_t* write_buffer, size_t write_size); /** */ esp_err_t soft_i2c_master_read(soft_i2c_master_bus_t bus, uint8_t device_address, uint8_t* read_buffer, size_t read_size); /** */ esp_err_t soft_i2c_master_write_read(soft_i2c_master_bus_t bus, uint8_t device_address, const uint8_t* write_buffer, size_t write_size, uint8_t* read_buffer, size_t read_size); #ifdef __cplusplus } #endif
4,122
/* */ #pragma once #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef enum { SOFT_UART_115200, SOFT_UART_230400, SOFT_UART_460800, SOFT_UART_921600, SOFT_UART_BAUD_END } soft_uart_baudrate_t; /** */ typedef struct { uint32_t tx_pin; uint32_t rx_pin; soft_uart_baudrate_t baudrate; } soft_uart_config_t; /** */ typedef struct soft_uart_port_impl_t* soft_uart_port_t; /** */ esp_err_t soft_uart_new(soft_uart_config_t *config, soft_uart_port_t *port); /** */ esp_err_t soft_uart_del(soft_uart_port_t port); /** */ esp_err_t soft_uart_send(soft_uart_port_t port, const uint8_t* write_buffer, size_t write_size); /** */ esp_err_t soft_uart_receive(soft_uart_port_t port, uint8_t* read_buffer, size_t read_size); #ifdef __cplusplus } #endif
4,123
/* */ #pragma once #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { uint32_t clk_pin; uint32_t mosi_pin; uint32_t miso_pin; uint32_t cs_pin; } soft_spi_config_t; /** */ typedef struct soft_spi_bus_impl_t* soft_spi_bus_t; /** */ esp_err_t soft_spi_new(soft_spi_config_t *config, soft_spi_bus_t *bus); /** */ esp_err_t soft_spi_del(soft_spi_bus_t bus); /** */ esp_err_t soft_spi_transfer(soft_spi_bus_t bus, const uint8_t* write_buffer, uint8_t* read_buffer, size_t buf_size); #ifdef __cplusplus } #endif
4,124
/* */ #pragma once #include "driver/i2c_master.h" #ifdef __cplusplus extern "C" { #endif void register_i2ctools(void); extern i2c_master_bus_handle_t tool_bus_handle; #ifdef __cplusplus } #endif
4,125
/* */ #include #include "driver/i2c_master.h" #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif typedef struct { i2c_device_config_t eeprom_device; /*!< Configuration for eeprom device */ uint8_t addr_wordlen; /*!< block address wordlen */ uint8_t write_time_ms; /*!< eeprom write time, typically 10ms*/ } i2c_eeprom_config_t; struct i2c_eeprom_t { i2c_master_dev_handle_t i2c_dev; /*!< I2C device handle */ uint8_t addr_wordlen; /*!< block address wordlen */ uint8_t *buffer; /*!< I2C transaction buffer */ uint8_t write_time_ms; /*!< I2C eeprom write time(ms)*/ }; typedef struct i2c_eeprom_t i2c_eeprom_t; /* handle of EEPROM device */ typedef struct i2c_eeprom_t *i2c_eeprom_handle_t; /** */ esp_err_t i2c_eeprom_init(i2c_master_bus_handle_t bus_handle, const i2c_eeprom_config_t *eeprom_config, i2c_eeprom_handle_t *eeprom_handle); /** */ esp_err_t i2c_eeprom_write(i2c_eeprom_handle_t eeprom_handle, uint32_t address, const uint8_t *data, uint32_t size); /** */ esp_err_t i2c_eeprom_read(i2c_eeprom_handle_t eeprom_handle, uint32_t address, uint8_t *data, uint32_t size); /** */ void i2c_eeprom_wait_idle(i2c_eeprom_handle_t eeprom_handle); #ifdef __cplusplus } #endif
4,126
/* */ #pragma once #include "stdint.h" #include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" #include "esp_heap_caps.h" #include "esp_probe.h" #ifdef __cplusplus extern "C" { #endif #define ESP_PROBE_DEFAULT_Q_DEPTH 8 #define ESP_PROBE_DEFAULT_MAX_RECV_SIZE (ESP_PROBE_DEFAULT_Q_DEPTH * 4092) #if CONFIG_PARLIO_ISR_IRAM_SAFE #define ESP_PROBE_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) #else #define ESP_PROBE_ALLOC_CAPS MALLOC_CAP_DEFAULT #endif struct esp_probe_t { uint32_t sample_width; /*!< sample width, i.e., enabled probe channel nums */ uint32_t sample_rate_hz; /*!< sample rate in Hz */ FILE *out_stream; /*!< Output stream */ TaskHandle_t dump_task; /*!< Task handle of the raw data dump task */ TaskHandle_t flush_task; /*!< Task handle of the raw data flush task, only created in buffer mode */ int dump_task_priority; /*!< Task priority */ uint32_t max_dump_size; /*!
4,127
< Max dump size */ uint32_t dump_data_size; /*!< Dump data size */ QueueHandle_t recv_que; /*!< Receive data queue */ QueueHandle_t flush_que; /*!< Flush data queue */ uint8_t *buffer; /*!< The storage buffer for dump data */ uint32_t buf_size; /*!< The storage buffer size/depth */ uint32_t w_ptr; /*!< The pointer of the current write offset of the buffer */ uint32_t f_ptr; /*!< The pointer of the current flush offset of the buffer */ struct { volatile uint32_t is_started: 1; /*!< Is the sampling started */ } flags; }; typedef struct { void *data; /*!< The pointer of the received raw data buffer */ uint32_t size; /*!< The size of the received raw data buffer */ } esp_probe_recv_data_t; typedef esp_probe_recv_data_t esp_probe_flush_data_t; esp_err_t esp_probe_priv_init_hardware(esp_probe_handle_t handle, esp_probe_config_t *config, int max_chan_id); esp_err_t esp_probe_priv_deinit_hardware(esp_probe_handle_t handle); esp_err_t esp_probe_priv_enable_hardware(esp_probe_handle_t handle); esp_err_t esp_probe_priv_disable_hardware(esp_probe_handle_t handle); #ifdef __cplusplus } #endif
4,127
/* */ #pragma once #include #include "driver/parlio_rx.h" #ifdef __cplusplus extern "C" { #endif #define ESP_PROBE_MAX_CHANNEL_NUM 16 /*!< Max supported probe channel number. Note that not all targets can reach the max channel, for example, ESP32-H2 has only 8 channels */ #define ESP_PROBE_MAX_SAMPLE_RATE 0 /*!< The maximum sample rates are different among different targets, Set 0 to adopt the maximum sample rate of the current target */ /** */ #define ESP_PROBE_DEFAULT_STREAM_CONFIG(rate_hz) { \ .sample_rate_hz = rate_hz, \ .dump_task_priority = 6, \ .storage_depth_kb = 0, \ .max_dump_size_kb = 0, \ .probe_gpio = { \ [0 ... ESP_PROBE_MAX_CHANNEL_NUM - 1] = -1, \ }, \ } /** */ #define ESP_PROBE_DEFAULT_BUFFER_CONFIG(rate_hz, depth_kb) { \ .
4,128
sample_rate_hz = rate_hz, \ .dump_task_priority = 6, \ .storage_depth_kb = depth_kb, \ .max_dump_size_kb = depth_kb, \ .probe_gpio = { \ [0 ... ESP_PROBE_MAX_CHANNEL_NUM - 1] = -1, \ }, \ } /** */ #define ESP_PROBE_DEFAULT_BUFFER_STREAM_CONFIG(rate_hz, depth_kb) { \ .sample_rate_hz = rate_hz, \ .dump_task_priority = 6, \ .storage_depth_kb = depth_kb, \ .max_dump_size_kb = 0, \ .probe_gpio = { \ [0 ... ESP_PROBE_MAX_CHANNEL_NUM - 1] = -1, \ }, \ } typedef struct { uint32_t sample_rate_hz; /*!< The sample rate of the probe, unit: Hz, set '0' to use the max sample rate */ int probe_gpio[ESP_PROBE_MAX_CHANNEL_NUM]; /*!
4,128
< The GPIO of each probe channel, please set '-1' for unused channels, some targets like ESP32-H2 only support up to 8 channels */ uint32_t storage_depth_kb; /*!< The max heap storage depth for probed data (unit: kilobytes). 0: the probed data won't be stored but output in realtime, i.e. stream mode; others: the probed data will be stored in a ping-pong buffer, The ping-pong buffer will be flushed alternately, i.e. buffer mode. ATTENTION: storage depth at lease be 8 KB, otherwise there is no difference with stream mode. */ uint32_t max_dump_size_kb; /*!< The max dump size for the limited storage (like flash/ram) (unit: kilobytes), The probe will stop if the dump data size reach this value.
4,128
set 0 for no dump size limitation (like dumping to the host via UART/USB/Network), set equals to `storage_depth_kb` to guarantee no sample lost in a short time */ uint32_t dump_task_priority; /*!< The priority of the dump task, which used for dumping the probed data via the out stream */ } esp_probe_config_t; typedef struct esp_probe_t *esp_probe_handle_t; /*!< The handle of probe instance */ /** */ esp_err_t esp_new_probe(esp_probe_config_t *config, esp_probe_handle_t* ret_handle); /** */ esp_err_t esp_del_probe(esp_probe_handle_t handle); /** */ esp_err_t esp_probe_start(esp_probe_handle_t handle, FILE *out_stream); /** */ esp_err_t esp_probe_stop(esp_probe_handle_t handle, uint32_t *dump_data_size); #ifdef __cplusplus } #endif
4,128
/* */ #pragma once #include #include #include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { #endif #if SOC_WIFI_SUPPORTED || SOC_EMAC_SUPPORTED /** */ FILE* esp_probe_open_tcp_stream(const char *host_ip, int port); /** */ void esp_probe_close_tcp_stream(FILE *f); #endif // SOC_WIFI_SUPPORTED || SOC_EMAC_SUPPORTED /** */ esp_err_t esp_probe_init_spiflash_fatfs(const char *mount_point, const char *partition_label, uint32_t *size); /** */ void esp_probe_deinit_spiflash_fatfs(const char *mount_point); /** */ FILE* esp_probe_open_file_stream(const char *file_path); /** */ void esp_probe_close_file_stream(FILE *f); #ifdef __cplusplus } #endif
4,129
/* */ #pragma once #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif esp_err_t tcp_server_wait_for_connection(void); esp_err_t tcp_server_send(uint8_t *payload, size_t size); void tcp_server_close_when_done(void); #ifdef __cplusplus } #endif
4,130
/* */ #pragma once #include #include "sdkconfig.h" #include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { #endif #define EXAMPLE_ANA_CMPR_UNIT 0 // Analog Comparator unit #define EXAMPLE_WAIT_TIME_PROP (0.1) // The wait time proportion in one relative signal period #define EXAMPLE_WAITE_TIME_US(freq_approx) (uint32_t)(1000000 * EXAMPLE_WAIT_TIME_PROP / (freq_approx)) #if CONFIG_IDF_TARGET_ESP32P4 #define EXAMPLE_MONITOR_GPIO_NUM (32) // The gpio to monitor the on cross callback #else #define EXAMPLE_MONITOR_GPIO_NUM (0) // The gpio to monitor the on cross callback #endif void example_init_monitor_gpio(void); #if CONFIG_EXAMPLE_USE_ETM /** */ void example_analog_comparator_etm_app(void); #endif /** */ void example_analog_comparator_intr_app(void); #ifdef __cplusplus } #endif
4,131
/* */ #pragma once #include #include "esp_err.h" /** */ void pretty_effect_calc_lines(uint16_t *dest, int line, int frame, int linect); /** */ esp_err_t pretty_effect_init(void);
4,132
/* */ #pragma once #include #include "esp_err.h" #define IMAGE_W 320 #define IMAGE_H 240 /** */ esp_err_t decode_image(uint16_t **pixels);
4,133
/* */ #include // Use IQ18 type, range [-8,192 8,191.999 996 185] // This definition should be added before including "IQmathLib.h" #define GLOBAL_IQ 18 #include "IQmathLib.h" // 3-phase uvw coord data type typedef struct foc_uvw_coord { _iq u; // U phase data in IQ type _iq v; // V phase data in IQ type _iq w; // W phase data in IQ type } foc_uvw_coord_t; // alpha-beta axis static coord data type typedef struct foc_ab_coord { _iq alpha; // alpha axis data in IQ type _iq beta; // beta axis data in IQ type } foc_ab_coord_t; //d-q (direct-quadrature) axis rotate coord data type typedef struct foc_dq_coord { _iq d; // direct axis data in IQ type _iq q; // quadrature axis data in IQ type } foc_dq_coord_t; /** */ void foc_clarke_transform(const foc_uvw_coord_t *v_uvw, foc_ab_coord_t *v_ab); /** */ void foc_inverse_clarke_transform(const foc_ab_coord_t *v_ab, foc_uvw_coord_t *v_uvw); /** */ void foc_park_transform(_iq theta_rad, const foc_ab_coord_t *v_ab, foc_dq_coord_t *v_dq); /** */ void foc_inverse_park_transform(_iq theta_rad, const foc_dq_coord_t *v_dq, foc_ab_coord_t *v_ab); /** */ void foc_svpwm_duty_calculate(const foc_ab_coord_t *v_ab, foc_uvw_coord_t *out_uvw);
4,134
/* */ #include "driver/mcpwm_prelude.h" /** */ typedef struct inverter_config { mcpwm_timer_config_t timer_config; // pwm timer and timing config mcpwm_operator_config_t operator_config; // mcpwm operator config mcpwm_comparator_config_t compare_config; // mcpwm comparator config int gen_gpios[3][2]; // 6 GPIO pins for generator config mcpwm_dead_time_config_t dt_config; // dead time config for positive pwm output mcpwm_dead_time_config_t inv_dt_config; // dead time config for negative pwm output } inverter_config_t; // inverter handler type typedef struct mcpwm_svpwm_ctx *inverter_handle_t; /** */ esp_err_t svpwm_new_inverter(const inverter_config_t *config, inverter_handle_t *ret_inverter); /** */ esp_err_t svpwm_inverter_register_cbs(inverter_handle_t handle, const mcpwm_timer_event_callbacks_t *event, void *user_ctx); /** */ esp_err_t svpwm_inverter_start(inverter_handle_t handle, mcpwm_timer_start_stop_cmd_t command); /** */ esp_err_t svpwm_inverter_set_duty(inverter_handle_t handle, uint16_t u, uint16_t v, uint16_t w); /** */ esp_err_t svpwm_del_inverter(inverter_handle_t handle);
4,135
/* */ #define CONST_PERIOD_2_PI 6.2832 // 2 * PI #define EXAMPLE_ARRAY_LEN 400 // Length of wave array #define EXAMPLE_DAC_AMPLITUDE 255 // Amplitude of DAC voltage. If it's more than 256 will causes dac_output_voltage() output 0. typedef enum { DAC_SINE_WAVE, DAC_TRIANGLE_WAVE, DAC_SAWTOOTH_WAVE, DAC_SQUARE_WAVE, DAC_WAVE_MAX, } dac_example_wave_type_t; /** void example_dac_continuous_by_dma(void); /** void example_dac_continuous_by_timer(void); /** */ void example_log_info(uint32_t conv_freq, uint32_t wave_freq);
4,136
/* */ #pragma once #include "sdkconfig.h" #ifdef __cplusplus extern "C" { #endif #if CONFIG_IDF_TARGET_ESP32 #define EXAMPLE_I2S_BCLK_IO1 GPIO_NUM_4 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO1 GPIO_NUM_5 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO1 GPIO_NUM_18 // I2S data out io number #define EXAMPLE_I2S_DIN_IO1 GPIO_NUM_19 // I2S data in io number // STD simplex pins #define EXAMPLE_I2S_BCLK_IO2 GPIO_NUM_22 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO2 GPIO_NUM_23 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO2 GPIO_NUM_25 // I2S data out io number #define EXAMPLE_I2S_DIN_IO2 GPIO_NUM_26 // I2S data in io number #elif CONFIG_IDF_TARGET_ESP32P4 #define EXAMPLE_I2S_BCLK_IO1 GPIO_NUM_45 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO1 GPIO_NUM_46 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO1 GPIO_NUM_47 // I2S data out io number #define EXAMPLE_I2S_DIN_IO1 GPIO_NUM_48 // I2S data in io number // PDM RX 4 line IO #define EXAMPLE_I2S_DIN1_IO1 GPIO_NUM_20 // I2S data in io number #define EXAMPLE_I2S_DIN2_IO1 GPIO_NUM_21 // I2S data in io number #define EXAMPLE_I2S_DIN3_IO1 GPIO_NUM_22 // I2S data in io number // STD/TDM simplex pins #define EXAMPLE_I2S_BCLK_IO2 GPIO_NUM_20 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO2 GPIO_NUM_21 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO2 GPIO_NUM_22 // I2S data out io number #define EXAMPLE_I2S_DIN_IO2 GPIO_NUM_23 // I2S data in io number #elif CONFIG_IDF_TARGET_ESP32S3 #define EXAMPLE_I2S_BCLK_IO1 GPIO_NUM_2 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO1 GPIO_NUM_3 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO1 GPIO_NUM_4 // I2S data out io number #define EXAMPLE_I2S_DIN_IO1 GPIO_NUM_5 // I2S data in io number // PDM RX 4 line IO #define EXAMPLE_I2S_DIN1_IO1 GPIO_NUM_6 // I2S data in io number #define EXAMPLE_I2S_DIN2_IO1 GPIO_NUM_7 // I2S data in io number #define EXAMPLE_I2S_DIN3_IO1 GPIO_NUM_8 // I2S data in io number // STD/TDM simplex pins #define EXAMPLE_I2S_BCLK_IO2 GPIO_NUM_6 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO2 GPIO_NUM_7 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO2 GPIO_NUM_8 // I2S data out io number #define EXAMPLE_I2S_DIN_IO2 GPIO_NUM_9 // I2S data in io number #else #define EXAMPLE_I2S_BCLK_IO1 GPIO_NUM_2 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO1 GPIO_NUM_3 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO1 GPIO_NUM_4 // I2S data out io number #define EXAMPLE_I2S_DIN_IO1 GPIO_NUM_5 // I2S data in io number #define EXAMPLE_I2S_BCLK_IO2 GPIO_NUM_6 // I2S bit clock io number #define EXAMPLE_I2S_WS_IO2 GPIO_NUM_7 // I2S word select io number #define EXAMPLE_I2S_DOUT_IO2 GPIO_NUM_8 // I2S data out io number #define EXAMPLE_I2S_DIN_IO2 GPIO_NUM_9 // I2S data in io number #endif #ifdef __cplusplus } #endif
4,138
/* */ #pragma once #include #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { struct { char chunk_id[4]; /*!< Contains the letters "RIFF" in ASCII form */ uint32_t chunk_size; /*!< This is the size of the rest of the chunk following this number */ char chunk_format[4]; /*!< Contains the letters "WAVE" */ } descriptor_chunk; /*!< Canonical WAVE format starts with the RIFF header */ struct { char subchunk_id[4]; /*!< Contains the letters "fmt " */ uint32_t subchunk_size; /*!< This is the size of the rest of the Subchunk which follows this number */ uint16_t audio_format; /*!< PCM = 1, values other than 1 indicate some form of compression */ uint16_t num_of_channels; /*!< Mono = 1, Stereo = 2, etc. */ uint32_t sample_rate; /*!< 8000, 44100, etc. */ uint32_t byte_rate; /*!< ==SampleRate * NumChannels * BitsPerSample s/ 8 */ uint16_t block_align; /*!< ==NumChannels * BitsPerSample / 8 */ uint16_t bits_per_sample; /*!
4,139
< 8 bits = 8, 16 bits = 16, etc. */ } fmt_chunk; /*!< The "fmt " subchunk describes the sound data's format */ struct { char subchunk_id[4]; /*!< Contains the letters "data" */ uint32_t subchunk_size; /*!< ==NumSamples * NumChannels * BitsPerSample / 8 */ int16_t data[0]; /*!< Holds raw audio data */ } data_chunk; /*!< The "data" subchunk contains the size of the data and the actual sound */ } wav_header_t; /** #define WAV_HEADER_PCM_DEFAULT(wav_sample_size, wav_sample_bits, wav_sample_rate, wav_channel_num) { \ .descriptor_chunk = { \ .chunk_id = {'R', 'I', 'F', 'F'}, \ .chunk_size = (wav_sample_size) + sizeof(wav_header_t) - 8, \ .chunk_format = {'W', 'A', 'V', 'E'} \ }, \ .fmt_chunk = { \ .subchunk_id = {'f', 'm', 't', ' '}, \ .subchunk_size = 16, /* 16 for PCM */ \ .audio_format = 1, /* 1 for PCM */ \ .num_of_channels = (wav_channel_num), \ .sample_rate = (wav_sample_rate), \ .
4,139
byte_rate = (wav_sample_bits) * (wav_sample_rate) * (wav_channel_num) / 8, \ .block_align = (wav_sample_bits) * (wav_channel_num) / 8, \ .bits_per_sample = (wav_sample_bits)\ }, \ .data_chunk = { \ .subchunk_id = {'d', 'a', 't', 'a'}, \ .subchunk_size = (wav_sample_size) \ } \ } #ifdef __cplusplus } #endif
4,139
/* */ #pragma once #include "sdkconfig.h" /* Example configurations */ #define EXAMPLE_RECV_BUF_SIZE (2400) #define EXAMPLE_SAMPLE_RATE (16000) #define EXAMPLE_MCLK_MULTIPLE (384) // If not using 24-bit data width, 256 should be enough #define EXAMPLE_MCLK_FREQ_HZ (EXAMPLE_SAMPLE_RATE * EXAMPLE_MCLK_MULTIPLE) #define EXAMPLE_VOICE_VOLUME CONFIG_EXAMPLE_VOICE_VOLUME #if CONFIG_EXAMPLE_MODE_ECHO #define EXAMPLE_MIC_GAIN CONFIG_EXAMPLE_MIC_GAIN #endif #if !defined(CONFIG_EXAMPLE_BSP) /* I2C port and GPIOs */ #define I2C_NUM (0) #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #define I2C_SCL_IO (GPIO_NUM_16) #define I2C_SDA_IO (GPIO_NUM_17) #elif CONFIG_IDF_TARGET_ESP32H2 #define I2C_SCL_IO (GPIO_NUM_8) #define I2C_SDA_IO (GPIO_NUM_9) #elif CONFIG_IDF_TARGET_ESP32P4 #define I2C_SCL_IO (GPIO_NUM_8) #define I2C_SDA_IO (GPIO_NUM_7) #else #define I2C_SCL_IO (GPIO_NUM_6) #define I2C_SDA_IO (GPIO_NUM_7) #endif /* I2S port and GPIOs */ #define I2S_NUM (0) #if CONFIG_IDF_TARGET_ESP32P4 #define I2S_MCK_IO (GPIO_NUM_13) #define I2S_BCK_IO (GPIO_NUM_12) #define I2S_WS_IO (GPIO_NUM_10) #define I2S_DO_IO (GPIO_NUM_11) #define I2S_DI_IO (GPIO_NUM_9) #else #define I2S_MCK_IO (GPIO_NUM_0) #define I2S_BCK_IO (GPIO_NUM_4) #define I2S_WS_IO (GPIO_NUM_5) #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #define I2S_DO_IO (GPIO_NUM_18) #define I2S_DI_IO (GPIO_NUM_19) #else #define I2S_DO_IO (GPIO_NUM_2) #define I2S_DI_IO (GPIO_NUM_3) #endif #endif #else // CONFIG_EXAMPLE_BSP #include "bsp/esp-bsp.
4,140
h" #define I2C_NUM BSP_I2C_NUM #endif // CONFIG_EXAMPLE_BSP
4,140
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif #define EXAMPLE_BUFF_SIZE 2048 /** */ void i2s_example_pdm_tx_task(void *args); /** */ void i2s_example_pdm_rx_task(void *args); #ifdef __cplusplus } #endif
4,141
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif #define MAKE_KEY_CODE(row, col) ((row > 8) & 0xFF) #define GET_KEY_CODE_COL(code) (code & 0xFF) /** typedef struct matrix_kbd_t *matrix_kbd_handle_t; /** typedef enum { MATRIX_KBD_EVENT_DOWN, /*!< Key is pressed down */ MATRIX_KBD_EVENT_UP /*!< Key is released */ } matrix_kbd_event_id_t; /** */ typedef esp_err_t (*matrix_kbd_event_handler)(matrix_kbd_handle_t mkbd_handle, matrix_kbd_event_id_t event, void *event_data, void *handler_args); /** typedef struct { const int *row_gpios; /*!
4,142
< Array, contains GPIO numbers used by row line */ const int *col_gpios; /*!< Array, contains GPIO numbers used by column line */ uint32_t nr_row_gpios; /*!< row_gpios array size */ uint32_t nr_col_gpios; /*!< col_gpios array size */ uint32_t debounce_ms; /*!< Debounce time */ } matrix_kbd_config_t; /** #define MATRIX_KEYBOARD_DEFAULT_CONFIG() \ { \ .row_gpios = NULL, \ .col_gpios = NULL, \ .nr_row_gpios = 0, \ .nr_col_gpios = 0, \ .debounce_ms = 20, \ } /** */ esp_err_t matrix_kbd_install(const matrix_kbd_config_t *config, matrix_kbd_handle_t *mkbd_handle); /** */ esp_err_t matrix_kbd_uninstall(matrix_kbd_handle_t mkbd_handle); /** */ esp_err_t matrix_kbd_start(matrix_kbd_handle_t mkbd_handle); /** */ esp_err_t matrix_kbd_stop(matrix_kbd_handle_t mkbd_handle); /** */ esp_err_t matrix_kbd_register_event_handler(matrix_kbd_handle_t mkbd_handle, matrix_kbd_event_handler handler, void *args); #ifdef __cplusplus } #endif
4,142
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif #include "esp_types.h" #include "esp_event.h" #include "esp_err.h" #include "driver/uart.h" #define GPS_MAX_SATELLITES_IN_USE (12) #define GPS_MAX_SATELLITES_IN_VIEW (16) /** ESP_EVENT_DECLARE_BASE(ESP_NMEA_EVENT); /** typedef enum { GPS_FIX_INVALID, /*!< Not fixed */ GPS_FIX_GPS, /*!< GPS */ GPS_FIX_DGPS, /*!< Differential GPS */ } gps_fix_t; /** typedef enum { GPS_MODE_INVALID = 1, /*!< Not fixed */ GPS_MODE_2D, /*!< 2D GPS */ GPS_MODE_3D /*!< 3D GPS */ } gps_fix_mode_t; /** typedef struct { uint8_t num; /*!< Satellite number */ uint8_t elevation; /*!< Satellite elevation */ uint16_t azimuth; /*!< Satellite azimuth */ uint8_t snr; /*!< Satellite signal noise ratio */ } gps_satellite_t; /** typedef struct { uint8_t hour; /*!< Hour */ uint8_t minute; /*!< Minute */ uint8_t second; /*!< Second */ uint16_t thousand; /*!
4,143
< Thousand */ } gps_time_t; /** typedef struct { uint8_t day; /*!< Day (start from 1) */ uint8_t month; /*!< Month (start from 1) */ uint16_t year; /*!< Year (start from 2000) */ } gps_date_t; /** typedef enum { STATEMENT_UNKNOWN = 0, /*!< Unknown statement */ STATEMENT_GGA, /*!< GGA */ STATEMENT_GSA, /*!< GSA */ STATEMENT_RMC, /*!< RMC */ STATEMENT_GSV, /*!< GSV */ STATEMENT_GLL, /*!< GLL */ STATEMENT_VTG /*!< VTG */ } nmea_statement_t; /** typedef struct { float latitude; /*!< Latitude (degrees) */ float longitude; /*!< Longitude (degrees) */ float altitude; /*!< Altitude (meters) */ gps_fix_t fix; /*!< Fix status */ uint8_t sats_in_use; /*!< Number of satellites in use */ gps_time_t tim; /*!
4,143
< time in UTC */ gps_fix_mode_t fix_mode; /*!< Fix mode */ uint8_t sats_id_in_use[GPS_MAX_SATELLITES_IN_USE]; /*!< ID list of satellite in use */ float dop_h; /*!< Horizontal dilution of precision */ float dop_p; /*!< Position dilution of precision */ float dop_v; /*!< Vertical dilution of precision */ uint8_t sats_in_view; /*!< Number of satellites in view */ gps_satellite_t sats_desc_in_view[GPS_MAX_SATELLITES_IN_VIEW]; /*!< Information of satellites in view */ gps_date_t date; /*!< Fix date */ bool valid; /*!< GPS validity */ float speed; /*!< Ground speed, unit: m/s */ float cog; /*!
4,143
< Course over ground */ float variation; /*!< Magnetic variation */ } gps_t; /** typedef struct { struct { uart_port_t uart_port; /*!< UART port number */ uint32_t rx_pin; /*!< UART Rx Pin number */ uint32_t baud_rate; /*!< UART baud rate */ uart_word_length_t data_bits; /*!< UART data bits length */ uart_parity_t parity; /*!< UART parity */ uart_stop_bits_t stop_bits; /*!< UART stop bits length */ uint32_t event_queue_size; /*!< UART event queue size */ } uart; /*!< UART specific configuration */ } nmea_parser_config_t; /** typedef void *nmea_parser_handle_t; /** #define NMEA_PARSER_CONFIG_DEFAULT() \ { \ .uart = { \ .uart_port = UART_NUM_1, \ .rx_pin = CONFIG_NMEA_PARSER_UART_RXD,\ .
4,143
baud_rate = 9600, \ .data_bits = UART_DATA_8_BITS, \ .parity = UART_PARITY_DISABLE, \ .stop_bits = UART_STOP_BITS_1, \ .event_queue_size = 16 \ } \ } /** typedef enum { GPS_UPDATE, /*!< GPS information has been updated */ GPS_UNKNOWN /*!< Unknown statements detected */ } nmea_event_id_t; /** */ nmea_parser_handle_t nmea_parser_init(const nmea_parser_config_t *config); /** */ esp_err_t nmea_parser_deinit(nmea_parser_handle_t nmea_hdl); /** */ esp_err_t nmea_parser_add_handler(nmea_parser_handle_t nmea_hdl, esp_event_handler_t event_handler, void *handler_args); /** */ esp_err_t nmea_parser_remove_handler(nmea_parser_handle_t nmea_hdl, esp_event_handler_t event_handler); #ifdef __cplusplus } #endif
4,143
/* */ #pragma once #include #include "driver/rmt_encoder.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { uint32_t resolution; /*!< Encoder resolution, in Hz */ } led_strip_encoder_config_t; /** */ esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder); #ifdef __cplusplus } #endif
4,144
/* */ #pragma once #include #include "driver/rmt_encoder.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { uint16_t address; uint16_t command; } ir_nec_scan_code_t; /** */ typedef struct { uint32_t resolution; /*!< Encoder resolution, in Hz */ } ir_nec_encoder_config_t; /** */ esp_err_t rmt_new_ir_nec_encoder(const ir_nec_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder); #ifdef __cplusplus } #endif
4,145
/* */ #pragma once #include #include "driver/rmt_encoder.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { uint32_t resolution; // Encoder resolution, in Hz uint32_t sample_points; // Sample points used for deceleration phase. Note: |end_freq_hz - start_freq_hz| >= sample_points uint32_t start_freq_hz; // Start frequency on the curve, in Hz uint32_t end_freq_hz; // End frequency on the curve, in Hz } stepper_motor_curve_encoder_config_t; /** */ typedef struct { uint32_t resolution; // Encoder resolution, in Hz } stepper_motor_uniform_encoder_config_t; /** */ esp_err_t rmt_new_stepper_motor_curve_encoder(const stepper_motor_curve_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder); /** */ esp_err_t rmt_new_stepper_motor_uniform_encoder(const stepper_motor_uniform_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder); #ifdef __cplusplus } #endif
4,146
/* */ #pragma once #include #include "driver/rmt_encoder.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { uint32_t freq_hz; /*!< Frequency, in Hz */ uint32_t duration_ms; /*!< Duration, in ms */ } buzzer_musical_score_t; /** */ typedef struct { uint32_t resolution; /*!< Encoder resolution, in Hz */ } musical_score_encoder_config_t; /** */ esp_err_t rmt_new_musical_score_encoder(const musical_score_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder); #ifdef __cplusplus } #endif
4,147
/* */ #pragma once #include #include #include "driver/rmt_encoder.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef struct { uint16_t throttle; /*!< Throttle value */ bool telemetry_req; /*!< Telemetry request */ } dshot_esc_throttle_t; /** */ typedef struct { uint32_t resolution; /*!< Encoder resolution, in Hz */ uint32_t baud_rate; /*!< Dshot protocol runs at several different baud rates, e.g. DSHOT300 = 300k baud rate */ uint32_t post_delay_us; /*!< Delay time after one Dshot frame, in microseconds */ } dshot_esc_encoder_config_t; /** */ esp_err_t rmt_new_dshot_esc_encoder(const dshot_esc_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder); #ifdef __cplusplus } #endif
4,148
/* */ #pragma once #include #ifdef __cplusplus extern "C" { #endif /** */ uint32_t example_uri_encode(char *dest, const char *src, size_t len); /** */ void example_uri_decode(char *dest, const char *src, size_t len); #ifdef __cplusplus } #endif
4,149
/* Common utilities for socket address input interface: The API get_addr_from_stdin() is mainly used by socket client examples which read IP address from stdin (if configured). This option is typically used in the CI, but could be enabled in the project configuration. In that case this component is used to receive a string that is evaluated and processed to output socket structures to open a connectio This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include "lwip/sys.h" #include #include #ifdef __cplusplus extern "C" { #endif /** */ esp_err_t get_addr_from_stdin(int port, int sock_type, int *ip_protocol, int *addr_family, struct sockaddr_storage *dest_addr); #ifdef __cplusplus } #endif
4,150
/* */ /* Private Funtions of protocol example common */ #pragma once #include "esp_err.h" #include "esp_wifi.h" #include "sdkconfig.h" #ifdef __cplusplus extern "C" { #endif #if CONFIG_EXAMPLE_CONNECT_IPV6 #define MAX_IP6_ADDRS_PER_NETIF (5) #if defined(CONFIG_EXAMPLE_CONNECT_IPV6_PREF_LOCAL_LINK) #define EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE ESP_IP6_ADDR_IS_LINK_LOCAL #elif defined(CONFIG_EXAMPLE_CONNECT_IPV6_PREF_GLOBAL) #define EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE ESP_IP6_ADDR_IS_GLOBAL #elif defined(CONFIG_EXAMPLE_CONNECT_IPV6_PREF_SITE_LOCAL) #define EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE ESP_IP6_ADDR_IS_SITE_LOCAL #elif defined(CONFIG_EXAMPLE_CONNECT_IPV6_PREF_UNIQUE_LOCAL) #define EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE ESP_IP6_ADDR_IS_UNIQUE_LOCAL #endif // if-elif CONFIG_EXAMPLE_CONNECT_IPV6_PREF_... #endif #if CONFIG_EXAMPLE_CONNECT_IPV6 extern const char *example_ipv6_addr_types_to_str[6]; #endif void example_wifi_start(void); void example_wifi_stop(void); esp_err_t example_wifi_sta_do_connect(wifi_config_t wifi_config, bool wait); esp_err_t example_wifi_sta_do_disconnect(void); bool example_is_our_netif(const char *prefix, esp_netif_t *netif); void example_print_all_netif_ips(const char *prefix); void example_wifi_shutdown(void); esp_err_t example_wifi_connect(void); void example_ethernet_shutdown(void); esp_err_t example_ethernet_connect(void); esp_err_t example_ppp_connect(void); void example_ppp_start(void); void example_ppp_shutdown(void); #ifdef __cplusplus } #endif
4,151
/* Common functions for protocol examples, to establish Wi-Fi or Ethernet connection. This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include "sdkconfig.h" #include "esp_err.h" #if !CONFIG_IDF_TARGET_LINUX #include "esp_netif.h" #if CONFIG_EXAMPLE_CONNECT_ETHERNET #include "esp_eth.h" #endif #endif // !CONFIG_IDF_TARGET_LINUX #ifdef __cplusplus extern "C" { #endif #if !CONFIG_IDF_TARGET_LINUX #if CONFIG_EXAMPLE_CONNECT_WIFI #define EXAMPLE_NETIF_DESC_STA "example_netif_sta" #endif #if CONFIG_EXAMPLE_CONNECT_ETHERNET #define EXAMPLE_NETIF_DESC_ETH "example_netif_eth" #endif #if CONFIG_EXAMPLE_CONNECT_PPP #define EXAMPLE_NETIF_DESC_PPP "example_netif_ppp" #endif /* Example default interface, prefer the ethernet one if running in example-test (CI) configuration */ #if CONFIG_EXAMPLE_CONNECT_ETHERNET #define EXAMPLE_INTERFACE get_example_netif_from_desc(EXAMPLE_NETIF_DESC_ETH) #define get_example_netif() get_example_netif_from_desc(EXAMPLE_NETIF_DESC_ETH) #elif CONFIG_EXAMPLE_CONNECT_WIFI #define EXAMPLE_INTERFACE get_example_netif_from_desc(EXAMPLE_NETIF_DESC_STA) #define get_example_netif() get_example_netif_from_desc(EXAMPLE_NETIF_DESC_STA) #elif CONFIG_EXAMPLE_CONNECT_PPP #define EXAMPLE_INTERFACE get_example_netif_from_desc(EXAMPLE_NETIF_DESC_PPP) #define get_example_netif() get_example_netif_from_desc(EXAMPLE_NETIF_DESC_PPP) #endif /** */ esp_err_t example_connect(void); /** */ esp_err_t example_disconnect(void); /** */ esp_err_t example_configure_stdin_stdout(void); /** esp_netif_t *get_example_netif_from_desc(const char *desc); #if CONFIG_EXAMPLE_PROVIDE_WIFI_CONSOLE_CMD /** */ void example_register_wifi_connect_commands(void); #endif #if CONFIG_EXAMPLE_CONNECT_ETHERNET /** */ esp_eth_handle_t get_example_eth_handle(void); #endif // CONFIG_EXAMPLE_CONNECT_ETHERNET #else static inline esp_err_t example_connect(void) {return ESP_OK;} #endif // !
4,152
CONFIG_IDF_TARGET_LINUX #ifdef __cplusplus } #endif
4,152
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif void register_wifi_cmd(void); void register_wifi_itwt(void); void register_wifi_stats(void); #ifdef __cplusplus } #endif
4,153
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif #if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS || CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS int wifi_cmd_get_tx_statistics(int argc, char **argv); int wifi_cmd_clr_tx_statistics(int argc, char **argv); int wifi_cmd_get_rx_statistics(int argc, char **argv); int wifi_cmd_clr_rx_statistics(int argc, char **argv); #endif #ifdef __cplusplus } #endif
4,154
/* Iperf Example - iperf declaration This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #ifndef __IPERF_H_ #define __IPERF_H_ #include "esp_err.h" #include "esp_types.h" #ifdef __cplusplus extern "C" { #endif #define IPERF_IP_TYPE_IPV4 0 #define IPERF_IP_TYPE_IPV6 1 #define IPERF_TRANS_TYPE_TCP 0 #define IPERF_TRANS_TYPE_UDP 1 #define IPERF_FLAG_SET(cfg, flag) ((cfg) |= (flag)) #define IPERF_FLAG_CLR(cfg, flag) ((cfg) &= (~(flag))) #define IPERF_FLAG_CLIENT (1) #define IPERF_FLAG_SERVER (1 << 1) #define IPERF_FLAG_TCP (1 << 2) #define IPERF_FLAG_UDP (1 << 3) #define IPERF_DEFAULT_PORT 5001 #define IPERF_DEFAULT_INTERVAL 3 #define IPERF_DEFAULT_TIME 30 #define IPERF_DEFAULT_NO_BW_LIMIT -1 #define IPERF_TRAFFIC_TASK_NAME "iperf_traffic" #define IPERF_TRAFFIC_TASK_PRIORITY CONFIG_IPERF_TRAFFIC_TASK_PRIORITY #define IPERF_TRAFFIC_TASK_STACK 4096 #define IPERF_REPORT_TASK_NAME "iperf_report" #define IPERF_REPORT_TASK_PRIORITY CONFIG_IPERF_REPORT_TASK_PRIORITY #define IPERF_REPORT_TASK_STACK 4096 #define IPERF_DEFAULT_IPV4_UDP_TX_LEN (1470) #define IPERF_DEFAULT_IPV6_UDP_TX_LEN (1450) #define IPERF_DEFAULT_UDP_RX_LEN (16 << 10) #define IPERF_DEFAULT_TCP_TX_LEN (16 << 10) #define IPERF_DEFAULT_TCP_RX_LEN (16 << 10) #define IPERF_MAX_DELAY 64 #define IPERF_SOCKET_RX_TIMEOUT CONFIG_IPERF_SOCKET_RX_TIMEOUT #define IPERF_SOCKET_TCP_TX_TIMEOUT CONFIG_IPERF_SOCKET_TCP_TX_TIMEOUT #define IPERF_SOCKET_ACCEPT_TIMEOUT 5 typedef enum { MBITS_PER_SEC, KBITS_PER_SEC, BITS_PER_SEC } iperf_output_format; typedef struct { uint32_t flag; union { uint32_t destination_ip4; char *destination_ip6; }; union { uint32_t source_ip4; char *source_ip6; }; uint8_t type; uint16_t dport; uint16_t sport; uint32_t interval; uint32_t time; uint16_t len_send_buf; int32_t bw_lim; iperf_output_format format; } iperf_cfg_t; esp_err_t iperf_start(iperf_cfg_t *cfg); esp_err_t iperf_stop(void); #ifdef __cplusplus } #endif #endif
4,155
/* */ #pragma once #include "lwip/esp_netif_net_stack.h" /** */ err_t lwip_tapif_init(struct netif *netif); /** */ void lwip_tapif_input(void *h, void *buffer, size_t len, void *l2_buff);
4,156
/* */ #pragma once #include "esp_err.h" #include "esp_netif.h" /** */ void *tapio_create(void); /** */ esp_err_t tapio_output(void *h, void *buffer, size_t len);
4,157
/* */ /* Common functions for protocol examples, to establish tap interface connection This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /** */ esp_err_t example_connect(void); #ifdef __cplusplus } #endif
4,158
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif /** esp_err_t update_time_from_nvs(void); /** esp_err_t fetch_and_store_time_in_nvs(void*); #ifdef __cplusplus } #endif
4,159
/* */ /* HTTP File Server Example, common declarations This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include "sdkconfig.h" #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif esp_err_t example_mount_storage(const char *base_path); esp_err_t example_start_file_server(const char *base_path); #ifdef __cplusplus } #endif
4,160
#ifndef __HTTPD_TESTS_H__ #define __HTTPD_TESTS_H__ #include extern httpd_handle_t start_tests(void); extern void stop_tests(httpd_handle_t hd); #endif // __HTTPD_TESTS_H__
4,161
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif #ifndef DNS_SERVER_MAX_ITEMS #define DNS_SERVER_MAX_ITEMS 1 #endif #define DNS_SERVER_CONFIG_SINGLE(queried_name, netif_key) { \ .num_of_entries = 1, \ .item = { { .name = queried_name, .if_key = netif_key } } \ } /** */ typedef struct dns_entry_pair { const char* name; /**<! Exact match of the name field of the DNS query to answer */ const char* if_key; /**<! Use this network interface IP to answer, only if NULL, use the static IP below */ esp_ip4_addr_t ip; /**<! Constant IP address to answer this query, if "if_key==NULL" */ } dns_entry_pair_t; /** */ typedef struct dns_server_config { int num_of_entries; /**<! Number of rules specified in the config struct */ dns_entry_pair_t item[DNS_SERVER_MAX_ITEMS]; /**<! Array of pairs */ } dns_server_config_t; /** */ typedef struct dns_server_handle *dns_server_handle_t; /** */ dns_server_handle_t start_dns_server(dns_server_config_t *config); /** */ void stop_dns_server(dns_server_handle_t handle); #ifdef __cplusplus } #endif
4,162
/* */ #include #include #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif esp_err_t esp_netif_init(void); #ifdef __cplusplus } #endif
4,163
/* Keep Alive engine for wss server example This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #define KEEP_ALIVE_CONFIG_DEFAULT() \ { \ .max_clients = 10, \ .task_stack_size = 2048, \ .task_prio = tskIDLE_PRIORITY+1, \ .keep_alive_period_ms = 5000, \ .not_alive_after_ms = 10000, \ } struct wss_keep_alive_storage; typedef struct wss_keep_alive_storage* wss_keep_alive_t; typedef bool (*wss_check_client_alive_cb_t)(wss_keep_alive_t h, int fd); typedef bool (*wss_client_not_alive_cb_t)(wss_keep_alive_t h, int fd); /** */ typedef struct { size_t max_clients; /*!< max number of clients */ size_t task_stack_size; /*!
4,164
< stack size of the created task */ size_t task_prio; /*!< priority of the created task */ size_t keep_alive_period_ms; /*!< check every client after this time */ size_t not_alive_after_ms; /*!< consider client not alive after this time */ wss_check_client_alive_cb_t check_client_alive_cb; /*!< callback function to check if client is alive */ wss_client_not_alive_cb_t client_not_alive_cb; /*!< callback function to notify that the client is not alive */ void *user_ctx; /*!< user context available in the keep-alive handle */ } wss_keep_alive_config_t; /** */ esp_err_t wss_keep_alive_add_client(wss_keep_alive_t h, int fd); /** */ esp_err_t wss_keep_alive_remove_client(wss_keep_alive_t h, int fd); /** */ esp_err_t wss_keep_alive_client_is_active(wss_keep_alive_t h, int fd); /** */ wss_keep_alive_t wss_keep_alive_start(wss_keep_alive_config_t *config); /** */ void wss_keep_alive_stop(wss_keep_alive_t h); /** */ void wss_keep_alive_set_user_ctx(wss_keep_alive_t h, void *ctx); /** */ void* wss_keep_alive_get_user_ctx(wss_keep_alive_t h);
4,164
/* */ /* **/ #ifndef _DEVICE_PARAMS #define _DEVICE_PARAMS #include // This file defines structure of modbus parameters which reflect correspond modbus address space // for each modbus register type (coils, discreet inputs, holding registers, input registers) #pragma pack(push, 1) typedef struct { uint8_t discrete_input0:1; uint8_t discrete_input1:1; uint8_t discrete_input2:1; uint8_t discrete_input3:1; uint8_t discrete_input4:1; uint8_t discrete_input5:1; uint8_t discrete_input6:1; uint8_t discrete_input7:1; uint8_t discrete_input_port1; uint8_t discrete_input_port2; } discrete_reg_params_t; #pragma pack(pop) #pragma pack(push, 1) typedef struct { uint8_t coils_port0; uint8_t coils_port1; uint8_t coils_port2; } coil_reg_params_t; #pragma pack(pop) #pragma pack(push, 1) typedef struct { float input_data0; // 0 float input_data1; // 2 float input_data2; // 4 float input_data3; // 6 uint16_t data[150]; // 8 + 150 = 158 float input_data4; // 158 float input_data5; float input_data6; float input_data7; uint16_t data_block1[150]; } input_reg_params_t; #pragma pack(pop) #pragma pack(push, 1) typedef struct { float holding_data0; float holding_data1; float holding_data2; float holding_data3; uint16_t test_regs[150]; float holding_data4; float holding_data5; float holding_data6; float holding_data7; } holding_reg_params_t; #pragma pack(pop) extern holding_reg_params_t holding_reg_params; extern input_reg_params_t input_reg_params; extern coil_reg_params_t coil_reg_params; extern discrete_reg_params_t discrete_reg_params; #endif // !
4,165
defined(_DEVICE_PARAMS)
4,165