## HiPi::Pin

HiPi::Pin provides an abstract GPIO Pin class that acts as a base for common implementations of the basic pin functions

Currently there are two concrete classes that derive from HiPi::Pin:

HiPi::BCM2835::Pin

HiPi::Device::GPIO::Pin

Classes based on HiPi::Pin inherit the following methods:

### Object Methods

##### $pin->value( [ $newval ] );

        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 ).

##### $pin->mode( [ $newval ] );

        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.

##### $pin->interrupt( [ $newmask ] );

        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.

        The HiPi::Device::GPIO::Pin implementation only supports
        RPI_INT_NONE, RPI_INT_FALL, RPI_INT_RISE. A $newmask value
        containing RPI_INT_AFALL, RPI_INT_ARISE, RPI_INT_HIGH
        or RPI_INT_LOW will be translated to RPI_INT_FALL,
        RPI_INT_RISE or both as appropriate.

HiPi Modules Copyright © 2013 Mark Dootson