mtthw-meyer / libdaisy-rust

Hardware Abstraction Layer implementation for Daisy boards
MIT License
47 stars 17 forks source link

Add hid::Led along with knob example using it #4

Closed glindstedt closed 3 years ago

glindstedt commented 3 years ago

Ported the Knob example from the official libraries. The hid::Led struct is roughly based on hid_led.cpp with some minor differences. Used this article as reference and so I've renamed samplerate which they use in hid_led.cpp to resolution, which I find is more intuitive. I'm also not sure why they divide 120 on this line hid_led.cpp#L41, so I didn't replicate it.

Pulling in the micromath crate is purely to get the f32.sqrt() function.

mtthw-meyer commented 3 years ago

Looks good. I'll give it a test when I get a chance and merge it.