yarf 0.1
Yet Another RepRap Firmware
|
00001 /* 00002 * pid.h 00003 * 00004 * Copyright 2011 Pieter Agten 00005 * 00006 * This file is part of Yarf. 00007 * 00008 * Yarf is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * Yarf is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with Yarf. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00032 #ifndef PID_H_ 00033 #define PID_H_ 00034 00035 #include <stdint.h> 00036 00040 typedef struct { 00041 uint8_t envelope; 00042 uint8_t p_gain; 00043 uint8_t i_gain; 00044 uint8_t d_gain; 00046 float i_state; 00047 float d_term; 00048 float target_temp; 00049 float last_temp; 00050 } pid_t; 00051 00065 void pid_init(pid_t *pid, uint8_t envelope, uint8_t p, uint8_t i, uint8_t d); 00066 00074 void pid_set_target(pid_t *pid, float target_temp); 00075 00089 uint8_t pid_next(pid_t *pid, float current_temp); 00090 00091 #endif //PID_H_