Skip to content

expose SerialBase interrupt control methods in UARTSerial #6295

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

Closed

Conversation

bmcdonnell-ionx
Copy link
Contributor

@bmcdonnell-ionx bmcdonnell-ionx commented Mar 7, 2018

Description

These methods should be exposed in UARTSerial like they are in Serial, right?

I haven't tested this yet, since I'm still trying to figure out how to conditionally sleep / wake on interrupt. Input on that question thread is welcome, so that I can test this PR.

It builds, though, and seems like it ought to work.

Pull request type

  • Fix
  • Refactor
  • New target
  • Feature
  • Breaking change

@kjbracey
Copy link
Contributor

kjbracey commented Mar 8, 2018

Nope, you should be using the generic FileHandle mechanisms here. Everything you need is in FileHandle. The tools are FileHandle::set_blocking/sigio/read/write, and mbed::poll().

Note if using UARTSerial you don't care about interrupts directly - you care about data or space in the buffers. UARTSerial provides that info via the generic FileHandle calls.

I had prepared a bunch of Handbook examples for UARTSerial/FileHandle based on the Serial ones showing the equivalent forms, but I think they got lost in the review ether.

In the tree you can see examples in https://github.com/ARMmbed/mbed-os/blob/master/platform/ATCmdParser.cpp and https://github.com/ARMmbed/mbed-os/blob/master/features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp. The second one uses interrupt-driven input - stream_cb -> ppp_input - mixed with blocking output - ppp_output.

Note that neither of them know anything about serial - they would work with any FileHandle stream device. (But the word serial occurs once in a comment. Pah).

The FileHandle APIs are basically the same as POSIX/Linux/whatever - just Google nonblocking/asynchronous IO.

@bmcdonnell-ionx
Copy link
Contributor Author

@kjbracey-arm, I'll look into your suggestions a bit later. It seems that you've addressed my wrong approach, so please close this as "don't merge" / wontfix for now.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2018

Please reopen if any update

@0xc0170 0xc0170 closed this Mar 8, 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

Successfully merging this pull request may close these issues.

3 participants