my %rpi_v2_gpio_p1 = (
3 => Device::BCM2835::RPI_V2_GPIO_P1_03,
5 => Device::BCM2835::RPI_V2_GPIO_P1_05,
7 => Device::BCM2835::RPI_V2_GPIO_P1_07,
...,
40 => Device::BCM2835::RPI_V2_GPIO_P1_40,
);
####
my @rpi_v2_gpio_p1;
for ( @Device::BCM2835::EXPORT_OK ) {
next if !/^RPI_V2_GPIO_P1_(\d+)\z/;
my $pin = 0 + $1;
my $val = do { no strict "refs"; "Device::BCM2835::$_"->() };
$rpi_v2_gpio_p1[ $pin ] = $val;
}
####
my @rpi_v2_gpio_p1;
for ( @Device::BCM2835::EXPORT_OK ) {
next if !/^RPI_V2_GPIO_P1_(\d+)\z/;
my $pin = 0 + $1;
my $val = ( \&{"Device::BCM2835::$_"} )->();
$rpi_v2_gpio_p1[ $pin ] = $val;
}