HiPi::Pin provides an abstract GPIO Pin class that acts as a base for common implementations of the basic pin functions
Currently the following concrete classes derive from HiPi::Pin:
Classes based on HiPi::Pin inherit the following methods:
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.
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.
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 HiPi::Device::GPIO module uses these values with the true interrupts provided by the kernel gpio driver as exported to the sysfs file space. The HiPi::BCM2835 and HiPi::Wiring 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.
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.