Newer
Older
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Get a specified PID.
*
* Example:
*
* struct frontend_pid_data pid_data;
* pid_data.pid = PITCH;
* if (frontend_getpid(conn, &pid_data)) {
* error
* } else {
* pid_data.p, pid_data.i, and pid_data.d are filled
* }
*
* Returns 0 on success, 1 on error
*/
int frontend_getpid(
struct backend_conn * conn, struct frontend_pid_data * pid_data) {
switch (pid_data->pid) {
case PITCH :
strncpy(line, "getpitchp\ngetpitchd\n", 20);
strncpy(line, "getrollp\ngetrolld\n", 18);
strncpy(line, "getyawp\ngetyawd\n", 17);
break;
default :
return 1;
}
int size;
if((size = ucart_backendWrite(conn, line)) < 0 ) {
return 1;
}