Elite 1.4-re IV-current avg has a bug; move include "XXX.h"

This commit is contained in:
alan
2019-08-28 16:13:19 +08:00
parent 9d288dee41
commit 658ed58412
2 changed files with 27 additions and 24 deletions
@@ -209,6 +209,8 @@ static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_
if (INSTRUCTION.eliteFxn == IVCurve) {
ADCRealCurrent += DecodeADCCurrent(ADCGain, ADC_measure);
if ((SampleRate_counter % 10) == 0) {
ADCRealCurrent = ADCRealCurrent / 10;
@@ -402,21 +402,12 @@ characteristic change event
#endif // ICALL_EVENTS
#include <ti/sysbios/hal/Hwi.h>
#include <ti/sysbios/knl/Queue.h>
#include "EliteADC.h"
#include "EliteDAC.h"
#include "EliteSPI.h"
#include "Elite_PIN.h"
#define DARKLED 0xE1
#define LIGHTLED 0xE8
static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
#define LEDPowerON() LED_color(DARKLED, 0x00, 0xFA, 0x00)
#ifdef ELITE_VERSION_1_4
#include "EliteI2C.h"
#endif
#ifdef USE_ICALL
#include <icall.h>
#else
@@ -426,11 +417,11 @@ static void LED_color(uint8_t bright, uint8_t red, uint8_t green, uint8_t blue);
// Internal Events for RTOS application
#ifndef RTOSPARA
#define RTOSPARA
#define SBP_STATE_CHANGE_EVT 0x0001
#define SBP_CHAR_CHANGE_EVT 0x0002
#define SBP_PERIODIC_EVT 0x0004
#define SBP_CONN_EVT_END_EVT 0x0008
#define SBP_KEY_CHANGE_EVT 0x0010
#define SBP_STATE_CHANGE_EVT 0x0001
#define SBP_CHAR_CHANGE_EVT 0x0002
#define SBP_PERIODIC_EVT 0x0004
#define SBP_CONN_EVT_END_EVT 0x0008
#define SBP_KEY_CHANGE_EVT 0x0010
#endif
static Clock_Struct periodicClock;
@@ -600,7 +591,7 @@ static void ADCChannelSelect(uint8_t ADCChannel);
static int32_t DecodeADCVolt(uint16_t ADC_measure);
static int32_t DecodeADCCurrent(uint8_t ADCGain, uint16_t ADC_measure);
static int32_t DecodeADCValue(uint8_t ADCGain, uint8_t ADCChannel, uint8_t *ADC_raw);
static void ADC_overflow(uint8_t gain, uint8_t *rawdata);
static void ADC_overflow(uint8_t gain, uint8_t *rawdata);
// DAC function
static uint16_t Usercode_Correction_to_DAC(uint16_t usercode);
@@ -672,12 +663,12 @@ static uint16_t SampleRate = 1;
static uint16_t SampleRate_counter = 1;
// record value for IV curve to calculate average current
static int16_t avg_number = 1;
static int32_t ADCRealCurrent = 0;
static int16_t avg_number = 1;
static int32_t ADCRealCurrent = 0;
static int32_t ADCRealCurrent_avg = 0;
#define GAIN_200K 0x00
#define GAIN_10K 0x01
#define GAIN_10K 0x01
#define GAIN_200R 0x02
#define GAIN_AUTO 0x03
static uint8_t ADCGainLevel = GAIN_200K;
@@ -697,9 +688,9 @@ static uint8_t StepTimeCounter = 1;
static uint16_t VoltScan(); // used in I-V and cyclic
static void Notify_IV(uint16_t Voltage); // send notify voltage after VoltScan()
static void fxn_Gen();
static void ZT_plot(uint16_t outV, uint16_t inV);
static void VT_Plot();
static void fxn_Gen();
static void ZT_plot(uint16_t outV, uint16_t inV);
static void VT_Plot();
static int32_t IT_Plot();
// the following fxn do the same thing
@@ -748,8 +739,9 @@ static void update_ZM_instruction(uint8 *ins) {
CleanBuffer();
INSTRUCTION.eliteFxn = IVCurve;
DACreset = true;
SampleRate = 10;
if (ins[3] | ins[4]) {
if (ins[3] | ins[4]) {
VoltOrigin = ((uint16_t)(ins[3]) << 8) | (uint16_t)(ins[4]);
VoltOrigin = Usercode_Correction_to_DAC(VoltOrigin);
}
@@ -898,8 +890,7 @@ static void update_ZM_instruction(uint8 *ins) {
CleanBuffer();
INSTRUCTION.eliteFxn = ITCurve;
StepTime = 0x01;
// IT_Plot(); // enable 10v = 1
// IT_Plot(); // enable 10v = 1
break;
}
@@ -1166,6 +1157,16 @@ static void headstage_gptimer_callback(GPTimerCC26XX_Handle handle, GPTimerCC26X
/*=======================================
==== headstage specific declaration ====
======================================*/
#include "EliteADC.h"
#include "EliteDAC.h"
#include "EliteSPI.h"
#include "Elite_PIN.h"
#ifdef ELITE_VERSION_1_4
#include "EliteI2C.h"
#endif
#include "EliteDeviceCorrection.h"
#include "EliteNotify.h"
#include "impedance_meter.h"