The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


<HTML>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <title>HiPi::Device::SerialPort</title></head>

<BODY TOPMARGIN=4 BGCOLOR=#FFFFFF TEXT=#000000 VLINK=#0000CC LINK=#0000CC ALINK=#0000CC>
<FONT FACE="Arial, Lucida, Helvetica" >

<TABLE WIDTH="100%" ALIGN=CENTER CELLPADDING=1 CELLSPACING=0>
<TR>
<TD WIDTH="100%" ALIGN=CENTER>


<A HREF="contents.htm"><img align=center src="home.png" BORDER=0 ALT="Contents"></A>


<A HREF="mod_device.htm"><img align=center src="up.png" BORDER=0 ALT="Up"></A>

<A HREF="mod_device_onewire.htm"><img align=center src="back.png" BORDER=0 ALT="Previous"></A>

<A HREF="mod_interface.htm"><img align=center src="forward.png" BORDER=0 ALT="Next"></A>
</TD>
</TR>
<TR>
<TD COLSPAN=2 HEIGHT=2 BGCOLOR="#C0C0C0">
</TD>
</TR>
</TABLE>

<H2>HiPi::Device::SerialPort</H2><p>This module is a thin wrapper around the standard CPAN module Device::SerialPort.</p>
<p>It is implemeted to give a simple write only interface to the TX 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 ).</p>
<p>For more complex interaction over a serial TX/RX link it is recommended to use Device::SerialPort directly.</p>
<p><b>Note</b> that by default on the Raspberry Pi 3 the mini uart ( UART1 ) broken out via pins 14 and 15 on the GPIO header as the main UART0 is used for Bluetooth. See the the contstructor method notes below</p>
<p>The following interface modules use HiPi::Device::SerialPort as a backend and may contain code that helps with your own usage.</p>
<p><A HREF="mod_interface_serlcd.htm">HiPi::Interface::SerLCD</A><br />
<A HREF="mod_interface_htbackpackv2.htm">HiPi::Interface::HTBackpackV2</A> <I>( as an optional backend )</I><br />

<h2>Object Constructor and Methods</h2>
<h5>my $dev = HiPi::Device::SerialPort->new();</h5>
<pre>    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.

    If you are using a Raspberry Pi 3 with default settings, the header pins
    on the Rpi gpio are connected to the mini uart. You will therefore need
    to specify the mini uart device to override the default.

    my $dev = HiPi::Device::SerialPort->new(
        devicename   => '/dev/ttyS0',
    );
 
</pre>
<h5>$dev->write( $buffer );</h5>
<pre>    Writes the $buffer to the open port using Device::SerialPort->write.
    Then calls Device::SerialPort->write_drain.
</pre>


</FONT>
<br>
<p>
<br>
<hr>
<br>
<center>
<A HREF="contents.htm"><img align=center src="home.png" BORDER=0 ALT="Contents"></A>


<A HREF="mod_device.htm"><img align=center src="up.png" BORDER=0 ALT="Up"></A>

<A HREF="mod_device_onewire.htm"><img align=center src="back.png" BORDER=0 ALT="Previous"></A>

<A HREF="mod_interface.htm"><img align=center src="forward.png" BORDER=0 ALT="Next"></A>
</center>

<HR>
<br>
<center><FONT FACE="Arial, Lucida, Helvetica" size="2" color="#000080">HiPi Modules Copyright &#169; 2013 - 2016 Mark Dootson</font></center>
</BODY></HTML>