private void CreateGetPinFromArrayFunction() { var tempcodeget = new List <string>(); var getpinname = "u8 GET_PIN_" + _union.Name + "(u8 BIT)"; tempcodeget.Add("ChannelControl::dir(" + _union.Name + "[BIT], 1);"); tempcodeget.Add("return ChannelControl::read(" + _union.Name + "[BIT]);"); _getPinFromArrayFunction = new CodeTemplateFunction(getpinname, tempcodeget); }
private void CreateClearPinArrayFunction() { var tempcodeclear = new List <string>(); var clearpinname = "void CLEAR_PIN_" + _union.Name + "(u8 BIT)"; tempcodeclear.Add("ChannelControl::dir(" + _union.Name + "[BIT], 0);"); tempcodeclear.Add("ChannelControl::write(" + _union.Name + "[BIT],0);"); _clearPinArrayFunction = new CodeTemplateFunction(clearpinname, tempcodeclear); }
private void CreateSetPinInArrayFunction() { var tempcodeset = new List <string>(); var setpinname = "void SET_PIN_" + _union.Name + "(u8 BIT)"; tempcodeset.Add("ChannelControl::dir(" + _union.Name + "[BIT], 0);"); tempcodeset.Add("ChannelControl::write(" + _union.Name + "[BIT],1);"); _setPinInArrayFunction = new CodeTemplateFunction(setpinname, tempcodeset); }
private void CreateSetBusFunction() { var tempcodeset = new List <string>(); var functionbody = new List <string> { "ChannelControl::dir(" + _union.Name + "[DATA_BIT], 0);", "ChannelControl::write(" + _union.Name + "[DATA_BIT],((DAT>>DATA_BIT)&0x1));" }; tempcodeset.AddRange(new CodeTemplateFor("DATA_BIT", _union.Chanels.Count.ToString(), functionbody).Code); var setname = "void SET_BUS_" + _union.Name + "(" + _union.GetDataType() + " DAT)"; _setBusFunction = new CodeTemplateFunction(setname, tempcodeset); }
private void CreateGetBusFunction() { var tempcodeget = new List <string> { _union.GetDataType() + " LOCAL_VALUE=0;" }; var functionbody = new List <string> { "ChannelControl::dir(" + _union.Name + "[DATA_BIT], 1);", "LOCAL_VALUE = LOCAL_VALUE | (ChannelControl::read(" + _union.Name + "[DATA_BIT]) << DATA_BIT);" }; tempcodeget.AddRange(new CodeTemplateFor("DATA_BIT", _union.Chanels.Count.ToString(), functionbody).Code); tempcodeget.Add("return LOCAL_VALUE;"); var getname = _union.GetDataType() + " GET_BUS_" + _union.Name + "(void)"; _getBusFunction = new CodeTemplateFunction(getname, tempcodeget); }
public EttOutputCommon(List <ConnectionUnion> unions) { Unions = new List <ConnectionUnion>(); Functions = new List <EttFunctions>(); Header = new HeaderTemplate("ProcessFK"); Unions = unions; Name = Header.Name + ".h"; foreach (var union in Unions) { Functions.Add(new EttFunctions(union)); } Header.AddBlankLine(); Header.AddDefine("CHIP_COUNT", 55); Header.AddDefine("PORT_COUNT", 112); Header.AddBlankLine(); Header.AddInclude("Pereferial_manager/Control_manager.h"); Header.AddInclude("I2C_Devices/Iic_pereferial.h"); Header.AddInclude("GPIO/iopins.h"); Header.AddInclude("GPIO/pinout.h"); Header.AddInclude("GPIO/pinlist.h"); Header.AddInclude("<sleep.h>"); Header.AddBlankLine(); Header.AddNameSpace("IO"); Header.AddNameSpace("MANAGERS"); Header.AddBlankLine(); foreach (var union in Unions) { if (union.ConnectionType != ConnectionType.Global) { Header.Code.Add(union.ToString()); } } var classcode = new List <string>(); var initcode = new List <string>(); var workingcode = new List <string>(); var errorcode = new List <string> { "if ( A!=B)", "\tif (Control_manager::resultBuff[ GROUPE*CHIP_COUNT + DUT ] < 0xFF)", "\t\tControl_manager::resultBuff[ GROUPE*CHIP_COUNT + DUT ]++;" }; var errorRoutine = new CodeTemplateFunction("void ERRORS(u8 A, u8 B, u8 DUT, u8 GROUPE)", errorcode); foreach (var function in Functions) { initcode.AddRange(function.InitializationCode); workingcode.AddRange(function.WorkingRutines); } var initRoutine = new CodeTemplateFunction("void init()", initcode); classcode.Add("public:"); classcode.AddRange(initRoutine.Code); classcode.Add("static void FK();"); classcode.Add("private:"); classcode.AddRange(errorRoutine.Code); foreach (var function in Functions) { classcode.AddRange(function.WorkingRutines); } var workingclass = new CodeTemplateClass(classcode, "ProcessFK"); Header.Code.AddRange(workingclass.Code); Header.CloseHeader(); CombineList(Header.Code); }