cbiffle / keybrain

Drop-in replacement controller for WASD CODE v2B keyboard
75 stars 4 forks source link

Hey Fellow WASD tinkerer #1

Open NonLogicalDev opened 4 years ago

NonLogicalDev commented 4 years ago

It's really cool to see a simple keyboard FW implemented in rust, that is pretty amazing level of functionality with so little code. Mad respect.

I did a similar project but used QMK and a Teensie:

cbiffle commented 4 years ago

I saw your project when I was trying not to design my own board, actually! You linked to the WASDat, which I was really excited about until I realized it's neither open source nor available for purchase, so I had to re-reverse-engineer the mechanical layout and spacing. (Disappointment with WASDat is a lot of why I published this.)

Your wiring is very neat, nice work. :-)

dhiltonp commented 4 years ago

I was looking at QMK and came across the WASDat hardware target. If only the HW were also open!

NonLogicalDev commented 4 years ago

@cbiffle Out of sheer curiosity what references did you use to get USB/HID and DFU compatibility implemented in rust?

Looking at stuff like this:

Also are there any good sources to start on embedded rust journey? Besides your website =]

cbiffle commented 3 years ago

I was looking at QMK and came across the WASDat hardware target. If only the HW were also open!

@dhiltonp - or even available for purchase! But it looks like it was a one-time group buy. Which is okay in the end, I don't love 8-bit processors anyway. The information in this repo should enable someone to make a QMK-compatible system if desired. (QMK might even run on this hardware already! I have no idea.)

Out of sheer curiosity what references did you use to get USB/HID and DFU compatibility implemented in rust?

@NonLogicalDev - so there's a stack of potential answers to that question. :-)

In terms of starting the journey, the Rust Embedded Book is a good place to start. It will give you enough information to get up to the "blinking an LED" point. There are some nice frameworks and stuff available in the Rust ecosystem, none of which I use, because I apparently like to make my life difficult?

The system init code, linker script, etc. that you linked is the result of past experience with the stm32 series and a large quantity of trial and error while staring at the ST reference manual. Referring to the ChromeOS embedded controller STM32L4 port also helped (though it's in C).

Same with the USB driver. This is my first USB project, so I spent a lot of time staring at:

The DFU support is, uh, weird. That code is not implementing USB DFU per se, it's jumping into the ST ROM bootloader, which itself can do DFU. Arguably a hack, but a very convenient one. So as a result, I actually have no idea how USB DFU works on the wire -- I just know that if I b 0x1fff0000 with the right context the ROM will do it for me. (I decided to implement this at the last minute after noticing that a freshly built board showed up as a USB device, because the ROM couldn't find any firmware in Flash.)