[−][src]Struct wooting_sdk::rgb::RgbKeyboard
Represents the connected keyboard to perform RGB operations. This struct is empty and
only exists to enforce that reset
is called on drop.
Implementations
impl RgbKeyboard
[src]
pub fn direct_set_key<K: IntoMatrixRowColumn>(
&mut self,
key: K,
red: u8,
green: u8,
blue: u8
) -> bool
[src]
&mut self,
key: K,
red: u8,
green: u8,
blue: u8
) -> bool
Set the color of a single key. This will not influence the keyboard color array. Use
this function for simple amplifications, like a notification. Use the array functions
if you want to change the entire keyboard. Returns true
if the color is set.
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Set the A key to white... keyboard.direct_set_key(Key::A, 255, 255, 255);
pub fn direct_reset_key<K: IntoMatrixRowColumn>(&mut self, key: K) -> bool
[src]
Directly reset the color of a single key on the keyboard. This will not influence the
keyboard color array. Use this function for simple amplifications, like a notification.
Use the array functions if you want to change the entire keyboard. Returns true
if
the color is reset.
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Set the A key to white... keyboard.direct_set_key(Key::A, 255, 255, 255); // ..and then reset it back! keyboard.direct_reset_key(Key::A);
pub fn array_update(&mut self) -> bool
[src]
Apply any updates made by the array_set_single
and array_set_full
functions.
Returns true
if the colors are updated.
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Modify keyboard array so A will be set to white.. keyboard.array_set_single(Key::A, 255, 255, 255); // ..and apply the change. keyboard.array_update();
pub fn array_auto_update(&mut self, auto_update: bool)
[src]
Set an auto-update trigger after every change with the array_set_single
and
array_set_full
functions. By default, no auto-update trigger is set.
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Make keyboard array changes apply automatically.. keyboard.array_auto_update(true); // ..and then modify the array so QWERTY are set to white... // ..with no need for a call to `array_update`! keyboard.array_set_full(&[ (Key::Q, (255, 255, 255)), (Key::W, (255, 255, 255)), (Key::E, (255, 255, 255)), (Key::R, (255, 255, 255)), (Key::T, (255, 255, 255)), (Key::Y, (255, 255, 255)), ]);
pub fn array_set_single<K: IntoMatrixRowColumn>(
&mut self,
key: K,
red: u8,
green: u8,
blue: u8
) -> bool
[src]
&mut self,
key: K,
red: u8,
green: u8,
blue: u8
) -> bool
Set a single color in the color array. This will not directly update the keyboard
unless the auto update flag is set (see array_auto_update
), so it can be called
frequently (i.e. in a loop that updates the entire keyboard). Returns true
if the
colors have changed.
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Modify the keyboard array so QWERTY will be set to white.. keyboard.array_set_single(Key::Q, 255, 255, 255); keyboard.array_set_single(Key::W, 255, 255, 255); keyboard.array_set_single(Key::E, 255, 255, 255); keyboard.array_set_single(Key::R, 255, 255, 255); keyboard.array_set_single(Key::T, 255, 255, 255); keyboard.array_set_single(Key::Y, 255, 255, 255); // ..and apply the change. keyboard.array_update();
pub fn array_set_full<K: IntoMatrixRowColumn>(
&mut self,
array: &[(K, (u8, u8, u8))]
) -> bool
[src]
&mut self,
array: &[(K, (u8, u8, u8))]
) -> bool
Set a complete color array. This will not directly update the keyboard unless the auto
update flag is set (see array_auto_update
). Returns true
if the colors have
changed.
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Modify the keyboard array so QWERTY will be set to white.. keyboard.array_set_full(&[ (Key::Q, (255, 255, 255)), (Key::W, (255, 255, 255)), (Key::E, (255, 255, 255)), (Key::R, (255, 255, 255)), (Key::T, (255, 255, 255)), (Key::Y, (255, 255, 255)), ]); // ..and apply the change. keyboard.array_update();
pub fn reset_all(&mut self) -> bool
[src]
Restore all colors to those that were originally on the keyboard. Must be called when application is closed (this will be invoked when this struct is dropped).
use wooting_sdk::{rgb::RgbKeyboard, Key}; let mut keyboard = RgbKeyboard::default(); // Set ABC to white.. keyboard.direct_set_key(Key::A, 255, 255, 255); keyboard.direct_set_key(Key::B, 255, 255, 255); keyboard.direct_set_key(Key::C, 255, 255, 255); // ..and then reset the entire keyboard back to how it was previously. keyboard.reset_all();
Trait Implementations
impl Clone for RgbKeyboard
[src]
fn clone(&self) -> RgbKeyboard
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for RgbKeyboard
[src]
impl Default for RgbKeyboard
[src]
fn default() -> RgbKeyboard
[src]
impl Drop for RgbKeyboard
[src]
Auto Trait Implementations
impl RefUnwindSafe for RgbKeyboard
impl Send for RgbKeyboard
impl Sync for RgbKeyboard
impl Unpin for RgbKeyboard
impl UnwindSafe for RgbKeyboard
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,