2 ms·
I would be interested to see some more complex examples for this than the ones provided[1], specifically around interrupts and DMA, both are somewhat "concurren
by snops 7y ago
I would be interested to see some more complex examples for this than the ones provided[1], specifically around interrupts and DMA, both are somewhat "concurrent" resources that in C need to be managed manually, with careful use of the volatile keyword and similar.
For instance, UART transmit looks to be implemented using blocking IO[2]. I don't know Go very well, but it would be interesting if this could be implemented as a buffered channel [3], which would provide a nice abstraction for the hardware FIFO buffer used by the UART, and allow the CPU to be doing other things. The same could also be used for the I2S support I think, which will often be used to send much more data (streaming audio) than the UART.
On closer inspection, looking at the issue tracker, it appears this is already in planning, which is great [4].
[1] https://github.com/tinygo-org/tinygo/tree/master/src/examples https://github.com/tinygo-org/tinygo/tree/master/src/example...
[2] https://github.com/tinygo-org/tinygo/blob/515daa7d3c9af18c78fd97d43cafda7e4dec6290/src/machine/machine_stm32f103xx.go#L156-L163 https://github.com/tinygo-org/tinygo/blob/515daa7d3c9af18c78...
[3] https://gobyexample.com/channel-buffering https://gobyexample.com/channel-buffering
[4] https://github.com/tinygo-org/tinygo/issues/9#issuecomment-502468619 https://github.com/tinygo-org/tinygo/issues/9#issuecomment-5...