HiPi

 view release on metacpan or  search on metacpan

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

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
        $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

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
    } 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

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
    $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

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
    # $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

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    } 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

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
        $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

358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
    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.268 second using v1.01-cache-2.11-cpan-cba739cd03b )