11 2022 档案
摘要:产生一个2K 占空比50%的pwm波形 // PWM输出 PB1 void PwmPhyConfig() { //此部分需手动修改 IO 口设置 RCC->APB1ENR |= 1<<1; //TIM3 时钟使能 RCC->AHB1ENR |= 1<<1; //使能 PORTB 时钟 GPIOB->
阅读全文
摘要://头文件 #include <QTimer> public: QTimer *timer0 = new QTimer(this); private slots: void Timer0CallBack(void); //源文件 timer0->start(1000); connect(timer0
阅读全文
摘要:#include <QDateTime> // 获取当前日期和时间 QString MyQtInterFace::GetCurTimeDate() { QString datetime = QDateTime::currentDateTime().toString("yyyy-MM-dd dddd
阅读全文
摘要:#include "BspPhy.h" //**************************************************************** //****** 串口GPIO初始化函数 //****** 输入参数: 无 //****** 返回值: 无 //*******
阅读全文
摘要:#include "BspPhy.h" uint8_t TimerFlag; //**************************************************************** //****** 定时器6初始化函数 //****** 输入参数: 无 //******
阅读全文
摘要:#include "BspPhy.h" static uint32_t fac_us; static uint32_t fac_ms; void PhyDelayInit() { SysTick->CTRL |= SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV; fac_us =
阅读全文
摘要://**************************************************************** //****** 连接LED指示灯 GPIO初始化函数 PA4 //****** 输入参数: 无 //****** 返回值: 无 //****************
阅读全文
摘要:QPushButton *but = new QPushButton(this); //创建按钮对象 but->resize(100,30); //设置大小 but->move(200,200); //移动位置 but->setText("按钮"); //设置显示字符 //1.设置显示字符大小,2.
阅读全文
摘要://源文件 //使能CPU的L1-Cache void Cache_Enable(void) { SCB_EnableICache(); // 使能I-Cache SCB_EnableDCache(); // 使能D-Cache SCB->CACR|=1<<2; // 强制D-Cache透写,如不开
阅读全文
摘要://源文件 void DACPhyConfig() { RCC->APB1ENR |= 1<<29; //使能 DAC 时钟 RCC->AHB1ENR |= 1<<0; //使能 PORTA 时钟 //PA4 输入模式、下拉、高速 GPIOA->MODER |= (3<<4*2); //输入模式 G
阅读全文
摘要://源文件 void ADCPhyConfig() { RCC->APB2ENR |=1 <<8; //使能 ADC1 时钟 RCC->AHB1ENR |=1 <<0; //使能 PORTA 时钟 //PA5 输入模式、下拉、高速 GPIOA->MODER |= (3<<5*2); //输入模式 G
阅读全文
摘要://源文件 void UartGpioConfig() { RCC->AHB1ENR |= (1<<3); //使能GPIOD RCC->APB1ENR |= (1<<18); //使能USART3 RCC->APB2ENR |= //PD8 TXD GPIOD->MODER |= (2<<16);
阅读全文
摘要://源文件 void TimerPhyConfig() { RCC->APB1ENR |= (1<<1); //使能Timer3 TIM3->ARR = arr; TIM3->PSC = psc; TIM3->DIER = (1<<0); //Update interrupt enabled TIM
阅读全文
摘要://源文件 void RccPhyConfig() { uint16_t retry = 0; RCC->APB1ENR|=1<<28; //电源接口时钟使能 PWR->CR1|=3<<14; //高性能模式,时钟可到 180Mhz PWR->CR1|=1<<16; //使能过驱动,频率可到 216
阅读全文
摘要://源文件 static uint32_t fac_us = 0; // us延时倍乘数 /** * @brief 初始化延迟函数 * 当使用ucos的时候,此函数会初始化ucos的时钟节拍 * SYSTICK的时钟固定为AHB时钟的1/8 * @param SYSCLK 系统时钟频率 */ voi
阅读全文
摘要://源文件 void LedPhyConfig() { RCC->AHB1ENR |= (1<<1); //使能GPIOB //LD1 GPIOB->MODER |= (1<<0*2); //输出模式 GPIOB->OTYPER &= ~(1<<0); //推挽 GPIOB->OSPEEDR |=
阅读全文