摘要: 1. YUV比例 分三种:YUV44,YUV422,YUV420 2. YUV排布 分三种:YUV planar,YUV Semi-Plannar,YUV packed 以YUV422 8*4 为例 ① 平面格式,3个plane: Y0 Y1 Y2 Y3 U0 U1 V0 V1 ② Semi-Pla 阅读全文
posted @ 2024-05-11 15:39 moonのsun 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1. 背景需求 python需要与外界或终端交互时,常常需要使用while循环一直跑。 如果需要终止程序,一般使用Ctrl+c,此时终端会打印一大堆backtrace,并且无法保留当前运行的状态,非常不优雅。 使用KeyboardInterrupt异常捕捉,可以实现优雅的终止while循环。 2. 阅读全文
posted @ 2024-04-16 22:32 moonのsun 阅读(18) 评论(0) 推荐(0) 编辑
摘要: windows/linux 安装openpyxl pip install openpyxl 查找某Excel中是否存在某字符串text # 输入: # file_path: Excel文件名 # search_text: 要查找的字符串 # 输出: # 查到: [sheetname, cell.ro 阅读全文
posted @ 2024-04-11 20:16 moonのsun 阅读(5) 评论(0) 推荐(0) 编辑
摘要: I2C读出来的内容的地址,比datasheet给出的小9? add- 0x0 = 0x0add- 0x1 = 0x76add- 0x2 = 0x73add- 0x3 = 0x4add- 0x4 = 0x0add- 0x5 = 0x61add- 0x6 = 0x4badd- 0x7 = 0x0add- 阅读全文
posted @ 2024-01-20 16:09 moonのsun 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 好用工具(bin) fzf cd ~/.bin git clone --depth 1 https://github.com/junegunn/fzf.git ./install rg fd vim插件 #/bin/bash # 前提: # 安装nvim # 使用pathogen.vim插件管理工具 阅读全文
posted @ 2024-01-20 16:05 moonのsun 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1. install neovim 1 sudo apt install neovim After installing neovim, we can delete old vi. 3. install # if use nvim, the nvim directory must be ~/.con 阅读全文
posted @ 2024-01-20 16:04 moonのsun 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 1. 现有设备 surface,树莓派3B 简介 优点 缺点 树莓派+鼠标键盘显示屏 开发方便 需要购买小/静音键盘 需要购买显示屏 显示屏小了用着不舒服,大了太贵 树莓派不需要显示屏!将来还要刷机不带桌面的核心系统 surface+usb转串口 只需要购买usb转串口线,成本低 速度慢 我按照网上 阅读全文
posted @ 2024-01-20 14:37 moonのsun 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1. 定义 这是个老生常谈的问题,定义大家都懂: 大端模式:数据低位存放在内存高位 小端模式:数据高位存放在内存高位 比如一个十进制数字:12345678 数据低位就是数据的右边,数据高位就是数据的左边; 地址低位就是地址的左边,地址高位就是地址的右边。 假如一页纸表示内存的话,大端模式刚好符合我们 阅读全文
posted @ 2023-03-31 14:44 moonのsun 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 1. I2C基本规则 ① start:scl = high,sda ↑ ② stop:scl = high,sda↓ ③ bit 1:scl = high,sda = 1 ④ bit 0:scl = high,sda = 0 总之:scl为高,sda才有效,可以保持电平或者上升下降;scl为低,sd 阅读全文
posted @ 2022-11-19 12:04 moonのsun 阅读(277) 评论(0) 推荐(0) 编辑
摘要: PICO 避坑指南 1. Win10 不需要串口驱动,使用PICO W之前先刷固件pico w的固件 micropython-firmware-pico-w-290622.rar 刚开始 刷的固件不对,一直无法识别串口。 2. 使用Mirco USB数据线(更粗),不要使用电源线 这种线目前比较少用,我随手找了一根,一 阅读全文
posted @ 2022-10-14 20:15 moonのsun 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 1. UTC、GMT、墙上时间 Coordinated Universal Time(UTC) Greenwich Mean Time(GMT) 两者都表示标准时间,或世界时,几乎没有差异,后者更加精确 墙上时间也就是本地时间,说出墙上时间的时候,需要告知时区信息,这样才有意义。 2. typede 阅读全文
posted @ 2022-05-10 15:52 moonのsun 阅读(245) 评论(0) 推荐(0) 编辑
摘要: DIR结构体: struct __dirstream{ void *__fd; char *__data; int __entry_data; char *__ptr; int __entry_ptr; size_t __allocation; size_t __size; __libc_lock_ 阅读全文
posted @ 2022-04-21 18:26 moonのsun 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 代码: #include <stdio.h>void main(int argc, char* argv[]) { printf("argc: %d\n", argc); int i; for (i = 0; i < argc; i++) { printf("argv[%d]: %s", i, ar 阅读全文
posted @ 2022-04-21 10:42 moonのsun 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 今天查询协程的使用方法,找到一些不明觉厉的文章,以后对协程有了深入了解之后再多读几次: 1. https://zhuanlan.zhihu.com/p/146844906 《说说对协程的看法》 2. https://zhuanlan.zhihu.com/p/147608872 《也来谈谈协程》 3. 阅读全文
posted @ 2022-04-12 21:43 moonのsun 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 1. 公式 2. 大光圈小景深 2. 长焦距小景深 3. 概述 景深和光圈的关系,可以通过图示很容易理解; 景深和焦距的关系,我认为无法用文字直接解释;即使使用图示解释,也只是给出示意图,无法严谨的证明! 比如2中左下角两个图,焦距增大前后景深都增大,两者的弥散圆如何变化只能通过计算结果得知,图示只 阅读全文
posted @ 2022-03-23 16:17 moonのsun 阅读(561) 评论(0) 推荐(0) 编辑
摘要: 条件变量 1. 条件变量初始化 1 // 方法1 2 pthread_cond_t cv = PTHREAD_COND_INITIALIZER; 3 4 5 // 方法2 6 pthread_cond_t cv; 7 pthread_condattr_t cattr; 8 int ret; 9 10 阅读全文
posted @ 2022-02-15 19:18 moonのsun 阅读(27) 评论(0) 推荐(0) 编辑
摘要: https://docs.oracle.com/cd/E19253-01/819-7051/index.html 1. Lightweight process(轻量进程) 用来执行内核代码和系统调用的内核线程,又称作 LWP。 一般来说内核只有进程,为了提高效率搞了一个轻量级进程,只用于内核调度。轻 阅读全文
posted @ 2022-02-09 10:31 moonのsun 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 1. 问题描述 vim安装了interastingwords插件,在mobaxterm中的session可以正常显示多彩关键字,但是使用tmux登录session,只能显示两个颜色 2. 解决办法 这是因为tmux默认TERM没有用256color,那么每次运行tmux时指定color即可,TERM 阅读全文
posted @ 2022-01-20 21:20 moonのsun 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 1.创建多进程 一般的步骤是这样的: #include <unistd.h> //C 和 C++ 程序设计语言中提供对POSIX 操作系统API 的访问功能的标头档的名称。是Unix Standard的缩写。 pid_t fpid; //fork函数返回值 fpid = fork(); //fork 阅读全文
posted @ 2021-09-23 10:35 moonのsun 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1.创建线程 pthread_cread(pthread_t tid, attr, (void*) pFun(void*), (void*)arg) 在新线程tid内执行指定函数pFun,参数为arg,原有线程继续往下执行; 2.结束线程 pthread_exit((void*) retValue) 阅读全文
posted @ 2021-09-23 10:33 moonのsun 阅读(35) 评论(0) 推荐(0) 编辑