Sounds like a candidate for driver interface, not HAL. I agree with Miguel. User could pick the implementation which uses UART, or one which uses hal_timer with hal_gpio.
However; Sam, you don’t think a generic driver interface makes sense? If you had driver package which implemented an API similar to this: One-Wire Library, https://www.pjrc.com/teensy/td_libs_OneWire.html <https://www.pjrc.com/teensy/td_libs_OneWire.html>, would you have been able to use it? > On Jul 3, 2018, at 3:11 AM, Sam Lewis <[email protected]> wrote: > > It might be more difficult to make a generic driver for but I've had some > great success using a UART peripheral to read/write 1 wire devices. There's > a good writeup of how this works in this app note: > https://www.maximintegrated.com/en/app-notes/index.mvp/id/214 > > The benefit is less CPU time needed for bit banging but you need to make > sure your 1 wire device fits the timing constraints of your UART peripheral. > > Just thought it was worth mentioning, might be something to consider. > > Sam > > > > On Tue., 3 Jul. 2018, 6:11 am Kevin Townsend, <[email protected]> > wrote: > >> Hi Miguel, >> >> Good to hear! >> >> Yeah, GPIO is the only way I've ever implemented this and I think a >> simple SW implementation is the way to go here. >> >> K. >> >> >> On 02/07/18 21:39, Miguel Azevedo wrote: >>> Hi Kevin, >>> I actually do have some code for 1-wire I implemented a few days ago. >>> AFAIK most MCUs we support don't have 1-wire specific hardware, so why >>> not have a general implementation(using hal_timer) instead of one >>> implementation per MCU? >>> >>> Thanks, >>> >>> Miguel >>> On Mon, Jul 2, 2018 at 8:10 PM Kevin Townsend >>> <[email protected]> wrote: >>>> Is there any interest is discussing how to add Dallas 1-Wire support to >>>> the HAL? https://en.wikipedia.org/wiki/1-Wire >>>> >>>> It's a bit of a niche item, but an interesting protocol (you can power >>>> some devices from the single GPIO line) and there are some very common >>>> and cheap waterproof temp sensors and a few other common items that are >>>> only available in 1 wire. >>>> >>>> I'm happy to put one or two test drivers together for common items like >>>> the DS18B20 (https://www.adafruit.com/product/381) ... but the HAL >>>> implementation is something that should probably be discussed with the >>>> wider community first. >>>> >>>> Kevin >>>> >>> >> >>
