The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Device::SerialPins - per-pin low-level serial port access

SYNOPSIS

use Device::SerialPins;
my $sp = Device::SerialPins->new('/dev/ttyS0');
$sp->set_txd(1);
$sp->set_dtr(1);
$sp->set_rts(1);

# aka
$sp->set_pin3(1);
$sp->set_pin4(1);
$sp->set_pin7(1);

warn "car ", $sp->car;
warn "dsr ", $sp->dsr;
warn "cts ", $sp->cts;
warn "rng ", $sp->rng;

# aka
warn "car ", $sp->pin1;
warn "dsr ", $sp->pin6;
warn "cts ", $sp->pin8;
warn "rng ", $sp->pin9;

Constructor

new

my $sp = Device::SerialPins->new('/dev/ttyS0');

Getter Methods

Note: there is currently no rxd/pin2

pin1 / car / dcd

my $state = $sp->pin1;

pin3 / txd

my $state = $sp->pin3;

pin4 / dtr

my $state = $sp->pin4;

ground pin is #5

pin6 / dsr

my $state = $sp->pin6;

pin7 / rts

my $state = $sp->pin7;

pin8 / cts

my $state = $sp->pin8;

pin9 / rng

my $state = $sp->pin9;

get

Gets the state of a named or numbered pin.

$sp->get($pin);

Setter Methods

You can only set the three output pins.

The setter methods have the three-letter pin names or the pin# numbered aliases. Also see the general-purpose set() method.

$sp->set_foo(1); # on

$sp->set_foo(0); # off

set_pin3 / set_txd

set_pin4 / set_dtr

set_pin7 / set_rts

set

Sets the state of a named or numbered pin.

$sp->set($pin, $bool);

SEE ALSO

Device::SerialPort for more typical usage.

http://www.easysw.com/~mike/serial/serial.html

AUTHOR

Eric Wilhelm @ <ewilhelm at cpan dot org>

http://scratchcomputing.com/

BUGS

If you found this module on CPAN, please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

If you pulled this development version from my /svn/, please contact me directly.

COPYRIGHT

Copyright (C) 2007 Eric L. Wilhelm, All Rights Reserved.

NO WARRANTY

Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.