Skip Menu |

This queue is for tickets about the Device-Chip CPAN distribution.

Report information
The Basics
Id: 127166
Status: open
Priority: 0/
Queue: Device-Chip

People
Owner: Nobody in particular
Requestors: simcop [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Feature Request: UART
There should be some kind of UART support added. Challenges 1) input reception, since this happens outside the program we need to schedule checks or reads somehow 2) platform support Pros 1) Another protocol to talk to devices, there's a lot of chips or modules that talk some form of serial port comms out there 2) Will make supporting projects like Firmata as adapters easier and more featurefully 3) We could use this to talk to bus pirates directly (over a D::C::A serial adapter), making some adapters that work over a serial interface already more portable Cons Adds complexity to the whole system
Undoubtedly, adding UART support will be useful. Supporting output (transmit) cases should be simple enough, as it would behave similarly to the write cases of SPI and I²C at present. Supporting input (receive) will require some design thought. I could imagine two ways it might work, either as alternatives, or combined in some way: * Adding a (Future-returning of course) ->read method that can potentially run concurrently with a ->write; and encourage users to use tricks like Future::Utils::repeat or, expecting a working version at some point, Future::AsyncAwait to create the "blocking" read loop. * Adding some sort of callback or stream mechanism to provide received data as and when it arrives. Callback or stream support might also provide a handy design precedent for how to handle adapters that can provide interrupt-like behaviours, perhaps to inform of state changes on handshaking or dedicated interrupt lines. I think as a first step, adding output-only UART support should be simple enough, and allow initial experimentation with what sort of configure API should look like (to set baud rate etc...), while considering any support for input handling as more experimental than the rest, and subject to change in later versions if we don't like it. -- Paul Evans