/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// A function to send data received from the server over to the /// code running in the PRU /// /// </summary> /// <param name="scData">the server client data object</param> /// <history> /// 19 Nov 18 Cynic - Originally written /// </history> public void SetPRUSteppersFromServerClientData(ServerClientData scData) { // sanity check if (scData == null) { LogMessage("SetPRUSteppersFromServerClientData, scData==null"); return; } // write the allstep_enable flag pruDriver.WritePRUDataUInt32(scData.AllStep_Enable, ALLSTEP_ENABLE_OFFSET); // write the STEP0 enable/disable flag pruDriver.WritePRUDataUInt32(scData.Step0_Enable, STEP0_ENABLED_OFFSET); // write the STEP0 fullcount value pruDriver.WritePRUDataUInt32(scData.Step0_StepSpeed, STEP0_FULLCOUNT); // write the STEP0 direction flag pruDriver.WritePRUDataUInt32(scData.Step0_DirState, STEP0_DIRSTATE); // write the STEP1 enable/disable flag pruDriver.WritePRUDataUInt32(scData.Step1_Enable, STEP1_ENABLED_OFFSET); // write the STEP1 fullcount value pruDriver.WritePRUDataUInt32(scData.Step1_StepSpeed, STEP1_FULLCOUNT); // write the STEP1 direction flag pruDriver.WritePRUDataUInt32(scData.Step1_DirState, STEP1_DIRSTATE); // write the STEP2 enable/disable flag pruDriver.WritePRUDataUInt32(scData.Step2_Enable, STEP2_ENABLED_OFFSET); // write the STEP2 fullcount value pruDriver.WritePRUDataUInt32(scData.Step2_StepSpeed, STEP2_FULLCOUNT); // write the STEP2 direction flag pruDriver.WritePRUDataUInt32(scData.Step2_DirState, STEP2_DIRSTATE); // write the STEP3 enable/disable flag pruDriver.WritePRUDataUInt32(scData.Step3_Enable, STEP3_ENABLED_OFFSET); // write the STEP3 fullcount value pruDriver.WritePRUDataUInt32(scData.Step3_StepSpeed, STEP3_FULLCOUNT); // write the STEP3 direction flag pruDriver.WritePRUDataUInt32(scData.Step3_DirState, STEP3_DIRSTATE); // write the STEP4 enable/disable flag pruDriver.WritePRUDataUInt32(scData.Step4_Enable, STEP4_ENABLED_OFFSET); // write the STEP4 fullcount value pruDriver.WritePRUDataUInt32(scData.Step4_StepSpeed, STEP4_FULLCOUNT); // write the STEP4 direction flag pruDriver.WritePRUDataUInt32(scData.Step4_DirState, STEP4_DIRSTATE); // write the STEP5 enable/disable flag pruDriver.WritePRUDataUInt32(scData.Step5_Enable, STEP5_ENABLED_OFFSET); // write the STEP5 fullcount value pruDriver.WritePRUDataUInt32(scData.Step5_StepSpeed, STEP5_FULLCOUNT); // write the STEP5 direction flag pruDriver.WritePRUDataUInt32(scData.Step5_DirState, STEP5_DIRSTATE); // pump the current state out to the console Console.WriteLine(scData.GetState()); LogMessage("scData=" + scData.GetState()); // write the semaphore. This must come last, the code running in the // PRU will see this change and set things up according to the // other configuration items above pruDriver.WritePRUDataUInt32(1, SEMAPHORE_OFFSET); }