Move shared PI global variable into the proper module.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-25 09:19:29 +02:00
parent 8f6d2549b1
commit e1f77422ec
3 changed files with 15 additions and 3 deletions

4
pi.c
View File

@ -29,8 +29,8 @@
#define SWTS_KI 0.001 #define SWTS_KI 0.001
/* These two take their values from the configuration file. (see ptp4l.c) */ /* These two take their values from the configuration file. (see ptp4l.c) */
extern double configured_pi_kp; double configured_pi_kp;
extern double configured_pi_ki; double configured_pi_ki;
struct pi_servo { struct pi_servo {
struct servo servo; struct servo servo;

12
pi.h
View File

@ -21,6 +21,18 @@
#include "servo.h" #include "servo.h"
/**
* When set to a non-zero value, this variable determines the
* proportional constant for the PI controller.
*/
extern double configured_pi_kp;
/**
* When set to a non-zero value, this variable determines the
* integral constant for the PI controller.
*/
extern double configured_pi_ki;
struct servo *pi_servo_create(int max_ppb, int sw_ts); struct servo *pi_servo_create(int max_ppb, int sw_ts);
#endif #endif

View File

@ -24,13 +24,13 @@
#include "clock.h" #include "clock.h"
#include "config.h" #include "config.h"
#include "pi.h"
#include "print.h" #include "print.h"
#include "sk.h" #include "sk.h"
#include "transport.h" #include "transport.h"
#include "util.h" #include "util.h"
int assume_two_step; int assume_two_step;
double configured_pi_kp, configured_pi_ki; /*see pi.c*/
extern unsigned char ptp_dst_mac[]; /*see raw.c*/ extern unsigned char ptp_dst_mac[]; /*see raw.c*/
extern unsigned char p2p_dst_mac[]; /*see raw.c*/ extern unsigned char p2p_dst_mac[]; /*see raw.c*/