embeddedlibrary
reusable software modules for embedded systems
pid.h
Go to the documentation of this file.
1 
16 #ifndef PID_H
17 #define PID_H
18 
19 #include <stdint.h>
20 #include <stdbool.h>
21 
36 typedef struct pid_controller_t {
37  // Setpoint
38  int32_t setpoint;
39  // PID Coefficients
40  int16_t kp; // Proportional
41  int16_t ki; // Integral
42  int16_t kd; // Derivitive
43  // Error
44  int32_t prev_error; // Used in Derivitive Calc
45  int32_t prev_i;
46  int32_t max_i;
47  // Integral/Derivitive dt calculation
48  uint32_t prev_time;
50 
51 
61 void PID_Reset(pid_controller_t *pid_handle);
62 
71 int32_t PID_Step(pid_controller_t *pid_handle, int32_t meas);
72 
73 #endif
74 
Definition: pid.h:36
int32_t PID_Step(pid_controller_t *pid_handle, int32_t meas)
Definition: pid.c:9
struct pid_controller_t pid_controller_t
void PID_Reset(pid_controller_t *pid_handle)
Definition: pid.c:3