New answers tagged

4

Call system(): #include <stdlib.h> ... system("sudo shutdown now");


0

I was able to figure something out, however I was not able to get it to work with the wiringPi library. I used the linux sysfs interface to control the gpio pin directly and then I created my own sofware timed pwm. I used the information in this link https://www.ics.com/blog/how-control-gpio-hardware-c-or-c. I hope this doesn't become a dead link in the ...


3

There is no way to call userspace code from an ISR. Unlike system calls which run on the stack of the userspace program, interrupt handlers use internal kernel memory for the stack. Since that memory is not visible in userspace, the system would crash the moment your ISR userspace function finishes or tries to use the stack for local variables (if not before,...


1

wiringPi uses interrupts, e.g. with the wiringPiISR function. pigpio uses interrupts, e.g. with the gpioSetISRFunc function. lgpio uses interrupts. e.g. with the gGpioSetAlertsFunc function. None of the above use polling or busy waits. I can only assume you are confused because at a low level they use a Linux function called poll. But this function does ...


1

As an alternative to @Ingo's excellent answer; i.e. "do not try to start a progrm in ~/.bashrc - create a systemd Unit file instead.": Do not try to start a progrm in ~/.bashrc - create a cron job instead. Complete instructions for setting up a cron job to start your program each time the RPi boots may be found here.


2

First of all: I also suggest together with all others from the comments, don't use ~/.bashrc to start a still running program. The best way is to create a service with a systemd Unit file. The problem with your program is that the Raspberry Pi does not have a real time clock. It needs an internet connection and some time after boot up to initialize the ...


0

Eventually I decided to use MMAL instead of OpenMAX, as I read somewhere it's optimized well enough so there aren't any performance issues. So far it works fine.


Top 50 recent answers are included