summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Reeder2018-08-02 13:55:35 -0500
committerJason Reeder2018-08-02 13:55:35 -0500
commitba6d5a43d7d7fc0e5a2e70901acb7f5e03d8fd9d (patch)
tree4d81269d7e26d598d327b4d2a924008ab0e90344
parent75f354c9c40aaa9d0686b54ef12f92b075e130fb (diff)
downloadtida01555-ba6d5a43d7d7fc0e5a2e70901acb7f5e03d8fd9d.tar.gz
tida01555-ba6d5a43d7d7fc0e5a2e70901acb7f5e03d8fd9d.tar.xz
tida01555-ba6d5a43d7d7fc0e5a2e70901acb7f5e03d8fd9d.zip
Change the frequency estimation channel index to be 1 based
Signed-off-by: Jason Reeder <jreeder@ti.com>
-rw-r--r--PRU_ADS8688_Controller/PRU_ADS8688_Controller.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/PRU_ADS8688_Controller/PRU_ADS8688_Controller.c b/PRU_ADS8688_Controller/PRU_ADS8688_Controller.c
index bec1fb6..3de9131 100644
--- a/PRU_ADS8688_Controller/PRU_ADS8688_Controller.c
+++ b/PRU_ADS8688_Controller/PRU_ADS8688_Controller.c
@@ -96,13 +96,13 @@ volatile register uint32_t __R31;
96#define OVERSAMPLE 1 96#define OVERSAMPLE 1
97 97
98/* Frequency estimation constants */ 98/* Frequency estimation constants */
99#define FREQ_EST_DEVICE 4 99#define FREQ_EST_DEVICE 5 //1 based index to match silkscreen
100#define FREQ_EST_CHANNEL 5 100#define FREQ_EST_CHANNEL 5
101#define FREQ_EST_CYCLES 5 101#define FREQ_EST_CYCLES 5
102#define MIN_DELAY 710 //55Hz 102#define MIN_DELAY 710 //55Hz
103#define DEFAULT_DELAY 781 //50Hz 103#define DEFAULT_DELAY 781 //50Hz
104#define DEFAULT_COMP 2 //50Hz 104#define DEFAULT_COMP 2 //50Hz
105#define MAX_DELAY 868 //45Hz 105#define MAX_DELAY 868 //45Hz
106 106
107/* Information about devices and channels connected */ 107/* Information about devices and channels connected */
108#define CHANS_PER_DEVICE 8 108#define CHANS_PER_DEVICE 8
@@ -318,7 +318,7 @@ void main(void)
318 if (oversample == OVERSAMPLE) { 318 if (oversample == OVERSAMPLE) {
319 chan_data_temp[idx] = (uint16_t)((chan_data_temp[idx] + (OVERSAMPLE/2)) / OVERSAMPLE); 319 chan_data_temp[idx] = (uint16_t)((chan_data_temp[idx] + (OVERSAMPLE/2)) / OVERSAMPLE);
320 /* Frequency estimation using zero crossings */ 320 /* Frequency estimation using zero crossings */
321 if (j == FREQ_EST_DEVICE && i == FREQ_EST_CHANNEL) { 321 if (j == (FREQ_EST_DEVICE - 1) && i == FREQ_EST_CHANNEL) {
322 if (((last_pol > 0) && ((int16_t)(chan_data_temp[idx] - 0x8000) < 0)) || 322 if (((last_pol > 0) && ((int16_t)(chan_data_temp[idx] - 0x8000) < 0)) ||
323 ((last_pol < 0) && ((int16_t)(chan_data_temp[idx] - 0x8000) > 0))) { 323 ((last_pol < 0) && ((int16_t)(chan_data_temp[idx] - 0x8000) > 0))) {
324 zero_crossings++; 324 zero_crossings++;