CrossCore XA
Revision: 1.0
Programmers Guide
Date: Jul 1, 10
Example
Note that this example is intended to show how to make the different function calls. All possible
errors are not handled.
int
fd, retval;
int
mmapsize = sizeof(smb380face);
smb380face
* modules = 0;
#define TRIGGER_SIGNAL SIGUSR2
void handle_trigger(int sno) {
printf(
"Trigger signal received!\n"
);
}
fd = open(
"/dev/accelerometer"
, O_RDWR|O_SYNC);
modules = mmap(0, mmapsize, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_LOCKED, fd, 0);
signal(TRIGGER_SIGNAL,handle_trigger);
modules->update = 1;
modules->trigger_client_pid = getpid();
modules->trigger_signo = TRIGGER_SIGNAL;
modules->trigger_signal_latch = 0;
sleep (30);
modules->trigger_client_pid = 0;
close(fd);
www.crosscontrol.com
45