There is an example given in Device::BCM2835 —
# Low level register access Device::BCM2835::peri_read(&Device::BCM2835::BCM2835_GPIO_BASE + &De +vice::BCM2835::BCM2835_GPFSEL1); Device::BCM2835::peri_write(&Device::BCM2835::BCM2835_GPIO_BASE + &D +evice::BCM2835::BCM2835_GPFSEL2, 0xdeadbeef) Device::BCM2835::peri_set_bits(&Device::BCM2835::BCM2835_GPIO_BASE + + &Device::BCM2835::BCM2835_GPFSEL3, 0xdeadbeef, 0x1f);
Note the GPIO_BASE. If these constants do not work either, you can resort to a little debugging. Insert print statements in both C and perl versions and verify that the constants are the same.
Your for loop may be simplified as:
Device::BCM2835::gpio_fsel($_, &Device::BCM2835::BCM2835_GPIO_FSEL_OUT +P) for @pins;
Another approach, that might prove superior, is to go with Inline::C. You can embed C code in your perl to do the heavy lifting. Pack your i/o sequences (address/value pairs) in vectors on the perl side, to be passed to your C function as necessary.
In reply to Re: Device::BCM2835, hardware access on a pi, SIGSEGV
by Anonymous Monk
in thread Device::BCM2835, hardware access on a pi, SIGSEGV
by Peterpion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |