• Johny Mattsson's avatar
    Fix uart regressions & bugs (#2817) · b0558d5b
    Johny Mattsson authored
    * Fix uart regressions & bugs.
    
    Using `uart.on()` with a search character was broken in that it did
    not invoke the callback on a full UART buffer as documented. Logic reworked
    to match docs again.
    
    Fixed memory leak on `task_post()` failure (eep!).
    
    Improved logic to attempt to coalesce input bytes to reduce the number of
    `task_post()` slots used up by the platform uart.
    
    Finally, added a semaphore to prevent the platform uart from overrunning
    the `task_post()` slots all the time on high baud rates (e.g. 1mbit).
    With the semaphore in there, the LVM RTOS task gets a chance to actually
    process the received data and free up a `task_post()` slot or two.
    The above mentioned read coalescing then allows the platform uart to
    immediately catch up.
    
    Also added an error log message if the `task_post()` actually does fail.
    
    * Don't cache the uart delims.
    
    Doing so makes reconfiguring those settings from within the callback not
    take effect until the currently buffered bytes have been processed.
    b0558d5b
platform.c 18.5 KB