From 7c6e90299de97b51f6ba17d1a50cedb824d0c82f Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 5 May 2018 18:35:39 +0200 Subject: Add gpio::is_set() to read from _latch register, update command parsing --- led.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'led.cpp') diff --git a/led.cpp b/led.cpp index 1d10e24..4888d84 100644 --- a/led.cpp +++ b/led.cpp @@ -9,7 +9,7 @@ led::led(gpio *pin, led::color color) : _pin(pin), _color(color) { - _pin->set_mode(0); + _pin->set_mode(0); // output } @@ -45,9 +45,9 @@ void led::set(unsigned s) _pin->set(s); } -unsigned led::read() const +unsigned led::is_set() const { - return _pin->read(); + return _pin->is_set(); } void led::toggle() @@ -74,7 +74,7 @@ std::string led::to_string() } str += ") is "; - str += (read()) ? "on" : "off"; + str += (is_set()) ? "on" : "off"; return str; } -- cgit v1.2.1