基于notepad++的sensor寄存器序列文本处理方法(以后会随时更新补充)
1.文本预处理
1.1第一种(去掉首位i2c地址)
6c 3506 f8
6c 350d 00
6c 350e b2
6c 350f 40
6c 3546 f8
6c 354d 00
6c 354e b2
6c 354f 40
6c 3586 f8
6c 358d 00
6c 358e b2
6c 358f 40
6c 3609 80
变为
3506 f8
350d 00
350e b2
350f 40
3546 f8
354d 00
354e b2
354f 40
3586 f8
358d 00
358e b2
358f 40
3609 80
查找:^([0-9a-fA-F]+)\s+(.*)$
替换:\2
有时厂家会在后面加个分号补充说明,如果删掉分号后面的东西则用下面方法:
\s*[;;].*$
2.输出格式处理
2.1XML文件
使用下面命令可以将之前处理的文本内容按照xml进行输出排版,然后赋值导入我们写的xml文件
查找:^(\S+)\s+(\S+).*$
替换: <regSetting>\r\n <registerAddr>0x$1</registerAddr>\r\n <registerData>0x$2</registerData>\r\n <regAddrType range=“[1,4]”>2</regAddrType>\r\n <regDataType range=“[1,4]”>1</regDataType>\r\n <operation>WRITE</operation>\r\n <delayUs>0x00</delayUs>\r\n </regSetting>
排版问题可以用xml tools插件解决