mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-17 23:46:03 +00:00
changed: improved port reading
git-svn-id: https://svn.fhem.de/fhem/trunk@4052 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0bfa50910b
commit
6517b21422
@ -124,18 +124,9 @@ sub PIFACE_Get($@){
|
||||
"25:noArg 26:noArg 27:noArg 28:noArg ";
|
||||
return $usage if $port eq "?";
|
||||
|
||||
if ($port eq "0") {
|
||||
# read all inports and outports
|
||||
PI_read_allports($hash);
|
||||
} elsif ($port ~~ [1..8]) {
|
||||
# read single inport
|
||||
$adr = $base + $port;
|
||||
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
||||
$val = `$cmd`;
|
||||
readingsSingleUpdate($hash, 'in'.$port, $val, 1);
|
||||
} elsif ($port ~~ [11..18]) {
|
||||
Log3($name, 3, "PIFACE $name: get inports with internal pullups is DEPRECATED and will be removed in further versions!");
|
||||
# read single inport with pullup
|
||||
if ($port ~~ [11..18]) {
|
||||
Log3($name, 3, "PIFACE $name: get inports with internal pullups is DEPRECATED and may be removed in further versions!");
|
||||
# read single inport with pullup
|
||||
$pin = $port - 10;
|
||||
$adr = $base + $pin;
|
||||
$cmd = '/usr/local/bin/gpio -p mode '.$adr.' up';
|
||||
@ -143,14 +134,9 @@ sub PIFACE_Get($@){
|
||||
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
||||
$val = `$cmd`;
|
||||
readingsSingleUpdate($hash, 'in'.$port, $val, 1);
|
||||
} elsif ($port ~~ [21..28]) {
|
||||
# read single outport
|
||||
$pin = $port - 12;
|
||||
$port -= 20;
|
||||
$adr = $base + $pin;
|
||||
$cmd = '/usr/local/bin/gpio -p read '.$adr;
|
||||
$val = `$cmd`;
|
||||
readingsSingleUpdate($hash, 'out'.$port, $val, 1);
|
||||
} else {
|
||||
# read all inports and outports
|
||||
PI_read_allports($hash);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user