<re_irc>
< (@firefrommoonlight:matrix.org)> You're looking for something like this in the DS
<re_irc>
< (@firefrommoonlight:matrix.org)> (That's for a RALTRON 52Mhz TCXO)
starblue has quit [Ping timeout: 256 seconds]
starblue has joined #rust-embedded
<Darius>
definitely check the datasheet, it varies a lot
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
<re_irc>
< (@thebutlah:matrix.org)> I have a feature flag that enables logging over uart, and a feature flag that controls which microcontroller I'm building for.
<re_irc>
For the uart loggers, I have two libraries - one that only works on esp32, and one that works on nrf52.
<re_irc>
I want to only enable the esp32 uart if _both_ the uart feature and the esp32 feature are enabled. Same with the nrf52.
<re_irc>
But cargo doesn't have a way to specify an "&&" between features for enabling an optional dependency.
<re_irc>
< (@thebutlah:matrix.org)> if "log-uart" AND "mcu-esp32c3", then enable "defmt_esp_println/uart"
<re_irc>
< (@grantm11235:matrix.org)> I think you can make it work if you create a logging library that works with both esp and nrf
<re_irc>
< (@grantm11235:matrix.org)> (Or just merge both your existing libraries into one)
<re_irc>
< (@grantm11235:matrix.org)> Then you can do "mcu-esp32c3 = ["defmt_println?/esp"]" and "log-uart = ["defmt_println/uart"]"
<re_irc>
< (@grantm11235:matrix.org)> You could implement the universal logging library as a thin shim around your existing libraries with something like this in the cargo toml of the new crate:
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Write error: Connection reset by peer]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
<re_irc>
< (@adamgreig:matrix.org)> Darius: I would love to check the datasheet but alas, seeed (who make the module that has the tcxo under the tin) don't say what it is or what voltage it needs 💀
<Darius>
adamgreig: fuuuu
<re_irc>
< (@adamgreig:matrix.org)> it's powered by the stm32wl which has a built in adjuatable ldo for powering tcxos that can be set in firmware to any voltage 1.6-3.3
<Darius>
what is the modue?
<re_irc>
< (@adamgreig:matrix.org)> which is cool for sur but would be better if they said what voltage it needs lol
<re_irc>
< (@adamgreig:matrix.org)> lora-e5
<Darius>
yeah
<Darius>
tried emailing them?
<Darius>
or their forums etc
<re_irc>
<meteor> Hi, have anyone compiled rust code for Arduino Uno Rev3 before?
<re_irc>
i'm holding off with a first release until i get some feedback here (hopefully?) on whether it makes sense to keep this driver-specific or if it could be agnostic (which would basically just mean some renaming of the structs).
<re_irc>
<Ralph> as a side-note: i've also had to add a "PwmPin" mock implementation to the "embedded-hal-mock" library, hopefully this is also useful to others: https://github.com/dbrgn/embedded-hal-mock/pull/52
crabbedhaloablut has quit [Read error: Connection reset by peer]
crabbedhaloablut has joined #rust-embedded
starblue has quit [Ping timeout: 260 seconds]
starblue has joined #rust-embedded
genpaku has quit [Read error: Connection reset by peer]
<re_irc>
- setting up the Rx/Tx pins, using these to set up a "Serial" and set up DMA for it (i realise more and more that this probably shouldn't/can't be in the crate at all because it's too device-specific; in the other drivers you e.g. also pass in the i2c instance and not the pins because it can't construct an i2c instance from them in a generic way)
<re_irc>
what i currently have separately in the consuming code is the handling of the DMA buffer (every time i get a message / the buffer i read for which i have to use "next_transfer") and i wonder if i could put that into the library.
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
<re_irc>
<Dlaw> Is there a good way to condition package dependencies on build profile? I'd like to use rtt-target and panic-rtt-target for my debug build, but strip out all the rtt stuff and use panic-abort or panic-halt on the release build. I'd like to use rprintln! calls throughout my code and have them magically turn into no-ops for the release build. My motivation here is shrinking the binary size of the release binary by making...
<re_irc>
... sure it doesn't include any string formatting.
<re_irc>
<Dlaw> (I am aware of defmt-rtt as one possible solution to minimize the binary size impact from string formatting. I'm still interested in learning how to have some dependency used for debug but not release, whether it's defmt or rtt or something else.)
dc740 has quit [Remote host closed the connection]
<re_irc>
<elephantpie> If I've never done any embedded systems programming which book should I start with? Is it that difficult to just learn from the main Embedded Rust Book?
<re_irc>
< (@k900:0upti.me)> The book is a good option
causal has joined #rust-embedded
starblue has quit [Ping timeout: 256 seconds]
crabbedhaloablut has quit [Remote host closed the connection]
<re_irc>
i guess it doesn't hurt to have the _dependency_ enabled if it's not actually "use"ed as it then won't end up in the compiled code? because i'm not aware of a way to select dependencies based on a profile (but i'm by no means an expert - i just briefly looked at the docs and checked the auto-complete in the IDE 😅)
<re_irc>
if anyone sees a good way to actually implement more of the device-specific stuff (UART, etc.) in the generic crate that'd be great!
<re_irc>
<Dlaw> Ralph: Conditional compilation works for covering up rtt usage (even if it's slightly clunky for me to define my own wrapper around rprintln), but it doesn't give me a way to change out the panic handler library
<re_irc>
<Dlaw> So panic-rtt-target is still there and it still pulls in all the string formatting stuff
<re_irc>
<Dlaw> Oh, hmm, it looks like I can place a conditional compilation attribute on the "use" statement which pulls in each of the panic handlers. This surprises me because I thought "use" tweaks what's in the local namespace but doesn't actually alter what links with the program.
<re_irc>
<Ralph> Dlaw: yes, you can put it on the "use". sorry, didn't mention that explicitly before.
<re_irc>
that's why i think that this should work (i haven't tried it for the crates you mentioned, but i've now tried it on 1-2 other external crates which i had as optional dependencies and had to guard in the code)
starblue has joined #rust-embedded
emerent has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
IlPalazzo-ojiisa has quit [Quit: Leaving.]
crabbedhaloablut has quit [Remote host closed the connection]