<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HiPi::Pin</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="pin_modules.htm"><img align=center src="up.png" BORDER=0 ALT="Up"></A>
<A HREF="pin_modules.htm"><img align=center src="back.png" BORDER=0 ALT="Previous"></A>
<A HREF="pin_modules_gpio.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::Pin</H2><p>HiPi::Pin provides an abstract GPIO Pin class that acts as a base for common implementations of the basic pin functions</p>
<p>Currently the following concrete classes derive from HiPi::Pin:</p>
<UL>
<li><A HREF="pin_modules_gpio.htm">HiPi::Device::GPIO::Pin</A>
<li><A HREF="pin_modules_wiring.htm">HiPi::Wiring::Pin</A>
<li><A HREF="pin_modules_bcm2835.htm">HiPi::BCM2835::Pin</A>
</UL>
<p>Classes based on HiPi::Pin inherit the following methods:</p>
<h3>Object Methods</h3>
<h5>$pin->value( [ $newval ] );</h5>
<pre> Returns the current level value of the pin
( 1 or 0 for high or low )
If the optional $newval is provided, sets the pin
to that value if possible ( e.g. pin is an output ).
When $newval is specified, that is the value returned.</pre>
<h5>$pin->mode( [ $newval ] );</h5>
<pre> Returns the current function of the pin.
This is one of the values:
RPI_PINMODE_INPT
RPI_PINMODE_OUTP
RPI_PINMODE_ALT0
RPI_PINMODE_ALT1
RPI_PINMODE_ALT2
RPI_PINMODE_ALT3
RPI_PINMODE_ALT4
RPI_PINMODE_ALT5
You can import these constants into your namespace using
use HiPi::Constant qw( :raspberry );
If the optional $newval is provided, sets the pin
function to that value.
When $newval is specified, that is the value returned.
The kernel gpio device driver provides access only for switching
the pin function between input and output. You cannot set a pin
to an alternate function using the HiPi::Device::GPIO::Pin
implementation. For that implmentation a value of RPI_PINMODE_OUTP
sets the pin to an output while all other values set the pin to
an input. You cannot access the pins through the kernel sysfs
interface when they are assigned to alternate functions.</pre>
<h5>$pin->interrupt( [ $newmask ] );</h5>
<pre> Returns the current edge settings of the pin.
This is am or'd mask of the following values:
RPI_INT_NONE
RPI_INT_FALL
RPI_INT_RISE
RPI_INT_AFALL
RPI_INT_ARISE
RPI_INT_HIGH
RPI_INT_LOW
You can import these constants into your namespace using
use HiPi::Constant qw( :raspberry );
If the optional $newmask is provided, sets the pin
edge settings according to the mask to that value.
When $newmask is specified, that is the value returned.
All HiPi modules only support RPI_INT_NONE, RPI_INT_FALL,
and RPI_INT_RISE or an or'd mask of RPI_INT_FALL|RPI_INT_RISE.
The <A HREF="mod_device_gpio.htm">HiPi::Device::GPIO</A> module uses these values with the
true interrupts provided by the kernel gpio driver as
exported to the sysfs file space.
The <A HREF="mod_gpio_bcm2835.htm">HiPi::BCM2835</A> and <A HREF="mod_gpio_wiring.htm">HiPi::Wiring</A> interrupt functions
are pseudo implementations that poll the pin value for
changes. Mask values containing RPI_INT_AFALL, RPI_INT_ARISE,
RPI_INT_HIGH or RPI_INT_LOW are translated to RPI_INT_FALL,
RPI_INT_RISE or both as appropriate.
</pre>
<h5>$pin->set_pud( $setting );</h5>
<pre> Sets the pull up / pull down resitor on this pin.
$setting can be one of
RPI_PUD_OFF
RPI_PUD_UP
RPI_PUD_DOWN
You can import these constants into your namespace using
use HiPi::Constant qw( :raspberry );
Note: The settings last across restarts so it is up to
you to record settings applied and control resetting as
you require.
</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="pin_modules.htm"><img align=center src="up.png" BORDER=0 ALT="Up"></A>
<A HREF="pin_modules.htm"><img align=center src="back.png" BORDER=0 ALT="Previous"></A>
<A HREF="pin_modules_gpio.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 © 2013 - 2016 Mark Dootson</font></center>
</BODY></HTML>