xnor has quit [Read error: Connection reset by peer]
<re_irc> <@n​ewam:m​atrix.org> ```text
<re_irc> <@n​ewam:m​atrix.org> Why does it take longer to document code than to compile it? 🤔
<re_irc> <@n​ewam:m​atrix.org> cargo doc --features stm32wl5x_cm4 23.452 total
<re_irc> <@n​ewam:m​atrix.org> Finished dev [optimized + debuginfo] target(s) in 23.40s
fabic has joined #rust-embedded
xnor has joined #rust-embedded
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
cyrozap has quit [Ping timeout: 272 seconds]
cyrozap has joined #rust-embedded
starblue2 has joined #rust-embedded
starblue1 has quit [Ping timeout: 250 seconds]
zBeeble42 has quit [Remote host closed the connection]
zBeeble has joined #rust-embedded
emerent has quit [Ping timeout: 245 seconds]
<re_irc> <@n​ewam:m​atrix.org> So we all know the one-giant-macro approach for the HALs.
<re_irc> <@n​ewam:m​atrix.org> I wanted to see which was better for compile times; one giant macro, or splitting up the giant macro into multiple smaller macros (1-2 methods per macro).
<re_irc> <@n​ewam:m​atrix.org> one giant macro:
<re_irc> <@n​ewam:m​atrix.org> ```console
emerent has joined #rust-embedded
<re_irc> <@f​irefrommoonlight:m​atrix.org> What are the macros for specifically?
<re_irc> <@n​ewam:m​atrix.org> in this case `embedded_hal` serial trait implementations for multiple instantiations of similar UART peripherals (LpUart is ever so slightly different than the other UARTs)
<re_irc> <@n​ewam:m​atrix.org> That and creating clk_en/clk_dis/rst functions since the UARTs controls are all in different RCC registers.
<re_irc> <@w​illeml:m​atrix.org> Does anyone know of a rust embedded library for emulating an xbox 360 (or one) controller over usb? I want to make a custom joystick/hotas, although I guess that there is the other question of is there enough usb support available for that in rust
<re_irc> <@n​ewam:m​atrix.org> host side USB is pretty good these days with `rusb`, not sure about embedded though.
<re_irc> <@w​illeml:m​atrix.org> Yeah, I would probably be needing embedded side because the mcu probably needs to present itself as an HID device (or whatever xbox controllers show up as)
<re_irc> <@9​names:m​atrix.org> that sounds more like a USB device
<re_irc> <@t​halesfragoso:m​atrix.org> You can create HID devices pretty easy today in rust, see all the keyboards already written in rust
<re_irc> <@t​halesfragoso:m​atrix.org> Not sure how special a Xbox controller is though
<re_irc> <@w​illeml:m​atrix.org> Hehe, I was just asking in a few keyboard discords, but am more wondering about the actual xbox/xinput side of things
<re_irc> <@n​ewam:m​atrix.org> I would grab wireshark and an xbox controller and see for myself :P
<re_irc> <@9​names:m​atrix.org> xbox controller is a slightly special custom HID device
<re_irc> <@w​illeml:m​atrix.org> Apparently the C keyboard software emulates an xbox controller for joystick functionality
<re_irc> <@t​halesfragoso:m​atrix.org> 9names: That shouldn't be much of a problem, you can define HID descriptors just fine
<re_irc> <@w​illeml:m​atrix.org> How would I do a generic controller than? is there a library for that?
<re_irc> <@t​halesfragoso:m​atrix.org> Mostly using the usb-device crate
<re_irc> <@w​illeml:m​atrix.org> Or is this something not yet done publicly that I would have to invent from scratch
<re_irc> <@t​halesfragoso:m​atrix.org> Probably there are a few HID crates, but if they don't give you enough flexibility, you can always write your HID descriptors yourself
<re_irc> <@9​names:m​atrix.org> i haven't seen anyone do a joystick so far. the xbox HID impl is different to the standard joystick one though
<re_irc> <@9​names:m​atrix.org> it is well documented in C projects though, so you shouldn't need to wireshark it
<re_irc> <@t​halesfragoso:m​atrix.org> That might give your some idea of how to define your own interface and descriptors:
<re_irc> <@w​illeml:m​atrix.org> The reason I want to show the device as a "normal controller" (so xbox or something) is so that geforce now actually does the passthrough
<re_irc> <@t​halesfragoso:m​atrix.org> willeml ^
<re_irc> <@w​illeml:m​atrix.org> thalesfragoso: ooo, thanks, ill check that out
hifi has quit [Remote host closed the connection]
hifi has joined #rust-embedded
<re_irc> <@w​00tspeaks:m​atrix.org> I managed to get openocd working to some degree with a lpc55s16
<re_irc> <@w​00tspeaks:m​atrix.org> I'm wondering if anyone here knows how to configure openocd properly for a particular chip.
<re_irc> <@w​00tspeaks:m​atrix.org> I seem to be able to stop and start execution.
fabic has quit [Ping timeout: 268 seconds]
jasperw has joined #rust-embedded
SanchayanMaity has quit [*.net *.split]
GenTooMan has quit [*.net *.split]
Ekho has quit [*.net *.split]
jasperw- has quit [*.net *.split]
inara has quit [*.net *.split]
fabic has joined #rust-embedded
SanchayanMaity has joined #rust-embedded
inara has joined #rust-embedded
<re_irc> <@b​radleyharden:m​atrix.org> @newam, I'm not sure if you're interested, but I thought I might share something. In `atsamd-hal`, we've managed to almost entirely move away from the macro approach. We use type-level metaprogramming instead. There's a bit of a learning curve, but once you're past that, I think the result is ultimately...
<re_irc> ... easier to understand, more powerful, and *far* more readable than macros.
<re_irc> <@b​radleyharden:m​atrix.org> In particular, I think I remember seeing you post a PR about refactoring a GPIO module. I remember looking at the code and thinking it was somewhat similar to our approach, but it still used macros.
<re_irc> <@b​radleyharden:m​atrix.org> I think our [`gpio`](https://atsamd-rs.github.io/docs/samd21g/thumbv6m-none-eabi/doc/atsamd_hal/gpio/v2/pin/index.html) module is a nice case study for the type-level approach. The [`AnyPin`](https://atsamd-rs.github.io/docs/samd21g/thumbv6m-none-eabi/doc/atsamd_hal/gpio/v2/pin/trait.AnyPin.html) trait in...
Shell has joined #rust-embedded
wose has joined #rust-embedded
Ekho has joined #rust-embedded
ni has joined #rust-embedded
GenTooMan has joined #rust-embedded
Lumpio- has joined #rust-embedded
<re_irc> <@h​egza:m​atrix.org> thalesfragoso: Suddenly interested as well. I'm going for a 2 weeks vacation starting next week, and on the vacation I'll need customize a bit of software to try and run a "USB-C pill" = Mini F4 as a HID joystick. Couldn't find a non-chinese page to sell those though. Probably need to get the order in today.
<re_irc> <@h​egza:m​atrix.org> The story is that we're making a bunch of dance gaming platforms and fixing the controllers on a few. The existing implementation runs on Teensy but we need to make 4 so having a cheaper hardware implementation would be great for our club. I know the author of that Teensy HID joystick for the dance gaming platform...
<re_irc> ... and he said it's pretty simple and the components for a STM32 should exist. He thinks doing it on a blue pill or a mini f4 should definitely be doable.
<Lumpio-> The "USB C pill" is available through a more or less official Chinese page so the quality should be ok, but shipping will take ages as always
cyrozap has quit [Ping timeout: 248 seconds]
cyrozap has joined #rust-embedded
<re_irc> <@h​egza:m​atrix.org> I saw that page I think, but like, I don't think I know enough Chinese to find the buy button.
<Lumpio-> It's just AliExpress
<re_irc> <@h​egza:m​atrix.org> No but the upper aliexpress link doesn't seem to contain the right device and the 'Sincere' link is dead.
<Lumpio-> Hmm
<Lumpio-> Guess they've ran into supply problems too finally
<Lumpio-> https://www.aliexpress.com/item/1005001456186625.html this seems to be available still
<Lumpio-> I feel like it may have gone up in price though
<re_irc> <@h​egza:m​atrix.org> I'm not super good at interpreting this, or don't know if it makes sense but it looks like it supports just a single ADC pin and we'd need 8, for 8 force sensing resistors. That's how we detect whether a person's foot is on a panel or not.
<re_irc> <@t​herealprof:m​atrix.org> heksa: Should have 10.
<re_irc> <@h​egza:m​atrix.org> The one linked by Lumpio- , not the original. Or does the STM32F411CEU6 implement the STM32F4+ or something like that.
<re_irc> <@h​egza:m​atrix.org> I mean, reading the name, the F4+ seems to imply F411CEU6 :D
<re_irc> <@t​herealprof:m​atrix.org> The clones are using the same chips as the original.
<re_irc> <@t​herealprof:m​atrix.org> (in theory, there might be copycats putting whatever chips on there 😅)
<Lumpio-> This shop has at least sold genuine stuff in the past and has the audacity to call out others for selling "pirated" copies so maybe they're fine? But you never know
<Lumpio-> Not sure what "F4+" is
<re_irc> <@h​egza:m​atrix.org> Well it's linked to by the WeAct github so that's probably real :) Thanks a lot, I think that I'm confident enough to make the order today. I might still fail at the HID joystick implementation but there's plenty of fallback options.
<Lumpio-> HID should be pretty doable!
<Lumpio-> But anyways do remember the standard shipping takes weeks usually
<Lumpio-> At least where I live it's been 2-3 weeks lately.
<re_irc> <@h​egza:m​atrix.org> Yeah, well constructing the pad hardware (CNC machining the wood and steel components, pulling the wires) is the important part. The chip can be inserted later on, of course I'll have the best time for development during the vacation. I do similar things for work so I could probably complete a part of the work even...
<re_irc> ... without the board.
<Lumpio-> oo, CNC steel machining huh
<Lumpio-> What're you building anyways, a DDR pad?
<re_irc> <@h​egza:m​atrix.org> yes, exactly
<Lumpio-> Neat
<Lumpio-> Knowing how to machine metal and such would be pretty neat
<Lumpio-> The homemade CNC at our hacklab can do aluminum at best, if you're careful
<re_irc> <@h​egza:m​atrix.org> At Tampere by any chance? It's the one we're using. We were considering using aluminum, but decided to go with steel; similar to the Cobalt Flux design. Not using CNC for that.
<Lumpio-> Lahti unfortunately
<re_irc> <@h​egza:m​atrix.org> Also getting highly off-topic, so if you want to continue on the CNC track, DM me :D
<Lumpio-> heh, maybe if I ever go through with my "move to Tampere" plan
<re_irc> <@n​ewam:m​atrix.org> is github showing HTTP 500 (internal server error) for anyone else?
<re_irc> <@n​ewam:m​atrix.org> https://www.githubstatus.com/
<re_irc> <@n​ewam:m​atrix.org> Oh, that answers that. Looks like a mini-meltdown
<re_irc> <@r​yan-summers:m​atrix.org> Yeah, in 100% unrelated news, my work has ground to a halt for the last hour
<re_irc> <@n​ewam:m​atrix.org> Heh, still better than what I use at work, we internally host bitbucket and gitlab and the uptime is only about 90% during work hours.
<re_irc> <@r​yan-summers:m​atrix.org> Pfft, uptime is overrated ;) In all seriousness, that sounds awful
<re_irc> <@r​yan-summers:m​atrix.org> I'm sorry 😅
<re_irc> <@c​hrysn:p​rivacytools.io> ah, and i was just about to look for an out-of-band channel to say that the commits i've claimed to have pushed around didn't really arrive anywhere.
<re_irc> <@r​yan-summers:m​atrix.org> I was going to ping you, but then my pushes started erroring out and I realized there were bigger fish frying
<Lumpio-> If you must use a trait object
<Lumpio-> oops
xnor has quit [Changing host]
xnor has joined #rust-embedded
fabic has quit [Ping timeout: 268 seconds]
<re_irc> <@g​rantm11235:m​atrix.org> How do I write unit tests that run on my pc for an embedded project? Do I need to create a separate library crate?
<re_irc> <@n​ewam:m​atrix.org> Generally yes, you need a library crate.
<re_irc> <@n​ewam:m​atrix.org> https://ferrous-systems.com/blog/tags/testing/
<re_irc> <@n​ewam:m​atrix.org> Check out the ferrous systems blog series on this, they cover on-target testing, off-target testing, all the things.
<re_irc> <@a​lmindor:m​atrix.org> anyone has any experience with a host shield like this http://domoticx.com/arduino-shield-usb-2-0-host-shield/ ? I'm trying to understand the power settings/jumpers but it's really confusing to me
SanchayanMaity has quit [Ping timeout: 245 seconds]
SanchayanMaity has joined #rust-embedded
<re_irc> <@c​hrysn:p​rivacytools.io> GrantM11235: If you have components of the chip you don't simulate in full, there may be opportunities to mock them at different levels. For example (as I'm just working on updates on that), if you don't have a mock for your radio module but the radio module provides the embedded-nal abstraction, you can...
<re_irc> ... replace it in testing with std-embedded-nal. Sure your tests don't cover the network stack code, but you can do a bit more thorough testing on the integration side. (Same goes for other peripherals and the linux-embedded-hal crate).
<re_irc> <@g​rantm11235:m​atrix.org> I just want some unit tests to help me write my parsing code. I can't be bothered to deal with different crates and workspaces, so for now I am just re-flashing each time I want to test a change.
<re_irc> <@t​herealprof:m​atrix.org> adamgreig: You there?
<re_irc> <@m​virkkunen:m​atrix.org> almindor: I made a board like that once with the same chip, does that count?
<re_irc> <@a​damgreig:m​atrix.org> therealprof: Nope, sorry! Not around to run a meeting today
<re_irc> <@t​herealprof:m​atrix.org> Oh, I'm also not prepared. Was fully immersed in some forstner bit action and just preparing food.
<re_irc> <@m​ichal:c​ap-net.cz> Hi, I have written a library that uses
<re_irc> <@m​ichal:c​ap-net.cz> and I would like to be able use it with `no_std` how can I solve this?
<re_irc> <@m​ichal:c​ap-net.cz> use std::cmp::Ordering;
<re_irc> <@m​ichal:c​ap-net.cz> use std::marker::PhantomData;
<re_irc> <@m​ichal:c​ap-net.cz> use std::ops::{Add, Div, Mul, Sub}```
<re_irc> <@a​lmindor:m​atrix.org> > > <almindor> anyone has any experience with a host shield like this http://domoticx.com/arduino-shield-usb-2-0-host-shield/ ? I'm trying to understand the power settings/jumpers but it's really confusing to me
<re_irc> <@a​lmindor:m​atrix.org> >
<re_irc> <@a​lmindor:m​atrix.org> > I made a board like that once with the same chip, does that count?
<re_irc> <@n​ewam:m​atrix.org> Michal: ```rust
<re_irc> <@n​ewam:m​atrix.org> #![no_std]
<re_irc> <@n​ewam:m​atrix.org> use core::marker::PhantomData;
<re_irc> <@n​ewam:m​atrix.org> use core::cmp::Ordering;
<re_irc> <@n​ewam:m​atrix.org> use core::ops::{Add, Div, Mul, Sub};
<re_irc> <@m​virkkunen:m​atrix.org> Michal: If you use no std features at all, just change all occurences of `std::` to `core::` and add `#![no_std]` at the top of your lib.rs
<re_irc> <@a​lmindor:m​atrix.org> damn quoting, yeah it counts :) i'm really confused about how to safely test those power jumpers
<re_irc> <@m​virkkunen:m​atrix.org> oops, slow
<re_irc> <@h​argonix:m​atrix.org> Michal: all of these traits can be found in core:: instead of std:: as well
<re_irc> <@m​ichal:c​ap-net.cz> Thank you very much 🙂
<re_irc> <@n​ewam:m​atrix.org> Lumpio−: 3x the answers is better than none 😀
<re_irc> <@h​argonix:m​atrix.org> something something redundancy
<re_irc> <@m​virkkunen:m​atrix.org> almindor: I think the page you linked is missing some things, but at least there's a schematic. Hopefully it's accurate.
<re_irc> <@j​osfemova:m​atrix.org> So I'm making some lab-equipment drivers (RS-232 com via UART) and was wondering if using nom was a good Idea for processing the ASCII commands coming from the instruments
<re_irc> <@j​osfemova:m​atrix.org> Perhaps someone has experience doing similar stuff and can provide useful info
<re_irc> <@m​virkkunen:m​atrix.org> Anyways, to start, the USB spec requires 5V power. Do you have that available? Self-powered devices may work without, but there's no guarantees.
<re_irc> <@j​osfemova:m​atrix.org> josfemova: The complexity of the sintaxis varies with the instrument ofc. Rn MKS 979B, MKS PR4000B and Adixen ACT-600H are priority
<re_irc> <@a​lmindor:m​atrix.org> > Anyways, to start, the USB spec requires 5V power. Do you have that available? Self-powered devices may work without, but there's no guarantees.
<re_irc> <@a​lmindor:m​atrix.org> my MCU should be able to provide both 3.3V and 5V but I can alwyas provide 5V from an external source
<re_irc> <@m​virkkunen:m​atrix.org> The specific shield on that page kind of seems to be designed for 5V microcontrollers it seems, it even has a level shifter of some sort, but by messing with those jumpers it can probably be made work
<re_irc> <@a​lmindor:m​atrix.org> yeah they mentioned "compatible with both 5V and 3.3V MCUs" so I'm guessing one jumper shuts off the upshift
<re_irc> <@a​lmindor:m​atrix.org> unless they just lazily ment "5V logic levels that 3.3V can use if it doesn't burn"
<re_irc> <@m​virkkunen:m​atrix.org> Well the USB chip itself is 3.3v only
<re_irc> <@m​ichal:c​ap-net.cz> And when I have function like this:
<re_irc> <@m​ichal:c​ap-net.cz> if table.len() < 2 {
<re_irc> <@m​ichal:c​ap-net.cz> pub fn new(table: &'a mut [(K, T)]) -> Self {
<re_irc> <@m​ichal:c​ap-net.cz> panic!("Array has to have length at least of two elements")
<re_irc> <@a​lmindor:m​atrix.org> Lumpio− btw. did you write a driver for thee MAX3421E chip when playing around with your board?
<re_irc> <@m​virkkunen:m​atrix.org> almindor Well... not really a proper driver but a test program that reads a keyboard
<re_irc> <@a​lmindor:m​atrix.org> > almindor Well... not really a proper driver but a test program that reads a keyboard
<re_irc> <@a​lmindor:m​atrix.org> is it OSS?
<re_irc> <@m​ichal:c​ap-net.cz> Solved with `introsort` crate
<re_irc> <@m​virkkunen:m​atrix.org> almindor: Well it's more like just files sitting on one of my computers but I can put them on github or something if you want to see
<re_irc> <@m​virkkunen:m​atrix.org> It's half hard-coded
<re_irc> <@a​lmindor:m​atrix.org> sure, it'd be a good start to get something going if I can manage the hw side
<re_irc> <@a​lmindor:m​atrix.org> thanks
<re_irc> <@a​lmindor:m​atrix.org> ok I wired the power pins + gnd from my MCU to this shield and it seems those 2 jumpers just cut power off unless you solder them. I'm guessing if enable both it'll use 3.3V for the MAX chip and the 5V for the USB out
<re_irc> <@m​virkkunen:m​atrix.org> If I'm looking at it right I'd solder both 3.3V and 5V next to the arduino jumpers, *but* put 3.3V on the Arduino 5V pin
<re_irc> <@m​virkkunen:m​atrix.org> Then leave both VBUS jumpers open but use the separate VBUS pad to feed 5V
<re_irc> <@m​virkkunen:m​atrix.org> Because your system is 3.3V you really only need 5V going to VBUS (literally the USB port) and nothing else
<re_irc> <@m​virkkunen:m​atrix.org> I think anyways.
<re_irc> <@m​virkkunen:m​atrix.org> almindor https://github.com/mvirkkunen/maxtest/tree/master/src you'll note that main.rs is from a time with weird GPIO incompatibilities, but `max.rs` is pretty readable
<re_irc> <@m​virkkunen:m​atrix.org> And platform agnostic too! I think anyways.
<re_irc> <@a​lmindor:m​atrix.org> thanks!
<re_irc> <@m​virkkunen:m​atrix.org> https://github.com/mvirkkunen/max3421eboard also this is the board it goes with but I guess that's not that important
<re_irc> <@m​virkkunen:m​atrix.org> (That one can be both host or device)
<re_irc> <@a​lmindor:m​atrix.org> ahh I get it now, the ARD jumpers are just input enablers from the MCU and then the VUSB jumpers are connecting them to the VUSB subcircruit or not (so that you provide an external 5v or possibly 3.3v for that)
<re_irc> <@a​lmindor:m​atrix.org> I guess the logic level will always be 5V tho
<re_irc> <@m​virkkunen:m​atrix.org> Looking at this schematic you can make it 3.3v: http://domoticx.com/wp-content/uploads/2019/07/Arduino-USB-2.0-Host-shield-schema.png
<re_irc> <@m​virkkunen:m​atrix.org> By doing what I suggested earlier.
SanchayanMaity_ has joined #rust-embedded
SanchayanMaity has quit [Ping timeout: 248 seconds]
SanchayanMaity_ is now known as SanchayanMaity
<re_irc> <@m​virkkunen:m​atrix.org> But yeah that's assuming the schematic matches what you actually got. You should be safe trying it out if you check with a multimeter to make sure the VBUS is not connected to anything else and then connect 5V to it, and only connect 3.3V elsewhere
<re_irc> <@a​lmindor:m​atrix.org> yeah that's what I'm thinking, ARD 3v shorted only, connect 5V to VBUS directly
<re_irc> <@m​virkkunen:m​atrix.org> I think you need to provide something on the "5V" (not "VBUS") line too for the level shifter/buffer/whatever, but 3.3V should be ok
<re_irc> <@m​virkkunen:m​atrix.org> Also make sure to remove any existing jumpers from the VBUS select when you put 5V directly
<re_irc> <@a​lmindor:m​atrix.org> yeah so the whole issue here is, the MCU is 3v3 (it has output 5V but the logic level is 3v3)