GURU = Anyone who knows more than me. i.e. almost everyone.
I am making good progress in learning Perl, but am stuck on an item that I can't seem to find in the Mastering Perl books. (Or more likely, don't recognize.)
I am doing I/O projects on a PI 4, using the GPIO for all kinds of stuff. The access for the pins via Perl is with the Device-BCM2835 module from CPAN. It works fine.
In it are very verbose calls to do something (set a pin for input/output, read, write, etc. The following is one.
Device::BCM2835::gpio_fsel(&Device::BCM2835::RPI_V2_GPIO_P1_07, $inputcmd)
So far I have been making a separate hardcoded call for each of the pins that I want to set to input, but that is cumbersome and obviously not the proper way to do such. I want to call this routine with a list of pins, not just number 07 or 19 or whatever. In other words, something like this...
$pinno = RPI_V2_GPIO_P1_07;
Device::BCM2835::gpio_fsel(&Device::BCM2835::$pinno, $inputcmd);
Or even better...
$pinno = "07";
Device::BCM2835::gpio_fsel(&Device::BCM2835::RPI_V2_GPIO_P1_ . "$pinno", $inputcmd)
(I know the above is incorrect. I am just showing what I am trying to do.)
I have been through the topics on aliasing and pointers but I am still not seeing the forest for the trees.
Anybody?
I am making good progress in learning Perl, but am stuck on an item that I can't seem to find in the Mastering Perl books. (Or more likely, don't recognize.)
I am doing I/O projects on a PI 4, using the GPIO for all kinds of stuff. The access for the pins via Perl is with the Device-BCM2835 module from CPAN. It works fine.
In it are very verbose calls to do something (set a pin for input/output, read, write, etc. The following is one.
Device::BCM2835::gpio_fsel(&Device::BCM2835::RPI_V2_GPIO_P1_07, $inputcmd)
So far I have been making a separate hardcoded call for each of the pins that I want to set to input, but that is cumbersome and obviously not the proper way to do such. I want to call this routine with a list of pins, not just number 07 or 19 or whatever. In other words, something like this...
$pinno = RPI_V2_GPIO_P1_07;
Device::BCM2835::gpio_fsel(&Device::BCM2835::$pinno, $inputcmd);
Or even better...
$pinno = "07";
Device::BCM2835::gpio_fsel(&Device::BCM2835::RPI_V2_GPIO_P1_ . "$pinno", $inputcmd)
(I know the above is incorrect. I am just showing what I am trying to do.)
I have been through the topics on aliasing and pointers but I am still not seeing the forest for the trees.
Anybody?