App-Device-Chip-UI
view release on metacpan or search on metacpan
lib/App/Device/Chip/UI.pm view on Meta::CPAN
label => "power",
on_toggle => sub {
my $self = shift;
$protocol->power( $self->is_active )->get;
},
)
);
$vbox->add(
my $tabbed = Tickit::Widget::Tabbed->new,
expand => 1,
);
my $updatesub;
my $initialtab;
foreach my $protoname (qw( GPIO SPI UART )) {
my $tab = $tabbed->add_tab( Tickit::Widget::VBox->new,
label => $protoname,
);
lib/App/Device/Chip/UI/SPIBox.pm view on Meta::CPAN
$readbutton->set_on_click( sub {
$self->read( $readsizeentry->text );
$readsizeentry->set_text( "" );
});
$self->add( $self->rowcount, 1,
$_readresultlabel = Tickit::Widget::Static->new(
text => "",
class => "readout",
),
col_expand => 1,
row_expand => 1,
);
# TODO: selection of SS GPIO line
}
method read ( $len )
{
$self->_do_write( "\x00" x $len );
}
lib/App/Device/Chip/UI/UARTBox.pm view on Meta::CPAN
has $_protocol;
has $_gpiobox;
BUILD ( %args )
{
$_protocol = $args{protocol};
$self->add(
$_gpiobox = App::Device::Chip::UI::GPIOBox->new( protocol => $_protocol ),
expand => 1,
);
# Fill the GridBox before adding it to $self to avoid a warning about undef
my $gridbox = Tickit::Widget::GridBox->new( class => "gpio" );
$gridbox->append_row(
[
Tickit::Widget::Static->new(
text => "Baud",
valign => "middle",
lib/App/Device/Chip/UI/UARTBox.pm view on Meta::CPAN
$gridbox->append_row(
[
Tickit::Widget::Static->new(
text => "Write",
valign => "middle",
),
{
child => my $writeentry = Tickit::Widget::Entry->new,
col_expand => 1,
},
my $writebutton = Tickit::Widget::Button->new(
label => "Write",
),
]
);
$writeentry->set_on_enter( sub {
$writebutton->click;
lib/App/Device/Chip/UI/UARTBox.pm view on Meta::CPAN
$writeentry->set_text( "" );
try {
$self->write( $text );
}
catch {
print STDERR "TODO: Error $@";
}
});
$self->add( $gridbox, expand => 1 );
}
method _do_write ( $bytes )
{
$_protocol->write( $bytes )->get;
}
method update ()
{
$_gpiobox->update;
( run in 0.698 second using v1.01-cache-2.11-cpan-5623c5533a1 )