Input module

Input module is used to input received data from ESP device to ESP-AT-Lib middleware part. 2 processing options are possible:

Tip

Direct or indirect processing mode is select by setting ESP_CFG_INPUT_USE_PROCESS configuration value.

Indirect processing

With indirect processing mode, every received character from ESP physical device is written to intermediate buffer between low-level driver and processing thread.

Function esp_input() is used to write data to buffer, which is later processed by processing thread.

Indirect processing mode allows embedded systems to write received data to buffer from interrupt context (outside threads). As a drawback, its performance is decreased as it involves copying every receive character to intermediate buffer, and may also introduce RAM memory footprint increase.

Direct processing

Direct processing is targeting more advanced host controllers, like STM32 or WIN32 implementation use. It is developed with DMA support in mind, allowing low-level drivers to skip intermediate data buffer and process input bytes directly.

Note

When using this mode, function esp_input_process() must be used and it may only be called from thread context. Processing of input bytes is done in low-level input thread, started by application.

Tip

Check Porting guide for implementation examples.

group ESP_INPUT

Input function for received data.

Functions

espr_t esp_input(const void *data, size_t len)

Write data to input buffer.

Note

ESP_CFG_INPUT_USE_PROCESS must be disabled to use this function

Return

espOK on success, member of espr_t enumeration otherwise

Parameters
  • [in] data: Pointer to data to write

  • [in] len: Number of data elements in units of bytes

espr_t esp_input_process(const void *data, size_t len)

Process input data directly without writing it to input buffer.

Note

This function may only be used when in OS mode, where single thread is dedicated for input read of AT receive

Note

ESP_CFG_INPUT_USE_PROCESS must be enabled to use this function

Return

espOK on success, member of espr_t enumeration otherwise

Parameters
  • [in] data: Pointer to received data to be processed

  • [in] len: Length of data to process in units of bytes