Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and re-export rgb crate for color handling #14

Merged
merged 11 commits into from
Feb 6, 2025
Merged

Add and re-export rgb crate for color handling #14

merged 11 commits into from
Feb 6, 2025

Conversation

alexeden
Copy link
Owner

@alexeden alexeden commented Feb 5, 2025

Added

  • #14 Add and re-export the rgb crate for all things related to color

Modified

  • BREAKING #14 The NeopixelModule now has a Color associated type that must implement the ComponentSlice<u8> trait from the rgb crate
    • For convenience, any device that implements the NeopixelModule trait exports a type alias for its Color type, e.g. NeoKey1x4Color
    • The impl_device_module! macro has been updated accordingly when implementing the NeopixelModule for a device:
      • Before: NeopixelModule { num_leds: 4, pin: 3 }
      • After: NeopixelModule<color_type = NeoKey1x4Color> { num_leds: 4, pin: 3 }
  • BREAKING #14 Functions that set handle colors in the NeopixelModule now take their Color associated type as parameters
    • Before: fn set_neopixel_color(&mut self, r: u8, g: u8, b: u8)
    • After: fn set_neopixel_color(&mut self, color: Self::Color)
    • Before: fn set_nth_neopixel_color(&mut self, n: usize, r: u8, g: u8, b: u8)
    • After: fn set_nth_neopixel_color(&mut self, n: usize, color: Self::Color)
    • Before: fn set_neopixel_colors(&mut self, colors: &[(u8, u8, u8); Self::N_LEDS as usize])
    • After: fn set_neopixel_colors(&mut self, colors: &[Self::Color; Self::N_LEDS])
  • #14 All device examples have been updated to use the new NeopixelModule API
  • #12 The register_write function on the Driver trait has been modified such that it no longer uses/needs const generics for buffer sizing (thanks @dsheets)

@alexeden alexeden marked this pull request as ready for review February 6, 2025 02:42
@alexeden alexeden merged commit 222e48c into main Feb 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant