asf/sam/drivers/pwm/pwm.c
uint32_t pwm_fault_init(Pwm *p_pwm, pwm_fault_t *p_fault)
{
	uint32_t fault_id = p_fault->fault_id;
	uint32_t fault_reg = p_pwm->PWM_FMR;

	/** Polarity of fault input */
	if (p_fault->polarity == PWM_HIGH) {
		fault_reg |= fault_id;
	} else {
		fault_reg &= ~fault_id;
	}
	/** Boolean of clearing fault flag */
	if (p_fault->b_clear) {
		fault_reg |= (fault_id << 8);
	} else {
		fault_reg &= ~(fault_id << 8);
	}
	/** Boolean of fault filtering */
	if (p_fault->b_filtered) {
		fault_reg |= (fault_id << 16);
	} else {
		fault_reg &= ~(fault_id << 16);
	}

	p_pwm->PWM_FMR = fault_reg;

	return 0;
}
/**
 * \brief Initialize the behavior of a fault input.
 *
 * \param p_pwm Pointer to a PWM instance.
 * \param p_fault Configurations of a fault input.
 *
 * \retval 0 if configuration succeeds, otherwise fails.
 */
\brief Initialize the behavior of a fault input.
\param p_pwm Pointer to a PWM instance.
\param p_fault Configurations of a fault input.

\retval 0 if configuration succeeds, otherwise fails.
\ brief Initialize the behavior of a fault input . \ param p_pwm Pointer to a PWM instance . \ param p_fault Configurations of a fault input . \ retval 0 if configuration succeeds otherwise fails .
uint32_t pwm_fault_init(Pwm *p_pwm, pwm_fault_t *p_fault)
{
	uint32_t fault_id = p_fault->fault_id;
	uint32_t fault_reg = p_pwm->PWM_FMR;
	if (p_fault->polarity == PWM_HIGH) {
		fault_reg |= fault_id;
	} else {
		fault_reg &= ~fault_id;
	}
	if (p_fault->b_clear) {
		fault_reg |= (fault_id << 8);
	} else {
		fault_reg &= ~(fault_id << 8);
	}
	if (p_fault->b_filtered) {
		fault_reg |= (fault_id << 16);
	} else {
		fault_reg &= ~(fault_id << 16);
	}
	p_pwm->PWM_FMR = fault_reg;
	return 0;
}
uint32_t pwm_fault_init ( Pwm * p_pwm , pwm_fault_t * p_fault ) { uint32_t fault_id = p_fault -> fault_id ; uint32_t fault_reg = p_pwm -> PWM_FMR ; if ( p_fault -> polarity == PWM_HIGH ) { fault_reg |= fault_id ; } else { fault_reg &= ~ fault_id ; } if ( p_fault -> b_clear ) { fault_reg |= ( fault_id << 8 ) ; } else { fault_reg &= ~ ( fault_id << 8 ) ; } if ( p_fault -> b_filtered ) { fault_reg |= ( fault_id << 16 ) ; } else { fault_reg &= ~ ( fault_id << 16 ) ; } p_pwm -> PWM_FMR = fault_reg ; return 0 ; }
\brief Initialize the behavior of a fault input.
\ brief Initialize the behavior of a fault input .
/** Polarity of fault input */ /** Boolean of clearing fault flag */ /** Boolean of fault filtering */