电调源码 开源ESC32

所需积分/C币:50 2018-06-12 17:32:06 9.05MB RAR
158
收藏 收藏
举报

/* This file is part of AutoQuad ESC32. AutoQuad ESC32 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. AutoQuad ESC32 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with AutoQuad ESC32. If not, see . Copyright © 2011, 2012 Bill Nesbitt */ /* * pwm.c文件.此文件有2个功能,2个功能分别使用,不能同时使用 * 1、pwm in输入模式,pwm输入中断里,调用runNewInput函数 * 2、one wire通讯协议,pwm输入中断里,调用owEdgeDetect函数,来输入新的数据,调用owReset函数来复位1wire通讯 * */ #include "pwm.h" #include "timer.h" #include "run.h" #include "main.h" #include "ow.h" #include "stm32f10x_gpio.h" #include "stm32f10x_tim.h" #include "misc.h" static int16_t pwmMinPeriod; //timer1 ch1 pwm 输入最小周期 static int16_t pwmMaxPeriod; //timer1 ch1 pwm 输入最大周期 int16_t pwmMinValue; //timer1 ch2 pwm 输入最小周期 static int16_t pwmMaxValue; //timer1 ch2 pwm 输入最大周期 int16_t pwmLoValue; int16_t pwmHiValue; int16_t pwmMinStart; volatile uint32_t pwmValidMicros; //关闭输入捕获比较中断 1和2 void pwmIsrAllOff(void) { PWM_TIM->DIER &= (uint16_t)~(TIM_IT_CC1 | TIM_IT_CC2);//关闭中断 } //开启输入捕获比较中断 1和2 void pwmIsrAllOn(void) { PWM_TIM->CCR1; PWM_TIM->CCR2; PWM_TIM->DIER |= (TIM_IT_CC1 | TIM_IT_CC2);//允许捕获比较 1 2中断 } //开启捕获比较2中断 void pwmIsrRunOn(void) { uint16_t dier = PWM_TIM->DIER; dier &= (uint16_t)~(TIM_IT_CC1 | TIM_IT_CC2); dier |= TIM_IT_CC2;//允许捕获/比较2中断 PWM_TIM->CCR1; PWM_TIM->CCR2; PWM_TIM->DIER = dier; } //timer 1 void pwmInit(void) { GPIO_InitTypeDef GPIO_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; TIM_ICInitTypeDe

...展开详情
立即下载
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
一个资源只可评论一次,评论内容不能少于5个字
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
  • 分享宗师

关注 私信
上传资源赚钱or赚积分
最新推荐
电调源码 开源ESC32 50积分/C币 立即下载
1/0