Open rursprung opened 9 months ago
I am working on an example that reads from one serial port and writes to another using Read
and Write
traits from embedded-io-0.6.1
(and using embedded-hal-1.0.0
). The code further below compiles using @techmccat 's fork of stm32g4xx-hal
and branch eh-v1.0
of stm32h7xx-hal
. Compiling with stm32f4xx-hal
gives these errors:
From the unused import
messages I think the stm32f4xx-hal
compile is not finding the traits properly. Is there a work-around or fix for this? The code and Cargo.toml` are
These are also available in a package structure at https://github.com/pdgilbert/echo .
This example is derived from an example that worked with embedded-hal-0.2.7
by reading and writing individual bytes. As pointed out by @richardion (see https://github.com/stm32-rs/stm32h7xx-hal/issues/474#issuecomment-1883838622 ), there are no methods for byte wise serial operations in embedded-io
. Thus the read/write buffer in the example can now be more than a single byte. I am not sure the example code will accomplish this properly, so comments on the code would also be appreciated.
Also tried with the stm32f4xx_hal
io
branch for @burrbull 's pull request https://github.com/stm32-rs/stm32f4xx-hal/pull/725. The error message suggests to disambiguate the method. So changing, for example, tx1.write(b"\r\nconsole connect check.\r\n").ok();
to embedded_io::Write::write(&mut tx1, b"\r\nconsole connect check.\r\n").ok();
the writes do not cause errors. It does not address Read
. Attempting read with let _len = embedded_io::Read::read(&mut rx1, &mut buffer).ok();
to disambiguate gives
with
embedded-hal
v1 the UART related traits have been removed in favour ofembedded-io
. thus these traits should be implemented by this HAL so that the replacement for the old e-h 0.2 traits is available.for avr-hal i've done an attempt at this, maybe that helps as a reference: https://github.com/Rahix/avr-hal/pull/484 (i don't have an STM32 at hand, so i can't provide it here, sorry)