Using bcm2835 C library from Gambas3


1 post
by IRQ » Thu Aug 09, 2012 5:16 pm
Hi,

With some luck I managed to compile a shared lib version of bcm2835 for Raspberri Pi made by Mike McCauley but I'm having problems using it from Gambas3 with the EXTERN function (http://gambasdoc.org/help/howto/extern).

I know that the shared lib is functional since I can use the library delay function with the following code...

Code: Select all
' Declare external function
Public Extern delay(millis As Integer) In "libbcm2835"

' Delay 2 sec
delay(2000)


But bumbs into problem when trying to call the functions to toggle I/O pins. Since my C knowledge is very limited I wonder what to declare "uint8_t" as? According to Google it seems to be the same as unsigned char. I tried to use byte, short as well as long in the declaration but no go, I get segmentation fault when calling that function.

Code: Select all
 Public Extern bcm2835_gpio_set(pin As Byte) In "libbcm2835"


Anyone have any ideas what I am missing? More info about Mikes bcm2835 C library can be found here...

http://www.open.com.au/mikem/bcm2835/index.html

BTW: Let me know if anyone wants the shared library file for bcm2835 and I will upload it somewhere (and if it's OK with Mike of course), it's compiled in Debain Squeeze.
Posts: 24
Joined: Thu Aug 09, 2012 4:56 pm