From 44c3b1d6c41f19c1e9d3f43ec4c7188f868ca08f Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 16 Oct 2021 14:59:16 +0200 Subject: Added write condition --- daemon/src/Gpio.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'daemon') diff --git a/daemon/src/Gpio.cpp b/daemon/src/Gpio.cpp index 23341aa..75d2ff1 100644 --- a/daemon/src/Gpio.cpp +++ b/daemon/src/Gpio.cpp @@ -17,17 +17,15 @@ void Gpio::apply(AssemblyContext ctx) void Gpio::set_mode(const unsigned port, const short mode) { - if (SIZE <= port) - return; - mode_of[port] = mode & 0x1; + if (SIZE > port) + mode_of[port] = mode & 0x1; } void Gpio::write(const unsigned port, const short value) { - if (SIZE <= port) - return; - value_of[port] = value & 0x1; + if (SIZE > port && mode_of[port] == 0x1) + value_of[port] = value & 0x1; } -- cgit v1.1