Implement the ufmt_write::uWrite trait for the USB Serial JTAG driver (#751)

* Implement the `ufmt_write::uWrite` trait for the USB Serial JTAG driver

* Update CHANGELOG
This commit is contained in:
Jesse Braham 2023-08-23 08:24:47 -07:00 committed by GitHub
parent 83e138a5d3
commit 9acb915fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add GPIO (output) and delay functionality to `esp32c6-lp-hal` (#715)
- Implement RTCIO pullup, pulldown and hold control for Xtensa MCUs (#684)
- Add GPIO input support and implement additional `embedded-hal` output traits for the C6's LP core [#720]
- Implement `ufmt_write::uWrite` trait for USB Serial JTAG (#751)
### Changed

View File

@ -240,6 +240,25 @@ impl core::fmt::Write for UsbSerialJtag<'_> {
}
}
#[cfg(feature = "ufmt")]
impl ufmt_write::uWrite for UsbSerialJtag<'_> {
type Error = Error;
#[inline]
fn write_str(&mut self, s: &str) -> Result<(), Self::Error> {
self.write_bytes(s.as_bytes())?;
Ok(())
}
#[inline]
fn write_char(&mut self, ch: char) -> Result<(), Self::Error> {
let mut buffer = [0u8; 4];
self.write_bytes(ch.encode_utf8(&mut buffer).as_bytes())?;
Ok(())
}
}
impl embedded_hal::serial::Read<u8> for UsbSerialJtag<'_> {
type Error = Error;