diff --git a/fhem/CHANGED b/fhem/CHANGED index 5c9a30826..388121cbb 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,8 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. - SVN + - feature: new module 35_SWAP_0000002200000008 for panstamp + indoor multi sensor board with tft - added: new module 36_EC3000.pm (justme1968) - feature: IT: added support for set-extensions (justme1968) - added: new modules 10_Itach_IR and 88_Itach_IRDevice to diff --git a/fhem/FHEM/35_SWAP_0000002200000008.pm b/fhem/FHEM/35_SWAP_0000002200000008.pm new file mode 100755 index 000000000..8fa5cb3fd --- /dev/null +++ b/fhem/FHEM/35_SWAP_0000002200000008.pm @@ -0,0 +1,117 @@ + +# $Id$ +package main; + +use strict; +use warnings; + +use constant { REG_DESIRED => '0D', + REG_TEXT => '0E', }; + +sub +SWAP_0000002200000008_Initialize($) +{ + my ($hash) = @_; + + require "$attr{global}{modpath}/FHEM/34_SWAP.pm"; + + $hash->{SWAP_SetFn} = "SWAP_0000002200000008_Set"; + $hash->{SWAP_SetList} = { desired => 1, + text => undef, }; + #$hash->{SWAP_GetFn} = "SWAP_0000002200000008_Get"; + #$hash->{SWAP_GetList} = { }; + #$hash->{SWAP_ParseFn} = "SWAP_0000002200000008_Parse"; + + my $ret = SWAP_Initialize($hash); + + return $ret; +} + +sub +SWAP_0000002200000008_Parse($$$$) +{ + my ($hash, $reg, $func, $data) = @_; + my $name = $hash->{NAME}; +} + +sub +SWAP_0000002200000008_Set($@) +{ + my ($hash, $name, $cmd, $arg, $arg2, $arg3) = @_; + + if( $cmd eq "desired" ) { + $arg += 50; + $arg *= 10; + my $value = sprintf( "%04X", int($arg) ); + return( "regSet", REG_DESIRED, $value ); + } elsif( $cmd eq "text" ) { + my $text = "000000000000000000000000000000000000000000000000"; + $arg .= " ". $arg2 if( defined($arg2) ); + $arg .= " ". $arg3 if( defined($arg3) ); + for( my $i = 0; $i < length($arg); ++$i) { + last if( $i >= 18 ); + substr( $text, 2*$i, 2, sprintf( "%02X", ord(substr($arg, $i, 1) ) ) ); + } + + return( "regSet", REG_TEXT, "FFFE" . "02" . $text ); + } + + return undef; +} + +sub +SWAP_0000002200000008_Get($@) +{ + my ($hash, $name, $cmd, @a) = @_; + + return undef; +} + +1; + +=pod +=begin html + + +
define <name> SWAP_0000002200000008 <ID> 0000002200000008