asf/sam/drivers/pwm/pwm.c
void pwm_enable_protect(Pwm *p_pwm, uint32_t ul_group, bool b_sw)
{
	uint32_t wp = 0;

	if (b_sw) {
		wp = PWM_WPCR_WPKEY_PASSWD | (ul_group << 2) |
				PWM_WPCR_WPCMD_ENABLE_SW_PROT;
	} else {
		wp = PWM_WPCR_WPKEY_PASSWD | (ul_group << 2) |
				PWM_WPCR_WPCMD_ENABLE_HW_PROT;
	}

	p_pwm->PWM_WPCR = wp;
}
/**
 * \brief Enable PWM write protect.
 *
 * \param p_pwm Pointer to a PWM instance.
 * \param ul_group Bitmask of PWM register group.
 * \param b_sw Boolean of software protect. True for software protect and false for hardware protect.
 */
\brief Enable PWM write protect.
\param p_pwm Pointer to a PWM instance.
\param ul_group Bitmask of PWM register group.
\param b_sw Boolean of software protect. True for software protect and false for hardware protect.
\ brief Enable PWM write protect . \ param p_pwm Pointer to a PWM instance . \ param ul_group Bitmask of PWM register group . \ param b_sw Boolean of software protect . True for software protect and false for hardware protect .
void pwm_enable_protect(Pwm *p_pwm, uint32_t ul_group, bool b_sw)
{
	uint32_t wp = 0;
	if (b_sw) {
		wp = PWM_WPCR_WPKEY_PASSWD | (ul_group << 2) |
				PWM_WPCR_WPCMD_ENABLE_SW_PROT;
	} else {
		wp = PWM_WPCR_WPKEY_PASSWD | (ul_group << 2) |
				PWM_WPCR_WPCMD_ENABLE_HW_PROT;
	}
	p_pwm->PWM_WPCR = wp;
}
void pwm_enable_protect ( Pwm * p_pwm , uint32_t ul_group , bool b_sw ) { uint32_t wp = 0 ; if ( b_sw ) { wp = PWM_WPCR_WPKEY_PASSWD | ( ul_group << 2 ) | PWM_WPCR_WPCMD_ENABLE_SW_PROT ; } else { wp = PWM_WPCR_WPKEY_PASSWD | ( ul_group << 2 ) | PWM_WPCR_WPCMD_ENABLE_HW_PROT ; } p_pwm -> PWM_WPCR = wp ; }
\brief Enable PWM write protect.
\ brief Enable PWM write protect .