Input module is used to input received data from ESP device to LwESP middleware part.
2 processing options are possible:
Direct or indirect processing mode is select by setting
LWESP_CFG_INPUT_USE_PROCESS configuration value.
With indirect processing mode, every received character from ESP physical device is written to intermediate buffer between low-level driver and processing thread.
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 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.
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.
Check Porting guide for implementation examples.
Input function for received data.
lwesp_input(const void *data, size_t len)¶
Write data to input buffer.
lwesp_input_process(const void *data, size_t len)¶
Process input data directly without writing it to input buffer.
This function may only be used when in OS mode, where single thread is dedicated for input read of AT receive
LWESP_CFG_INPUT_USE_PROCESS must be enabled to use this function
[in] data: Pointer to received data to be processed
[in] len: Length of data to process in units of bytes