diff --git a/groundStation/src/frontend/frontend_common.h b/groundStation/src/frontend/frontend_common.h index dd2eb7e3beaafec37a8e057016421d7b37a9ad0c..095c06b817cf21483c1cfa957106c20f65a4ebd3 100644 --- a/groundStation/src/frontend/frontend_common.h +++ b/groundStation/src/frontend/frontend_common.h @@ -1,5 +1,6 @@ #ifndef FRONTEND_COMMON_H #define FRONTEND_COMMON_H +#include <stdlib.h> struct backend_conn; @@ -16,6 +17,6 @@ void ucart_backendDisconnect(struct backend_conn * conn); char * ucart_backendGetline(struct backend_conn * conn); /* Write a line to the backend */ -void ucart_backendWrite(struct backend_conn * backend, const char * line); +size_t ucart_backendWrite(struct backend_conn * backend, const char * line); #endif diff --git a/groundStation/src/frontend/frontend_getpid.h b/groundStation/src/frontend/frontend_getpid.h new file mode 100644 index 0000000000000000000000000000000000000000..977ae97f314a3c5b3891f5d60e56929aa03d6db9 --- /dev/null +++ b/groundStation/src/frontend/frontend_getpid.h @@ -0,0 +1,26 @@ +#ifndef FRONTEND_GETPID_H +#define FRONTEND_GETPID_H + +#include "frontend_common.h" +#include "pid_common.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); + + +#endif diff --git a/groundStation/src/frontend/pid_common.h b/groundStation/src/frontend/pid_common.h new file mode 100644 index 0000000000000000000000000000000000000000..c1dac6535d7f6a5f219da61bce7b7a17d247d963 --- /dev/null +++ b/groundStation/src/frontend/pid_common.h @@ -0,0 +1,20 @@ +#ifndef PID_COMMON_H +#define PID_COMMON_H + +enum frontend_pid { + PITCH, + ROLL, + YAW, + NUM_PIDS +}; + +struct frontend_pid_data { + enum frontend_pid pid; + + float p; + float i; + float d; +}; + + +#endif