FAQ-Frequently Asked Questions

+ Is it difficult to manipulate sequential I/O with your library for PWM, there is some way to to do this easily? (eg Inside a loop)
- No it's so easy. You can use toggleValue() or setValue(gpio_value) function for changing gpio pin value. Pin changing value time is about 250 usecond. If you think use this method for generating pwm, this may be inefficient.

+ I'm having a little trouble compiling the example file you included. Should I be doing something differently?
- You must compile all files in BlackLib sources like BlackDef.h, BlackErr.h, BlackPWM.h etc. and then you must link to these compiled xxx.o files to your example.o file. But doing these steps at every changing in your code is hard and wasting your time. I captured a video of my desktop about doing cross compile setting to eclipse for compiling code to arm processor. Its link is below. You can install eclipse and then do cross compile settings to your eclipse in your computer. I promise your development process will be easier than now.
Also you should googling like this; "compiling and linking multiple c++ file". Results may be useful for your case.


+ Just wondering how do you handle GPIO interrupt using your library. Do you have plan to add functionality related to GPIO interrupt handling?
- Interrupts are divided into two types. These are hardware and software interrupts. For using hardware interrupt you must create special device tree overlay. This operation has various user defined component and it's generalization is hard so hardware interrupt support in BlackLib is not planned.

Also you can use software interrupt like signal slot mechanism, event system. But these are another software design world. In real world these methods implemented and most of these are open source. You can use these systems with BlackLib.

+ To cross compile it on a desktop I need the name of libraries (.so or .a) that BlackLib needs in order to compile and link. I'll appreciate if you send me a list of libraries that BlackLib needs for compiling.
- BlackLib uses only basic c++ libraries like fstream, string etc. I suggest you to using eclipse and if you using Ubuntu or any linux distrubition, gcc cross compiling tools. I captured a video for cross compiling c++ code with Eclipse on Ubuntu OS. I added youtube link to mail which i mentioned video. I suggest watching and appling this video for cross compiling.


+ Is the class BlackGPIO have some issue in time responding? It can not react quickly enough as I turn on and off the GPIO pin that fast?
- Actually BlackLib hasn't got issue about timing, because it is doing only file opearations. But this situation doesn't change anything about timing problem. The gpio pins' reaction time is unstable and little long. The reason of this problem is operating system. Any operating system which is running on Beaglebone Black is causing to delay. The delay of switching GPIO pin is about 250 microseconds. So if you want to generate PWM like signal you must use PWM or PRU. PRU is the little microprocessor which accesses pins directly without using any software layer like operating system, at the Beaglebone. The worst thing is about the PRU you must write the code with assembly.

+ I found this summary on the web for example: http://stuffwemade.net/post/beaglebone-pinout and can't map it to BlackLib. Lets say i want to use pin 10 of P8 ... what's the equivalent in BlackLib enum?
- The link which is mentioned in your mail includes old version of pin naming. I prefer you this link. (http://beagleboard.org/static/images/cape-headers-digital.png) It shows new naming style and also it is official web page. Also the old and new naming style is very similar, like below:

Old style New Style Equation
gpio1_7 gpio39 (1x32)+7 = 39
gpio3_21 gpio117 (3x32)+21 = 117
gpioA_B gpioM (Ax32)+B = M
..... ..... ......... etc.

Lets assume you want to use P8.10 pin. P8.10 equals GPIO2_4, at the link which you sent. This representation is old style. Lets calculate new name of this pin:

(2 x 32) + 4 = 68 ==> GPIO68

It is equal the GPIO68 at the new naming style. Lets check the link which i mention above (http://beagleboard.org/static/images/cape-headers-digital.png). And now in the BlackLib if you want to use this pin, you must write only GPIO_68 at object instantination stage.