/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// The sysfs system requires a number to be used in order to /// specify a specific PWM device on a EHRPWM chip This function /// converts the PWMPortEnum value to that number /// </summary> /// <param name="pwmPortIn">The PWM port we use</param> /// <returns>the export number</returns> /// <history> /// 07 Mar 19 Cynic - Originally written /// 03 Mar 19 Cynic - Converted to new PWM Port Enum names /// </history> public uint ConvertPWMPortEnumToDeviceNumber(PWMPortEnum pwmPortIn) { if (pwmPortIn == PWMPortEnum.PWM0_A) { return(0); // 0 - EHRPWM0A } if (pwmPortIn == PWMPortEnum.PWM0_B) { return(1); // 1 - EHRPWM0B } if (pwmPortIn == PWMPortEnum.PWM1_A) { return(0); // 3 - EHRPWM1A } if (pwmPortIn == PWMPortEnum.PWM1_B) { return(1); // 4 - EHRPWM1B } if (pwmPortIn == PWMPortEnum.PWM2_A) { return(0); // 5 - EHRPWM2A } if (pwmPortIn == PWMPortEnum.PWM2_B) { return(1); // 6 - EHRPWM2B } throw new Exception("Unknown PWM Port: " + pwmPortIn.ToString()); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// The sysfs system requires a number to be used in order to /// export and manipulate the PWM device we wish to use. This function /// converts the PWMPortEnum value to that number /// </summary> /// <param name="pwmPortIn">The PWM port we use</param> /// <returns>the export number</returns> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public uint ConvertPWMPortEnumToExportNumber(PWMPortEnum pwmPortIn) { if (pwmPortIn == PWMPortEnum.PWM_0) { return(0); } if (pwmPortIn == PWMPortEnum.PWM_1) { return(1); } throw new Exception("Unknown PWM Port: " + pwmPortIn.ToString()); }