摘要: 1.+重载 class Time { private: int num; public: Time operator+(const Time & t) const; }; Time Time::operator+(const Time & t) const { Time sum; sum.num = 阅读全文
posted @ 2019-08-03 16:12 penuel 阅读(151) 评论(0) 推荐(0)
摘要: 1函数模板可以允许以泛型的方式编写程序 template <typename name> 或 template <class name> void swap( name & a, name & b) { name temp; temp = a; a = b; b = temp; } 2.这种写法有一 阅读全文
posted @ 2019-08-02 18:06 penuel 阅读(144) 评论(0) 推荐(0)
摘要: static void MX_USART1_UART_Init(void) { /* USER CODE BEGIN USART1_Init 0 */ /* USER CODE END USART1_Init 0 */ /* USER CODE BEGIN USART1_Init 1 */ /* USER CODE END USART1_Init 1 */ huart... 阅读全文
posted @ 2019-08-02 14:04 penuel 阅读(1372) 评论(0) 推荐(0)
摘要: 1.使用的TIM1,配置如下: 2.代码: 阅读全文
posted @ 2019-08-02 13:42 penuel 阅读(1617) 评论(0) 推荐(0)
摘要: 一、实验 1.光电反射理论是经过码盘的window时,电压变低,经过bar时,电压为高,这样可以通过检测到的脉冲数,来进行速度的获取。但是实际并不是这样, 反馈回来的信号是周期性的,经过试验发现,可以通过周期的时间间隔来进行速度的转换,周期越短,速度越快。 下图是逻辑分析仪采集到的波形: 码盘为25 阅读全文
posted @ 2019-07-31 18:25 penuel 阅读(368) 评论(0) 推荐(0)
摘要: 1.引用变量是已定义变量的别名,这点是与指针本质的区别 int rats; int & rodents = rats; 两者指向相同的值和内存单元 2.声明引用时必须进行初始化 int rat; int & rodents; rodents = rats; 这种是不被允许的 3.引用非常适合用于结构 阅读全文
posted @ 2019-07-30 11:15 penuel 阅读(713) 评论(0) 推荐(0)
摘要: cmake_minimum_required(VERSION 2.8.3) PROJECT (HELLO) #工程名 set(CMAKE_BUILD_TYPE "Debug")set(CMAKE_BUILD_TYPE "RelWithDebInfo") SET( MAIN_LIST main.cpp 阅读全文
posted @ 2019-07-29 18:19 penuel 阅读(2098) 评论(0) 推荐(0)
摘要: 1.拼接字符串 2.对比字符串 3.字符串转整型 4.整型转字符串 5.取出指定的数据: 6.利用空闲中断接收不固定长度的数据 阅读全文
posted @ 2019-07-29 18:09 penuel 阅读(405) 评论(0) 推荐(0)
摘要: IAR: __no_init uint8_t _downflag @0x2001FF00; 阅读全文
posted @ 2019-07-29 17:41 penuel 阅读(274) 评论(0) 推荐(0)
摘要: static void ADC_Init(void) { /********************DMA配置**************************/ DMA2_Stream0->PAR=(uint32_t)&(ADC->CDR); //DMA外设地址 多重ADC->CDR DMA2_Stream0->M0AR=(uint32_t)_A... 阅读全文
posted @ 2019-07-29 17:32 penuel 阅读(1607) 评论(1) 推荐(1)