- 博客(48)
- 资源 (1)
- 收藏
- 关注
原创 andriod.bp中 添加宏控编译
1.aosp/build/make/core/soong_config.mk+$(call add_json_bool, Cus_nfc_config, $(filter true,$(CUS_NFC_CONFIG))2.aosp/build/soong/android/variable.go在Product_variables struct下添加自己的宏控变量+Cus_nfc_config struct { Cfla
2022-04-18 16:45:18
3432
原创 【shell】shell脚本更改文件中的值 然后编译n次。
#!/bin/bashval=0echo 'start'while((val<5))dolet name=val+1sed -i "s/=$val/=$name/g" file.c #在这个文本中把val替换为name变量的值echo "name" = $nameecho "val" = $val#add 在这里增加编译命令let val++ # let val+=1 在进行加减的时候要用let,+ -不能有空格cp test.txt ./text.$name.txtech
2022-02-13 15:46:32
554
原创 c语言 实现 接口 demo
interface.h#ifndef INTERFICE_H#define INTERFICE_Htypedef struct{ int age; int (*eat)(int); void (*play)(char *);}com,*p_com;p_com getPointInit(){ return (p_com)malloc(sizeof(com));}int eat(int a){ return printf("eat %d\n",a);
2022-01-09 14:34:42
1118
原创 初识c++ 泛型 函数模板
#include<iostream>using namespace std;template<typename T>//声明一个模板告诉编译器后面紧更的代码 T 是一种 通用的数据类型。不要报错 void test(T &a,T &b){ int temp; temp =a; a=b; b=temp; }int main(void){ int a=1,b=2; //1.自动类型推导 test(a,b); cout<<"a=
2021-09-20 22:58:33
133
原创 c++ 初识多态(一)
polymorphism.cpp#include <iostream>using namespace std;/**多态:1.有继承关系 2.子类重写父类的虚函数**父类的指针 或者 引用 指向子类对象**/class animal{public: virtual void speak()//底层用的函数指针实现虚函数 运行时指向子类的方法 { cout<<"animal is speaking"<<endl; }};class cat
2021-09-04 22:07:31
161
原创 Makefile中用宏定义进行条件编译(gcc -D)
一共3个文件:Makefile 、macro_test.c、test.mkMakefileinclude ./test.mk #读取当前目录下test.mk里的宏控CC = gccRM = rm#判断读到的宏值=y?ifeq ($(one),y)CFLAGS += -D one #-D选项就是在编译时增加对-D后面的宏的定义 相当于 gcc -D oneendifTARGETS := macro#all:$(TARGETS)$(TARGETS):macro_test.c gc
2021-08-30 14:01:14
554
原创 初识 c++ 构造函数 拷贝函数 析构函数
#include<iostream>#include<string>using namespace std;class Student{ public: Student()//类实例化时使用 { cout<<"无参构造函数调用"<<endl; } Student(string name,int id,int sex) { cout<<"有参构造函数调用"<<endl; this->n
2021-08-22 10:32:36
145
原创 Makefile使用笔记
Makefilesrc=$(wildcard ./*.c *.c)#获取当前目录下所有.c文件dir=$(notdir $(src))#清除.c文件的路径obj=$(patsubst %.c,%.o,$(dir) )#把dir目录下的*.c 换成*.oall: @echo $(src) @echo $(dir) @echo $(obj) @echo "end" ifeq ("abcd","abcd")#ifeq<空格>("abcd","abcd") 空格划重点 否则报错 @
2021-08-20 09:56:26
190
原创 Linux 内核等待队列使用
lcx_wait_queue.c#include<linux/module.h>//所有模块都要使用头文件module.h,此文件必须包含进来#include<linux/kernel.h>//头文件kernel.h包含了常用的内核函数。#include<linux/init.h>//头文件init.h包含了宏_init和_exit,它们允许释放内核占用的内存#include<linux/of.h>#include<linux/platform
2021-08-13 15:38:13
314
原创 工作队列work_struct 两种使用方法
lcx_work_struct.c注:使用了设备树进行驱动匹配,测试前在设备树添加节点才可以测试ok。#include<linux/module.h>//所有模块都要使用头文件module.h,此文件必须包含进来#include<linux/kernel.h>//头文件kernel.h包含了常用的内核函数。#include<linux/init.h>//头文件init.h包含了宏_init和_exit,它们允许释放内核占用的内存#include<linux
2021-08-13 10:24:22
781
原创 input输入子系统(一)
app.c#include<stdio.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>#include<unistd.h>#include<linux/input.h>/*struct input_event { struct timeval time; __u16 type;//事件类型 __u16 code;//编码 __s32 v
2021-07-25 20:31:06
193
原创 平台总线模型(二)
platform_driver.c#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>#include<linux/platform_device.h>#include<linux/miscdevice.h>#include<linux/fs.h>struct resource *Platform_device_resource;st
2021-07-17 22:04:55
102
原创 平台总线模型(一)
platform_device.c#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>#include<linux/platform_device.h>struct resource platform_device_resource[]={ [0]= { .start=0x00100,//内存起始地址 .end=0x00104,//内存结束地址 .fla
2021-07-17 22:03:32
123
原创 platform_driver注册并与设备匹配
platform_driver.c#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>#include<linux/platform_device.h>int Platform_driver_probe(struct platform_device *Device){ printk("Platform_driver_probe enter\n"); retu
2021-07-11 15:35:11
261
原创 platform_device注册
platform_device.c#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>#include<linux/platform_device.h>struct resource platform_device_resource[]={ [0]= { .start=0x00100,//内存起始地址 .end=0x00104,//内存结束地址 .fla
2021-07-11 15:09:52
335
原创 理解c语言fork()函数
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/types.h>#include<sys/wait.h>int main(void){ int i; pid_t pid; pid=fork();//从这里开始代码一分为2 2个进程 pid 返回值为2个 子进程返回值=0 父进程返回值=子进程号 printf("pid=%d\n",pid)
2021-07-09 15:00:57
256
原创 字符设备创建(二)
文件名 Chardev_register_node.c#include<linux/kernel.h>#include<linux/module.h>#include<linux/init.h>#include<linux/fs.h>#include<linux/kdev_t.h>#include<linux/cdev.h>// #define MAJOR_NUM 20// #define MINOR_NUM 1sta
2021-07-04 21:59:12
133
原创 字符设备注册(一)
**Chardev.c**#include<linux/kernel.h>#include<linux/module.h>#include<linux/init.h>#include<linux/fs.h>#include<linux/kdev_t.h>// #define MAJOR_NUM 20// #define MINOR_NUM 1static int MAJOR_NUM;//主设备号static int MINOR
2021-07-03 22:25:43
125
原创 驱动模块传参(array&&variable)
文件名:module_param.c#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>static int a;static int b[5];static int count;//传参数module_param(a,int,0555);//module_param(name,type,perm) module_param(变量名,变量类型,权限)//传数组mod
2021-07-03 00:07:01
139
原创 杂项设备&&文件操作集
file_operationgs.c#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>#include<linux/fs.h>//文件操作集头文件#include<linux/miscdevice.h>//杂项设备头文件#include<linux/uaccess.h>//数据发送接受头文件int misc_open(struct i
2021-06-27 15:46:50
161
原创 第一个杂项设备驱动
#include<linux/init.h>#include<linux/module.h>#include<linux/kernel.h>#include<linux/fs.h>#include<linux/miscdevice.h>struct file_operations misc_fops ={ .owner=THIS_MODULE};struct miscdevice misc_dev={ .minor=MISC_DY
2021-06-26 23:08:41
114
原创 认识一下杂项设备
cat /proc/misc 可以查看到杂项设备杂项设备特点:自动生成节点杂项设备是特殊的一种字符设备、比字符设备代码简单。主设备号为10、次设备号不同。ps主设备号给设备分类、次设备号区分具体设备杂项设备结构体描述 include/linux/miscdevice.hstruct miscdevice { int minor;//次设备号 const char *name;//设备节点名字 ls /dev 可以查看到 const struct file_operations *
2021-06-26 21:29:31
364
原创 自用 bash配置
# ~/.bashrc: executed by bash(1) for non-login shells.# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)# for examples# If not running interactively, don't do anything[ -z "$PS1" ] && return# don't put duplicate lines
2021-06-22 19:23:31
255
原创 ubuntu下第一个内核模块
1.文件准备新建hello.c Makefile在同级目录下2.hello.c#include<linux/module.h>//所有模块都要使用头文件module.h,此文件必须包含进来#include<linux/kernel.h>//头文件kernel.h包含了常用的内核函数。#include<linux/init.h>//头文件init.h包含了宏_init和_exit,它们允许释放内核占用的内存。static int __init Hello(vo
2021-06-12 16:54:34
281
原创 c语言 关于const 修饰符笔记
#if 0//const把变量限定为只读int const p //常量p 可以通过指针间接修改 int const *p //常量指针 可以修改变量的值 *p不能够修改 const int *p //常量指针 可以修改变量的值 *p不能够修改int *const p //指针常量 可以修改指针的指向 p不能被修改 const int *const p //指针指向和*p都不能被修改 ...
2021-05-05 13:47:56
74
原创 c语言 字符数组存放字符串&&指针存放字符串
#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char a[]="hello";//字符数组 strcpy(a,"world"); // a="world"; a是数组首地址 是一个常量 不能够被赋值 printf("%s\n",a); char *p="hello2";// strcpy(p,"world"); p存放的是字符串常量的地址 字符串常量不可
2021-05-05 12:56:10
2381
原创 c语言 指针的初步理解
#include<stdio.h>#include<stdlib.h>int main(){ int i=1; int *p=&i; int **q=&p;//p指针指向i的地址 p指针的地址用二级指针**q存放 printf("i=%d\n",i); printf("&i=%p\n",&i);//i的地址 printf("p=%p\n",p);//i的地址 printf("&p=%p\n",&p);
2021-05-04 22:43:50
116
原创 c语言 单词个数统计
#include<stdio.h>#include<stdlib.h>int main(){ char a[]="aead cv v d ";//tab键无法识别 int count=0,flag=0; for(int i=0;a[i]!='\0';i++) { if(a[i]==' ') flag=0; else if(flag==0) { count++; flag=1; }
2021-05-04 19:46:07
189
原创 c语言strlen strcpy strncpy strcat strncat strcmp
#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char a[]="hello111"; char b[]="hello2"; char *c; printf("%d\n",strlen(a));//求字符串长度 不带'\0' c=strcpy(a,b);//返回值为 char * 把b中的字符串覆盖到a中 printf("%s\n",c); c=strnc
2021-05-04 19:09:49
185
1
原创 c语言二元数组a[0] a[0][0]的区别
#include <stdio.h>#include <stdlib.h> int main(){ int a[2][3]={{1,2,3},{4,5,6}}; printf("%d\n",sizeof(a)/sizeof(a[0][0]));//sizeof(a[0][0])代表单个元素的大小 求得多少个元素 printf("%d\n",sizeof(a)/sizeof(a[0]));//sizeof(a[0])代表的行地址大小 求得多少行 }...
2021-05-04 10:08:45
852
原创 c语言 二维数组学习(行列翻转、求二元数组中最大项 并记录对应下标、各行各列分别求和)
#include<stdio.h>#include<stdlib.h>#define M 2 #define N 3void change(){ int a[M][N]={1,2,3,4,5,6};//M 代表行 N代表列 int b[N][M]; for ( int i=0;i<M;i++) { for(int j=0;j<N;j++) { printf("%d",a[i][j]); b[j][i]=a[i][j]; }
2021-05-04 09:58:32
557
原创 c语言 冒泡排序
#include<stdio.h>#include<stdlib.h>void Sort(){ int a[8]={7,4,0,9,2,1,4,3}; for(int i=0;i<sizeof(a)/sizeof(a[0])-1;i++) for(int j=0;j<sizeof(a)/sizeof(a[0])-i-1;j++) { int temp; if(a[j+1]<a[j]) { temp=a[
2021-05-04 09:54:47
92
原创 c语言 printf 输出格式控制 %#x 带0x 16进制的输出
#include<stdio.h>#include<stdlib.h>int main(void){#if 0printf("这里是注释");#endif int a; a=13; printf("a=%#x",a);//输出:0x0d exit (0);}
2021-05-04 09:48:36
4720
原创 网站底部运行时间统计
<!-- 网站运行计时统计 start--><center><span id="momk"></span><span id="momk" style="color: #ff0000;"></span><script type="text/javascript"> function NewDate(str) { str = str.split('-'); var date = ne
2021-04-13 17:34:58
598
翻译 微信开发者工具提示 “当前系统代理不是安全代理,是否信任?”
微信开发者工具提示 “当前系统代理不是安全代理,是否信任?”导致开发者工具登陆不上 提示证书错误。解决办法:1. 网上下载fiddler ,安装打开fiddler2. 选择tools>option>connection3.设置好本地代理端口号88884.微信开发者工具中代理设置 修改手动设置代理5.重启微信开发者工具 就搞定了。...
2021-01-09 18:40:37
1792
翻译 米拓MetInfo 7.0去底部版权信息Power by方法
声明:以下方法仅供学习参考,提供一种解决问题的思路。请大家尊重知识产权,购买正版。使用米拓建站去除版权修改目录下app/system/include/class/view/compile.class.php 这个文件搜索config']['met_copyright_type这个字段修改$_M['']中的内容即可...
2021-01-08 16:27:10
1615
原创 通过.htaccess设置重定向实现强制https访问
最近在做seo优化,做网站过程中遇到网站重定向问题(重定向有利于seo优化)网站根目录创建.htaccess文件(这个文件类型是隐藏类型的)只需要将下列代码任选其一,放到 .htaccess 文件中即可,如果 .htaccess 文件中已经有内容,请将重定向代码放在最前面。**代码 1(需要修改代码中的 domain.com 为你自己的域名,我用的代码1):RewriteEngine OnRewriteCond %{SERVER_PORT} 80RewriteRule ^(.*)$
2021-01-07 10:51:07
765
转载 ZigBee Zstack之RSSI信号值获取以及显示
在zigbee设备建立了连接之后,我们一般在应用中都还是很关心它们之间的通讯信号强度的。获取以Zstack为基础的zigbee通信设备的信号强度一般来说有两种方式:第一种是通过访问CC2530底层的信号状态寄存器,然后对其中数值进行计算,其中还需要参考电压值和温度,这种方法比较麻烦。第二种就是直接读取zigbee设备的AF消息结构体中的RSSI数值即可。在这里,我根据自己的实验和网上搜集的资料...
2019-06-19 14:55:21
3423
notepad++ 插件 AndroidLogger 64位版本 官网下载的32位安装不了
2023-02-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人