PID loop development + move rate control to own source files

This commit is contained in:
Ed Clarke
2018-11-30 10:14:34 +00:00
parent 0b2839c9fc
commit 45d84a2b84
5 changed files with 243 additions and 207 deletions

View File

@@ -0,0 +1,17 @@
#include <stdint.h>
#include <limits.h>
typedef int32_t xua_lite_fixed_point_t;
typedef struct pid_state_t{
xua_lite_fixed_point_t fifo_level_filtered_old;
xua_lite_fixed_point_t fifo_level_accum;
} pid_state_t;
//USB Adaptive mode helper
void do_rate_control(int fill_level, pid_state_t *pid_state, int *clock_nudge);
//USB Asynch mode helper
void do_feedback_calculation(unsigned &sof_count, const unsigned mclk_hz, unsigned mclk_port_counter,unsigned &mclk_port_counter_old
,long long &feedback_value, unsigned &mod_from_last_time, unsigned fb_clocks[1]);