![]() ![]() ![]() ![]() |
|
The HiPi::Device::GPIO module provides access to the kernel driver for the GPIO.
See : GPIO Device Driver
Many of the methods expect a GPIO Pin Id as a parameter. You can use the pin id constants exported by HiPi::Constant module if you wish.
use HiPi::Constant qw( :raspberry ); # this will export, amongst other things, the following # pin constants that you can pass to the HiPi::Device::GPIO # methods and functions RPI_PIN_3 RPI_PIN_5 RPI_PIN_7 RPI_PIN_8 RPI_PIN_10 RPI_PIN_11 RPI_PIN_12 RPI_PIN_13 RPI_PIN_15 RPI_PIN_16 RPI_PIN_18 RPI_PIN_19 RPI_PIN_21 RPI_PIN_22 RPI_PIN_23 RPI_PIN_24 RPI_PIN_26 RPI_PIN_27 RPI_PIN_28 RPI_PIN_29 RPI_PIN_31 RPI_PIN_32 RPI_PIN_33 RPI_PIN_35 RPI_PIN_36 RPI_PIN_37 RPI_PIN_38 RPI_PIN_40 # the constant RPI_BOARD_REVISION is also exported # under the :raspberry tag and will be defined as # 1 or 2 depending on your board revision.
Creates a new object instance of class HiPi::Device::GPIO;
$pindid GPIO Pin Number Returns the current status of the pin which indicates whether it is currently exported by the kernel driver. Return value is one of DEV_GPIO_PIN_STATUS_NONE DEV_GPIO_PIN_STATUS_EXPORTED You may import these constants into your namespace with use HiPi::Device::GPIO qw( :pinstatus );
$pindid GPIO Pin Number Will export the specified pin id so that it may be accessed using the kernel device driver. The script user must have permissions to export device driver pins ( probably conferred by membership of gpio group). The method returns a HiPi::Device::GPIO::Pin object for the specified pin number. (see also $dev->get_pin( $pinid ) ). see : GPIO Device Driver
$pindid GPIO Pin Number Will unexport the specified pin id so that it may mo loner be accessed using the kernel device driver. The script user must have permissions to unexport device driver pins. see : GPIO Device Driver
$pinid GPIO Pin Number returns an object instance of HiPi::Device::GPIO::Pin