/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
* File Name : stm32f10x_tim.c
* Author : MCD Application Team
* Version : V2.0.3
* Date : 09/22/2008
* Description : This file provides all the TIM firmware functions.
********************************************************************************
* 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.
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_tim.h"
#include "stm32f10x_rcc.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* ---------------------- TIM registers bit mask ------------------------ */
#define CR1_CEN_Set ((u16)0x0001)
#define CR1_CEN_Reset ((u16)0x03FE)
#define CR1_UDIS_Set ((u16)0x0002)
#define CR1_UDIS_Reset ((u16)0x03FD)
#define CR1_URS_Set ((u16)0x0004)
#define CR1_URS_Reset ((u16)0x03FB)
#define CR1_OPM_Reset ((u16)0x03F7)
#define CR1_CounterMode_Mask ((u16)0x038F)
#define CR1_ARPE_Set ((u16)0x0080)
#define CR1_ARPE_Reset ((u16)0x037F)
#define CR1_CKD_Mask ((u16)0x00FF)
#define CR2_CCPC_Set ((u16)0x0001)
#define CR2_CCPC_Reset ((u16)0xFFFE)
#define CR2_CCUS_Set ((u16)0x0004)
#define CR2_CCUS_Reset ((u16)0xFFFB)
#define CR2_CCDS_Set ((u16)0x0008)
#define CR2_CCDS_Reset ((u16)0xFFF7)
#define CR2_MMS_Mask ((u16)0xFF8F)
#define CR2_TI1S_Set ((u16)0x0080)
#define CR2_TI1S_Reset ((u16)0xFF7F)
#define CR2_OIS1_Reset ((u16)0x7EFF)
#define CR2_OIS1N_Reset ((u16)0x7DFF)
#define CR2_OIS2_Reset ((u16)0x7BFF)
#define CR2_OIS2N_Reset ((u16)0x77FF)
#define CR2_OIS3_Reset ((u16)0x6FFF)
#define CR2_OIS3N_Reset ((u16)0x5FFF)
#define CR2_OIS4_Reset ((u16)0x3FFF)
#define SMCR_SMS_Mask ((u16)0xFFF8)
#define SMCR_ETR_Mask ((u16)0x00FF)
#define SMCR_TS_Mask ((u16)0xFF8F)
#define SMCR_MSM_Reset ((u16)0xFF7F)
#define SMCR_ECE_Set ((u16)0x4000)
#define CCMR_CC13S_Mask ((u16)0xFFFC)
#define CCMR_CC24S_Mask ((u16)0xFCFF)
#define CCMR_TI13Direct_Set ((u16)0x0001)
#define CCMR_TI24Direct_Set ((u16)0x0100)
#define CCMR_OC13FE_Reset ((u16)0xFFFB)
#define CCMR_OC24FE_Reset ((u16)0xFBFF)
#define CCMR_OC13PE_Reset ((u16)0xFFF7)
#define CCMR_OC24PE_Reset ((u16)0xF7FF)
#define CCMR_OC13M_Mask ((u16)0xFF8F)
#define CCMR_OC24M_Mask ((u16)0x8FFF)
#define CCMR_OC13CE_Reset ((u16)0xFF7F)
#define CCMR_OC24CE_Reset ((u16)0x7FFF)
#define CCMR_IC13PSC_Mask ((u16)0xFFF3)
#define CCMR_IC24PSC_Mask ((u16)0xF3FF)
#define CCMR_IC13F_Mask ((u16)0xFF0F)
#define CCMR_IC24F_Mask ((u16)0x0FFF)
#define CCMR_Offset ((u16)0x0018)
#define CCER_CCE_Set ((u16)0x0001)
#define CCER_CCNE_Set ((u16)0x0004)
#define CCER_CC1P_Reset ((u16)0xFFFD)
#define CCER_CC2P_Reset ((u16)0xFFDF)
#define CCER_CC3P_Reset ((u16)0xFDFF)
#define CCER_CC4P_Reset ((u16)0xDFFF)
#define CCER_CC1NP_Reset ((u16)0xFFF7)
#define CCER_CC2NP_Reset ((u16)0xFF7F)
#define CCER_CC3NP_Reset ((u16)0xF7FF)
#define CCER_CC1E_Set ((u16)0x0001)
#define CCER_CC1E_Reset ((u16)0xFFFE)
#define CCER_CC1NE_Reset ((u16)0xFFFB)
#define CCER_CC2E_Set ((u16)0x0010)
#define CCER_CC2E_Reset ((u16)0xFFEF)
#define CCER_CC2NE_Reset ((u16)0xFFBF)
#define CCER_CC3E_Set ((u16)0x0100)
#define CCER_CC3E_Reset ((u16)0xFEFF)
#define CCER_CC3NE_Reset ((u16)0xFBFF)
#define CCER_CC4E_Set ((u16)0x1000)
#define CCER_CC4E_Reset ((u16)0xEFFF)
#define BDTR_MOE_Set ((u16)0x8000)
#define BDTR_MOE_Reset ((u16)0x7FFF)
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
static void TI1_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection,
u16 TIM_ICFilter);
static void TI2_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection,
u16 TIM_ICFilter);
static void TI3_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection,
u16 TIM_ICFilter);
static void TI4_Config(TIM_TypeDef* TIMx, u16 TIM_ICPolarity, u16 TIM_ICSelection,
u16 TIM_ICFilter);
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : TIM_DeInit
* Description : Deinitializes the TIMx peripheral registers to their default
* reset values.
* Input : - TIMx: where x can be 1 to 8 to select the TIM peripheral.
* Output : None
* Return : None
*******************************************************************************/
void TIM_DeInit(TIM_TypeDef* TIMx)
{
/* Check the parameters */
assert_param(IS_TIM_ALL_PERIPH(TIMx));
switch (*(u32*)&TIMx)
{
case TIM1_BASE:
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE);
break;
case TIM2_BASE:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, DISABLE);
break;
case TIM3_BASE:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, DISABLE);
break;
case TIM4_BASE:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4, DISABLE);
break;
case TIM5_BASE:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, DISABLE);
break;
case TIM6_BASE:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE);
break;
case TIM7_BASE:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM7, DISABLE);
break;
case TIM8_BASE:
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, DISABLE);
break;
default:
break;
}
}
/*************
没有合适的资源?快使用搜索试试~ 我知道了~
基于STM32的12864点阵液晶程序
共97个文件
h:34个
c:29个
r79:22个
4星 · 超过85%的资源 需积分: 33 77 下载量 32 浏览量
2011-04-15
15:49:18
上传
评论 1
收藏 343KB RAR 举报
温馨提示
用万利得开发板上的12864写的,在他的程序基础上改写的。增加了写字符,字符串,汉字,的子函数,调用简单。
资源推荐
资源详情
资源评论
收起资源包目录
New_Lcd.rar (97个子文件)
library
inc
stm32f10x_adc.h 18KB
stm32f10x_tim.h 46KB
stm32f10x_usart.h 14KB
stm32f10x_dac.h 9KB
stm32f10x_bkp.h 7KB
stm32f10x_dbgmcu.h 3KB
stm32f10x_pwr.h 4KB
stm32f10x_map.h 489KB
stm32f10x_sdio.h 18KB
stm32f10x_wwdg.h 3KB
stm32f10x_rtc.h 4KB
stm32f10x_gpio.h 14KB
stm32f10x_flash.h 14KB
stm32f10x_dma.h 18KB
cortexm3_macro.h 2KB
stm32f10x_rcc.h 14KB
stm32f10x_systick.h 3KB
stm32f10x_iwdg.h 3KB
stm32f10x_fsmc.h 18KB
stm32f10x_lib.h 3KB
stm32f10x_exti.h 6KB
stm32f10x_spi.h 13KB
stm32f10x_crc.h 2KB
stm32f10x_nvic.h 19KB
stm32f10x_i2c.h 15KB
stm32f10x_can.h 12KB
stm32f10x_type.h 3KB
src
stm32f10x_sdio.c 38KB
stm32f10x_adc.c 57KB
stm32f10x_bkp.c 11KB
stm32f10x_usart.c 43KB
stm32f10x_pwr.c 11KB
stm32f10x_flash.c 32KB
stm32f10x_lib.c 9KB
stm32f10x_nvic.c 28KB
stm32f10x_dbgmcu.c 5KB
stm32f10x_wwdg.c 7KB
stm32f10x_gpio.c 22KB
stm32f10x_crc.c 5KB
stm32f10x_rtc.c 12KB
stm32f10x_dac.c 17KB
stm32f10x_spi.c 34KB
stm32f10x_can.c 31KB
stm32f10x_systick.c 7KB
stm32f10x_iwdg.c 6KB
stm32f10x_dma.c 33KB
stm32f10x_tim.c 128KB
stm32f10x_i2c.c 47KB
stm32f10x_rcc.c 43KB
stm32f10x_exti.c 9KB
stm32f10x_fsmc.c 40KB
project
settings
Lcd.wsdt 4KB
Lcd.cspy.bat 2KB
Lcd.dni 552B
Lcd.dbgdt 5KB
compile
lnkarm_flash.xcl 7KB
lnkarm_ram.xcl 7KB
stm32f10x_vector.c 3KB
cortexm3_macro.s 9KB
Lcd.ewd 31KB
inc
fsmc_sram.h 2KB
8x16.h 44KB
8x8.h 45KB
16x16.h 3KB
lcd.h 5KB
stm32f10x_conf.h 6KB
stm32f10x_it.h 3KB
Lcd.ewp 46KB
Lcd.dep 25KB
Debug
Obj
stm32f10x_gpio.r79 13KB
stm32f10x_dma.r79 10KB
stm32f10x_flash.r79 3KB
stm32f10x_fsmc.r79 18KB
stm32f10x_systick.r79 5KB
stm32f10x_can.r79 21KB
stm32f10x_it.r79 11KB
Lcd.pbd 841B
stm32f10x_iwdg.r79 4KB
main.r79 12KB
stm32f10x_i2c.r79 20KB
stm32f10x_wwdg.r79 5KB
stm32f10x_bkp.r79 10KB
stm32f10x_lib.r79 16KB
stm32f10x_rcc.r79 18KB
Lcd.r79 40KB
stm32f10x_pwr.r79 7KB
stm32f10x_exti.r79 6KB
stm32f10x_tim.r79 50KB
stm32f10x_spi.r79 17KB
stm32f10x_usart.r79 19KB
stm32f10x_nvic.r79 17KB
stm32f10x_adc.r79 22KB
List
Exe
src
stm32f10x_it.c 22KB
main.c 5KB
fsmc_sram.c 7KB
Lcd.c 42KB
Lcd.eww 265B
共 97 条
- 1
资源评论
- jcyhcs2013-10-19还行,获得了点知识
- Bohua032014-04-10学习学习,还是可以的。是我想要看的驱动!
- 乘帆关雪2014-03-26对我来说没有太大的用处,从他的初始化LCD代码来开很可能是ST7920的IC我用的是ST7567差别太大,不过代码很完整,相信对同型号的LCD有很大的借鉴作用
- scinan_eric2013-09-27一般般,不过还是对我有点用
- 落天宇2015-03-24代码很完整,相信对同型号的LCD有很大的借鉴作用
zj345692429
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功