public int calculateOffPositionForPulseDuration ( int duration ) { validatePwmDuration ( duration ) ; int result = ( PWM_STEPS - 1 ) * duration / periodDurationMicros ; if ( result < 1 ) { result = 1 ; } else if ( result > PWM_STEPS - 1 ) { result = PWM_STEPS - 1 ; } return result ; }
Calculates the OFF position for a certain pulse duration .