HiPi

 view release on metacpan or  search on metacpan

lib/HiPi/Interface/Common/HD44780.pm  view on Meta::CPAN

sub clear { $_[0]->send_command( HD44780_CLEAR_DISPLAY ); $_[0]->delayMicroseconds(2000); }

sub set_cursor_mode { $_[0]->send_command( $_[1] ); }

sub backlight { croak('backlight must be overriden in derived class'); }

sub send_text { croak('send_text must be overriden in derived class'); }

sub send_command { croak('send_command must be overriden in derived class'); }

sub update_baudrate { croak('update_baudrate must be overriden in derived class'); }

sub update_geometry { croak('update_geometry must be overriden in derived class'); }

1;

__END__

lib/HiPi/Interface/HobbyTronicsBackpackV2.pm  view on Meta::CPAN

        $bset = 0;
    } elsif( $brightness >= 250 ) {
        $bset = 250;
    } else {
        $bset = int( 2.5 * $brightness);
    }
    
    $self->send_htv2_command( HTV2_CMD_BACKLIGHT, $bset );
}

sub update_baudrate {
    my $self = shift;
    return unless $self->backend eq 'serialrx';
    my $baud = $self->device->baudrate;
    my $bflag;
    
    if ($baud == 2400) {
        $bflag = HTV2_BAUD_2400;
    } elsif ($baud == 4800) {
        $bflag = HTV2_BAUD_4800;
    } elsif ($baud == 9600) {

lib/HiPi/Interface/HobbyTronicsBackpackV2.pm  view on Meta::CPAN

    } elsif ($baud == 115200) {
        $bflag = HTV2_BAUD_115200;
    } else {
        croak(qq(The baudrate of the serial device is not supported by the LCD controller));
    }
    
    $self->send_htv2_command( HTV2_CMD_BAUD_RATE, $bflag );
    carp('The HobbyTronicsBackpackV2 device must be powered off and on after changing baudrate.');
}

sub update_geometry {
    my $self = shift;
    $self->send_htv2_command( HTV2_CMD_LCD_TYPE, $self->lines, $self->width );
}

sub change_i2c_address {
    my( $self, $newaddress) = @_;
    if( $self->backend eq 'serialrx') {
        carp('The HobbyTronicsBackpackV2 device is in Serial RX mode. You cannot change the i2c address.');
        return;
    }

lib/HiPi/Interface/IS31FL3730.pm  view on Meta::CPAN

    $self->send_command( REG_LIGHTING, $mask );
}

sub brightness {
    my($self, $value) = @_;
    $value //= 127; # undefined get default 127
    my $mask = ( $value > 127 ) ? 0x80 : $value & 0x7F;
    $self->send_command( REG_PWM, $mask );
}

sub update {
    my $self = shift;
    $self->send_command( REG_UPD_COL, 0x00 );
}

sub reset {
    my $self = shift;
    $self->send_command( REG_RESET, 0x00 );
}

sub send_command {

lib/HiPi/Interface/LCDBackpackPCF8574.pm  view on Meta::CPAN

    # $brightness = 0 to 100
    # we translate to 0 - 250
    
    return unless $self->backlightcontrol;
    
    my $bset = int( 2.5 * $brightness);
    $self->_backlight( $bset );
    $self->_write_to_bus(0x00, SEND_MODE_DATA, SEND_DISABLE );
}

sub update_baudrate {
    my $self = shift;
    # not handled
    return;
}

sub update_geometry {
    my $self = shift;
    # not handled
    return;
}

sub _write_command_part {
    my($self, $data) = @_;
    $self->_write_to_bus( $data, SEND_MODE_CMD, SEND_ENABLE );
    $self->delayMicroseconds(1);
    $self->_write_to_bus( $data, SEND_MODE_CMD, SEND_DISABLE );

lib/HiPi/Interface/SerLCD.pm  view on Meta::CPAN

    } else {
        $level = int( 128.5 + ( ( $brightness / 100 ) * 30 ) );
        $level = 129 if $level < 129;
    }
    
    $level = 157 if $level > 157;
    
    $self->send_special_command( $level );
}

sub update_baudrate {
    my $self = shift;
    my $baud = $self->device->baudrate;
    my $bflag;
    
    if ($baud == 2400) {
        $bflag = 11;
    } elsif ($baud == 4800) {
        $bflag = 12;
    } elsif ($baud == 9600) {
        $bflag = 13;

lib/HiPi/Interface/SerLCD.pm  view on Meta::CPAN

        $bflag = 15;
    } elsif ($baud == 38400) {
        $bflag = 16;
    } else {
        croak(qq(The baudrate of the serial device is not supported by the LCD controller));
    }
    
    $self->send_special_command( $bflag );
}

sub update_geometry {
    my $self = shift;
    
    if($self->width == 20) {
        $self->send_special_command( 3 );
    }
    if($self->width == 16) {
        $self->send_special_command( 4 );
    }
    if($self->lines == 4) {
        $self->send_special_command( 5 );

lib/HiPi/Interface/Si470N.pm  view on Meta::CPAN

    for ( my $i = 2; $i < 8; $i ++) {
        my $high = $regvals->[$i] >> 8;
        my $low  = $regvals->[$i] & 0xFF;
        push @bytes, ( $high, $low );
    }
    
    my $rval = $self->device->bus_write( @bytes );
    return $rval;
}

sub update_registers {
    my($self, $delay) = @_;
    $delay ||= 0.1;
    $self->write_registers();
    $self->sleep_seconds( $delay );
    $self->read_registers;
    return 1;
}

sub set_config_value {
    my( $self, $valuename, $newvalue ) = @_;



( run in 0.291 second using v1.01-cache-2.11-cpan-cba739cd03b )