/**
******************************************************************************
* @file stm32f10x_tim.c
* @author MCD Application Team
* @version V3.5.0
* @date 11-March-2011
* @brief This file provides all the TIM firmware functions.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_tim.h"
#include "stm32f10x_rcc.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @defgroup TIM
* @brief TIM driver modules
* @{
*/
/** @defgroup TIM_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup TIM_Private_Defines
* @{
*/
/* ---------------------- TIM registers bit mask ------------------------ */
#define SMCR_ETR_Mask ((uint16_t)0x00FF)
#define CCMR_Offset ((uint16_t)0x0018)
#define CCER_CCE_Set ((uint16_t)0x0001)
#define CCER_CCNE_Set ((uint16_t)0x0004)
/**
* @}
*/
/** @defgroup TIM_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup TIM_Private_Variables
* @{
*/
/**
* @}
*/
/** @defgroup TIM_Private_FunctionPrototypes
* @{
*/
static void TI1_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
uint16_t TIM_ICFilter);
static void TI2_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
uint16_t TIM_ICFilter);
static void TI3_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
uint16_t TIM_ICFilter);
static void TI4_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
uint16_t TIM_ICFilter);
/**
* @}
*/
/** @defgroup TIM_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup TIM_Private_Variables
* @{
*/
/**
* @}
*/
/** @defgroup TIM_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup TIM_Private_Functions
* @{
*/
/**
* @brief Deinitializes the TIMx peripheral registers to their default reset values.
* @param TIMx: where x can be 1 to 17 to select the TIM peripheral.
* @retval None
*/
void TIM_DeInit(TIM_TypeDef* TIMx)
{
/* Check the parameters */
assert_param(IS_TIM_ALL_PERIPH(TIMx));
if (TIMx == TIM1)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE);
}
else if (TIMx == TIM2)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, DISABLE);
}
else if (TIMx == TIM3)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, DISABLE);
}
else if (TIMx == TIM4)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE);
}
else if (TIMx == TIM5)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, DISABLE);
}
else if (TIMx == TIM6)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE);
}
else if (TIMx == TIM7)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, DISABLE);
}
else if (TIMx == TIM8)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, DISABLE);
}
else if (TIMx == TIM9)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM9, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM9, DISABLE);
}
else if (TIMx == TIM10)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM10, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM10, DISABLE);
}
else if (TIMx == TIM11)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM11, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM11, DISABLE);
}
else if (TIMx == TIM12)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM12, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM12, DISABLE);
}
else if (TIMx == TIM13)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM13, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM13, DISABLE);
}
else if (TIMx == TIM14)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM14, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM14, DISABLE);
}
else if (TIMx == TIM15)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM15, DISABLE);
}
else if (TIMx == TIM16)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM16, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM16, DISABLE);
}
else
{
if (TIMx == TIM17)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM17, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM17, DISABLE);
}
}
}
/**
* @brief Initializes the TIMx Time Base Unit peripheral according to
* the specified parameters in the TIM_TimeBaseInitStruct.
* @param TIMx: where x can be 1 to 17 to select the TIM peripheral.
* @param TIM_TimeBaseInitStruct: pointer to a TIM_TimeBaseInitTypeDef
* structure that contains the configuration information for the
* specified TIM peripheral.
* @retval None
*/
void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct)
{
uint16_t tmpcr1 = 0;
/* Check the parameters */
assert_param(IS_TIM_ALL_PERIPH(TIMx));
assert_param(IS_TIM_COUNTER_MODE(TIM_TimeBaseInitStruct->TIM_CounterMode));
assert_param(IS_TIM_CKD_DIV(TIM_TimeBaseInitStruct->TIM_ClockDivision));
tmpcr1 = TIMx->CR1;
if((TIMx == TIM1) || (TIMx == TIM8)|| (TIMx == TIM2) || (TIMx == TIM3)||
(TIMx == TIM4) || (TIMx == TIM5))
{
/* Select the Counter Mode */
tmpcr1 &= (uint16_t)(~((uint16_t)(TIM_CR1_DIR | TIM_CR1_CMS)));
tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_CounterMode;
}
if((TIMx != TIM6) && (TIMx != TIM7))
{
/* Set the clock division */
tmpcr1 &= (uint16_t)(~((uint16_t)TIM_CR1_CKD));
tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_ClockDivision;
}
TIMx->CR1 = tmpcr1;
/* Set the Autoreload value */
TIMx->ARR = TIM_TimeBaseInitStruct->TIM_Period ;
/* Set the Prescaler value */
TIMx->PSC = TIM_TimeBaseInitStruct->TIM_Prescaler;
if ((TIMx == TIM1) || (TIMx == TIM8)|| (TIMx == TIM15)|| (TIMx == TIM16) || (TIMx == TIM17))
{
/* Set the Repetition Counter value */
TIMx->RCR = TIM_TimeBaseInitStruct->TIM_RepetitionCounter;
}
/* Generate an update event to reload the Prescaler and the Repetition counter
values immediately */
TIMx->EGR = TIM_PSCReloadMode_Immediate;
}
/**
* @brief Initializes the TIMx Channel1 according to the specified
* parameters in the TIM_OCInitStruct.
* @param TIMx: where x can be 1 to 17 except 6 and 7 to select the TIM peripheral.
* @param TIM_OCInitStruct: pointer to a TIM_OCInitTypeDef structure
* that contains the configuration information for the specified TIM peripheral.
* @retval None
*/
void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct)
{
uint16_t tmpccmrx = 0, tmpccer = 0, tmpc
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
毕业设计基于STM32开发的远程医疗监测系统源码+项目说明.zip 【项目资源介绍】 该项目是做的毕业设计,是远程医疗监测系统 功能简介 采集温度 血氧 舒张压 收缩压 心率数据和经纬度数据,把这些信息上传机智云平台,并能在手机弹窗报警 所需硬件 定位模块ATGM336H 健康检测模块(同时检测血氧 舒张压 收缩压 心率数据) STM32F103C8T6单片机 OLED显示屏 DS18B20 ESP8266 01S 引脚连接 OLED屏部分 SCL--PA4 SDA--PA5 VCC-3.3V 健康检测模块 VCC---3.3V RXD----PA2 TXD----PA3 GND----GND DS18B20 VCC---3.3V D0----PB8 GND----GND 定位模块 VCC----3.3V RXD----PA9 TXD----PA10 GND----GND PPS----悬空 ESP8266部分 VCC---3.3V RXD----PB10 TXD----PB11 GND---GND
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计基于STM32开发的远程医疗监测系统源码+项目说明.zip (121个子文件)
main.uvguix.14498 177KB
main.uvgui.Administrator 139KB
keilkilll.bat 372B
stm32f10x_tim.c 104KB
stm32f10x_flash.c 59KB
stm32f10x_rcc.c 49KB
gizwits_protocol.c 49KB
gizwits_protocol.c 48KB
stm32f10x_adc.c 45KB
stm32f10x_i2c.c 43KB
stm32f10x_can.c 43KB
stm32f10x_usart.c 36KB
system_stm32f10x.c 35KB
stm32f10x_fsmc.c 34KB
stm32f10x_spi.c 29KB
stm32f10x_dma.c 28KB
stm32f10x_sdio.c 27KB
stm32f10x_gpio.c 22KB
stm32f10x_dac.c 18KB
core_cm3.c 16KB
stm32f10x_cec.c 11KB
oled.c 10KB
dataPointTools.c 9KB
stm32f10x_pwr.c 8KB
stm32f10x_rtc.c 8KB
stm32f10x_bkp.c 8KB
gizwits_product.c 7KB
gizwits_product.c 7KB
misc.c 7KB
stm32f10x_exti.c 7KB
common.c 6KB
main.c 6KB
stm32f10x_wwdg.c 5KB
stm32f10x_dbgmcu.c 5KB
stm32f10x_iwdg.c 5KB
usart.c 5KB
ds18b20.c 4KB
delay.c 4KB
stm32f10x_it.c 4KB
ringbuffer.c 3KB
stm32f10x_crc.c 3KB
usart_2.c 3KB
usart2.c 2KB
timer.c 2KB
HX711.c 1KB
BEEP.c 607B
sys.c 155B
main.uvguix.coding 176KB
Target_1_STM32F103ZE_1.0.0.dbgconf 7KB
Target_1_STM32F103C8_1.0.0.dbgconf 7KB
Target_1_STM32F103C6_1.0.0.dbgconf 2KB
stm32f10x.h 611KB
core_cm3.h 82KB
stm32f10x_tim.h 50KB
oledfont.h 43KB
stm32f10x_rcc.h 29KB
stm32f10x_i2c.h 29KB
stm32f10x_can.h 26KB
stm32f10x_fsmc.h 26KB
gizwits_protocol.h 25KB
stm32f10x_flash.h 24KB
gizwits_protocol.h 24KB
stm32f10x_sdio.h 21KB
stm32f10x_adc.h 21KB
stm32f10x_dma.h 20KB
stm32f10x_gpio.h 19KB
stm32f10x_spi.h 17KB
stm32f10x_usart.h 16KB
stm32f10x_dac.h 15KB
bmp.h 10KB
misc.h 9KB
stm32f10x_bkp.h 7KB
stm32f10x_exti.h 6KB
stm32f10x_cec.h 6KB
stm32f10x_pwr.h 4KB
common.h 4KB
stm32f10x_rtc.h 4KB
stm32f10x_dbgmcu.h 4KB
stm32f10x_iwdg.h 4KB
stm32f10x_conf.h 3KB
stm32f10x_wwdg.h 3KB
sys.h 2KB
stm32f10x_crc.h 2KB
stm32f10x_it.h 2KB
system_stm32f10x.h 2KB
dataPointTools.h 2KB
usart.h 1KB
oled.h 1KB
ringBuffer.h 1KB
gizwits_product.h 1KB
gizwits_product.h 1KB
delay.h 960B
ds18b20.h 609B
timer.h 565B
usart_2.h 472B
RTE_Components.h 315B
HX711.h 206B
BEEP.h 134B
usart2.h 121B
main.hex 113KB
共 121 条
- 1
- 2
资源评论
- m0_749782082024-06-18资源内容总结地很全面,值得借鉴,对我来说很有用,解决了我的燃眉之急。
manylinux
- 粉丝: 4552
- 资源: 2484
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于mosquitto的android mqtt客户端详细文档+全部资料.zip
- 基于mqtt的消息推送系统,单点推送,分组推送详细文档+全部资料.zip
- 基于MQTT的聊天系统演示详细文档+全部资料.zip
- 基于mqtt的遥控器,在app上点击按钮,将码(空调码,电视码,风扇码)发送到mqqt,mqtt通过WiFi发给esp8266,esp8266解析转为红外,发出
- 基于Mqtt实现的简单推送服务的服务端详细文档+全部资料.zip
- 基于mqtt实现的即时通讯IM服务详细文档+全部资料.zip
- 基于mqtt开发sdk源码详细文档+全部资料.zip
- 基于MQTT实现的局域网通讯,模仿微信详细文档+全部资料.zip
- 最简单优雅的SQL操作类库
- 基于MQTT物联网用户终端程序详细文档+全部资料.zip
- 基于MQTT协议,物联网云平台的智慧路灯管理系统,在PC机上进行项目软件的Web开发,采集端的数据采用MQTT.fx进行模拟,数据通过MQTT协议进行传输到服务
- 基于MQTT协议的一个即时通讯安卓APP详细文档+全部资料.zip
- 基于MQTT协议的底层通讯SDK详细文档+全部资料.zip
- 基于MQTT协议的物联网健康监测系统详细文档+全部资料.zip
- 基于netty, spring boot, redis等开源项目实现的物联网框架, 支持tcp, udp底层协议和http, mqtt, modbus等上层协议
- 基于MQTT协议实现消息的即时推送Android开发详细文档+全部资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功