STM32庫(kù)函數(shù)TIM_CCxCmd()和TIM_CCxNC-國(guó)產(chǎn)精品久久A∨,無碼人妻精品一區(qū)二區(qū)三區(qū)A片
2015年9月7日,在使用pwm時(shí),調(diào)試發(fā)現(xiàn)stm32 v3.5的庫(kù)有幾個(gè)函數(shù)有問題。下載了stm32 v3.61的庫(kù),也是同樣的問題,于是自己修改這個(gè)bug。
stm32庫(kù)函數(shù)tim_ccxcmd()和tim_ccxncmd()錯(cuò)誤修改:/** * @brief enables or disables the tim capture compare channel x. * @param timx: where x can be 1 to 17 except 6 and 7 to select the tim peripheral. * @param tim_channel: specifies the tim channel * this parameter can be one of the following values: * @arg tim_channel_1: tim channel 1 * @arg tim_channel_2: tim channel 2 * @arg tim_channel_3: tim channel 3 * @arg tim_channel_4: tim channel 4 * @param tim_ccx: specifies the tim channel ccxe bit new state. * this parameter can be: tim_ccx_enable or tim_ccx_disable. * @retval none */void tim_ccxcmd(tim_typedef* timx, uint16_t tim_channel, uint16_t tim_ccx){ uint16_t tmp = 0; /* check the parameters */ assert_param(is_tim_list8_periph(timx)); assert_param(is_tim_channel(tim_channel)); assert_param(is_tim_ccx(tim_ccx)); tmp = ccer_cce_set << tim_channel; /* reset the ccxe bit */ timx->ccer &= (uint16_t)~ tmp; /* set or reset the ccxe bit */ https://timx->ccer |= (uint16_t)(tim_ccx << tim_channel); https://原來的庫(kù)函數(shù)錯(cuò)誤https://修改為:if(tim_ccx==enable) timx->ccer |= tmp;} /** * @brief enables or disables the tim capture compare channel xn. * @param timx: where x can be 1, 8, 15, 16 or 17 to select the tim peripheral. * @param tim_channel: specifies the tim channel * this parameter can be one of the following values: * @arg tim_channel_1: tim channel 1 * @arg tim_channel_2: tim channel 2 * @arg tim_channel_3: tim channel 3 * @param tim_ccxn: specifies the tim channel ccxne bit new state. * this parameter can be: tim_ccxn_enable or tim_ccxn_disable. * @retval none */void tim_ccxncmd(tim_typedef* timx, uint16_t tim_channel, uint16_t tim_ccxn){ uint16_t tmp = 0; /* check the parameters */ assert_param(is_tim_list2_periph(timx)); assert_param(is_tim_complementary_channel(tim_channel)); assert_param(is_tim_ccxn(tim_ccxn)); tmp = ccer_ccne_set << tim_channel; /* reset the ccxne bit */ timx->ccer &= (uint16_t) ~tmp; /* set or reset the ccxne bit */ https://timx->ccer |= (uint16_t)(tim_ccxn << tim_channel); https://原來的庫(kù)函數(shù)錯(cuò)誤https://修改為:if(tim_ccxn==enable) timx->ccer |= tmp; }