<re_irc>
<@newam:matrix.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>
<@newam:matrix.org> So we all know the one-giant-macro approach for the HALs.
<re_irc>
<@newam:matrix.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>
<@firefrommoonlight:matrix.org> What are the macros for specifically?
<re_irc>
<@newam:matrix.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>
<@newam:matrix.org> That and creating clk_en/clk_dis/rst functions since the UARTs controls are all in different RCC registers.
<re_irc>
<@willeml:matrix.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>
<@newam:matrix.org> host side USB is pretty good these days with `rusb`, not sure about embedded though.
<re_irc>
<@willeml:matrix.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>
<@9names:matrix.org> that sounds more like a USB device
<re_irc>
<@thalesfragoso:matrix.org> You can create HID devices pretty easy today in rust, see all the keyboards already written in rust
<re_irc>
<@thalesfragoso:matrix.org> Not sure how special a Xbox controller is though
<re_irc>
<@willeml:matrix.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>
<@newam:matrix.org> I would grab wireshark and an xbox controller and see for myself :P
<re_irc>
<@9names:matrix.org> xbox controller is a slightly special custom HID device
<re_irc>
<@willeml:matrix.org> Apparently the C keyboard software emulates an xbox controller for joystick functionality
<re_irc>
<@thalesfragoso:matrix.org> 9names: That shouldn't be much of a problem, you can define HID descriptors just fine
<re_irc>
<@willeml:matrix.org> How would I do a generic controller than? is there a library for that?
<re_irc>
<@thalesfragoso:matrix.org> Mostly using the usb-device crate
<re_irc>
<@willeml:matrix.org> Or is this something not yet done publicly that I would have to invent from scratch
<re_irc>
<@thalesfragoso:matrix.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>
<@9names:matrix.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>
<@9names:matrix.org> it is well documented in C projects though, so you shouldn't need to wireshark it
<re_irc>
<@thalesfragoso:matrix.org> That might give your some idea of how to define your own interface and descriptors:
<re_irc>
<@willeml:matrix.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>
<@thalesfragoso:matrix.org> willeml ^
<re_irc>
<@willeml:matrix.org> thalesfragoso: ooo, thanks, ill check that out
hifi has quit [Remote host closed the connection]
hifi has joined #rust-embedded
<re_irc>
<@w00tspeaks:matrix.org> I managed to get openocd working to some degree with a lpc55s16
<re_irc>
<@w00tspeaks:matrix.org> I'm wondering if anyone here knows how to configure openocd properly for a particular chip.
<re_irc>
<@w00tspeaks:matrix.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>
<@bradleyharden:matrix.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>
<@bradleyharden:matrix.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>
<@hegza:matrix.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>
<@hegza:matrix.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>
<@hegza:matrix.org> I saw that page I think, but like, I don't think I know enough Chinese to find the buy button.
<Lumpio->
I feel like it may have gone up in price though
<re_irc>
<@hegza:matrix.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>
<@therealprof:matrix.org> heksa: Should have 10.
<re_irc>
<@hegza:matrix.org> The one linked by Lumpio- , not the original. Or does the STM32F411CEU6 implement the STM32F4+ or something like that.
<re_irc>
<@hegza:matrix.org> I mean, reading the name, the F4+ seems to imply F411CEU6 :D
<re_irc>
<@therealprof:matrix.org> The clones are using the same chips as the original.
<re_irc>
<@therealprof:matrix.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>
<@hegza:matrix.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>
<@hegza:matrix.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>
<@hegza:matrix.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>
<@hegza:matrix.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>
<@hegza:matrix.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>
<@newam:matrix.org> is github showing HTTP 500 (internal server error) for anyone else?
<re_irc>
<@newam:matrix.org> Oh, that answers that. Looks like a mini-meltdown
<re_irc>
<@ryan-summers:matrix.org> Yeah, in 100% unrelated news, my work has ground to a halt for the last hour
<re_irc>
<@newam:matrix.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>
<@ryan-summers:matrix.org> Pfft, uptime is overrated ;) In all seriousness, that sounds awful
<re_irc>
<@ryan-summers:matrix.org> I'm sorry 😅
<re_irc>
<@chrysn:privacytools.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>
<@ryan-summers:matrix.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>
<@grantm11235:matrix.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>
<@newam:matrix.org> Generally yes, you need a library crate.
<re_irc>
<@newam:matrix.org> Check out the ferrous systems blog series on this, they cover on-target testing, off-target testing, all the things.
<re_irc>
<@almindor:matrix.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>
<@chrysn:privacytools.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>
<@grantm11235:matrix.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>
<@therealprof:matrix.org> adamgreig: You there?
<re_irc>
<@mvirkkunen:matrix.org> almindor: I made a board like that once with the same chip, does that count?
<re_irc>
<@adamgreig:matrix.org> therealprof: Nope, sorry! Not around to run a meeting today
<re_irc>
<@therealprof:matrix.org> Oh, I'm also not prepared. Was fully immersed in some forstner bit action and just preparing food.
<re_irc>
<@michal:cap-net.cz> Hi, I have written a library that uses
<re_irc>
<@michal:cap-net.cz> and I would like to be able use it with `no_std` how can I solve this?
<re_irc>
<@michal:cap-net.cz> use std::cmp::Ordering;
<re_irc>
<@michal:cap-net.cz> use std::marker::PhantomData;
<re_irc>
<@michal:cap-net.cz> use std::ops::{Add, Div, Mul, Sub}```
<re_irc>
<@almindor:matrix.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>
<@almindor:matrix.org> >
<re_irc>
<@almindor:matrix.org> > I made a board like that once with the same chip, does that count?
<re_irc>
<@newam:matrix.org> Michal: ```rust
<re_irc>
<@newam:matrix.org> #![no_std]
<re_irc>
<@newam:matrix.org> use core::marker::PhantomData;
<re_irc>
<@newam:matrix.org> use core::cmp::Ordering;
<re_irc>
<@newam:matrix.org> use core::ops::{Add, Div, Mul, Sub};
<re_irc>
<@mvirkkunen:matrix.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>
<@almindor:matrix.org> damn quoting, yeah it counts :) i'm really confused about how to safely test those power jumpers
<re_irc>
<@mvirkkunen:matrix.org> oops, slow
<re_irc>
<@hargonix:matrix.org> Michal: all of these traits can be found in core:: instead of std:: as well
<re_irc>
<@michal:cap-net.cz> Thank you very much 🙂
<re_irc>
<@newam:matrix.org> Lumpio−: 3x the answers is better than none 😀
<re_irc>
<@mvirkkunen:matrix.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>
<@josfemova:matrix.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>
<@josfemova:matrix.org> Perhaps someone has experience doing similar stuff and can provide useful info
<re_irc>
<@mvirkkunen:matrix.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>
<@josfemova:matrix.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>
<@almindor:matrix.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>
<@almindor:matrix.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>
<@mvirkkunen:matrix.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>
<@almindor:matrix.org> yeah they mentioned "compatible with both 5V and 3.3V MCUs" so I'm guessing one jumper shuts off the upshift
<re_irc>
<@almindor:matrix.org> unless they just lazily ment "5V logic levels that 3.3V can use if it doesn't burn"
<re_irc>
<@mvirkkunen:matrix.org> Well the USB chip itself is 3.3v only
<re_irc>
<@michal:cap-net.cz> And when I have function like this:
<re_irc>
<@michal:cap-net.cz> if table.len() < 2 {
<re_irc>
<@michal:cap-net.cz> panic!("Array has to have length at least of two elements")
<re_irc>
<@almindor:matrix.org> Lumpio− btw. did you write a driver for thee MAX3421E chip when playing around with your board?
<re_irc>
<@mvirkkunen:matrix.org> almindor Well... not really a proper driver but a test program that reads a keyboard
<re_irc>
<@almindor:matrix.org> > almindor Well... not really a proper driver but a test program that reads a keyboard
<re_irc>
<@almindor:matrix.org> is it OSS?
<re_irc>
<@michal:cap-net.cz> Solved with `introsort` crate
<re_irc>
<@mvirkkunen:matrix.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>
<@almindor:matrix.org> sure, it'd be a good start to get something going if I can manage the hw side
<re_irc>
<@almindor:matrix.org> thanks
<re_irc>
<@almindor:matrix.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>
<@mvirkkunen:matrix.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>
<@mvirkkunen:matrix.org> Then leave both VBUS jumpers open but use the separate VBUS pad to feed 5V
<re_irc>
<@mvirkkunen:matrix.org> Because your system is 3.3V you really only need 5V going to VBUS (literally the USB port) and nothing else
<re_irc>
<@mvirkkunen:matrix.org> I think anyways.
<re_irc>
<@mvirkkunen:matrix.org> (That one can be both host or device)
<re_irc>
<@almindor:matrix.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>
<@almindor:matrix.org> I guess the logic level will always be 5V tho
<re_irc>
<@mvirkkunen:matrix.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>
<@mvirkkunen:matrix.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>
<@almindor:matrix.org> yeah that's what I'm thinking, ARD 3v shorted only, connect 5V to VBUS directly
<re_irc>
<@mvirkkunen:matrix.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>
<@mvirkkunen:matrix.org> Also make sure to remove any existing jumpers from the VBUS select when you put 5V directly
<re_irc>
<@almindor:matrix.org> yeah so the whole issue here is, the MCU is 3v3 (it has output 5V but the logic level is 3v3)