Contents Up Previous Next

HiPi::Device::SerialPort

This module is a thin wrapper around the standard CPAN module Device::SerialPort.

It is implemeted to give a simple write only interface to the UART0_TXD output pin for devices such as LCD controllers that accept commands on their RX pins without needing a connection on their TX pins. ( TX output pin on Raspberry Pi goes to RX input pin on device ).

For more complex interaction over a serial TX/RX link it is recommended to use Device::SerialPort directly.

The following interface modules use HiPi::Device::SerialPort as a backend and may contain code that helps with your own usage.

HiPi::Interface::SerLCD
HiPi::Interface::HTBackpackV2 ( as an optional backend )

Object Constructor and Methods

my $dev = HiPi::Device::SerialPort->new();
    Returns a new instance of the HiPi::Device::SerialPort class.

    You can optionally specify several parameters as key 
    value pairs in the constructor. Their default values
    are:

    my $dev = HiPi::Device::SerialPort->new(
        devicename   => '/dev/ttyAMA0',
        baudrate     => 9600,
        parity       => 'none',
        stopbits     => 1,
        databits     => 8,
    );

    The devicename is passed the Device::SerialPort constructor
    while all other parameters are used to set the corresponding
    Device::SerialPort object properties.
$dev->write( $buffer );
    Writes the $buffer to the open port using Device::SerialPort->write.
    Then calls Device::SerialPort->write_drain.




Contents Up Previous Next


HiPi Modules Copyright © 2013 Mark Dootson