Input module

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

Tip

Direct or indirect processing mode is select by setting LWESP_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 lwesp_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 lwesp_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 LWESP_INPUT

Input function for received data.

Functions

lwespr_t lwesp_input(const void *data, size_t len)

Write data to input buffer.

Note

LWESP_CFG_INPUT_USE_PROCESS must be disabled to use this function

Parameters
  • data[in] Pointer to data to write

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

Returns

lwespOK on success, member of lwespr_t enumeration otherwise

lwespr_t lwesp_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

LWESP_CFG_INPUT_USE_PROCESS must be enabled to use this function

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

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

Returns

lwespOK on success, member of lwespr_t enumeration otherwise