Posts: 35
Joined: Thu Aug 09, 2012 4:56 pm

Using bcm2835 C library from Gambas3

Thu Aug 09, 2012 5:16 pm


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 (

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
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...

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.

Return to “Other languages”

Who is online

Users browsing this forum: No registered users and 0 guests