VT/IT/VOut using OOC struct

This commit is contained in:
weiting2
2019-10-29 11:18:16 +08:00
parent 8213d9fb19
commit a5df1c227e
3 changed files with 19 additions and 7 deletions
@@ -242,16 +242,24 @@ static RTMode * InitRTMode(){
/* End of IV Mode Data */
typedef struct _WorkMode{
// Measure only
ITMode *IT;
VTMode *VT;
RTMode *RT;
// Output Only
VoltOutMode *VO;
// Measure + Output
// RTMode *RT;
}WorkMode;
static WorkMode *InitWorkMode(){
WorkMode *ret = malloc(sizeof(WorkMode));
ret->IT = InitITMode();
ret->VT = InitVTMode();
ret->RT = InitRTMode();
ret->VO = InitVoltOutMode();
// ret->RT = InitRTMode();
return ret;
}
@@ -834,12 +834,9 @@ static void update_ZM_instruction(uint8 *ins) {
break;
}
case VOLT_OUTPUT: {
INSTRUCTION.eliteFxn = VOLT_OUTPUT;
INSTRUCTION.VoltConstant = ( ((uint16_t)(ins[3])) << 8) | (uint16_t)(ins[4]);
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
// DAC_outputV(INSTRUCTION.VoltConstant);
break;
}
@@ -108,9 +108,9 @@ static void SimpleBLEPeripheral_performPeriodicTask(WorkMode *WorkModeData) {
}
/** Periodic Event **/
// Default working mode is DAC out -> ADC read -> send notify
// Default working flow is DAC out -> ADC read -> send notify
// We will need a flag to control DAC, if we want to exchange to ADC -> DAC -> notify
// This flag can be named by FxnNameReset
// This flag can be named by FxnNameDACReset
// In IV, CV, and func-gen mode, DAC will output voltage
// else DAC do nothing.
@@ -129,6 +129,13 @@ static void EliteDACControl(WorkMode *WorkModeData) {
// output a certain voltage and put it into NotifyVolt
DACCode2Real2Notify(VoltScan());
}
else if(INSTRUCTION.eliteFxn == VOLT_OUTPUT){
// assign WorkModeData->VO = INSTRUCTION.VoltConstant
WorkModeData->VO->SetVoltOut((struct VoltOutPara) WorkModeData->VO, INSTRUCTION.VoltConstant);
// UserCode -> DAC code -> DAC out
DAC_outputV(Usercode_Correction_to_DAC(WorkModeData->VO->GetVoltOut((struct VoltOutPara) WorkModeData->VO));
}
else if (INSTRUCTION.eliteFxn == ZT_CURVE){
if(INSTRUCTION.ResisterMeter == RESISTER_METER_SMALL){
// output 1V