1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use {Result as Res, Controller};

/// Controller led management.
pub struct Lizard<'a, 'b: 'a> {
	controller: &'a mut Controller<'b>,
}

impl<'a, 'b> Lizard<'a, 'b> {
	#[doc(hidden)]
	pub fn new(controller: &'a mut Controller<'b>) -> Lizard<'a, 'b> {
		Lizard {
			controller: controller,
		}
	}

	/// Enable lizard mode.
	pub fn enable(self) -> Res<()> {
		self.controller.settings().lizard = true;
		self.controller.reset()
	}

	/// Disable lizard mode.
	pub fn disable(self) -> Res<()> {
		self.controller.settings().lizard = false;
		self.controller.reset()
	}
}