#include <string.h>
#include <pid.h>
Go to the source code of this file.
Functions | |
void | pid_init (struct pid_filter *p) |
void | pid_reset (struct pid_filter *p) |
void | pid_set_gains (struct pid_filter *p, int16_t gp, int16_t gi, int16_t gd) |
void | pid_set_maximums (struct pid_filter *p, int32_t max_in, int32_t max_I, int32_t max_out) |
void | pid_set_out_shift (struct pid_filter *p, uint8_t out_shift) |
int8_t | pid_set_derivate_filter (struct pid_filter *p, uint8_t nb_samples) |
int16_t | pid_get_gain_P (struct pid_filter *p) |
int16_t | pid_get_gain_I (struct pid_filter *p) |
int16_t | pid_get_gain_D (struct pid_filter *p) |
int32_t | pid_get_max_in (struct pid_filter *p) |
int32_t | pid_get_max_I (struct pid_filter *p) |
int32_t | pid_get_max_out (struct pid_filter *p) |
uint8_t | pid_get_out_shift (struct pid_filter *p) |
uint8_t | pid_get_derivate_filter (struct pid_filter *p) |
int32_t | pid_get_value_I (struct pid_filter *p) |
int32_t | pid_get_value_in (struct pid_filter *p) |
int32_t | pid_get_value_D (struct pid_filter *p) |
int32_t | pid_get_value_out (struct pid_filter *p) |
int32_t | pid_do_filter (void *data, int32_t in) |
int32_t pid_do_filter | ( | void * | p, | |
int32_t | in | |||
) |
PID process
Definition at line 177 of file pid.c.
References pid_filter::derivate_nb_samples, pid_filter::gain_D, pid_filter::gain_I, pid_filter::gain_P, pid_filter::index, pid_filter::integral, pid_filter::max_I, pid_filter::max_in, pid_filter::max_out, pid_filter::out_shift, gen_regs::p, pid_filter::prev_D, pid_filter::prev_out, pid_filter::prev_samples, and S_MAX.
uint8_t pid_get_derivate_filter | ( | struct pid_filter * | p | ) |
int16_t pid_get_gain_D | ( | struct pid_filter * | p | ) |
int16_t pid_get_gain_I | ( | struct pid_filter * | p | ) |
int16_t pid_get_gain_P | ( | struct pid_filter * | p | ) |
int32_t pid_get_max_I | ( | struct pid_filter * | p | ) |
int32_t pid_get_max_in | ( | struct pid_filter * | p | ) |
int32_t pid_get_max_out | ( | struct pid_filter * | p | ) |
uint8_t pid_get_out_shift | ( | struct pid_filter * | p | ) |
int32_t pid_get_value_D | ( | struct pid_filter * | p | ) |
get previous derivate value (without gain)
Definition at line 156 of file pid.c.
References IRQ_LOCK, IRQ_UNLOCK, and pid_filter::prev_D.
int32_t pid_get_value_I | ( | struct pid_filter * | p | ) |
get the sum of all nput samples since the filter initialisation
Definition at line 136 of file pid.c.
References pid_filter::integral, IRQ_LOCK, and IRQ_UNLOCK.
int32_t pid_get_value_in | ( | struct pid_filter * | p | ) |
get previous input value
Definition at line 146 of file pid.c.
References pid_filter::index, IRQ_LOCK, IRQ_UNLOCK, and pid_filter::prev_samples.
int32_t pid_get_value_out | ( | struct pid_filter * | p | ) |
get previous output value
Definition at line 166 of file pid.c.
References IRQ_LOCK, IRQ_UNLOCK, and pid_filter::prev_out.
void pid_init | ( | struct pid_filter * | p | ) |
this function will initialize all fieds of pid structure to 0
Definition at line 27 of file pid.c.
References pid_filter::derivate_nb_samples, pid_filter::gain_P, IRQ_LOCK, and IRQ_UNLOCK.
void pid_reset | ( | struct pid_filter * | p | ) |
this function will initialize all fieds of pid structure to 0, except configuration
Definition at line 39 of file pid.c.
References pid_filter::integral, IRQ_LOCK, IRQ_UNLOCK, pid_filter::prev_D, pid_filter::prev_out, and pid_filter::prev_samples.
int8_t pid_set_derivate_filter | ( | struct pid_filter * | p, | |
uint8_t | nb_samples | |||
) |
Definition at line 78 of file pid.c.
References pid_filter::derivate_nb_samples, IRQ_LOCK, and IRQ_UNLOCK.
void pid_set_gains | ( | struct pid_filter * | p, | |
int16_t | gp, | |||
int16_t | gi, | |||
int16_t | gd | |||
) |
Definition at line 50 of file pid.c.
References pid_filter::gain_D, pid_filter::gain_I, pid_filter::gain_P, IRQ_LOCK, and IRQ_UNLOCK.
void pid_set_maximums | ( | struct pid_filter * | p, | |
int32_t | max_in, | |||
int32_t | max_I, | |||
int32_t | max_out | |||
) |
Definition at line 60 of file pid.c.
References IRQ_LOCK, IRQ_UNLOCK, pid_filter::max_I, pid_filter::max_in, and pid_filter::max_out.
void pid_set_out_shift | ( | struct pid_filter * | p, | |
uint8_t | out_shift | |||
) |