Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TW#14031] Feature request: UART code improvement #805

Closed
samsam4 opened this issue Jul 15, 2017 · 2 comments
Closed

[TW#14031] Feature request: UART code improvement #805

samsam4 opened this issue Jul 15, 2017 · 2 comments

Comments

@samsam4
Copy link

samsam4 commented Jul 15, 2017

In case of UART_PATTERN_DET event, the uart_event_t.size to return the position in the buffer of the pattern detected(i.e. size of the buffered data before and incl. the terminators) instead of the total data size in the buffer.
It is a common situation to transmit via uart some chunks of data or commands which are terminated with a predefined terminator char(or few chars). Before the terminator is received, the part of data/command received and accumulated in the uart buffer so far is useless and is waste of resources to grab and process every few chars when they come available instead on UART_PATTERN_DET event notification to pull only the finished(terminated) chunk and whatever bytes left in the buffer to wait there until next terminator come.
Else with current condition need one extra buffer to move the data from the uart there, locate the terminator, use the bytes before it, then delete them and shift if there some leftovers to wait for the next chunk(s) of data until next terminator is available and so on .. :(

@FayeY FayeY changed the title Feature request: UART code improvement [TW#14031] Feature request: UART code improvement Jul 17, 2017
@FayeY
Copy link
Collaborator

FayeY commented Nov 28, 2017

Hi @samsam4 , this feature should have been added in the latest IDF. If it is not, please feel free to reopen this issue. Thanks.

@FayeY FayeY closed this as completed Nov 28, 2017
@projectgus
Copy link
Contributor

Reopening as this feature is not part of ESP-IDF yet.

@projectgus projectgus reopened this Jan 12, 2018
igrr pushed a commit that referenced this issue Jan 23, 2018
requirement from github(#805): to provide the position in the buffer of the pattern detected.

requirement from AT application: in AT app, when no hardware flow control is enabled, in some situation the rx buffer might be full, and the terminator “+++” might be lost, we can use pattern detect interrupt to avoid missing the terminator. When pattern detect interrupt happens, it will not send a data event at the same time.

1. Add API to get position of detected pattern in rx buffer
2. Modify UART event example
3. Add comments for uart_flush, add alias API uart_flush_input to clear the rx buffer
4. Modify the way rx_buffered_len is calculated
@FayeY FayeY closed this as completed Jan 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants