summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-10-16 14:59:16 +0200
committerAki <please@ignore.pl>2021-10-16 14:59:16 +0200
commit44c3b1d6c41f19c1e9d3f43ec4c7188f868ca08f (patch)
tree7df53943b71b430e303438622c524f8c0e77ecd4 /daemon
parent8f1844febcd87487e979435469645132da4e09c5 (diff)
downloadhwd-44c3b1d6c41f19c1e9d3f43ec4c7188f868ca08f.zip
hwd-44c3b1d6c41f19c1e9d3f43ec4c7188f868ca08f.tar.gz
hwd-44c3b1d6c41f19c1e9d3f43ec4c7188f868ca08f.tar.bz2
Added write condition
Diffstat (limited to 'daemon')
-rw-r--r--daemon/src/Gpio.cpp10
1 files changed, 4 insertions, 6 deletions
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;
}