摘要: 1、当一个变量可能会被意想不到的更新时,要使用volatile来声明该变量,告诉编译器它所修饰的变量的值可能会在任何时刻被意外的更新。 2、语法 volatile int foo; int volatile foo; volatile int * foo; int volatile * foo; i 阅读全文
posted @ 2019-11-19 00:25 千小塔 阅读(438) 评论(0) 推荐(0) 编辑
摘要: 1、串行外围接口 高速、全双工的同步通信总线 一主多从 一般速度几十MHZ,最高可以工作在上百MHZ 2、连接图 3、工作模式 阅读全文
posted @ 2019-11-17 15:52 千小塔 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 1、模式 标准模式:达到100Kb/S 快速模式:达到400Kb/S 2、连接图 3、协议 SDA、SCL在空闲的时候为高电平 重点!重点!重点! 4、涉及到多主机仲裁的竞争及时钟信号的同步 阅读全文
posted @ 2019-11-17 10:13 千小塔 阅读(185) 评论(0) 推荐(0) 编辑
摘要: atoi函数 功能:字符串转化为整型数 1 #include <iostream> 2 3 using namespace std; 4 int atoi_my(const char *str) 5 { 6 int s = 0; 7 bool flag = false; 8 while(*str = 阅读全文
posted @ 2019-11-03 20:44 千小塔 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 写一个函数找出一个整数数组中,第二大的数 1 #include <stdio.h> 2 3 int max(int a, int b) 4 { 5 return a>b?a:b; 6 } 7 8 int min(int a, int b) 9 { 10 return a<b?a:b; 11 } 12 阅读全文
posted @ 2019-11-03 00:01 千小塔 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1、指向对象的指针 类名 *对象指针名 Time *pt; Time t1; pt = &t1; 2、指向对象成员的指针 a、指向对象数据成员的指针 Time t1; int *p1; p1 = &t1.hour; b、指向对象成员函数的指针 数据类型名(类名::*指针变量名)(参数表列) 指针变量 阅读全文
posted @ 2019-09-03 15:23 千小塔 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1、构造函数 a、C++中与类名相同的成员函数叫构造函数 b、定义时可以有参数 c、没有任何返回类型的声明(void也没有) d、自动调用和手动调用 2、析构函数 a、清理对象的特殊成员函数,语法:~ClassName() b、没有参数,没有任何类型的返回类型的声明 c、对象被销毁时自动被调用 3、 阅读全文
posted @ 2019-09-02 17:51 千小塔 阅读(227) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; struct Teacher{ char name[64]; int age; }; //在被调用函数 获取资源int getTeacher(Teacher **p){ if (p == NULL) { return 阅读全文
posted @ 2019-08-30 11:48 千小塔 阅读(342) 评论(0) 推荐(0) 编辑
摘要: Ubuntu 18.04安装arm-linux-gcc交叉编译器 阅读全文
posted @ 2019-08-01 15:39 千小塔 阅读(579) 评论(0) 推荐(0) 编辑
摘要: 1、文件IO的四个函数 一些术语: 不带缓冲的I/O: 每个read和write都调用内核中的一个系统调用。 文件描述符: 一个非负整数,对内核而言,所以打开的文件都通过文件描述符引用。 ①打开或创建一个文件 open(char *path, flag, mode) 在fcntl.h文件中声明 in 阅读全文
posted @ 2019-07-05 15:21 千小塔 阅读(230) 评论(0) 推荐(0) 编辑