ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
emerent has quit [Ping timeout: 246 seconds]
emerent has joined #rust-embedded
starblue has quit [Ping timeout: 252 seconds]
starblue has joined #rust-embedded
crabbedhaloablut has joined #rust-embedded
dc740 has joined #rust-embedded
causal has quit [Quit: WeeChat 3.6]
starblue has quit [Ping timeout: 246 seconds]
starblue has joined #rust-embedded
<re_irc> <richarddodd> almindor: All Rust ownership is 'virtual' in the end - none of it is present in the final binary (unless you count runtime techniques like reference counting).
<re_irc> <richarddodd> So I don't think what the HAL is doing is different in spirit to any other rust ownership code. I regularly introduce 'virtual' lifetimes and ownership when wrapping C APIs to embed the documented lifetime invariants in the types themselves
dc740 has quit [Remote host closed the connection]
<re_irc> <abdullahie> Thank me later https://t.me/+kaz97seJgx9jNTNh
dc740 has joined #rust-embedded
crabbedhaloablut has quit [Quit: No Ping reply in 180 seconds.]
crabbedhaloablut has joined #rust-embedded
<re_irc> <dirbaio> "async fn" in traits is sort of working on nightly now! 🚀
<re_irc> <dirbaio> it's happeninggggg!!
<re_irc> <burrbull> is TAIT still required?
<re_irc> <dirbaio> no
<re_irc> <dirbaio> (it internally desugars to an associated type + TAIT, but this doesn't mean stable AFIT needs stable TAIT)
<re_irc> <dirbaio> (similar to how stable "async fn" today desugars to unstable generators internally)
<re_irc> <burrbull> I just saw it in cfg features
<re_irc> <burrbull> you did not remove it
<re_irc> <dirbaio> see the PR descriiption, it doesn't remove all TAIT usage yet because trying to make SpiDevice using AFIT ICEs
<re_irc> <burrbull> ok
dc740 has quit [Remote host closed the connection]
<re_irc> <omar_u8> AM trying to create a function that looks like this "fn send_array<const P: char, const N: u8, SPI, PINS>( arr: &[u8], per: &Spi<SPI, PINS, TransferModeNormal>, cs: &Pin<P, N, Output>, ) -> Result<(), stm32f4xx_hal::spi::Error> { cs.set_low(); per.write(&arr); cs.set_high(); }" though I'm getting an error on the write method
<re_irc> <omar_u8> AM trying to create a function that looks like this "fn send_array<const P: char, const N: u8, SPI, PINS>( arr: &[u8], per: &Spi<SPI, PINS, TransferModeNormal>, cs: &Pin<P, N, Output>, ) -> Result<(), stm32f4xx_hal::spi::Error> { cs.set_low(); per.write(&arr); cs.set_high(); }" though I'm getting an error on the write method
<re_irc> <omar_u8> I'm trying to create a function that looks like this
<re_irc> "fn send_array<const P: char, const N: u8, SPI, PINS>( arr: &[u8], per: &Spi<SPI, PINS, TransferModeNormal>, cs: &Pin<P, N, Output>, ) -> Result<(), stm32f4xx_hal::spi::Error> { cs.set_low(); per.write(&arr); cs.set_high(); }" though I'm getting an error on the write method
<re_irc> <omar_u8> I'm trying to create a function that looks like this
<re_irc> "fn send_array<const P: char, const N: u8, SPI, PINS>( arr: &[u8], per: &Spi<SPI, PINS, TransferModeNormal>, cs: &Pin<P, N, Output>, ) -> Result<(), stm32f4xx_hal::spi::Error> { cs.set_low(); per.write(&arr); cs.set_high(); }"
<re_irc> though I'm getting an error on the write method
<re_irc> <omar_u8> Error has to do with trait bounds
<re_irc> <omar_u8> ```the method "write" exists for reference "&Spi<SPI, PINS>", but its trait bounds were not satisfied
<re_irc> the following trait bounds were not satisfied:
<re_irc> "&Spi<SPI, PINS>: stm32f4xx_hal::embedded_hal::blocking::spi::write::Default<_>"
<re_irc> which is required by `&Spi<SPI, PINS>: stm32f4xx_hal::prelude::_embedded_hal_blocking_spi_Write<_>````
<re_irc> <omar_u8> "the method `write` exists for reference `&Spi<SPI, PINS>`, but its trait bounds were not satisfied the following trait bounds were not satisfied: `&Spi<SPI, PINS>: stm32f4xx_hal::embedded_hal::blocking::spi::write::Default<_>` which is required by \`&Spi\<SPI, PINS>: stm32f4xx\_hal::prelude::_embedded\_hal\_blocking\_spi\_Write\<_\>"
<re_irc> <dirbaio> change "&Spi, &Pin" to "&mut Spi, &mut Pin"
<re_irc> <omar_u8> That didnt do it 😟
<re_irc> <omar_u8> The error message just added the word "mutable" to it :D
<re_irc> <omar_u8> * 😀
<re_irc> <dirbaio> ahh, you need to restrict the generics with "where" clauses so that Spi<..> and Pin<..> are valid
<re_irc> <dirbaio> usually copying the "where" clauses on these struct
<re_irc> <dirbaio> * structs
<re_irc> <dirbaio> but it's easier to use embedded-hal
<re_irc> <dirbaio> +traits on the bounds
<re_irc> <dirbaio> fn send_array<SPI, CS>( arr: &[u8], per: &mut SPI, cs: &mut CS) -> Result<(), SPI::Error>
<re_irc> SPI: embedded_hal::blocking::spi::Write,
<re_irc> where
<re_irc> CS: embedded_hal::digital::v2::OutputPin
<re_irc> <omar_u8> Right, that was my next step though I am experimenting to see if I understand what Im doing 😀
<re_irc> <omar_u8> Awesome thanks!
giripriyadarshan has joined #rust-embedded
giripriyadarshan has quit [Quit: Quit]
giripriyadarshan has joined #rust-embedded
giripriyadarshan has quit [Client Quit]
crabbedhaloablut has quit [Quit: No Ping reply in 180 seconds.]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Ping timeout: 258 seconds]
crabbedhaloablut has joined #rust-embedded
causal has joined #rust-embedded
rardiol has joined #rust-embedded
rardiol has quit [Ping timeout: 265 seconds]
rardiol has joined #rust-embedded