ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to and logged at, code of conduct at
starblue has quit [Ping timeout: 246 seconds]
starblue has joined #rust-embedded
explore has quit [Quit: Connection closed for inactivity]
Socke has quit [Ping timeout: 248 seconds]
Socke has joined #rust-embedded
emerent has quit [Ping timeout: 260 seconds]
emerent has joined #rust-embedded
tokomak has joined #rust-embedded
ymwm has joined #rust-embedded
ymwm has quit [Max SendQ exceeded]
ymwm has joined #rust-embedded
ymwm has quit [Max SendQ exceeded]
ymwm has joined #rust-embedded
ymwm has quit [Max SendQ exceeded]
ymwm has joined #rust-embedded
ymwm has quit [Max SendQ exceeded]
ymwm has joined #rust-embedded
ymwm has quit [Max SendQ exceeded]
IsaacClayton[m] has quit [Quit: You have been kicked for being idle]
<re_irc> <nihal.pasham> I'm using the "log" crate for some quick testing on the raspberry pi 4 (which I believe rpi4 has support for atomics). The "impl" is a copy-paste from the crate's documentation.
<re_irc> use log::{Level, Metadata, Record};
<re_irc> use rustBoot_hal::info;
<re_irc> use log::{LevelFilter, SetLoggerError};
<re_irc> <David Cabanis> ls
<ni> Cargo.lock Cargo.toml src/
<ni> :)
starblue has quit [Ping timeout: 248 seconds]
<re_irc> <nihal.pasham> the thread-unsafe version (i.e. "set_logger_racy") works as expected. I wonder why the safe version does not work. My guess is - probably has something to do the MMU being disabled. I'm writing some bare-metal stuff that doesn't need the MMU.
starblue has joined #rust-embedded
gsalazar has joined #rust-embedded
gsalazar has quit [Ping timeout: 260 seconds]
gsalazar has joined #rust-embedded
GenTooMan has joined #rust-embedded
gsalazar has quit [Ping timeout: 268 seconds]
<re_irc> <chmanie> I'm looking at the embedded_time library here and am trying to format a frequency: but it seems the "format!" macro is not available to me. How could I obtain it?
<re_irc> <Martin> maybe you could use "write!" instead
<re_irc> <chmanie> Hm, where would that come from?
<re_irc> <chmanie> Ah it only says it's ambiguous
<re_irc> <Martin> "use core::fmt::Write;"
<re_irc> <chmanie> Okay thank you!
<re_irc> <chmanie> It seems I have to implement the formatter:
<re_irc> <chmanie> I mean it's weard, embedded_time is specifically targeting no_std, why would format! be in the docs
<re_irc> <chmanie> * weird,
<re_irc> <Martin> also in the super cool heapless crate you have a String type to allows you:
<re_irc> let mut out: String<U256> = String::new();
<re_irc> let my_var = Type::new()
<re_irc> write!(&mut out, "{}", my_var).unwrap();
<re_irc> <chmanie> Ah yeah I forgot about heapless!
<re_irc> <chmanie> But I also just saw that there's an "integer()" method on the Rates
<re_irc> <chmanie> Thanks Martin!
gsalazar has joined #rust-embedded
CheeksTheGeek has joined #rust-embedded
CheeksTheGeek has left #rust-embedded [#rust-embedded]
cyrozap has quit [Ping timeout: 260 seconds]
cyrozap has joined #rust-embedded
gsalazar has quit [Ping timeout: 240 seconds]
<re_irc> <ryan-summers> Question: If you have an array of "[MaybeUninit<u8>; N]", is it sound to transmute that memory into an array of "[u8; N]" since all memory values are valid for "u8"?
<re_irc> <ryan-summers> I essentially just want that uninitialized u8 array as a "&mut [u8]" slice so I can pass it to an external function. I don't have control to make that external function take "&mut [MaybeUninit<u8>]" instead
<re_irc> <ryan-summers> I guess you can do "let array =|x| unsafe { x.assume_init() });" as well. Unsure if that compiles into any actual instructions
<re_irc> <ryan-summers> Follow up: No, it's not valid to do, and I always forget this
tokomak has quit [Ping timeout: 268 seconds]
<re_irc> <dngrs (spookyvision@github)> it sure is slightly irritating that you get nonsensical missing stdlib build errors when you just haven't done the required "rustup target add whatever-target-triple"
<re_irc> <dngrs (spookyvision@github)> ryan-summers: hmm, I suppose because the compiler will be like "yeah this is invalid memory so I can do UB in any way I want" when you try to access it?
<re_irc> <jamwaffles> They really meant min when "min_const_generics" was stabilised :((((
<re_irc> Is there a way to do "let buf = [0u8; N / u8::BITS]" where "const N: usize" on stable rust?
<re_irc> <dirbaio> no :(
<re_irc> <jamwaffles> It's beautiful on nightly with "#![feature(generic_const_exprs)]" 😍
<re_irc> <dirbaio> you can kinda workaround it by having the user pass in both N and N/8
<re_irc> <jamwaffles> Yeah that's what I'm doing for now. This struct will end up with 4 const params which is a lil uggo
<re_irc> <dirbaio> and maybe do some hax to assert the user did it right at compile time..
<re_irc> <dirbaio> or have the top-level API be a macro that passes all the params
<re_irc> <dirbaio> I did that here, it wasn't that bad
<re_irc> <jamwaffles> Hm that doesn't look too bad actually, thanks for the tip 🙂
<re_irc> <dirbaio> it doesn't work if the user passes _another_ const generic to the macro, of course...
<re_irc> <jamwaffles> I think I can get away with "PackedBuffer<const W: u32, const H: u32, const N: usize>" where "N = (W * H) / 8", no need for a fourth one (which was the cause of my original question). I suppose a macro would let me elide "N" but I'm doing an assertion to check the invariant anyway
<re_irc> <dirbaio> fun
emerent has quit [Remote host closed the connection]
emerent has joined #rust-embedded