Ubuntu&Fedora装机&Mac装机(UOS装机将会持续更新)

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#406

帖子 243750496 » 2017-09-19 20:30

下面是mac下的软件:
http://pan.baidu.com/s/1o6zOEpW 百度云系统录像地址
QQ:
http://im.qq.com/macqq/index.shtml
QQ输入法:
http://shurufa.qq.com/mac/
QQ音乐:
http://y.qq.com/y/static/down/mac.html? ... .y.topmenu
迅雷:
http://mac.xunlei.com/
阿里旺旺:
http://page.1688.com/html/wangwang/download/mac.html
搜狗输入法:
http://pinyin.sogou.com/mac/
PPS:
http://dl.pps.tv/pps_mac_download.html
影音播放器:
MPlayerX(需到官网下载Mavericks下从苹果商店下载的运行时会僵死): Moviest(要付费 但好看)
http://mplayerx.org/download.html
解压软件:
BetterZip

风扇转速控制软件(玩游戏时左右各4000转左右即可(很好的解决发热问题)):
smcFanControl

防休眠工具:
Caffeine(MAC 商店)(推荐)
防休眠+设定当XXX运行时不睡眠(自动检测并执行:比如迅雷):Wimoweh(Mac商店(免费))

刻录软件:
Toast(升级后支持视网膜屏,注:其他没说的网盘中的软件除了maya、eclipse和Zbrush不支持视网膜屏其他都支持)

音乐播放器:
iYY(须用支付宝付费,注:此为国人开发)

Office:Microsoft Office 2011(升级后支持视网膜屏)
注:Mac 下软件一旦破解后是可以升级的!

杀毒软件:
诺顿(200块人民币左右,比win'贵很多,但是连win下病毒也能杀!)

词典:
有道词典

去除开机的当的一声的小工具:
StartNinjaInstaller

Safari翻墙教程:
http://www.appifan.com/jc/201209/35546.html

视频格式转换软件:
Any Video Converter

将Widget转换为应用程序的软件(尽管Widget 可以拖到桌面上但是会盖住其他窗口(Widget 默认置顶而且无法改变),所以这个方法可以使程序显示在桌面上而且不被置顶,缺点是:在Dock上多了个图标(毕竟因为转成了应用程序类型了么),然后右击第一个选项->登陆后自动打开设置上就可以了,算是一种Widget桌面化的一中不完美解决方案吧):
Amnesty Singles

包月翻墙软件(效果相当的棒):
ExpressVPN
https://www.expressvpn.biz

系统时钟小工具(Mac App Store下载,最好下载12块的收费版):
TICKE-TACK
注:可以在壁纸上以文字提醒的方式显示时间比如差几分到九点。

笔记类应用(Mac App Store里下载(免费)):
有道云笔记和印象笔记

Mac 更换程序图标:
附件:
1.jpg
1.jpg [ 363.1 KiB | 被浏览 5787 次 ]



Mac下数据恢复软件:
Data Rescue

与Data Rescue是一个公司出品的 但是是针对照片的恢复软件
Picture Rescue

Mac下的disk genus:
Drive Genius

DVD抓轨工具(翻录dvd音频)
DVD Audio Extractor

天气插件
Clear Day(要付费)

mac下远程软件(对于个人版是免费用的)
Teamviewer
注:跨平台 mac和win可以互相控制

菜单栏图标合并软件(付费)
Bartender

图标重新排列软件(付费)
MenuBar ReArranger

mac控制ipad/iphone软件(付费)
Instashare

Mac和ipad/iphone互传文件(付费)
Airserver

Trim Enabler
固态硬盘其实并不会自动开启TRIM功能。这项功能可以有效减轻固态硬盘的“磨损”,提升读取速度。TRIM功能可以令操作系统删除数据时,通知固态硬盘立即擦除这些数据占据的区块,从而防止固态硬盘长期使用后出现性能下降问题。

Disk Doctor 有两个版本一个是data recovery 一个是photo recovery 都是很贵的数据恢复软件
app store 有售

闪存卡数据恢复(闪迪公司出品) app store 有售
Rescue Pro Deluxe

定时休眠/关机软件 Mac app store里有
Sleepytimer (在caffeine 激活的状况下也能使用)

countBattery
浏览电池信息(包括循环次数,电池电量是否缩水)

iStat Menus
查看cpu温度,硬盘占用,上传下载速度, 类似conky

Xee
mac下的看图软件支持多点触摸 这样就不用按方向键看图了 而且是按照图片排列顺序看图 不是选那个看那个(这个在使用mac自带的预览功能时很不人性化)

LunarCal
mac下的农历软件

————————————————————————————————————
Safari 插件

ClickToFlash
自动弹出并播放的flash很烦人?这个可以让flash只有在你点击播放的时候才会播放

Turn Off the Lights
看视频的时候会压暗周围背景

Awesome Screenshot
浏览器截图工具

——————————————————————————————————————

Techtool Pro 系统检测工具(检测是否工作良好功能十分强大但操作简单 是而且带有很多工具如数据恢复 磁盘整理 硬盘修复等)

隐藏重要文件的软件(你懂的!)
Hider 2

Mac下的顶级音乐播放软件
Amarra 几百刀的软件音质不是闹着玩的

翻墙后看美国电视的好方法:(需付费9刀一月)
http://www.hulu.com
mac端倒是有hulu封装好的播放软件,但是停止更新了,所以算了,还是上网站吧,用Express Vpn后速度还是蛮快的

Mac 下破解wifi(除了WPA2)的利器
KisMac

iLocker
如果有些程序不想被外人打开(比如快播),这个程序再好不过了,除非输入密码才能打开。

易呗背单词
Mac下免费的背单词软件也有手机版,比较方便个人认为比完美规划背单词强大,因为有多种出题模式,听写 ,默写,选择题等等

Mac上也会偶尔找不到鼠标吧
Find My Mouse 这款应用在Mac App Store里有

Gemini(去除相同文件的小软件)App Store里有

softmatic exif (查看相机的光圈快门对焦点的软件,相较同类产品这个软件界面看着舒服用着也简单)

cleanmydrive 这个可以方便的弹出U盘和清理U盘很方便

Mac 下利用betterzip压缩rar
我们需要下载一个包,作为betterzip的helper.
具体操作如下,
到相应地址中下载名为rar的文件,解压以后可以把它放到你自己喜欢的路径上。
之后打开betterzip,打开它的偏好设置preferences,找到helper.把刚才下载好的文件中名为rar的东西添加进去就可以了。
附件:
115942_70f813335407725711c9f656468c0.png
115942_70f813335407725711c9f656468c0.png [ 53.22 KiB | 被浏览 3256 次 ]


现在我们就可以看到,在输出类型中就可以有rar格式的文件了!
附件:
115942_0b5413335408161c6b1117c0448d6.png
115942_0b5413335408161c6b1117c0448d6.png [ 109.36 KiB | 被浏览 3256 次 ]



Smart Utility
查看硬盘smart信息的好工具(检验硬盘是否三码合一 和是否快坏了 提前预警 备份数据)

Resolution Tab
视网膜屏下应用一塌糊涂?用它就对了,选择个合适的分辨率,然后就可以尽情工作了

Mac下也有Mathtype所以要输入数学公式的人有福了

最近上线的应用Shazam,我说的是mac版的shazam哦 终于mac上有了听音识曲的软件了 太棒了而且是免费

待办事项管理软件
clear

财务管理软件
Bill
Money

令人放松的软件
Relax Melodies Seasons Premium
Relax Melodies Premium

录音机软件
Tapedeck

VPN三件套:
服务器:VPNServerConfigurator
助手:VPNServerAgent
添加VPN向导:VPNClientConfigurator

倒计时软件:
Alinof TimePro

Mac 下的字幕查看软件
ezText 2

DynamicLyrics Mac下iTunes显示桌面歌词的软件

BatchPhoto
mac下批量转换照片的好应用 支持raw和可以进行色彩管理
mac 软件 camtasia iphone configre utility hidemyass(VPN) acronis true image 下载软件(按好用程度排名):4 folx pro (支持BT非app store 里的) 3、 iGetter 2、Leech(app store) 1、Maxel(app store)
Mac下载软件:
Leech Maxel Folx iGetter



iOS 软件 Moves、 Proximo、 Decibemeter(测噪音)、Evernote(笔记)、Cycles(测大姨妈和大姨夫还可夫妻同步)、freshbox(提醒你该吃东西了)、StormDistance(测量暴风雨云和你的距离)、Clear(日程软件)、电信联通营业厅、TouchMood(触摸测量情绪)、Sleep Time (轻柔闹钟)、工行手机银行、Money、肯德基宅急送、Weather Dial(简约天气)、Password(密码查看软件(非黑客))、CanOpener(防听觉疲劳音乐播放器)、Relax MSP (白噪声季节版)、Relax Oriental (白噪声官方播放软件)、cs go 、cs go we...、HABU(只能情绪分类听歌软件)、Ibeer(虚拟喝啤酒)、注:打火机不要买、Coin Flip(掷硬币)、蜻蜓FM(有各地的电台)、Dictionary(一个中Eng图标)和一个韦伯出品的英英词典、牛津英汉双解词典(无发音)、自选股、AVPlayer、Soundhound、 Ruler (一橘黄色图标)、Signal(电话加密)、SlowShutter(满门拍照类似蓝色写轮眼图标)、Teamviewer、Calculator(手写计算器跟三图标)、645Pro(把iPhone变单反)、Starwalk (看星座)、Remote(iPhone变apple tv遥控器)、Nutstore、EncryptAPic(加密照片Free)、Flashlight(金色手电筒配灰底图标 可发sos)、Timer(品红色圆圈的计时器免费)、ScretText(加密短信)、Splashtop(远程遥控比teamviewer 好用)、Line tools 小工具集合包(免费)、Crunchyroll (动漫可以免费看)、Ceunxhy News、Chrome(挺好用的)、HMAPro VPN
chrome settings camera clock qq calendar app store hma!VPN Crunchy News
Working&Studying: TED Netflix BBC news Zite 百度音乐 Keynote OmniGraffle Numbers Pages 网易云阅读 调调 AdobeAcrobat Mathpad Forest Pendo iTunes U Podcast
utilities :AVplayer Dictionary Oalecd 百度地图 LINE Tools Dictionary Soundhound Calculator Ruler SlowShutter Calculator 645Pro Star Walk Remote Nutstore 百度云 115 Spyder4Gallery Timer Flashlight Compass Compress Wallpaper EncryptAPic
entertainment :Phonto InstaFOod CanOpener Relax M.S.P Relax Oriental InstaWeather HABU QQ空间 InstaPLace Union
Games:Circle Pool Break 植物大战僵尸2 猫和老鼠 Hay Day 植物大战僵尸雨神 愤怒的小鸟2 ANgrybirds (变形金刚版)
Life : 1Password Weather Dial Daybox Moweather Storm Distance Mail 手机淘宝 Ibooks 大众点评 Newsstand 电信营业厅 滴滴出行 Sleep Time 工行手机银行 肯德基宅急送 Photos Reminders Notes Proximo Evernote Recipe 支付宝 Skype
Trashbin:Stocks Apple watch Voice memos Music Health Game Centre 搜狗输入法 微步 天天动听 Office Mobile Passbook FaceTime Contacts Maps Tips Videos Weather iTunes Store 麦当劳麦乐送 优酷
iZip Pro 30元 可以压缩和解压rar zip 7z
懒人听书 企鹅FM + QQmusic(联通包月) 网易云音乐(电信包月) Tec news Open Source 酷我听书 myTuner Radio Zaker Pro Tapes HiDef Radio 网易云阅读 微信读书
LizhiFM Science News (RealGuitar+RealPiano+RealDrum+Metronome+Real Ukulele+Xylophone组合包) 城市精灵Go Speed Test 没有广告的唯一一款测速软件 Shadowmatic New Ludo Simply Ludo Photography Light and Landscape(最好的免费摄影杂志) Snorelab 闲鱼 500px最好的卖照片的网站 smugmug
picsplay maxcurve kawaii Image(小女生一定喜欢这是唯一一款没广告的东西) Exif Viewer
Sketchbook(画原画),concepts,My wonderful days(日记应用简约版有mac版),Day one(日记应用普通版有mac版)
51CTO
好用的学习编程的软件(ios客户端)
ios应用 摩拜单车
淘宝阅读 书旗小说 腾讯动漫 bilibili Acfun 腾讯自选股 京东股票 鑫财通 仙人掌股票 平安证券 中山证券 恒泰掌财 雪球 摩拜单车 弹琴吧(极客智能钢琴、智能尤克里里、智能吉他/电吉他) 飞猪 Deezer(spotify的替代品 需要翻墙到英国去注册)虾米音乐 gitter 点点虫 purevpn

iOS游戏:Jelly Jump , Spikes , ZigZag , Don't Fall , SKY , Ninja (注:都是ketchapp 发布的去广告在软件内部 有个No ads选项) 城市精灵GO tank battles(支持·mac 可用把子) 、报告村长(走游)、Walkr(走游)、Pocketminion、Framed、Zombies run 、craft the world (支持iOS 但与mac无法同步进度)、breakit (发泄软件)、心动回忆(谈恋爱软件)


steam 软件 cs go 、robocraft、craft the world 、jets'n'Guns Gold(类似雷电)、Farming Simulator、castle story、ace of spreads、Gratuitous Tank Battles

iHeartRadio(美国区)、HBO go(要到美国账号可以看)、Whatsapp(美国微信)、英语流利说、Zite、Spotify,Netflix与信用卡绑定就可以看、

Itunes U:harvard 哈佛公开课

Podcasts:learning English for china(bbc出品)、ted talks 健康

音乐:
atomic kitten 的 if you come to me
the avett Brothers 的 morning song
avril Lavigne 的 My happy ending
calvin Harris 的 Pray to god (feat. HAIM )
Carissa Rae 的 Near or far
Carpenters 的 Top of the world
the chainsmokers 的 Kanye (feat. Siren)
Charice 的 Louder
The civil wars 的 My father's father
Colony House 的 Silhouettes
Eagles 的 Take it easy
Glee Cast 的 Loser Like me (Glee Cast Version)
Groove Coverage 的 God is a girl
hafdis huld 的 Action Man
Jamie T 的 Zombie
Jewel 的 Stay here forever 和 Satisfied
Kelly Clarkson 的 Catch my Breath
Kevin Kern 的专辑:Always Near 、Because i love u-signle、Beyond the Sundial、Christmas、Embracing the wind、Enchanted Piano、Endless Blue Sky、Imagination‘s light、In My Life、In the enchanted Garden、The moon represents my heart、More than words、Summer day dreams 、the winding Path
Lenka 的 The show 和 everything at once
M2m 的 girl in your dreams
Martin Solveig & Dragonette 的 Hello
Matt Nathanson 的 faster
Meg myers 的 the morning after
Mia Martina 的 Burning
Mocca 的专辑 Colours、Dear friends、Imaginary Girl Friends
One Direction 的 Steal my Girl
Pau simon 的 Me and julio down by the Schoolyard
Paul Simon 的 change
Spice Girls 的 wannabe (radio edit)
Taylor Swift 的 We are never ever getting back together 和Shake it off
Tiffany Alvord 的 All about that bass 和 专辑 My heart is
Vanessa Carlton 的 A thousand miles
Various Artists 的 this is me (demi lovato & Joe Jonas)
West life 的 My Love
Wynter Gordon 的 Till death (denial Park Radio Edit)
==============================================================
15-28零散知识点总结
如果安装过nod32杀毒软件记得安装英伟达驱动的时候要先卸载nod32杀毒软件 不然会卡住无法完成安装( ppa 或run驱动都适用)
消除恼人photoshop标签(Preference->Interface->show tool tips取消勾选)
apt-get update
在修改/etc/apt/sources.list或/etc/apt/preferences之后运行该命令。此外您需要定期运行这一命令以确保您的软件包列表是最新的。
apt-get install packagename
安装一个新软件包(参见下文的aptitude)
apt-get remove packagename
卸载一个已安装的软件包(保留配置文档)
apt-get remove --purge packagename
卸载一个已安装的软件包(删除配置文档)
apt-get autoremove packagename
删除包及其依赖的软件包
apt-get autoremove --purge packagname
删除包及其依赖的软件包+配置文件,比上面的要删除的彻底一点
dpkg --force-all --purge packagename
有些软件很难卸载,而且还阻止了别的软件的应用,就能够用这个,但是有点冒险。
apt-get autoclean
apt会把已装或已卸的软件都备份在硬盘上,所以假如需要空间的话,能够让这个命令来删除您已卸载掉的软件的备份。
apt-get clean
这个命令会把安装的软件的备份也删除,但是这样不会影响软件的使用。
apt-get upgrade
可以使用这条命令更新软件包,apt-get upgrade不仅可以从相同版本号的发布版中更新软件包,也可以从新版本号的发布版中更新软件包,尽管实现后一种更新的推荐命令为apt-get dist-upgrade。
在运行apt-get upgrade命令时加上-u选项很有用(即:apt-get -u upgrade)。这个选项让APT显示完整的可更新软件包列表。不加这个选项,你就只能盲目地更新。APT会下载每个软件包的最新更新版本,然后以合理的次序安装它们。注意在运行该命令前应先运行 apt-get update更新数据库,更新任何已安装的软件包。[2]
apt-get dist-upgrade
将系统升级到新版本。
apt-cache search string
在软件包列表中搜索字符串。
dpkg -l package-name-pattern列出任何和模式相匹配的软件包。假如您不知道软件包的全名,您能够使用“*package-name-pattern*”。
aptitude
周详查看已安装或可用的软件包。和apt-get类似,aptitude能够通过命令行方式调用,但仅限于某些命令——最常见的有安装和卸载命令。
由于aptitude比apt-get了解更多信息,能够说他更适合用来进行安装和卸载。

How to know the version of installed package?

apt-cache policy <package name>

The above command will shows installed package version and also all the available versions in the repository according to the version of Ubuntu in which you are running.It doesn't display the package version which was intended for another version of Ubuntu(not your's).
Example:

$ apt-cache policy gparted
gparted:
Installed: 0.16.1-1
Candidate: 0.16.1-1
Version table:
*** 0.16.1-1 0
500 http://ubuntu.inode.at/ubuntu/ saucy/main amd64 Packages
100 /var/lib/dpkg/status

So the installed gparted version is 0.16.1-1.
How to install a specific package version?

sudo apt-get install package=version

Example:

$ sudo apt-get install gparted=0.16.1-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
gparted is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 265 not upgraded.

[功能]

ubuntu下面的软件包管理工具。


[举例]

目前常用的

==========

*更新本机中的数据库缓存:

sudo apt-get update


*查找包含部分关键字的软件包:

sudo apt-cache search <你要查找的name>


*安装指定的软件:

sudo apt-get install <你要安装的软件包>


*下载软件包源代码(如果有的话):

apt-get source <你要下载的源代码包名>



详细的资料

=========

http://www.debian.org/doc/manuals/apt-h ... ng.en.html

apt-get:


安装和卸载------

*更新本机中的数据库缓存:

sudo apt-get update

最好定期更新一下使你自己机器上面的数据和服务器(/etc/apt/sources.list列出)上面的信息保持一致,在安装软件之前可以运行一下这个命令保证成功性。


*安装软件:

#apt-get install packagename

这里将安装你需要的在sources.lists中的最新的软件包,如果有其他依赖则自动安装相应的依赖软件包。packagename可以是多个软件包。

一些有用的选项:

-h This help text.

-d Download only - do NOT install or unpack archives

-f Attempt to continue if the integrity check fails

-s No-act. Perform ordering simulation

-y Assume Yes to all queries and do not prompt

-u Show a list of upgraded packages as well


*卸载软件(用install):

#apt-get install packagename-

在需要卸载的包后面加上一个'-'(我没有实验过),当然可以apt-get install p1 p2-这样多个命令合并了,装p1卸p2。


*卸载软件2:

#apt-get remove packagename

这会卸载相应的软件,同时也会卸载依赖的部分,没办法指定不卸载依赖的。但是软件的配置文件还是会留在系统中。


*完全卸载软件包括删除配置:

#apt-get --purge remove packagename

这样配置文件也会被删除。


*安装软件2(用remove):

#apt-get remove packagename+

这个和用install来卸载软件的意义类似,在包名称后面添加一个+,表示安装。


*修复或者只安装最新版本:

#apt-get --reinstall install packagename

这里,如果你的软件包被破坏了,或者你想要安装一个最新的软件,运行这个。


升级软件包------

*升级软件包1:

#apt-get -u upgrade

这里加上-u选项列出将要升级的软件,可能会提示有些软件不会升级,因为可能会破坏依赖关系,更好的方法是利用apt-get dist-upgrade

你可以通过cd或者添加源地址来更新,如果你想从cd来升级,首先运行apt-cdrom把cd中的软件添加到/etc/apt/sources源中,然后运行apt-get dist-upgrade来升级,但是因为apt-get总是使用最新版本,如果cd中的不是最新的版本,那么也不会用到cd。


*升级软件包2:

#apt-get -u dist-upgrade

这样安装的软件前面apt-get -u upgrade安不了的也会安装了,但个别的仍然不能安装,例如:升级会导致需要卸载一些包,卸载这些包会导致另外的软件不能用,所以就不升级了。


*升级软件包3:

#apt-get -u install packagename

假设前面升级的时候packagename无法升级,那么这个命令会升级packagename如果需要卸载默写模块而卸载这些模块导致一些软件无法使用,那么干脆把这些软件都卸载了,然后升级,这个命令会导致packagename最终升级了。


清理没用的包文件------

用apt-get 安装软件包的时候,apt会从/etc/apt/sources.list里面将相应的软件包恢复出来,把它们存放在一个本地的文档库中(/var/cache/apt/archives/)然后才开始安装,随着时间的增长,这将不断地消耗硬盘的空间。


*清理所有的缓存文件:

#apt-get clean

这会清理所/var/cache/apt/archives/ 和 /var/cache/apt/archives/partial/中没有被锁定的文件。当然你再次安装软件的时候,这个软件又被恢复到本地文档库中了。


*仅仅清理旧的缓存文件:

#apt-get autoclean

这会清理旧版本的/var/cache/apt/archives/ 和 /var/cache/apt/archives/partial/中的文件。旧版本是指已经有更新的版本的软件了,再下载的话应下载最新的而不是这个旧版本的了。根据apt-show-versions -p可以知道哪些是旧的。


*安装指定版本的软件包:

# apt-get install package=version


查找信息--------


*查找一个含有packagename字符串的包:

#apt-cache search packagename

这样将输出所包含packagename字符串的包。


*显示软件包的详细信息:

# apt-cache show stella

这包含了软件包许多的信息,例如如果你已经安装了这个软件包,信息里面也会显示。


*显示软件包的大致信息:

apt-cache showpkg packagename

这会显示大致的信息。


*查看那些包可以升级的信息:

$ apt-show-versions -u

这个apt-show-versions工具需要安装一下的。


*查看当前特定软件版本:

apt-show-versions -p packagename


*检查packagename依赖的包:

#apt-cache depends packagename


工作相关--------


*安装编译源代码需要的库(包):

# apt-get build-dep packagename

所的源代码包一个'Build-Depends'域,指明了从源代码编译这个包需要安装的软件。上面的命令可以下载这些包,其中'packagename'是包名。



*查看编译一个包需要哪些其他的库(包):

#apt-cache show packagename

如果你只是想要检查编译一个包需要哪些其他的包,那么可以利用上面的命令,其中'packagename'是包名。



*下载包packagename的源代码:

$ apt-get source packagename

这将在当前目录下载个文件:*.orig.tar.gz,*.dsc,*.diff.gz。如果这个包是debian的,那么最后一个文件没有,并且第一个文件名里面不包括"orig"字符串。

.dsc文件被dpkg-source使用,把源代码包解压到目录 packagename-version.每一个下载的源代码包里面都有一个debian/目录,这个目录包含了用于创建.deb包的文件。



*下载的时候自动把源代码包编译:

$ apt-get -b source packagename

可能是编译成.deb包,我没有试过。


*根据下载的源代码创建deb包:

$ dpkg-buildpackage -rfakeroot -uc -b

如果你决定在下载的时候不创建deb包,你可以以后通过在下载的包之后创建的目录里面运行这个命令来创建。


*直接利用包管理器安装包:

# dpkg -i file.deb

需要直接使用包管理器,运行这个命令来安装包。


-------dpkg查找


*已知软件包中有一个文件,根据文件查找软件包:

# dpkg -S stdio.h

输入之后,输出如下:

libc6-dev: /usr/include/stdio.h

libc6-dev: /usr/include/bits/stdio.h

perl: /usr/lib/perl/5.6.0/CORE/nostdio.h

这在知道包中某些文件的时候,来根据文件查找软件包这种情况下非常用。


*查找安装在你的机器上面的软件包:

dpkg -l


*自动安装缺失的软件:

# auto-apt run command

这里,command是你要运行的命令。例如 auto-apt run ./configure .当缺失依赖软件的时候,它会询问你安装,方便了编译。安装之后会继续运行。auto-apt需要保持一个最新的数据库,利用这个命令进行更新:auto-apt update, auto-apt updatedb and auto-apt update-local。


--------apt-get查找


*利用apt-file根据文件名查找相应的软件包:

$ apt-file search filename

如果你只知道程序名字filename,那么你可以运行这个命令,它的工作方式和 dpkg -S差不多,就是根据某个软件包里可能包含的文件来查找这个软件包的名字。另外,它也会显示包含这个文件的没有安装的软件包。当你编译的时候,提示缺了什么头文件的时候,利用这个很方便地确定需要装哪些软件包(当然利用audo-apt更方便).


*列出一个软件包中包含的文件:

$apt-file list packagename

这里,apt-file是根据一个数据库来读取信息的,所以需要保持数据库是最新的。


*更新apt-file的数据库:

# apt-file update

默认情况下,apt-file的数据库和auto-apt是一样的。

本文简单介绍ubuntu/var/log/下各个日志文件,方便出现错误的时候查询相应的log



/var/log/alternatives.log-更新替代信息都记录在这个文件中

/var/log/apport.log -应用程序崩溃记录

/var/log/apt/ -用apt-get安装卸载软件的信息

/var/log/auth.log -登录认证log

/var/log/boot.log -包含系统启动时的日志。
/var/log/btmp -记录所有失败启动信息

/var/log/Consolekit - 记录控制台信息

/var/log/cpus - 涉及所有打印信息的日志

/var/log/dist-upgrade - dist-upgrade这种更新方式的信息

/var/log/dmesg -包含内核缓冲信息(kernel ringbuffer)。在系统启动时,显示屏幕上的与硬件有关的信息

/var/log/dpkg.log - 包括安装或dpkg命令清除软件包的日志。

/var/log/faillog - 包含用户登录失败信息。此外,错误登录命令也会记录在本文件中。

/var/log/fontconfig.log -与字体配置有关的log。

/var/log/fsck - 文件系统日志

/var/log/faillog -包含用户登录失败信息。此外,错误登录命令也会记录在本文件中。

/var/log/hp/

/var/log/install/

/var/log/jokey.log

/var/log/kern.log –包含内核产生的日志,有助于在定制内核时解决问题。

/var/log/lastlog —记录所有用户的最近信息。这不是一个ASCII文件,因此需要用lastlog命令查看内容。

/var/log/faillog –包含用户登录失败信息。此外,错误登录命令也会记录在本文件中。

/var/log/lightdm/

/var/log/mail/ – 这个子目录包含邮件服务器的额外日志。

/var/log/mail.err -类似于上面的

/var/log/news/

/var/log/pm-powersave.log

/var/log/samba/ –包含由samba存储的信息。

/var/log/syss.log

/var/log/speech-dispacher/

/var/log/udev

/var/log/ufw.log

/var/log/upstart/

/var/log/uattended-upgrades/

/var/log/wtmp —包含登录信息。使用wtmp可以找出谁正在登陆进入系统,谁使用命令显示这个文件或信息等。

/var/log/xorg.*.log— 来自X的日志信息。

先必须了解两个最基本的命令:

tail -n 10 test.log 查询日志尾部最后10行的日志;

tail -n +10 test.log 查询10行之后的所有日志;

head -n 10 test.log 查询日志文件中的头10行日志;

head -n -10 test.log 查询日志文件除了最后10行的其他所有日志;



场景1: 按行号查看---过滤出关键字附近的日志

因为通常时候我们用grep拿到的日志很少,我们需要查看附近的日志.

我是这样做的,首先: cat -n test.log |grep "地形" 得到关键日志的行号



<3>得到"地形"关键字所在的行号是102行. 此时如果我想查看这个关键字前10行和后10行的日志:

cat -n test.log |tail -n +92|head -n 20

tail -n +92表示查询92行之后的日志

head -n 20 则表示在前面的查询结果里再查前20条记录



场景2:那么按日期怎么查呢? 通常我们非常需要查找指定时间端的日志

sed -n '/2014-12-17 16:17:20/,/2014-12-17 16:17:36/p' test.log

特别说明:上面的两个日期必须是日志中打印出来的日志,否则无效.



关于日期打印,可以先 grep '2014-12-17 16:17:20' test.log 来确定日志中是否有该时间点,以确保第4步可以拿到日志

这个根据时间段查询日志是非常有用的命令.

6

如果我们查找的日志很多,打印在屏幕上不方便查看, 有两个方法:

(1)使用more和less命令, 如: cat -n test.log |grep "地形" |more 这样就分页打印了,通过点击空格键翻页

(2)使用 >xxx.txt 将其保存到文件中,到时可以拉下这个文件分析.如:

cat -n test.log |grep "地形" >xxx.txt

这几个日志查看方法应该可以满足日常需求了.

Ubuntu实时查看tomcat运行log


1、找到tomcat安装目录:cd tomcat/logs

2、tail -f catalina.out

3、ctrl+c 退出


对于VI的命令行,不需要特意的去记忆,写下来,让要用到的时候能找到就行



游标控制
h 游标向左移
j 游标向下移
k 游标向上移
l (or spacebar) 游标向右移
w 向前移动一个单词
b 向后移动一个单词
e 向前移动一个单词,且游标指向单词的末尾
( 移到当前句子的首部
) 移到下一个句子的首部
{ 移到当前段的首部
} 移到下一段的首部
[[ 移到当前区段的首部
]] 移到下一个区段的首部
0 移到当前行的首部
$ 移到当前行的尾部
^ 移到当前行第一个非空白字符的地方
+ or RETURN 移动到下一行的第一个字符
- 移动到上一行的第一个字符
n | 移动到当前行的字符n的地方
H 移动到当前屏幕的首部
M 移动到当前屏幕的中部
L 移动到当前屏幕的尾部
nH 移动到当前屏幕首部下的n行
nL 移动到当前屏幕尾部上的n行
Ctrl-F 移动到下一屏
Ctrl-B 移动到上一屏
Ctrl-D 向下移动半屏
Ctrl-U 向上移动半屏




z RETURN 刷新屏幕,调整屏幕,使当前的游标在刷新后的屏幕的首部(是不是不明白???不明白的话,试试就知道是什么意思了)
z . 刷新屏幕,调整屏幕,使当前的游标在刷新后的屏幕的中部
z - 刷新屏幕,调整屏幕,使当前的游标在刷新后的屏幕的尾部
Ctrl-L 刷新屏幕,不调整屏幕位置
Ctrl-R 刷新屏幕,不调整屏幕位置
/text 向下搜索text
/ 重复上次的搜索的内容向下搜索一次
?text 向上搜索text
? 重复上此搜索的内容向上搜索一次
n 重复上此的搜索,向下搜索
N 重复上此的搜索,向上搜索
/text/+n 移动到text所在行的下面n行
?text?-n 移动到text所在行的上面n行




nG 移动到n行
:n 移动到n行
G 移动在最后一行



内容编辑

A:当前行的尾部追加内容

i:游标前插入内容

I:游标后插入内容

o:在鼠标所在行的下面添加内容

O:在鼠标所在行的上面添加内容

ESC:退出编辑模式

Ctrl-T:移动到下一个tab

Backspace:向后移动一个字符

Ctrl-U:删除当前

cw:删除游标所在的字符,然后进入编辑模式

cc:删除游标所在的行,然后进入编辑模式

C:删除从游标所在的位置到行尾的字符,然后进入编辑模式

dd:删除当前行

ndd:删除第n行

D:删除当前行游标所在的位置后面的字符

dw:删除邮编所在的字符

d}:删除当前段剩余的字符

d^:删除游标前到行首的字符

c/pat:删除游标后面到第一次匹配字符间的内容

dn:删除游标后面到下一个匹配字符间的内容

dfa:删除当前行游标到匹配字符间的内容(匹配的字符也将被删)

dta:删除当前行游标到匹配字符间的内容(匹配的字符不被删)

dL:删除从游标到屏幕的最后一行之间的内容

dG:删除从游标到文件末尾之间的内容
J:连结上下两行的内容

p:在游标后面插入buffer中的内容

P:在游标前面插入buffer中的内容

rx:用x替换字符

Rtext:用text从游标开始处进行替换

u:撤销最后的改变

U:还原当前行的内容

x:向后删除游标所在位置的字符

X:向前删除游标前面的字符

nX:删除前面的n个字符,游标所在的字符将不会被删

.:还原最后的改变

~:反转字母的大小写

y:拷贝当前行到新的buffer

yy:拷贝当前行

"xyy:拷贝当前行的buffer名为x的buffer

ye:拷贝当单词的末尾



文件操作
:w 写文件
















:w! 写文件,忽略警告信息
:w! file 覆盖文件,忽略警告信息
:wq 写文件之后退出编辑
:q 退出编辑器
:q! 强制退出编辑器
:w file 把文件的内容写到另一个文件
ZZ 退出编辑器,如果文件有改动,则保存再退出
:x 退出编辑器,如果文件有改动,则保存再退出
:n1,n2w file 把n1行到n2行间的内容写到文件file
:n1,n2w >> file 把n1行到n2行间的内容追加到文件file
:e file2 在当前文件的命令行模式下编辑file2
:e! 重新从磁盘加载文件
:e# 交替编辑文件




:n 编辑地下一行
:n! 编辑地下一行(忽略警告)


:r file 在游标后面插入文件
:r !command 在当前行的后面,插入运行命令后的输出内容

无法获取锁 /var/cache/apt/archives/lock

在另一个程序在使用APT时,会发生该错误。假定你正在Ubuntu软件中心安装某个东西,然后你又试着在终端中运行apt。

E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable)

E: Unable to lock directory /var/cache/apt/archives/

通常,只要你把所有其它使用apt的程序关了,这个问题就会好的。但是,如果问题持续,可以使用以下命令:

sudo rm /var/lib/apt/lists/lock

如果上面的命令不起作用,可以试试这个命令:

sudo killall apt-get

关于该错误的更多信息,可以在这里找到。

有一個很方便的方法...
先安裝vcdimager
sudo aptitude install vcdimager
然後光碟片放進去之後輸入
vcdxrip -C /dev/cdrom
就烤貝出來了...

首先sudo fdisk -l查看U盘的路径,如/dev/sdc之类的,一定要确保正确,否则会写到硬盘上,查看容量识别一下。
然后准备好ISO文件,如放在/home/someone/abc.iso
然后输入 sudo dd if=/home/someone/abc.iso of=/dev/sdc
回车后静等命令完成,此时U盘灯会闪烁,表示有数据写入,但打开u盘的话,里面看不出文件有改变,不用担心。
dd if=/dev/scd0 of=~/xx.iso
This is very helpfull to backup you cd and dvd into iso images:

To make an ISO from your CD/DVD, place the media in your drive but do not mount it. If it automounts, unmount it. (ubuntu automount so you need to unmount, that's quite easy, just choose the option unmount from the shell).

dd if=/dev/dvd of=dvd.iso # for dvd
dd if=/dev/cdrom of=cd.iso # for cdrom
dd if=/dev/scd0 of=cd.iso # if cdrom is scsi

To make an ISO from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command.

mkisofs -o /tmp/cd.iso /tmp/directory/

This results in a file called cd.iso in folder /tmp which contains all the files and directories in /tmp/directory/.

For more info, see the man pages for mkisofs, losetup, and dd, or see the CD-Writing-HOWTO at http://www.tldp.org.

Hope it helps
Sniff.

Ubuntu Freak :mrgreen:

If you need to copy a CD to your hard drive:

prompt@shell$ dd if=/dev/cdrom of=/path/to/cdcopy.iso

For a DVD:

prompt@shell$ dd if=/dev/dvd of=/path/to/dvdcopy.iso


sudo apt-get install libavcodec-extra
sudo apt-get install python3-pyqt5 python-pyqt5
_________________________________________________________________________
sudo pip install '/home/cc/Downloads/ffmulticonverter-1.8.0.tar.gz'
sudo pip3 install '/home/cc/Downloads/ffmulticonverter-1.8.0.tar.gz'
------------------------------------------------------------------------

sudo pip install ffmulticonverter
sudo pip install ffmulticonverter

有些包尽管apt-get删除不了但是只要是deb包安装的synaptic总能找到相应的包并卸载

BTW:桌面图标也得删除哦不然还是会残余僵尸图标在启动菜单内,还有就是如果不小心添加到快速启动栏(因为在启动菜单里并没有显示而误执行此操作,正确操作为重启系统),synaptic就能卸载尽管apt-get删除不了


sudo apt-get install ideviceinstaller python-imobiledevice libimobiledevice-utils libimobiledevice6 libplist3 python-plist ifuse usbmuxd

然后插入iPhone
打开终端输入idevicepair pair
然后打开iPhone点击trust
然后就可以访问照片了

sudo add-apt-repository ppa:berfenger/roccat
sudo apt-get update
sudo apt-get install roccat-tools
sudo adduser cc roccat
安完XTD Linux驱动请重启才能生效

sudo add-apt-repository ppa:terrz/razerutils
sudo apt-get update
sudo apt-get install python3-razer razer-kernel-modules-dkms razer-daemon razer-doc


seta8967
8/30/2014seta8967
I had a quick question. Is the EVGA x99 classy really x8/x8/x8 for 3-way sli? the brochures says so, but isn't it normally x16/x16/x8 like the dark? did they just test the board with a 5820k?
houkom
8/30/2014houkom
This says differently... Says PCI-E Slot Arrangement – 1x16, 2x16, 3x8, 4x8
seta8967
8/30/2014seta8967
houkom
This says differently... Says PCI-E Slot Arrangement – 1x16, 2x16, 3x8, 4x8




Thats what i'm talking about, it says x8/x8/x8. Asus and other have said x16/x16/x8, so is x8/x8/x8 unique to EVGA?
Scarlet-Tech
8/30/2014Scarlet-Tech
I am curious... I think EVGA wrote it out in a slightly less than smart format. I think it may actually mean Lane 1: x16, Lane 2: x16 Lane 3: x8, Lane 4: x8 and items in those slots would be capable of running at the suggested speeds... They should definitely clarify that though... It says lane configuration, so I think Houkon is saying that Lane 1 and 2 should run at x16 with a capable chip.
seta8967
8/30/2014seta8967
Scarlet-Tech
I am curious... I think EVGA wrote it out in a slightly less than smart format. I think it may actually mean Lane 1: x16, Lane 2: x16 Lane 3: x8, Lane 4: x8 and items in those slots would be capable of running at the suggested speeds... They should definitely clarify that though... It says lane configuration, so I think Houkon is saying that Lane 1 and 2 should run at x16 with a capable chip.



ahhh i understand sorry 5 hours of sleep, daughter woke up at freaking 5:30 in the morning. though babies slept alot.... anyways that resolved my issues. Ordered it and sent it to nateman... for things....
houkom
8/30/2014houkom
The way that i had read what i linked was that slot 1 was x16 and so was slot 2 but that slots 3 and 4 were going to be x8... so if you wanted to run SLI with both cards at x16, you would have to use both slots 1 and 2 and not slots 1 and 3 or whatever... assuming that you have the right kind of processor with enough lanes to run both at x16 lol
linuxrouter
8/30/2014linuxrouter
I looked at the Classified x99 manual earlier and below is a summary of the slot configurations listed in the manual.

1 - x16/x8 - x8 if 2 is occupied
2 - x8

3 - x8 - Disabled on 28-lane CPU
4 - x16/x8 - x8 if 3 is occupied or on 28-lane CPU

5 - x4 2.0 -> x99 PCH

6 - x8 on 40-lane CPU or x4 on 28-lane CPU

Source (Page 9):

http://www.evga.com/support/manuals/fil ... _Part1.pdf

Based on this slot layout, there are some different options for a 3x GPU installation. If the cards are installed in slots 1, 2, and 4, the cards should operate at x8/x8/x16. If the cards are installed in slots 1, 4, and 6, the cards should operate at x16/x16/x8. This would be with the 40-lane CPU. This is somewhat different from the EVGA x79 Dark slot layout. The Dark could run 3 cards in slot 1, 3, and 6 and have the cards operate at x16/x16/x8 with one slot open between each card for air flow. This is how I run my Dark with 3x AMD 7970 cards. The slot configuration appears to have been changed with the EVGA x99 ATX motherboards. You would also have to look at the included 3-way SLI adapter to see which slot configuration would work for SLI.

With SLI, the maximum bandwidth between cards will be that of the slowest slot. In a 3 GPU configuration, that would be x8. The benefit to the x16 slots in a 3 GPU configuration would be when the GPUs are used for compute purposes.
EVGATech_JoeyC
8/30/2014EVGATech_JoeyC
Here is a breakdown of the PCI-E Lane Distribution between 40 and 28 Lane CPUs. Hopefully this clears up any confusion.

This is for the X99 Classified.

PCI-E Lane Distribution (40 Lane Processor)
PE1 – x16 (x8 if PE2 is used)
PE2 – x8
PE3 – x8
PE4 – x16 (x8 if PE3 is used)
PE5 – x4 (Gen 2 only, 4 lanes pulled from PCH)
PE6 – x8
PCI-E Lane Distribution (28 Lane Processor)
PE1 – x16 (x8 if PE2)
PE2 – x8
PE3 – x8 (Slot is *NOT* functional with a 28 lane processor.)
PE4 – x8
PE5 – x4 (Gen 2 only, 4 lanes pulled from PCH)
PE6 – x4


Scarlet-Tech
8/31/2014Scarlet-Tech
EVGATech_JoeyC
Here is a breakdown of the PCI-E Lane Distribution between 40 and 28 Lane CPUs. Hopefully this clears up any confusion.

Thanks Joey. It looks like lanes 1, 4, and 6 are the way to go.
EVGATech_JoeyC
8/31/2014EVGATech_JoeyC
Scarlet-Tech
EVGATech_JoeyC
Here is a breakdown of the PCI-E Lane Distribution between 40 and 28 Lane CPUs. Hopefully this clears up any confusion.

Thanks Joey. It looks like lanes 1, 4, and 6 are the way to go.
Not a problem

Also if anyone needs the PCI-E breakdowns for the FTW and Micro please visit: http://www.evga.com/support/faq/afmmain ... aqid=59510.

asus x99-a manual PCIE Lane Distribution
或搜索asus x99-a specification PCIE Lane Distribution
即可搜到关于expansion slot 交火分配模式的说明

linux zip 解压乱码
请用以下命令:
unzip -O cp936 *.zip

linux查看cpu温度
2013-04-05 21:23阅读:7,292
一、安装
sudo apt-get install lm-sensors
二、查看
linux@cdyemail:~$ sensors
k10temp-pci-00c3
Adapter: PCI adapter
temp1: +33.6°C (high = +70.0°C)
(crit = +72.0°C, hyst = +70.0°C)
radeon-pci-0100
Adapter: PCI adapter
temp1: +54.0°C

chmod是权限管理命令change the permissions mode of a file的缩写。。
u代表所有者,x代表执行权限。 + 表示增加权限。
chmod u+x file.sh 就表示对当前目录下的file.sh文件的所有者增加可执行权限。。。
==============================================================
其他(Mac系统使用+蛋糕甜点制作):
请查看11-14页
上次由 243750496 在 2017-09-19 22:12,总共编辑 1 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#407

帖子 243750496 » 2017-09-19 21:51

购买的所有设备清单:
小米插排:https://detail.tmall.com/item.htm?id=44 ... d0ltsk711d
小米wifi放大器:https://detail.tmall.com/item.htm?id=52 ... d0ltsk259e
小熊酵素机:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk5d5e
备用气弹:https://detail.tmall.com/item.htm?id=21 ... d0ltsk4cb6
(如需换气请将原件寄回并附98块钱换气费不用购买新气弹,链接在店铺内搜索“气”即可)
酸梅膏:https://detail.tmall.com/item.htm?id=53 ... d0ltskd521
芒果果酱:https://detail.tmall.com/item.htm?id=52 ... d0ltsk376a
草莓果酱:https://detail.tmall.com/item.htm?id=52 ... d0ltsk4a36
奇异果果酱:https://detail.tmall.com/item.htm?id=53 ... d0ltsk640d
菠萝果酱:https://detail.tmall.com/item.htm?id=53 ... d0ltsk1e19
百香果果酱:https://detail.tmall.com/item.htm?id=53 ... d0ltsk0c08
甜筒机(冷冻液版,使用前需将制冷桶冷冻8h):https://detail.tmall.com/item.htm?id=44 ... d0ltsk8549
https://detail.tmall.com/item.htm?id=40 ... d0ltsk283a
烤箱地址
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1502
可信的充值美国区iTunes store 的商家
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4b58
iphone 6 半透明后盖
https://detail.tmall.com/item.htm?id=40 ... d0ltskc179 吐司切片工具
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk15fe 8 寸披萨盘
https://item.taobao.com/item.htm?spm=a1 ... d0ltskfc44 马芬蛋糕陶瓷模具
https://item.taobao.com/item.htm?spm=a1 ... d0ltska3fb 浓情布朗尼用模具
https://item.taobao.com/item.htm?spm=a1 ... d0ltskc367 柠檬汁
https://item.taobao.com/item.htm?spm=a1 ... d0ltskae1e 奥尔良烤肉料(不要买蜜汁烤肉料不好吃)
https://detail.tmall.com/item.htm?id=39 ... d0ltskb31d 绿梅花
https://detail.tmall.com/item.htm?id=39 ... d0ltsk4f7a 绞股蓝
https://detail.tmall.com/item.htm?id=39 ... d0ltsk2f25 茉莉花
https://detail.tmall.com/item.htm?id=38 ... d0ltske7c4 玫瑰花
https://detail.tmall.com/item.htm?id=16 ... d0ltsk9f89 金盏菊
https://detail.tmall.com/item.htm?id=13 ... d0ltsk79ce 百合花
https://detail.tmall.com/item.htm?id=18 ... d0ltsk2802 牡丹花
https://item.taobao.com/item.htm?spm=a1 ... d0ltskc307 披萨用罗勒
https://item.taobao.com/item.htm?spm=a1 ... d0ltskadf2 披萨用牛至
https://detail.tmall.com/item.htm?id=38 ... d0ltsk0cee 砸牛排用肉锤
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8dc8 可爱的帽子
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk817c 黑椒汁
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6972 饼干桶
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk69ed 肉豆蔻粉
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk618b 肉桂粉
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk0ee8 糖霜
https://detail.tmall.com/item.htm?id=36 ... d0ltskea7c 薄荷叶
https://detail.tmall.com/item.htm?id=36 ... d0ltsk5199 薰衣草
https://detail.tmall.com/item.htm?id=36 ... d0ltsk1bb4 桂花
https://detail.tmall.com/item.htm?id=36 ... d0ltsk1bb4 佛手柑
https://detail.tmall.com/item.htm?id=40 ... d0ltsk214f 甜叶菊
https://detail.tmall.com/item.htm?id=41 ... d0ltskbf88 玳玳花
https://detail.tmall.com/item.htm?id=41 ... d0ltsk5ae7 迷迭香
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk61fa 奶酪擦丝器
https://item.taobao.com/item.htm?spm=a1 ... d0ltskd573 马卡龙硅胶垫
https://detail.tmall.com/item.htm?id=25 ... d0ltskfc24 好妈咪料理棒
https://detail.tmall.com/item.htm?id=10 ... d0ltskc980 柠檬挤汁器
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1196 奶油摸刀
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk7f84 食用色素
https://item.taobao.com/item.htm?spm=a1 ... skbb76金钻奶油 济南有实体店 在山师附近
https://detail.tmall.com/item.htm?id=37 ... d0ltskeeec 奶油裱花笔
https://item.taobao.com/item.htm?spm=a1 ... d0ltskc34b 普通硅胶垫
https://item.taobao.com/item.htm?spm=a1 ... d0ltskea0d 硅胶刷
https://detail.tmall.com/item.htm?id=38 ... d0ltsk18d4 奶油抹刀
https://item.taobao.com/item.htm?spm=a1 ... d0ltskf496 裱花枪
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk02c2 4 寸小模具 (蛋糕)
https://detail.tmall.com/item.htm?id=35 ... d0ltskc9b5 抹茶
https://detail.tmall.com/item.htm?id=36 ... d0ltskc389 可可粉
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2f14 明胶
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4888 卡拉胶
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1018 果胶
https://item.taobao.com/item.htm?spm=a1 ... d0ltskfc48 魔芋胶
https://detail.tmall.com/item.htm?id=39 ... d0ltsk6d78 小熊打蛋器
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2ea4 塑料蛋清蛋黄分离器
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6c37 铁制蛋清蛋黄分离器
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk92a9 奶油芝士 (济南有实体店)
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3611 无盐黄油
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk82c8 马苏里拉奶酪
https://detail.tmall.com/item.htm?id=37 ... d0ltsk7877 慕斯圈
https://detail.tmall.com/item.htm?id=38 ... d0ltsk8634 丹麦管
https://detail.tmall.com/item.htm?id=27 ... d0ltskb866 朗姆酒
https://item.taobao.com/item.htm?spm=a1 ... d0ltskb2cc 苦甜巧克力
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk96de 塔塔粉
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6f8d 6寸重芝士蛋糕用的模具
https://item.taobao.com/item.htm?spm=a1 ... d0ltskc9c3 黑胡椒碎
注:小虫草堂里有一些土的原料 混合木屑后种植食虫植物 和多肉植物效果很好
http://world.tmall.com/item/35224245323 ... d0ltske23b
这个要选大号横向黑色
https://item.taobao.com/item.htm?spm=a1 ... d0ltskf9f1
http://world.tmall.com/item/37461844992 ... d0ltsk1901
https://detail.tmall.com/item.htm?id=35 ... d0ltsk6197
http://world.tmall.com/item/16516177426 ... d0ltskba13
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4699
捷波朗耳机:https://detail.tmall.com/item.htm?id=37 ... d0ltskbf4a
西数硬盘:http://world.tmall.com/item/38497317591 ... d0ltskcb4f
https://detail.tmall.com/item.htm?id=21 ... d0ltsk9cd0
http://world.tmall.com/item/22536044177 ... d0ltsk48cf
http://world.tmall.com/item/17998347726 ... 3958585208
https://item.taobao.com/item.htm?spm=a1 ... d0ltskdf4f
SEENDA蓝牙鼠标音箱 可通话支持平板安卓 WIN8 MAC全兼容充电正品[交易快照] 自己找
代尔塔丁腈涂层防寒劳保手套 工业/冷库耐磨防水防冻防护手套[交易快照] 自己找
https://detail.tmall.com/item.htm?id=19 ... 63:6536025
https://detail.tmall.com/item.htm?id=25 ... d0ltsk7105
光盘贴:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk0ebe
变电插排:
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk7618 https://detail.tmall.com/item.htm?id=35 ... d0ltsk66c0
推荐碎纸机:https://item.taobao.com/item.htm?spm=a1 ... d0ltska405
贴光盘神器:https://item.taobao.com/item.htm?spm=a1 ... d0ltskd52d
推荐mac 读卡器:https://detail.tmall.com/item.htm?id=15 ... d0ltsk6d48
http://world.tmall.com/item/18730828177 ... 9319555599
港行正品店:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9e3b
100m无线话筒:http://world.tmall.com/item/43249201903 ... d0ltsk78bd
金银花:https://detail.tmall.com/item.htm?id=73 ... d0ltsk29f5
紫罗兰:http://world.tmall.com/item/19790420953 ... bbucket=17
葛根:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9e73
绿萝https://detail.tmall.com/item.htm?id=13326151563&spm=a1z09.2.0.0.bL0Dby&_u=fd0ltskaf4c
手机触控笔:https://item.taobao.com/item.htm?spm=a1 ... d0ltskdd36

电容麦:https://item.taobao.com/item.htm?spm=a1 ... d0ltskda5d
监听耳机:https://detail.tmall.com/item.htm?id=52 ... d0ltskb49b
调音台:https://detail.tmall.com/item.htm?id=45 ... d0ltsk134c
苹果线:https://detail.tmall.com/item.htm?id=52 ... 6547:21516
名片:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb82a
名片盒:https://detail.tmall.com/item.htm?id=25 ... d0ltskbe2b
蓝牙音箱:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4c46
充电宝:https://detail.tmall.com/item.htm?id=52 ... d0ltske1c7
吉他校音器:https://detail.tmall.com/item.htm?id=43 ... d0ltsk4c98
手持照片打印机:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2b29
相纸:https://item.taobao.com/item.htm?spm=a1 ... d0ltskefe8
Eyefi卡:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6634
绿雏菊种子:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb05f
向日葵:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8231
菠萝莓:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4d63
草莓雪糕:https://item.taobao.com/item.htm?spm=a1 ... d0ltska6ce
香槟玫瑰:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk618d
相机数据线:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk7bd6
有机土:https://item.taobao.com/item.htm?spm=a1 ... d0ltskfc25
水苔:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk357c
喷壶:https://detail.tmall.com/item.htm?id=52 ... d0ltsk0ffb
椰砖:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9577
除虫菊素:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4fc3
白僵菌:https://item.taobao.com/item.htm?spm=a1 ... d0ltske2d5
蜡质芽孢杆菌:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk69d2
哈茨木霉:https://item.taobao.com/item.htm?spm=a1 ... d0ltske8b5
海藻肥:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk5a8b
叶面肥:https://item.taobao.com/item.htm?spm=a1 ... d0ltska1aa
香水柠檬:https://item.taobao.com/item.htm?spm=a1 ... d0ltskdcc9
蓝莓苗:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk55d4
封口仪:https://detail.tmall.com/item.htm?id=52 ... d0ltske728
花盆:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb870
红提葡萄苗:https://item.taobao.com/item.htm?spm=a1 ... d0ltskfec3
黄灯笼雏菊:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1559
花开富贵:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb26b
园艺三件套:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk95f1
喷壶:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8c98
俄罗斯果茶:https://item.taobao.com/item.htm?spm=a1 ... d0ltskab80
土壤PH检测仪:https://detail.tmall.com/item.htm?id=18 ... d0ltsk0e2d
EC计:https://detail.tmall.com/item.htm?id=52 ... d0ltskf503
植物杀虫剂:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk0c96 (使用前请喷水)
史丹利有机肥:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9791
喷壶:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4e1f
矮壮素:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2061
光触媒:https://item.taobao.com/item.htm?spm=a1 ... d0ltskcd75
多肉细胞分裂素:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8cdc
细胞分裂素:https://item.taobao.com/item.htm?spm=a1 ... d0ltskcff7
吸管:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4344
定时器:https://item.taobao.com/item.htm?spm=a1 ... d0ltskad99
灭蝇胺:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3fd8
花盆:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1391
标签机:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1629
奥绿肥:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1f23
美乐棵控释肥:https://detail.tmall.com/item.htm?id=18 ... d0ltskfc8e
珍珠岩:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3714
硅藻土:https://item.taobao.com/item.htm?spm=a1 ... d0ltskeca2
赤玉土:https://item.taobao.com/item.htm?spm=a1 ... d0ltska61b
蛭石:https://item.taobao.com/item.htm?spm=a1 ... d0ltskcf1c
鹿沼土:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk187b
植金石:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1800
麦饭石:
海藻球:https://detail.tmall.com/item.htm?id=52 ... d0ltskd5a9
海藻球真的很便宜很真:https://item.taobao.com/item.htm?spm=a1 ... d0ltskacbe
纽扣电池(遥控灯用):https://detail.tmall.com/item.htm?id=40 ... d0ltskb2f2
海藻球营养液:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2aaa
遥控灯(一定要选带遥控器的!如果用来养海藻球一定要选最小的那款):https://item.taobao.com/item.htm?spm=a1 ... d0ltskd742
玻璃砂:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk38f5
iphone6保护壳:https://item.taobao.com/item.htm?spm=a1 ... d0ltskffad
奥尔良烤肉料:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk999e
牙线棒:https://detail.tmall.com/item.htm?id=45 ... d0ltsk0ef8
丝叶狸藻(捕食水中小虫子):https://item.taobao.com/item.htm?spm=a1 ... d0ltskd28d
肚兜萍:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb6e5
铜钱草:https://detail.tmall.com/item.htm?id=45 ... :118686807
支持卡拉ok的(支持6.5话筒输入不用买音响直接接电视就可用)DVD:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk69fd
话筒:https://detail.tmall.com/item.htm?id=43 ... d0ltsk1473
相机(支持微单操作):https://detail.tmall.com/item.htm?id=37 ... 9063:10010
功夫茶杯:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6722
护眼贴(不辣眼):https://detail.tmall.com/item.htm?id=14 ... 6184563764
男梅糖:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3f8a
口气清新剂:https://detail.tmall.com/item.htm?id=18 ... d0ltsk62ae
小资情调/行货WACACO Minipresso手动便携式手压式意式浓缩咖啡机(分咖啡粉和胶囊版) 香港代购美国进口airwaves Super劲浪爽浪口香糖超强凉薄荷鹿晗款 意大利进口caffitaly胶囊咖啡 手动WACACO Minipresso胶囊版专用
八仙鼻通:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk30ae
路由器:https://item.taobao.com/item.htm?spm=a1 ... d0ltskacfe
纳豆机:https://item.taobao.com/item.htm?spm=a1 ... d0ltskd7af
猫耳帽子:猫耳朵 女士毛绒棒球帽 秋冬天帽子毛呢鸭舌韩国韩版潮时尚可爱 [交易快照] 灰色和豹纹比较好看
乐仪洗鼻壶:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk86ce
SD转CF卡套:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk38bb
mac能用的读卡器:https://detail.tmall.com/item.htm?id=18 ... d0ltsk0395
好用鼠标:SEENDA蓝牙鼠标音箱 可通话支持平板安卓 WIN8 MAC全兼容充电正品 申派正品 双肩包男书包女双肩电脑包超大旅行背包中学生书包男生
朗科USB3.0带写保护U盘:https://detail.tmall.com/item.htm?id=35 ... 0924208769
耳机:https://detail.tmall.com/item.htm?id=37 ... 63:6536025
碎纸机:https://item.taobao.com/item.htm?spm=a1 ... d0ltsked6c
CD纸套:https://detail.tmall.com/item.htm?id=25 ... d0ltskd892
cd贴片器:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk44e3
空白光盘贴:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9532
空白CD:https://detail.tmall.com/item.htm?id=36 ... d0ltskfcdf
单词卡片:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4406
很正宗的奥尔良腌料:https://item.taobao.com/item.htm?spm=a1 ... d0ltska707
小草人(很便宜)
洋甘菊滴眼液:https://item.taobao.com/item.htm?spm=a1 ... d0ltskfa73
高端路由器:https://item.taobao.com/item.htm?spm=a1 ... d0ltskdc2b
美国Itunes Store 充值:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk692d
卡纸:https://item.taobao.com/item.htm?spm=a1 ... d0ltskaec9
代尔塔丁腈涂层防寒劳保手套 工业/冷库耐磨防水防冻防护手套 [交易快照]
科密碎纸机:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8677
相片裁纸机:https://detail.tmall.com/item.htm?id=15 ... d0ltsk1073
苏打水机:https://detail.tmall.com/item.htm?id=19 ... d0ltskc91a
(冰激凌粉自行解决:硬冰激凌粉适合挖球,软的时候做圣代)
小熊全自动冰激凌机(带制冷非冷冻液版本)https://detail.tmall.com/item.htm?id=53 ... d0ltsk17f6
小熊原汁机:https://detail.tmall.com/item.htm?id=52 ... 1904557839
(除了果汁外还可以灌肠,切片/丝,挤面条)
奶酪:https://detail.tmall.com/item.htm?id=22 ... d0ltsk7784
红茶菌:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk471f
(非常好养)
封口纱布:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk37ad
枫树糖浆B:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2cbc
茶杯:https://detail.tmall.com/item.htm?id=52 ... d0ltsk472e
酸黄瓜:https://item.taobao.com/item.htm?spm=a1 ... d0ltskdf8b
小草人:https://detail.tmall.com/item.htm?id=19 ... d0ltsk8e15
品胜尼龙数据线(比瑜伽线更耐用)
手机-》话筒转换器(卡拉ok曲子就可用手机放了)https://item.taobao.com/item.htm?spm=a1 ... d0ltsk23d6
adonit压感笔:https://item.taobao.com/item.htm?spm=a1 ... d0ltskc22d
罗技太阳能键盘:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk920d
电热水杯220V:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9c2e
挂耳咖啡:https://detail.tmall.com/item.htm?id=53 ... d0ltsk7ff9
保温座:https://detail.tmall.com/item.htm?id=52 ... d0ltskdcb9
usb保温杯:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3d51
车载加热杯:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4d5c
光轴机械键盘:https://detail.tmall.com/item.htm?id=53 ... 63:6536025
CAD mouse:https://item.taobao.com/item.htm?spm=a1 ... aec淘宝网官网首页
分线器:https://detail.tmall.com/item.htm?id=18 ... d0ltsk4029
护手垫:https://detail.tmall.com/item.htm?id=52 ... d0ltska42e
智能吉他:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9380
智能吉他琴箱(配套):https://detail.tmall.com/item.htm?id=18 ... d0ltsk4d53
智能吉他耳机效果器(不用接音响了):https://detail.tmall.com/item.htm?id=37 ... d0ltske1f1
智能吉他配套的大容量充电电池:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1c4a
XTD游戏鼠标(非左右手通用):https://item.taobao.com/item.htm?spm=a1 ... d0ltskc9f7
鼠标垫:https://item.taobao.com/item.htm?spm=a1 ... d0ltskf785
XTD脚贴:https://detail.tmall.com/item.htm?id=37 ... d0ltskd6b0
赛睿游戏鼠标(左右手通用):https://detail.tmall.com/item.htm?id=52 ... 5616566088
赛睿脚贴:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4182
雷蛇游戏鼠标:https://detail.tmall.com/item.htm?id=22 ... 3219083685
雷蛇脚贴:https://detail.tmall.com/item.htm?id=26 ... d0ltskfb29
雷蛇赛睿通用编码器:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2025
通用微动:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3885
雷蛇下压微动:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk69f0
镊子套装:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb7f3
电烙铁:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk103b
吸锡枪:https://detail.tmall.com/item.htm?id=40 ... d0ltske96d
无铅锡丝:https://item.taobao.com/item.htm?spm=a1 ... d0ltskd276
小螺丝刀带磁套装:https://detail.tmall.com/item.htm?id=52 ... d0ltskf560
风枪:https://detail.tmall.com/item.htm?id=52 ... d0ltsk3bd5
烙铁架:https://detail.tmall.com/item.htm?id=40 ... d0ltsk4392
烙铁头:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk7af0
发热芯:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6239
轻触开关(插脚):https://item.taobao.com/item.htm?spm=a1 ... d0ltskc7c9
轻触开关(贴片):https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2301
发光二极管
彩色5mm:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1d73
彩色3mm:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk689d
红外5mm发射管:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb554
红外5mm接收器:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6cf7
红外3mm发射管:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6d84
红外3mm接收器:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk5e97
6x6x3.1直脚:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk0e35
6x6x3.1贴片:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk143d
万用表:https://detail.tmall.com/item.htm?id=39 ... d0ltsk4029
加磁器:https://detail.tmall.com/item.htm?id=39 ... d0ltsk0c87
UV手电筒:https://item.taobao.com/item.htm?spm=a1 ... d0ltskcfdf
绿油笔:https://item.taobao.com/item.htm?spm=a1 ... d0ltskbb1e
漆包线:https://item.taobao.com/item.htm?spm=a1 ... 4193772076
焊油:https://shop67091911.taobao.com/search. ... highPrice=
松香:https://shop67091911.taobao.com/search. ... highPrice=
海绵:https://item.taobao.com/item.htm?spm=a1 ... 5819439530
绿油:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9ac8
UV胶:https://item.taobao.com/item.htm?spm=a1 ... d0ltskd3ed
硅胶维修台:https://item.taobao.com/item.htm?spm=a1 ... d0ltskcf17
除胶剂:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3abc
背光密封胶:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk00b8
热熔胶枪:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk1b38
胶棒:https://item.taobao.com/item.htm?spm=a1 ... d0ltske52c
除锡网:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4495
主板卡具:https://item.taobao.com/item.htm?spm=a1 ... d0ltskde3a
迷你钳子:https://detail.tmall.com/item.htm?id=43 ... d0ltsk7f3f
奥罗波若蛇激光引擎:https://item.taobao.com/item.htm?spm=a1 ... d0ltska270
赛睿sensei wireless & XTD 激光头:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6822
开壳工具:https://item.taobao.com/item.htm?spm=a1 ... d0ltska9f7
硅脂刮刀:https://detail.tmall.com/item.htm?id=43 ... d0ltsk5302
硅脂:https://detail.tmall.com/item.htm?id=17 ... 9586567845
cpu风扇润滑油:https://detail.tmall.com/item.htm?id=52 ... d0ltskca2e
开壳器:https://world.taobao.com/item/535349774 ... d0ltska3e3
风扇机油:https://detail.tmall.com/item.htm?id=52 ... oSite=main
硅脂:https://detail.tmall.com/item.htm?id=17 ... 9586567845
尖嘴瓶:https://world.taobao.com/item/165283437 ... d0ltsk2dac
95度酒精(无水乙醇不好买):https://world.taobao.com/item/524531360 ... d0ltsk6ebd
脱脂棉:https://world.taobao.com/item/537114471 ... d0ltsk62ce
按压式酒精瓶(防挥发,用多少出多少):https://world.taobao.com/item/123236810 ... d0ltsk395a
cpu开盖神器:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk4166
cpu密封胶:https://item.taobao.com/item.htm?spm=a1 ... d0ltska393
cpu换液金绝缘漆:https://item.taobao.com/item.htm?spm=a1 ... d0ltskc5c4
液金导热膏:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8b8f
cpu开盖台钳:https://detail.tmall.com/item.htm?id=43 ... d0ltsk271b
电工胶布:https://detail.tmall.com/item.htm?id=45 ... d0ltsk2a03
硅脂清洗剂:https://detail.tmall.com/item.htm?id=39 ... d0ltsk06e2
木条:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk6247
迷你锤:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk72d9
橡皮锤:https://detail.tmall.com/item.htm?id=45 ... oSite=main
CPU无腐蚀焊锡膏:https://detail.tmall.com/item.htm?id=40 ... d0ltskad2a
CPU开盖教程暴力硅脂适用版:http://pan.baidu.com/s/1eRIyHto
钎焊非暴力开盖版
https://m.baidu.com/from=0/bd_page_type ... -a-p%22%7D

视频中所用吸锡线:https://detail.tmall.com/item.htm?id=40 ... d0ltskc3e3
金属擦亮膏:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk7a25
铜水:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk30da
Ryzen 1800X +微星(MSI)X370 XPOWER GAMING TITANIUM主板(AM4)+双 新泰坦(如果是京东的能换新就换新尽管可能购买这个服务需要多花点钱399(第一年换新)+72(第二年换新))
Ryzen 1800X
http://item.jd.com/3885175.html
微星(MSI)X370 XPOWER GAMING TITANIUM主板(AM4)
http://item.jd.com/4482420.html
装机:
酷冷至尊官方旗舰店的一体式水冷(AM4):
https://detail.tmall.com/item.htm?id=54 ... dmg8j26111
注:用手机买G240,电脑上只能看到G120 3月6日才开售
如急买请打开京东:
https://item.jd.com/3837765.html
酷冷至尊官方旗舰店的显卡千斤顶支架
https://detail.tmall.com/item.htm?id=54 ... 3453954099
酷冷至尊官方旗舰店MasterCase Maker 5机箱配件 组件MasterCase 5模组配件
https://detail.tmall.com/item.htm?id=53 ... 63:6536025
如果买不到红光风扇(需一次买3个)请打开京东:
https://item.jd.com/2997561.html
三星960PRO M2固态
https://item.taobao.com/item.htm?spm=a1 ... dmg8j26111
海盗船官方企业店的1500W电源
https://item.taobao.com/item.htm?spm=a1 ... dmg8j26111
海盗船官方企业店的3000MHZ内存条16Gx2=32G
https://item.taobao.com/item.htm?spm=a1 ... dmg8j26111
LG 29UC88-B 29寸IPS曲面窄边框液晶显示器21:9 2K 包完美
https://item.taobao.com/item.htm?spm=a1 ... dmg8j26111
内存散热马甲片:
https://detail.tmall.com/item.htm?id=52 ... dmg8j26111
英特尔台式机内置wifi蓝牙模块
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk3049
新泰坦
https://item.taobao.com/item.htm?spm=a1 ... d0ltskf8dd

电脑电源线(买0.75平方直头5m的2根):
https://detail.tmall.com/item.htm?id=42 ... d0ltsk12e1
原装sli桥(金手指)
https://item.taobao.com/item.htm?spm=a1 ... d0ltskafea
HDMI线(5m圆线):
https://detail.tmall.com/item.htm?id=12 ... d0ltsk91d1
Mini-ITX机箱:https://detail.tmall.com/item.htm?id=35 ... 6125469371
配套的12cm风扇防尘网:https://detail.tmall.com/item.htm?id=18 ... d0ltsk9f9f
配套的120水冷:https://detail.tmall.com/item.htm?id=54 ... d0ltskbfe2
12cm风扇:https://detail.tmall.com/item.htm?id=53 ... d0ltsk7183

海盗船白金统治者内存风扇:
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk7183
海盗船水冷替换用风扇(非水冷原装风扇)3只一套
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk89f9
海盗船SP120(日食风扇3只套装)
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk13c6

注意换新服务也要买上(第一年换新+第二年只换不修)
京东海盗船HD120(选单只带控制器(主要是为了买控制器,这个买不到,如组合买3个装请上淘宝))
http://item.jd.com/11258698860.html
京东海盗船SP120(选单只带控制器(主要是为了买控制器,这个买不到,如组合买3个装请上淘宝))
http://item.jd.com/10907719837.html

注:控制器通用!

华硕千年光盘刻录机(千年光盘读取通用,但刻录需要刻录机支持,不是所有刻录机都能刻)
https://detail.tmall.com/item.htm?spm=a ... abbucket=2
先锋蓝光刻录机:
https://item.taobao.com/item.htm?spm=a2 ... t=2#detail
蓝牙功能的wacom数位板(通过蓝牙连接,避免电池过度充电(通过usb链接同时进行充电)导致电池寿命降低)
https://detail.tmall.com/item.htm?id=54 ... d0ltsk0dd5
带实时显示的手绘屏(不带电池)
https://detail.tmall.com/item.htm?id=52 ... d0ltsk9887

注:链接中的手绘板都支持linux




港行 原装正品 爱色丽 Colormunki photo 显示器校色仪 送原厂色卡
https://item.taobao.com/item.htm?spm=a1 ... d0ltska841

后期我要做linux上的色彩管理,需要用到以上两个设备+红蜘蛛(displaycal为其校色软件是GUI的没难度,难的是使用Argyllcms用命令行校色,但是Argyllcms不支持spyder print所以才需要购买爱色丽的设备,如果需要用到请注意)
罗技太阳能键盘surface(Windows)专用版
https://item.taobao.com/item.htm?id=522 ... d0ltskf912
surface使用的分线器(因为罗技太阳能键盘使用的是usb接收器不是蓝牙,所以唯一的端口被占用,另外还要接雷蛇鼠标和移动硬盘或u盘所以需要分线器,这个不需要单独供电
https://detail.tmall.com/item.htm?id=52 ... d0ltsk8c9d

机械键盘:
银轴:触发键程短(启动此按键所需时间短),容易误碰。
绿轴:大力青轴,使用时需有使劲敲回车的感觉,但是敲键盘的声音更大,当然力度也更大(适合泄愤)
灰轴:比黑轴力度更大和白轴差不多,费手
白轴:使用时需要最大的力度(激发需要的力度为所有轴中最大的),有段落感(相较灰轴而言)
奶轴:绿轴手感+较小噪音,有咔哒声(相较灰轴而言)
粉轴:红轴触底时是“哒哒哒”的声音,粉轴是“噔噔噔”
黑轴:偏重游戏轴,个人认为:和红轴相比声音大小一样,但是触发需要力度更大
红轴:万金油(打字游戏通用),个人认为:无特点的标准的机械键盘轴
茶轴:接近薄膜键盘(无特点),个人认为:触发压力比红轴小,但是触发声音和红轴一样
青轴:偏重打字,打字很舒服噼里啪啦,个人认为:触发声音比红轴大清脆,但是压力却比茶轴略微大一点点
光轴:下一代机械键盘(比青轴声音更清脆更大,而且触发压力更小)触发压力更小)
(非机械触发,而是光电信号触发,寿命所有轴中最长(但轴是无法更换(没卖的)),省维护成本)个人认为最好用的轴
数字小键盘(体验用)
https://detail.tmall.com/item.htm?id=38 ... 63:6536025

数字小键盘(研究和替换轴使用(最好替换粉轴)):
https://item.taobao.com/item.htm?id=536 ... dmg8j26111
:会替换鼠标微动就会换轴只不过小键盘键位少,换起来方便,省时间

轴体购买:
https://detail.tmall.com/item.htm?id=17 ... 63:6536025


如何测量鼠标编码器尺寸:
MM数为六棱孔中间至接触电路板端的距离,并不是更精确,别被误导了。不同高度导致滚轮轴与编码器不垂直,滚动造成损坏。请更换相同mm的编码器。
IMG_1450.JPG
7:粉轴 8:灰轴 9:白轴
4:银轴 5:黑轴 6:奶轴
1:青轴 2:红轴 3:绿轴
0:茶轴
其他不变(如图)
IMG_1453.JPG
注:这样做是让每个轴的特点充分突出(强调轴的对比清晰

注:粉轴用作小键盘还是手感非常棒的,甚至比光轴都好用(我买了两个实验用的小键盘,一个改成上面所示的体验版小键盘,另一个全是粉轴,十分好用而且静音,还不累手)
好用的记忆棉鼠标垫(尺寸刚好合适)
https://detail.tmall.com/item.htm?id=52 ... d0ltsk7e6c
便宜大牌支持linux(得去英文官网下驱动(国内网站没有))3D打印机
https://item.taobao.com/item.htm?spm=a1 ... d0ltsk8100
杀潮虫绿百灵:https://item.taobao.com/item.htm?spm=a1 ... d0ltskb29a
带自动滤芯检测(是否该换滤芯了了)的净水机:https://detail.tmall.com/item.htm?id=53 ... d0ltsk49a0
志琪M9娱乐器(带笑声的主播神器):https://detail.tmall.com/item.htm?id=55 ... 63:6536025
志琪M16耳机:https://detail.tmall.com/item.htm?id=52 ... 63:6536025
志琪K歌声卡(可配专用的电容麦,非48V):https://detail.tmall.com/item.htm?id=54 ... d0ltskff5f
这三款都带可调音量的耳返
蔓越莓+玫瑰+红茶+黑糖:https://chaoshi.detail.tmall.com/item.h ... 1975990234
复青柠檬片+玫瑰:https://detail.tmall.com/item.htm?id=55 ... d0ltsk479e
弘强酸梅汤:https://detail.tmall.com/item.htm?id=53 ... d0ltsk8030
虎标原味黑糖:https://detail.tmall.com/item.htm?id=54 ... d0ltsk7a93
虎标桂花黑糖:https://detail.tmall.com/item.htm?id=53 ... d0ltske44b
小米乳胶U型午睡枕:https://detail.tmall.com/item.htm?id=54 ... d0ltsk7386
卡通收纳袋(工作时装些必备品):黑糖+桂花黑糖+酸梅汤+柠檬片&玫瑰+南孚口红充电宝+荞麦茶+咸梅子+枇杷糖(润喉)
https://item.taobao.com/item.htm?spm=a1 ... d0ltske21a
南孚口红充电宝:https://detail.tmall.com/item.htm?id=53 ... d0ltska105
湿厕纸:https://chaoshi.detail.tmall.com/item.h ... 8101453818
诺依曼记忆枕枕套定制:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk9fdc
xlevel的mini数据线(苹果,可以挂到钥匙上):https://detail.tmall.com/item.htm?id=55 ... d0ltsk88ad
图拉斯7plus充电壳:https://detail.tmall.com/item.htm?id=55 ... d0ltsk1a37
图拉斯带安全锤的点烟器充电头:https://detail.tmall.com/item.htm?id=54 ... d0ltsk838b
南极人6XL内裤(男):https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2ec4
7-9XL内裤(男):https://detail.tmall.com/item.htm?id=13 ... d0ltsk7a6e
科乐多linghting转MicroUSB(苹果转安卓,购买了收纳瓶可以挂到钥匙上):https://detail.tmall.com/item.htm?id=55 ... d0ltskc580
沙宣男士打底洗发露:https://detail.tmall.com/item.htm?id=52 ... d0ltsk1f0c
沙宣修护水养护发素:https://detail.tmall.com/item.htm?id=36 ... d0ltsk2c0f
沙宣醒发水:https://detail.tmall.com/item.htm?id=52 ... d0ltsk4b80
沙宣醒发精油:https://detail.tmall.com/item.htm?id=54 ... 9394229849
天福茗茶苦荞茶:https://detail.tmall.com/item.htm?id=54 ... d0ltsk0a75
莫干山咸话梅:https://detail.tmall.com/item.htm?id=52 ... 0601958175
星期袜:https://detail.tmall.com/item.htm?id=14 ... 0509:28383
手套:https://detail.tmall.com/item.htm?id=54 ... 0509:28383
小米运动鞋(男):https://detail.tmall.com/item.htm?id=54 ... d0ltska2da
小米腰包:https://detail.tmall.com/item.htm?id=42 ... d0ltsk71b6
小米折叠伞:https://detail.tmall.com/item.htm?id=55 ... d0ltskaf06
福味坊酸梅干:https://item.taobao.com/item.htm?spm=a1 ... d0ltskdb0b

注:185cm+85kg穿6xl平角裤正好,否则是你不会穿(裤子鼻卡腰部凹陷的即平时系腰带的地方,不要提太高,否则不舒服)
上次由 243750496 在 2017-09-26 21:55,总共编辑 4 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#408

帖子 243750496 » 2017-09-19 22:07

如何评价音响的好坏 :音响二十要

此文对如何评价音响的好坏作了准确易懂的评论,对我门系统地学习评价音响有很大帮助.

音响二十要

作者:刘汉盛



这已经是我第三次写“音响二十要”了。第一次在“音响论坛”第40期,隔了不久又写了一次算是补述的材料。这次为了第七届音响大展我们自己编的手册,我又写了一次。前后三次写“音响二十要”,时间隔了五年多。五年后检视我所写过的二篇“音响二十要”,几乎已经没有多少补充或更改的必要。不过,为了让读者们不必分篇去找,并且也藉此机会重新整理“音响二十要”的思绪,我还是决定再写一次。或者说再编一次:将前后二次的“音响二十要”融合起来。所以,如果有论坛的老读者发现这篇“音响二十要”几乎都是旧材料,请不必生气,它本来就已经无可更改。至于新读者,我诚挚的希望这篇“音响二十要”能够在您的心里建构出一套听音响的中心思想。为什么要写“音响二十要”


自台湾有人开始写音响器材的评论以来,有关音响器材表现的各种名词、形容词就一直处于不够精确的情况下;而且,许多名词或形容词也一直被评论员或读者们误解、误用,以致于产生许多不应该有的迷惑与矛盾。究其原因,中国人“差不多先生”的个性脱离不了责任,国内国外土洋杂用的名词也是原因之一;最后,评论人员本身及读者未能对器材评论中所用的名词、形容词深思也是帮凶。因此,许多评论甚至可说是玩弄文字游戏,灌水填充版面之劣作。说得直接一点,许多评论文章距离应该有的精确、扎实境界还有一段距离。多年以前,我因深受上述事项所苦,曾经写了一篇“音响十要”的短文,当时只是简单说明我评论器材的方向。事隔多年,我发现“音响十要”早已经无法满足“精确”的要求,而且包括我自己在内,许多评论文章仍然会因偷懒而写得不够周全。因此脑中就蕴酿着要重新为如何写、看器材评论文章下个较详细的分项。让我自己、“音响论坛”的评论员、以及读者们都有一个明确的指引。唯有这样,文字的传达才能达到最低失真;也唯有如此,器材评论的文章才能更扎实、精炼,且言之有物。或许,我的思考尚不够周全,以下的二十分项可能仍有疏漏或值得再论之处。不过,多年以来“音响二十要”已经成为台湾音响界普遍接受的主流思想,这已是不争的事实。我希望新读者在仔细阅读过这篇文章之后,能够精确的培养出自己品评音响器材的基本能力。这样,也就不会被许多不精确、玩弄文字、模棱二可的评论所迷惑。


音响第一要:音质


音质是指声音的品质,许多人都把它与“音色”混淆了。什么叫作声音的品质?当您在说一双鞋子品质好的时候。您指的一定是合脚、舒服、耐穿,而不是指它的造形好不好看、时不时髦。同样的,当您在说一件音响器材音质好、坏的时候,您也不是在说它的层次如何、定位如可,而是专指这件器材“耐不耐听”!就好像耐不耐穿、合不合脚一样。一件音质很好的器材,它表现在外的就是舒服、耐听。您不必去探讨它听起来舒服、耐听的原因,那是专家们的事,您只要用您的耳朵去判断就行。有些器材生猛有力、速度奇快、解析力也强,但是不耐久听,那可能就是音质的问题。一件好的音响器材,其音质就应该像一副好嗓子,让人百听不腻。或许我这么说您还是认为很抽象。其实不然,我可以再举实列来说明。当您提到布料时,您会说:这块料子的质很好。当您在吃牛排时,您会说:这块牛排的肉质很好。当您在称赞一个小孩时,会说:这个孩子的资质很好。所以,当您在听一件音响器材或一件乐器时,您也会说:它的音质很美。从以上这些例子,您可以很清楚的知道“质”就是与生俱来的天性。音质高贵、很好、很美就代表着这件器材的本性很好,它让人听起来很舒服。我可以说音质是音响器材中最重要的一环,所以我将它摆在第一要。

音响第二要:音色


音色是指声音的颜色。在英文里,音质(TONE QUALITY)与音色(TIMBRE或TONE COLOR)一看便知其所指不是同一件事。但是在中文里,音质与音色经常被混用、误用。我们时常会听到:这把小提琴音色真冷、这把小提琴音色真暖等的说法,这就是指小提琴的音色而言。声音就像光线一样,是有颜色的,不过它并不是用眼睛看到的,而是以耳朵听到的。通常,音色愈暖声音愈软;音色愈冷声音愈硬。太软或太硬当然都不是很好。有时,音色也可以用“高贵”、“美”等字眼来形容,基本上它也是天性之一。不过,就像布料一般,布质是指它的材料,布色却是指它的颜色,这其间还是有明显的界线。在音响器材评论里,音色就如同颜色一般,是指它特有的颜色。有些器材的音色偏黄、有些偏白、有些偏冷、甚至您可说它是带点忧懋的蓝。总之,音响器材就如乐器一般,几乎脱离不了愈贵音色愈美的事实。一把二百万美金的小提琴其音色可能美得有着金黄色的光泽;而一把五千台币的小提琴其音色有可能像褪了色的画。虽然每个人观点各异,但是,“美”仍然有着一个大家承认的“共识”,您不能说一个朝天鼻者是“美的化身”;同样的您不能说一件冷蓝音色的器材是美。这就是我们对音色之美的共识。

音响第三要:高、中、低各频段量感的分布与控制力


这个项目很容易了解,但也很容易产生文字传达上的误解。怎么说呢?大家都会说:这对喇叭的高音太强、低音太少。这就是高、中、低频段的量感分布。问题出于如果把从20Hz到20KHz的频宽只以三段来分的话,那必然会产生“不够精确”的混淆。到底您的低音是指那里呢?多低呢?为了让形容的文字更精确,有必要把20Hz-20kHz的频宽加以细分。照美国TAS与Stereophile的分法很简单,他们把高、中、低每段再细分三小段,也就是变成“较低的中频、中频、较高的中频”分法。这种分法就像十二平均律一般,相当规律化。不过用在中国人身上就产生了一些翻译上的小问题,如“较低的中频”我们称作“中低频”还是“低中频”?那么较高的低频呢?“高低频”吗?对于中国人而言,老外这种分法恐怕行不通。因此很早以前我便参考乐器的频宽,以及管弦乐团对声音的称呼,将20Hz-20KHz的频率分为极低频、低频、中低频、中频、中高频、高频、极高频等七段。这七段的名词符合一般中国人的习惯称呼,而且易记,不会混淆。

低频

从40Hz-80Hz这段频率称为低频。这个频段有什么乐器呢?大鼓、低音提琴、大提琴、低音巴松管、巴松管、低音伸缩号、低音单簧管、土巴号、法国号等。这个频段就是构成浑厚低频基础的大功臣。通常,一般人会将这个频段误以为是极低频,因为它听起来实在已经很低了。如果这个频段的量感太少,丰润澎湃的感觉一定没有;而且会导致中高频、高频的突出,使得声音失去平衡感,不耐久听。

<中低频

从80Hz-160Hz之间,我称为中低频。这个频段是台湾音响迷最头痛的一段,因为它是造成耳朵轰轰然的元凶。为什么这个频段特别容易有峰值呢?这与小房间的长、宽、高尺寸有关。大部份的人为了去除这段恼人的峰值,费尽心力吸收这个频段,使耳朵不致于轰轰然。可惜,当您耳朵听起来不致轰轰然时,下边的低频与上边的中频恐怕都已随着中低频的吸收而呈凹陷状态,而使得声音变瘦,缺乏丰润感。更不幸的是大部份的人只因峰值消失而认为这种情形是对的。这就是许多人家里声音不够丰润的原因之一。这个频段中的乐器包括了刚才低频段中所提及的乐器。对了,定音鼓与男低音也要加上去。

中频

从160Hz-1280Hz横跨三个八度(320Hz、640Hz、1280Hz)之间的频率我称为中频。这个频段几乎把所有乐器、人声都包含进去了,所以是最重要的频段。读者们对乐器音域的最大误解也发生在此处。例如小提琴的大半音域都在这个频段,但一般人却误以为它很高;不要以为女高音音域很高,一般而言,她的最高音域也才在中频的上限而已。从上面的描述中,您一定也了解这段中频在音响上是多么重要了。只要这段频率凹陷,声音的表现马上变瘦了。有时,这种瘦很容易被解释为“假的凝聚”。我相信有非常多的音响迷都处于中频凹陷的情况而不自知。这个频段的重要性同时也可以从二音路喇叭的分频点来分析。一般二音路喇叭的分频点大多在2500Hz或3000Hz左右,也就是说,2500Hz以上由高音单体负责,2500Hz以下由中低音单体负责。这2500Hz约莫是1280Hz的二倍,也就是说,为了怕中低音单体在中频极限处生太大的分频点失真,设计师们统统把分频点提高到中频上限的二倍处,如此一来,最完美的中频就可以由中低音单体发出。如果这种说法无误,高音单体做什么用呢?如果您曾经将耳朵贴近高音单体,您就听到一片“嘶嘶”的声,那就是大部份泛音所在。如果没有高音单体发出嘶嘶的音,单用一个中低音单体来唱音乐,那必然是晦暗不堪的。当然,如果是三音路设计的喇叭,这段中频绝大部份会被包含在中音单体中。

中高频

从1280Hz-2560Hz称为中高频。这个频段有什么乐器呢?小提琴约有四分之一的较高音域在此,中提琴的上限、长笛、单簧管、双簧管的高音域、短笛的一半较低音域、钹、三角铁等。请注意,小喇叭并不在此频段域中。其实中高频很容易辨认,只要弦乐群的高音域及木管的高音域都是中高频。这个频段很多人都会误以为是高频,因此请您特别留意。

高频

从2560Hz-5120Hz这段频域,我称之为高频。这段频域对于乐器演奏而言,已经是很少有机会涉入了。因为除了小提琴的音域上限、钢琴、短笛高音域以外,其余乐器大多不会出现在这个频段中。从喇叭的分频点中,我们可以发现到这段频域全部都出现在高音单体中。如我前面所言,当您将耳朵靠近高音单体时,您所听到的不是乐器的声音,而是一片嘶嘶声。从高音单体的表现中,可以再度证明高音单体几乎很少发出乐器或人声的基音,它只是发出基音的高倍泛音而已。

极高频

从5120Hz-20000Hz这么宽的频段,我称之为极高频。各位可以从高频就已经很少有乐器出现的事实中,了解到极高频所容纳的尽是乐器与人声的泛音。一般乐器的泛音大多是愈高处能量愈小,换句话说,高音单体要制造得很敏锐,能够清楚的再生非常细微的音。从这里,发生了一件困扰喇叭单体制造的事情,那就是要如何两全其美?什么是“两全”?您有没有想过,假若一个高音单体为了清楚再生所有细微的泛音,不顾一切的设计成很小的电流就能推动振膜,那么同样由这个高音单体所负责的大能量高频与中频极可能就会时常处于失真的状态,因为这二个频段的能量要比极高频大太多了。这也是目前市面上许多喇叭极高频很清楚,却容易流于刺耳的原因之一。您还记不记得以前的Spentdor SP-1喇叭?它是三音路设计,那三音路呢?中低音单体、高音单体、超高音单体三路。那个超高音单体负责13000Hz以上的频率。我记得当时有许多人都“不解”,为什么SP-1有超高音单体,而声音却是那么的柔呢?应该要很锐利才对呀!现在我想您该了解了吧!SP-1设计着眼点在于使高音单体不会失真,而又能再生极高频。这就是SP-1听起来很舒服,具有音乐性的原因之一。了解了高、中、低频段的分段法之后,我们接着要讨论量感之外的“控制力”。量感当然是指量的多寡,即是我们说的:高音比较多、低音比较少等。而控制力通常多指“对低频段与高频段”的控制力。有些器材低频松散,有些则具有弹性。我们会说后者有低频的控制力。有些器材能够抓得住高频,让它不会飙得耳朵难受,我们说它高频控制力佳。请注意,各频段量感的多寡并不代表器材真正的好坏,器材之间量感多寡的相互搭配才是重要的。而控制力的好坏就可以说是器材本身的优、劣。

音响第四要:音场表现


“音场”到底是什么?在美国,“Sound Field”与“Sound Stage”是二个名词。“Sound Field”泛指整个声音充塞的空间;“Sound Stage”特指舞台上乐队的排列(包括宽、深、高、低)。在台湾,我们所谓的“音场”其实是指“Sound Stage”而言,因为无论是“声音的舞台”或“音台”都无法让人望文生义。至于“Sound Field”,我们早已用另外一个名词代替,那就是“空间感”。因此,当我们提到“音场的形状”时,就是指您的器材所再生的乐团排列形状。由于受到频率响应曲线分布不均匀以及喇叭指向性、房间声波反射条件的影响,有些音场是内凹形的、有些是宽度大于深度的;有些是深度大于宽度的。有些音场形状就是四四方方,没有内凹的。这种声音舞台不同形状的再生,我称为音场的形状。最好的音场形状当然要与录音时的原样符合。在此我要提出一个值得注意之处:现场演奏时的录音,其乐团的排列是宽度大于深度的;但在录音室中,往往为了音响效果,乐团的排列方式会改变,通常纵深会拉长,尤其是打击乐器会放得更远一些。如此一来,就不是我们在音乐厅中所见到的排列。,挑剔的读者以及评论员们不可不察。


音场位置


除了“形状”之外,音场还有“位置”的问题。这里面包括音场的前、后、高、低。有些器材会使整个音场向聆听者逼近;有些则后退。有些音场听起来会觉得浮在半空中;有些则又像坐在音乐厅的二楼看舞台一般。会形成音场位置的原因很多,像喇叭的摆位与频率响应的均匀与否皆为重大影响因素。一个理想的音场位置应该如何呢?低音提琴、大提琴的声音应从较低的地方出来,小提琴的位置比低音提琴及大提琴高;如果录音时乐团有前低后高的排列时,音场内也要有前低后高的模样出现。像铜管就极有可能位置较高。至于整个音场的高度?常您坐着时两眼平视的高度应该是音场的略低高度。换句话说,小提琴应该在视线以上,大提琴、低音提琴应在视线下。铜管至少要与小提琴等高或更高。至于音场的前、后位置应该在那里?应该在“喇叭前沿一线”开始往后延伸。当然,这种最理想的音场位置不容易求得,因为它与聆听软体也有极大的关系。通常,从喇叭后沿一线往后延伸比较容易求得,不过,不能“后缩”得太多。


音场的宽度


常常听到发烧友夸口:“我的音场不只超出喇叭、宽抵二侧墙,甚至破墙而出。”这句话在外行人听来,简直是天方夜谭。在我听来,则仅是有点夸张而已。我想许多音响迷都有这种经验,不必我再多费唇舌。一般而言,音场的宽度可以宽抵侧墙。至于破墙而出,那恐怕就要靠一点想像力了。至少,以我而言,我要“用眼睛能够看得到”音场在那里才算数,墙外的东西我看不到,我不能肯定它在那里。所以,我的音场宽度其实在只在我的墙壁之内而已。


音场的深度

这就是我们平常所说的“深度感”,现在我把它归于音场的深度。为什么不像以前一样,将它与层次感、定位感并列呢?因为层次与定位谈的不是音场,而深度感却仍属音场的范围之中,所以,我将它改成“音场的深度”而不以“深度感”称之。与“音场的宽度”一样,许多人会说他家音场深度早已破墙而出,深到对街。这当然也仅是满足自己的形容词而己。真正的“音场深度”指的是音场中最前一线乐器与最后一线乐器的距离。换句话说,它极可能是指小提琴与大鼓、定音鼓之间的距离。“宽到隔邻、深过对街”这应该是包含在后面说的“空间感”中。有些器材或环境由于中低频或低频过多,因此大鼓与定音鼓的位置会前冲,此时,音场的深度当然很差。另有一例,有些音场的位置向后缩,结果被误以为音场的深度很好,那是错误的。我相信,您只要把握住“小提琴到定音鼓、大鼓之间的距离”这句话就不会错了。

音响第五要:声音的密度与重量感


所谓声音的密度就像一公斤棉花与一公斤铁块一般,铁块的密度当然要大得多。因此虽然二者重量相同,不过铁块给予人的重量感就要大得多。声音密度大听起来是什么感受呢?弦乐有黏滞感、管乐厚而饱满、打击乐器敲起来都会有空气振动的感觉。所有的乐器与人声都应具有重量感。不过,大部份的音响迷都得不到很好的声音密度与重量感。这种感觉我推测与供电的充足及中频段、低频段的饱满有关。声音的密度与重量感好有什么好处呢?让乐器与人声听起来更稳更扎实更像真的。

音响第六要:透明感


透明感几乎是一个只可意会、不可言传的名词。有些器材听起来澄澈无比,有些则像蒙上一层雾般,只要是有换机经验的人一定就有这种感觉。透明感是“音响二十要”中很重要的一个环节,因为如果透明感不佳的话,连带也会影响对其余各项的判定。最好的透明感是柔和的,听起来耳朵不会疲劳;较差的透明感像是伤眼的阳光,虽然看得清楚,但很伤神。大部份的音响器材无法达到既清楚又柔和的透明程度,而只能单单表现清楚而已。如果能够达到“清楚又柔和”,那么该件器材的价值恐怕也不低了。

音响第七要:层次感


层次感很容易了解,它是指乐器由前往后一排排的间隔能否清楚再生。以电视而言,深灰与黑能够分辨出来的话就是有层次感。音响亦然,乐团的排列不会混在一起就是有好的层次感。更甚者,我们要听到乐器与乐器之间的空间,这样才会有最好的层次感。

音响第八要:定位感


顾名思义,定位感就是将位置“定在那里”。聚焦不准定位感就差,结像力不佳定位感就不行,器材的相位失真也会导至定位的漂移;甚至空间中直接音与反射音的比例不佳(一般指高频反射太强)也会导至定位不准。举一个例子:夏天很热时,柏油路上会冒气。此时如果您走在路上,就会觉得物体的影像会飘。这就像我们音场内乐器定位会飘移的情形。如果您有散光而忘了戴眼镜,那也是定位感不好的具体表现。总之,定位感不佳可能由许多原因造成,我们不管它是怎么形成的,我们要求的是乐器或人声要浮凸而清楚的“定”在那里,不该动的时候就不要动,不该乱的时候就不能乱。

音响第九要:活生感


所谓活生感可以说是暂态反应、速度感、强弱对比的另一面。它让您听起音乐来很活泼,不会死气沈沈的。这是音乐好听与否的一个重要因素,就好像一个卓越的指挥家能把音乐指挥得充满生气;而蹩脚的指挥往往将音乐弄得死气沈沈的。这就是音乐的活生感。



音响第十要:结像力与形体感


顾名思义,结像力就是将虚无飘渺的的音像凝结成实体的能力;换句话说,也就是让人声或乐器的形体展现出立体感的能力。在以前,我把它归入“形体感”中。后来我仔细思考过,认为用结像力能包容更完整的意思,所以现在将之改为结像力与形体感。结像力好的音响器材会让音像更浮凸,更具有立体感。也就是我常说的音像轮廓的阴影更清楚。

音响第十一要:解析力


这个名词最容最懂,玩过相机的人都知道镜头解析力好坏的差距;看电视的人也知道自己的电视能把一片黑色的头发解析得丝毫不混就是解析力好的表现。好的音响器材,即使再细微、再复杂的东西都能清楚的表达出来,这就是解析力。其实,细节多与暗部层次清楚也是解析力产生的结果,这就好像空间感也可合并入音场来讲一样。但是解析力并不能代表所有的细节再生与层次感。例如由前往后一排排的层次感就不是全由解析力造成的;再者,如果真的将层次感并入解析力,那就无法对单项的名词做明确的解释。因此,我在此都尽可能分开来说,读者们只要知道“音响二十要”之间彼此都有难以分割的关系就可以了。一般而言,如果细微的变化(低电平时)都能表现得很清楚,那么这件器材的解析力当然很好。既然有低电平时的解析力,那么有没有高电平时的解析力呢?当然有!在极端爆棚时能将所有东西解析得很清楚,那就是高电平的解析力。



音响第十二要:速度感与暂态反应


其实,速度感就是暂态反应的结果,也是器材上升时间与回转率的具体表现。老外通常会将这项说成是暂态反应而不说速度感。不过,台湾习惯的用语是速度感。对于老中而言,速度感要比暂态反应更容易了解。基本上,这二个名词都是指器材各项反应的快慢而言。我想,在此就不必多做解释了。



音响第十三要:强弱对比与动态对比


强弱对比也可以说是老外所说的动态对比,也就是大声与小声之间的对比。一般而言,强弱对比也可以分为“对比强大”的强弱对比与“对比极小”的强弱对比。我们常说古典音乐的动态很大就是指它最大声与最小声的对比很大;而摇滚乐虽然大声,但是它大小声的起伏并不大,所以我们说它虽然大声,但是动态对比并不大。什么是对比极小的动态对比呢?也就是强弱很接近的细微对比。这种细微的强弱对比就像水波荡漾般,远远看好像不动,近看才知道它是一直细微的在波动。强弱对比用最浅显的说法应该是这样的:极大的强弱对比是拍打岩岸的海浪;极小的强弱对比就是清风吹拂下的湖水波动。

音响第十四要:乐器与人声的大小比例


到底乐器的线条、形体要多大才算对?到底人声要一缕如链?还是要丰润有肉?这个问题一直在困扰着音响迷。理想主义者认为应该按实际乐团大小比例缩小放入家中聆听室。事实上,这是不可能的。我举一个最简单的例子好了。当钢琴与小提琴在演奏奏鸣曲时,钢琴的形体不知道要超过小提琴多少倍(音量亦然)。如果在录音时不增加小提琴的音量,小提琴往往被钢琴掩没(现场音乐会往往就是如此)。所以在录音时,录音师都会刻意平衡一下小提琴的音量。再来说到整个管弦乐团与小提琴做协奏演出时,如果完全按比例缩小,那么小提琴的音应该要细小得不能再细小,而不是我们在CD上所听到的那么清楚、强劲。所以,正确的“乐器与人声大小比例”不是一味的照章缩小,而是按照合理的音乐要作大小比例。乐器如此,人声亦然。其实,乐器与人声的大小比例最值得注意的不是比例缩小与否的问题,而是因为频率响应曲线扭曲所造成的误解。例如您的房间在100Hz左右有严重峰值的话,定音鼓敲起来一定会特别的大、特别有劲;大提琴、低音提琴亦然。这才是真正错误的比例。所以,在评写“乐器与人声的大小比例”时,应该特别注意频率响应曲线扭曲所造成的影响。



音响第十五要:乐器与人声的质感、空气感


“质感”这个名词相当抽象,我们常说这家俱的木头质感很好、这套真皮沙发的质感很好;或这个大理石的质感很好。从这个例子中,我们可了解,所谓“质感”京是指该物体“材质的本性”。不过,我们在此说的并不是音质的那个质感,而是乐器演奏、打击接触那一刹那动作所发生的质感。因此,当我们在说:“小提琴的擦弦质感很好”,就意谓着“它录得很像小提琴”。当我们说:“钹的敲击质感很好”,也就是说“它敲起来像真的”。反过来说,当我们认为“小提琴擦弦质感不够”时说的就是“它不像真的”。由此,我们可以很清楚的了解到,所谓质感也就是指“传真度”。雷射唱盘刚推出时,大家都觉得小提琴的声音不像,就是指它的擦弦质感不像。而“形体感”则更容易了解,当我们听单簧管吹奏时,我们说它的形体感真好,那也是“传真度”的一种。总之,质感与形体感皆是“传真与否”的代名词。至于“空气感”又是什么呢?当我们在形容拉奏、敲击键盘乐器时,我们用的是“某某乐器的质感很好”。可是,当我们在形容管乐器时,我们通常不用“质感”二字,而用“空气感”,也就是说吹气的感觉。说得更清楚些,“空气感”是指声波振动的感觉,而质感大部分是“接触”后刹那的感觉。当然,弦乐群除了拉奏时的擦弦质感外,它同时还有弦乐空气中产生的“空气感”。


音响十六要:细节再生


细节大概是泛指乐器的细节、堂音的细微再生与录音空间中所有的杂音。一件音响器材细节再生的多寡很容易经由AB Test比较出来。为什么有些器材所再生的细节较多呢?我想这与低失真、高讯噪比、高灵敏度、解析力、透明感等都有关。细节少的器材听起来平板乏味:细节多的器材起来趣味盎然。一件优秀的音响器材,其细节的再生当然是丰富无比的。

音响第十七要:空间感


我常常说,如果一套音响系统(包括器材与空间)能够“使音场浮出来”,那么它一定也“可以看到”空间感。请注意,我是用“看到”而非“听到”。真正表现好的音场与空间感绝对是可以“看到”的,而非仅“听到”而已。什么是空间感?那就是录音场所的三度空间实体大小。要能够将空间感完全表现出来,绝佳的细节再生是绝对需要的,尤其是“堂音”的再生。我甚至可以说,如果听不到完整的堂音,那么“空间感”也无法完整的再生出来。什么又是“堂音”?堂音与“残响”往往又被混淆不清。大部份人误认“堂音”就是“残响”。其实,这是二种不同的东西。堂音的英文是Ambience,残响的英文是Reverberation。Ambience原意是指周围、环境或气氛,后来被引申为音乐厅中的堂音。从“气氛”二字,我们就可了解它是指包围在我们周围的音乐细节。除了感性的意义之外,Ambience另有一个理性的解释,那是狭隘的指传入耳朵的第一次反射音。换句话说藉由第一次反射音与真接音的时间延迟,我们可以“感受到”音乐厅空间的大小。因此,如果我们无法在软体中听到堂音的话,我们便无法“看到”空间感?“残响”在一般的解释中,当然也可以说是反射音。但是,残响有一个更严苛的时间定义,那就是指一个猝发音发生之后,声音的能量衰减到原来的百万分之一(60dB)的时间长度。换句话说,通常我们会说:“这个音乐厅的残响真丰富、真美”,而应该说残响较长较短。反过来说,我们也不应该说:“这个音乐厅的堂音太短”,而应该说:“这个音乐厅的堂音真丰富、真自然”。



音响第十八要:整体平衡性


每件音响器材都和指挥在控制乐团一样,应该求得一个整体的平衡性。这就好比一个乐团中,人人皆是独奏的高手,但是每一个人都想出锋头,不听指挥的诠释,如此一来虽然个别演奏水准高,但是乐团的整体平衡性一定很差。这样就不是一个好乐团。同理,一件音响器材的前述十七项要素都非常好,但是如果无法把这十七项要素做一个精妙的平衡,那么也一定不耐久听。此时,不管解析力再高、强弱对比再好也没有用。关于这项,我们无法用尺度去度量出来,要分辨整体平衡性就像多听音乐会才能分辨乐团好坏一般,祗有靠自己丰富的聆听经验来判断了。除此之外,整体平衡性说的还有高、中、低频段的适当量感分配。例如我们所说的低频基础要好就是其中之一。所谓低频基础就是低频段在整个音乐里造成的稳固、稳定的状态。大部份的音乐迷都希望音乐是很厚实、丰润的,而不希望高频多过中频、低频,而造成头重脚轻的情况。这种合理的高、中、低频段量感也就是我所说旳整体平衡性。整体平衡性好的器材听起来就会耐听,这也就是一般人所说的音乐性。在此顺带一句,当您在做喇叭摆位时,首先要得到的就是整体的平衡性。千万不要为了音场表现,而牺牲了雄厚的中频与低频。我的意思是:如果您的喇叭离墙太远时低频会不足,那么就应该让喇叭靠墙摆。

音响第十九要:器材个性


每件音响器材都和人一般,有着自己的个性。有些器材听起来像绅士,有些像火爆浪子;有些温柔得像淑女,有些又热情得像卡门。由于个性不同,因此,在搭配上也就必须如婚姻大事一样,慎重其事。二件火爆脾气的器材配在一起一定让您难以消受。反之,二件温吞水、慢郎中配在一起也要急死您。所以,器材个性的认知绝对是必要的。在此我必须郑重的告诉读者们,根据我长期试听音响器材的经验,我认为器材本身个性上的差异要大过各器材之间真正品质的差异。也就是说,一般读者们所认为的器材好坏往往可能是不同个性搭配下所产生的个人好恶而以,真正器材的好坏往往被个性所掩盖。因此,深入的了解器材的个性是有其绝对的必要性。如果您不了解器材个性,当然也就无法做合适的搭配。这样一来,声音要好听就难了。



音响第二十要:搭配上的推荐


这“第二十要”是特别为评论员而写的。一个负责任的音响器材评论员应该就他自己丰富的经验,向读者推荐适合的搭配组合,否则,读者枉费看了前十九要,却因自己缺乏其他器材的个性资料或搭配经验,到头来仍然不知该项被评器材到底要如何搭配周边器材。对于评论员而言,这是为德不卒。所以,当您写完十九项要素之后,一定不要忘了,为读者推荐适合的搭配组合。我再次强调,不当的器材搭配往往比器材本身的好坏影响更大。不仅是一般音响迷,就是连音响评论员也经常会因为不当的搭配而误解了器材本身的真正能力,这是很遗憾的事。其实,任何一位评论员只要听得愈多,就愈不敢为一件器做黑与白、好与坏的二极化评语。因为在这二极之间往往还存在着许多可能性。所以,听得愈少的人愈肯定二极化的答案。这就好像小孩子在看电影时最喜欢问大人:爸爸!那些是好人?那些是坏人?为了减少犯错的机会,评论员在聆听器材时一定要先做多方的搭配,然后再将自己的搭配推荐告诉读者。

结语


看完上述“音响二十要”,我相信有些人会认为太繁琐了,但是,为了提升音响器材评论文章的水准,为了让读者有明白的脉络去判断音响器材的优劣,我认为完整的写完或看完这二十要是必需的。有了这“音响二十要”,评论员们不致于天马行空,读者们也不再一头雾水。这样,音响迷才能享受到既理性又感性的音乐与音响生活。

[ZT]教你几招买音响

当您准备为自己添购一套音响时,您是相信广告、导购人员、还是自己的耳朵呢?千万记住,您的耳朵也有被欺骗的时候!当导购人员为您播放一首首动听的乐曲时,当您正在为扬声器中传来的逼真人声、摔玻璃声、中鼓沉重的低音感动时,您是否怀疑过自己的耳朵呢?您还能对眼前的音响提出疑问吗?要是您在这一瞬间决定购买,那我可以告诉您!您的决定往往是错的(我说的是“往往”)。因为导购人员正在误导您,这是音响导购人员贯用的促销手法。他们给您播放的是经过特殊音效处理的碟片(可能是刻录的,但音效一样迷惑性很强)。即使很烂的音响也可播放出这种效果,某某进口大片DVD片段等,一样具有很大的欺骗性。

什么样的音响才是好音响呢?价格高的就好吗?名牌就一定好吗(某国产合资名牌,实际试听大跌眼镜)?功能全的就好吗?先进的就一定好吗(24bit-192khz要是没有严谨的外围电路保障也可能做出极烂的产品来,相反16bit-44.1khz做好了照样出顶级天机)?数码的就一定好吗(全数码d类功放音质平庸,有目共睹)?眼观、手摸、耳听(最重要),根据生活居住环境及经济承受能力及个人爱好来作参考。用来听音乐就要买纯功放,看电影就要买家庭影院功放,细心挑选也能鱼与熊掌兼得。客厅用买落地音箱,书房用买书架音箱。外观时尚漂亮的不一定品质好,时尚的外观只能讨好那些好色的门外汉。当然要是能内外兼修,好品质加好外观就再好不过了。

买音响记得带上您熟悉的片子(普通CD就可以,最好是正版的或深圳某某公司的HDCD,我试过,品质都不错)。看功放说明书,最好带解码的(即数字接口:如光纤、USB、同轴输入),有的只有模拟接口也带解码,我是不明白,既然是模拟输入,带解码又有何用,有嫌疑。功放带解码可避免DVD或CD音质的不确定因素,绝大多数普及版DVD或CD音质不敢恭维,屡试不爽。打开功放电源,几分钟后用手模外壳温热为佳(说明功放的静态电流较大,纯功放外壳温度更高),隔着散热窗往里看,能否看到硕大的变压器和电容器(不懂可用手掂重量,通常份量大的更好些)。

音箱挑选也有讲究,外壳材料上有原木的、有高密板贴皮的、有塑料的,喇叭单元有进口、国产、有防磁屏蔽的、有双磁铁的、单磁的,有合金铁磁的、有稀土磁的。纸盆有化纤的、纸的、有羊毛的、还有多材料混合的。结构上有落地箱、书架箱、带侧低音的、不带侧低音的、正低音的、背低音的,分频网络有二分频、三分频、多分频等,通常原木音箱(有人认为原木音箱不如高密板音箱好听,但价格肯定是原木箱贵很多)、防磁双磁喇叭单元(特别是电脑音箱)、羊毛纸盆、正低音、三分频器要好些。可根据个人喜好、经济条件选购。一般结构紧凑、严密、平衡、无明显外观瑕疵就可,至于材质都装入箱中,想看也看不到,只能用您的金耳验收。但我个人认为功放才是一套音箱的基础,没有好的功放,再好的音箱也没用,功放本身充斥噪音、失真,再好的音箱又有何用,所谓:“问渠哪得清如许,为有源头活水来”。所以选购昂贵的音箱请谨慎,以免金钱被谋杀(高烧友本身功放品质一流,只是嫌音箱味道不够者另当别论)。相反,好的功放却可配合一般的音箱出靓声。当然,若能专业选配效果更好,但需先进的声电仪器设备及丰富的经验。

接下来就是最关键的用耳验收的阶段了,首先接好光纤线或别的接口,把功放音量开最大,把DVD或CD音量也开最大(千万记得先把DVD或CD按暂停,否则当心您的耳朵),把耳朵贴近喇叭,此时应听不到任何声音从喇叭中传出。以此证明您要的功放有足够的信噪比(采用1bit解码芯片的功放尤为重要)。关小音量电位器,播放您熟悉的音乐(自带的片子比较好,有小提琴、中鼓、钢琴、人声、交响乐等的,但不要用那些专业处理过的试音碟),慢慢品味。以不亢不卑。不软不硬,高音细腻撩人,中音饱满宽广,低音结实深厚为佳,播放弦乐流畅无毛噪感。那些对高低音过度的渲染都是不对的,有时您可能被夸张的声音吸引,但长时间的聆听下去却觉得乏味、刺耳、厌烦,这就是好音响与不好音响之差别,好的音响只制造音乐,差的音响制造音乐的同时也制造噪音。

当您发现平时并不觉得好听的音乐突然变得清晰明亮,绕梁不绝,聆听到了平时听不到的声音时就对了。好音响十分耐听,越听越好听,听女声如泣如诉、男声嘹亮婉转、童声像小手轻抚您的肌肤,弦乐如大珠小珠落玉盘,管乐直冲云宵,打击乐如排山倒海,直到耳孔流油。

我的一次亲身经历让我领略到好音响无穷魅力,去年我花不多钱买了某某牌音响回家接好线细细品位,刚好那晚女同事来访,闲聊间谈到音响,隧播一段梅艳芳唱的歌曲,开始播的是“一生爱你千百回”然后播“想得开”“女儿红”,女同事侧过脸去,播到“女人花”快完时再看女同事已是泪流满面,抽泣不已。事后她告诉我说她听十几年音乐从没如此感动过,梅艳芳细腻的声音如在耳边倾诉,背景很细微的乐器声都清晰可辨,气氛太好了,自己也是女人,真想痛哭一场。我愕然
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#409

帖子 243750496 » 2017-09-19 22:10

新奇花卉列表
多肉植物/生石花:
拉灯/红、绿灯泡/SH531 生石花
SH1200 生石花
五十铃玉 生石花
翠滴玉 生石花
翡翠玉 生石花
兔儿 生石花
爱心 生石花
马哈/汉尼 肉锥花
玉露
石莲花
虹之玉/玉米石
佛手(绿色的植物)
金华佛手(接金色果的树)
食虫植物(请在淘宝小虫草堂订购):
巨夹捕蝇草
G16捕蝇草
食人鱼捕蝇草 有绿的和紫的 最好要紫的
猪笼草
勺叶茅膏菜
好望角茅膏菜 白(绿杆白毛) 红(全红) 普通(绿枝干红毛)
洛弗丽茅膏菜 秋天通红
孔雀茅膏菜 天生就红
锦地罗茅膏菜
丝叶茅膏菜
阿帝露茅膏菜
苹果捕虫堇 最大15cm
爱丝捕虫堇
爱兰捕虫堇
巨大捕虫堇 能长到30厘米其他最5 6cm
弗洛里捕虫堇 注意是弗洛里不是洛弗丽
各种狸藻(其中金花/黄花狸藻是水盆里养能食虫)
猩红瓶子草
土瓶草
丝叶彩虹草 一种长得很快的并不好看的食虫植物
芳香植物/开花植物:
夜来香 花 香
马薄荷/美国薄荷 花 香
柠檬猫薄荷 香 柠檬味
柠檬香蜂草 香 柠檬味
胡椒薄荷 香 普通薄荷香
巧克力薄荷 香
葡萄柚薄荷 香 有柚子香
苏格兰薄荷 香
猫儿脸 花
金鱼草 花
金鱼花 花
驱蚊草 花 香
迷迭香 香
猫薄荷/香荆芥 花 香
碰碰香 香
日日春 花
金银花 花
水仙花 花
藏红花 花
鼠尾草 花
藿香正气草 香
百里香 香
三色旋花 花
气球花 花
羽叶茑萝 花
草原松果菊 花
风铃草 花
瓜叶菊 花
紫盆花 花
甜味香雪球 花
蒲包花 花
柠檬草 香
波斯菊 花
雏菊 花
荷兰菊 花
可爱
太极豆
小孩瓜
飞碟瓜
水果玉米
水果黄瓜
羽扇豆
甜叶菊(叶子是甜的)
跳舞草(夏天叶子会随着音乐转动)
蛇莓
菠萝莓 吃起来有菠萝味的白草莓
黑巴克 黑草莓
水生植物:
铜钱草
碗莲(可在碗里种植):
海尔芙拉
冰娇
蓝宝石
彼得
霞光
金色年华
瑰丽
树木:
梅花
红豆杉
吊钟花
树莓
蓝梅
常绿植物:
豆瓣绿
吸毒草
龙骨
仙人掌:
玉翁
金丝猴
地肤
救心菜
佛甲草
蔬菜:
白芹
紫叶甜菜
油菜
绿番茄
以色列进口红番茄
日本小叶香菜
红提葡萄
虫药:
吡虫啉
地虫光/辛硫磷
多菌灵
园艺工具
迷你三件套
温湿度计
土:
小虫草堂食虫植物专用土(不推荐最好自己用下面的配)
泥炭
珍珠岩
赤玉土
植金石
蛭石
水苔
木屑
肥料
花木营养液
硝酸钙
硫酸钾
过磷酸钙
磷酸二氢钾
花多多10 12号 (小虫草堂独家)
生长调节剂
生根粉(生根)
赤霉素(催芽)
矮壮素(抑制长高)


收藏花卉
羽叶薰衣草
柠檬马鞭草
洋甘菊
香蜂草
欧石楠
玳玳花
红巧梅
洛神花
甜叶菊
野菊花
一点红
紫背菜
菊花菜
藤三七
四籽马蓝
珍珠菜
苦菜
宝塔花
富贵菜
白背三七
鸡毛菜
佛手瓜
羽衣甘蓝
益母草
七叶一枝花
猫爪草
夏枯草
筋骨草
酢浆草
波斯婆婆纳
狗牙根
冰草
画眉草
狼尾草
猫尾草
红三叶
红三叶草
蓝茉莉
蝴蝶草
银合欢
猪屎豆
柠条
沙冬青
半日花
星叶草
翠雀
嚏根草
八宝景天
金娃娃萱草
花叶玉簪
紫露草
黛粉叶
合果芋
花叶冷水花
红花酢浆草
葱兰
二月兰
花烟草
绣线菊
银露梅
山樱桃
小冠花
籽粒苋
田菁
沙打旺
水果蓝
山桃草
日本血草
蜘蛛兰
鹅掌柴
龙船花
红背桂
金焰绣线菊
红叶小檗
龟甲冬青
金丝桃
喷雪花
醉鱼草
太平花
火星花
串叶松香草
紫花苜蓿
燕麦草
红三叶
韭兰
金叶女贞
榆叶梅
金银花
无毛紫露草
金边麦冬
白车轴草
蝎子草
虎刺梅
伏牛花
令箭荷花
仙人鞭
量天尺
仙人柱
麒麟掌
青锁龙
不夜城芦荟
百日草
蜡菊
针叶火绒草
唐菖蒲
小叶三点金草
悬崖菊
大丽花
石蒜
吉祥草
郁金香
中国芦荟
开普芦荟
皂质芦荟
翠叶芦荟
珍珠芦荟
黄毛掌
白檀
文竹
假叶树
五色草
彩叶草
霸王鞭
一品红
时钟花
三色堇
四叶草
花叶芦竹
吉祥草
卷丹百合
毛百合
川百合
山丹百合
台湾百合
崂山百合
麝香百合
香水百合
卷丹
黑种草
豹子花
大丁草
山丹花
艳红鹿子百合
花叶玉簪
翠雀 马蔺
地被菊
黄金菊
大滨菊
火炬花
紫叶草
金盏菊
香菊
沿阶草
银叶菊
金叶景天
紫斑风铃草
梅花草
花锚
柳兰
山刺玫
天蓝苜蓿
南苜蓿
麦秆菊
天人菊
欧洲报春花
美国石竹
高山积雪
蛇目菊
金鸡菊
蜀葵
勋章菊
南非万寿菊
波斯菊
琉璃苣
对叶香豌豆
金线莲
孔雀草
小丽花
福禄考
勿忘我
剪秋罗
药百合
红叶甜菜
茑萝
玩具南瓜
獐耳细辛
耧斗花
延龄草
沙冬青
嚏根草
凤凰木
露兜树
红三叶
结缕草
马蹄筋
冰草
红三叶草
石荷叶
开运竹
虎耳兰
金钱树
八角莲
鸡血藤
凌霄花
朱槿花
含笑花
夜合花
紫藤萝
洛神花
甜叶菊
玳玳花
欧石楠
洋甘菊
山金车
藤黄果
红巧梅
神香草
香水草
鼠尾草
柳叶马鞭草
大滨菊
地涌金莲
肥皂草
喇叭水仙
剑叶金鸡菊
花葵
黑心菊
松果菊
草原松果菊
翠菊
白菊花
贡菊
杭菊花
蓍草
钓钟柳
胡椒薄荷
荷兰薄荷
水薄荷
柑橘薄荷
虾夷葱
牛至
荷兰菊
春芋
龟背竹
棕竹
巴西木
绿宝石喜林芋
八角金盘
艳山姜
滴水观音
铁树
琉璃苣
剑兰
非洲菊
茱萸
蓝雪花
翠花掌
天门冬
春黄菊
虎刺梅
马齿苋树
兔耳草
紫花猫薄荷
凤仙花
龙舌兰
蟹爪兰
剑兰
米兰
蕙兰
春兰
三角梅
玻璃翠
子花
茉莉花
紫茉莉
地雷花
夜来香
太阳花/大花马齿苋
紫罗兰
蝴蝶兰
琼花
灯笼花
海棠 丁香
月桂
沙棘
依米花
彼岸花 豹皮花
金茶花
山茶花
天山雪莲
昙花
箬竹
佛肚竹/罗汉竹
苦竹
斑竹
宝华玉兰
杜鹃花
清香木
罗勒
五色梅
薰衣草
银边天竺葵
蝴蝶花
兔耳草
兔耳兰
猫耳朵草
垂吊天竺葵
铁线蕨
小叶万年青
清香木
琼花
微型葫芦
旱金莲
蒲苇
铁树
喇叭花
蔷薇
虎眼万年青
瓶子草
天目琼花
生石花/肉锥花
忘忧草/萱草/黄花菜
红豆草
虎皮兰
待雪草/雪花莲
捕虫堇
降落伞花
木香薷
鱼香草
虎皮兰
富贵竹
滴水观音
龟背竹
缤郎芋/荔浦芋头
琉璃苣
蓝蓟
太阳花/松叶牡丹
硫华菊
矢车菊
大花藿香蓟
五瓣梅/长春花/日日春
花环菊
虞美人
罗马甘菊
鸢尾花
花毛茛
花毛茛
枸杞
迎春花
六倍利
常夏石竹
桔梗
麦秆菊
欧洲报春
春黄菊
醉蝶花
蝴蝶花
飞燕草
附地菜
鸭舌草
蝶豆
悬星花
紫叶草
海州常山
鸳鸯茉莉
金露花
凤仙花
虎耳草
石莲
天人菊
草原松果菊
酸浆
迎春花
君子兰
金边吊兰
仙客来
万年青
栾树
合欢树
金合欢树
红豆杉
金钱树
幸福树
发财树
佛手花
佛手掌
金盏菊
夜合花
紫露草
葱兰
米兰
香雪兰
风信子
马蹄莲
铃兰
袖珍椰子
非洲红茄
小可爱多黄瓜
珊瑚豆
八千代
香蕉草
火祭
风雨兰
酸浆
银苞菊
紫盆花
勋章菊
花菱草
千日红
水果玉米
春黄菊
金绣球
香矢车菊
硫华菊
珊瑚豆
落地生根
金冠仙人球
玉翁仙人球
裤裆果
朱砂根
覆盘子
裂叶喜林芋
紫叶鸭跖草
绿帝黄
桃叶珊瑚
光触媒
蒲葵
银波锦
海葱
酒瓶兰
旱伞草
芭蕉
构树
火棘
紫色鸭拓草
报春花
雪片莲
接骨木
八仙花
鸡蛋花
算盘子
宝塔花
爆仗竹
含笑
珊瑚豆
秤锤树
金合欢
凤眼莲
大叶莲花掌
十二卷
绿萝吊兰
珍珠吊兰
垂盆草
玉扇
老花农-FB039花仙子花种
花卉种子
观果系列-小可爱多黄瓜
水果玉米
老花农-B013花仙子花种
花卉种子
观果系列-顽皮小孩
金莲花
老花农-花卉自动浇花器 浇水器 渗水器
金盏菊
夜合花
紫露草
葱兰
米兰
香雪兰
风信子
马蹄莲
铃兰
袖珍椰子
非洲红茄
小可爱多黄瓜
珊瑚豆
八千代
香蕉草 火祭
风雨兰 酸浆
银苞菊
紫盆花
勋章菊
花菱草
千日红
水果玉米
春黄菊
金绣球
香矢车菊
硫华菊
珊瑚豆
落地生根
金冠仙人球
裤裆果
朱砂根
覆盘子
裂叶喜林芋
紫叶鸭跖草
绿帝黄
桃叶珊瑚
光触媒
蒲葵
银波锦
海葱
酒瓶兰
旱伞草
芭蕉
构树
火棘
紫色鸭拓草
袖珍椰子
报春花
雪片莲
接骨木
八仙花
鸡蛋花
算盘子
宝塔花
爆仗竹
含笑
珊瑚豆
秤锤树
金合欢
凤眼莲
大叶莲花掌
十二卷
绿萝吊兰
珍珠吊兰
千日红
垂盆草
玉扇
老花农-FB039花仙子花种
花卉种子
观果系列-小可爱多黄瓜
鸡蛋茄
水果玉米 老花农-B013花仙子花种
花卉种子 观果系
列-顽皮小孩
金莲花
老花农-花卉自动浇花器 浇水器 渗水器
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#410

帖子 243750496 » 2017-09-26 21:01

男女通用化妆品及化妆术语说明&使用方法

小米90分金属旅行箱
https://detail.tmall.com/item.htm?id=53 ... 1433:32652

LG竹盐按压式牙膏
https://detail.tmall.com/item.htm?id=54 ... dmg8j26111

先水、中乳,最后油
当你分不清是该先用哪个后用哪个时,就先看一下该护肤品的质地,如果是水质的,就一定比乳霜质的先用,而油质的通常都用在最后。这一方法可以依次用在确定一整套护扶品的顺序,以及同种产品,如同样两款以上面霜的使用顺序上。

如果你先用了霜状的滋润度较高的产品,涂用后会在肌肤外层形成一层保护膜,那么分子较小的水状、精华液类的产品就很难再被肌肤吸收,更谈不上发挥作用了。研究发现精华液的细小分子若能达到肌肤的底层,所携带的养分可高达88%;而油类的大分子产品,大多在肌肤表面发挥作用,所携带的养分只有6%左右。

使用顺序
按特性:
化妆水--精华液--凝胶--乳液--乳霜--防晒霜

按类别
洗面奶(清洁1)--爽肤水(清洁2+补水1)--乳液(进一步补水2)--隔离霜(低级别防晒)--防晒霜(高等级防晒)

精简:面霜,隔离(可选),防晒

套装:
0硅油蓬松洗发水+0硅油蓬松泡沫护发素
https://detail.tmall.com/item.htm?id=55 ... d0ltsk00e9
单个购买:
0硅油蓬松洗发水
https://detail.tmall.com/item.htm?id=55 ... dmg8j26111
0硅油蓬松泡沫护发素
https://detail.tmall.com/item.htm?id=55 ... dmg8j26111
醒发水(专治各种醒后的各种翘头发)
https://detail.tmall.com/item.htm?id=52 ... dmg8j26111
护发精油(进一步处理各种醒后的各种翘头发)
https://detail.tmall.com/item.htm?id=54 ... 9394229849
无香味男女通用化妆品

工作用的防晒补喷
https://detail.tmall.com/item.htm?id=78 ... 6803889260
日用面霜
https://detail.tmall.com/item.htm?id=51 ... 4719008054
用的起的超高性价比不美白防晒:
https://detail.tmall.com/item.htm?id=16 ... 5039592639
美白防晒霜:
https://detail.tmall.com/item.htm?id=14 ... 3454319576
洗面奶(美白+不美白)
https://detail.tmall.com/item.htm?id=53 ... 2326161827
单个购买:
美白洗面奶
https://detail.tmall.com/item.htm?id=55 ... dmg8j26111
不美白洗面奶
https://detail.tmall.com/item.htm?id=53 ... 5207626517
晚霜:
https://detail.tmall.com/item.htm?id=55 ... 6021114434
美白补水:
https://detail.tmall.com/item.htm?id=51 ... 4719144897
不美白的补水
https://detail.tmall.com/item.htm?id=51 ... 5702728726
防黑眼圈眼霜:
https://detail.tmall.com/item.htm?id=78 ... 6803889260
不美白护手+指甲霜:
https://detail.tmall.com/item.htm?id=56 ... 5805247272

精华素正确用量:
精华素
乳液质地:一般1cm是正确的用量
啫喱质地:比乳液质地略多,约1.5cm的圆。
纯液体质地:2-3滴是合适的。

平时使用方法如下(极润非美白系列):
洗面奶->化妆水->保湿乳液->美白精华(平时晒黑了需要美白时可选)->美白面霜(平时晒黑了需要美白时可选)->防晒

晚上(如果需要快速美白的话):
美白洗面奶(熊果苷Or柔内透白活彩洁面乳)->美白化妆水->美白精华->美白面霜(白润水分露)->美白保湿乳液(可选)

工作携带:
秋冬:护手霜
春夏:用得起的保湿防晒

出差:极润旅行套装+用得起的保湿防晒+眼霜

电动牙刷:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk0d89
小米床垫软硬两面可睡:https://detail.tmall.com/item.htm?id=55 ... d0ltsk344b
拖把:https://detail.tmall.com/item.htm?spm=a ... bbucket=19
喷雾粉底(液体丝袜,脸部也可用):https://detail.tmall.com/item.htm?id=55 ... 8559291736
所望非美白牛奶沐浴露(赠浴花):https://detail.tmall.com/item.htm?id=55 ... 1643370509
腰带:https://detail.tmall.com/item.htm?id=39 ... d0ltskd82c
上次由 243750496 在 2017-11-07 23:24,总共编辑 6 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#411

帖子 243750496 » 2017-10-21 16:37

新开综合

mypaint brushes 安装与卸载
请安装如下笔刷库:
extra brush.png
点右上角三根画笔->Import Brushes:(目前笔刷就这两个能下,配合笔刷库后仍然不全)
Concept Design.zip
(164.93 KiB) 已下载 244 次
tone_v2.zip
(2.29 MiB) 已下载 152 次
卸载:
将/home/atc/.local/share/mypaint/brushes中不需要的笔刷包文件夹删除
然后
点击小扳手->Delete Group
delete brush.png
支持中文OCR软件(图形化界面的tesseract)
sudo apt-get install gimagereader tesseract-ocr-all
非中文适用OCR软件(图形化界面的cuneiform)
sudo apt-get install lios yagf

各种OCR字典
sudo apt-get install aspell-af aspell-am aspell-ar aspell-ar-large aspell-bg aspell-bn aspell-br aspell-ca aspell-cs aspell-cy aspell-da aspell-de aspell-de-1901 aspell-de-alt aspell-doc aspell-el aspell-eo aspell-eo-cx7 aspell-es aspell-et aspell-eu aspell-eu-es aspell-fa aspell-fo aspell-fr aspell-ga aspell-gl-minimos aspell-gu aspell-he aspell-hi aspell-hr aspell-hsb aspell-hu aspell-hy aspell-id aspell-is aspell-it aspell-kk aspell-kn aspell-ku aspell-lt aspell-lv aspell-ml aspell-mr aspell-nl aspell-no aspell-nr aspell-ns aspell-or aspell-pa aspell-pl aspell-pt aspell-pt-br aspell-pt-pt aspell-ro aspell-ru aspell-sk aspell-sl aspell-st aspell-sv aspell-ta aspell-te aspell-tl aspell-tn aspell-ts aspell-uk aspell-uz aspell-xh aspell-zu hunspell hunspell-af hunspell-an hunspell-ar hunspell-be hunspell-bn hunspell-bo hunspell-br hunspell-bs hunspell-ca hunspell-en-med hunspell-eu hunspell-eu-es hunspell-gl-es hunspell-gu hunspell-hi hunspell-is hunspell-it hunspell-kk hunspell-kmr hunspell-ko hunspell-lo hunspell-lt hunspell-ml hunspell-ne hunspell-oc hunspell-ro hunspell-se hunspell-si hunspell-sl hunspell-sr hunspell-sv hunspell-sw hunspell-te hunspell-th hunspell-uz hunspell-vi iamerican iamerican-huge iamerican-insane iamerican-large iamerican-small ibrazilian ibritish ibritish-huge ibritish-insane ibritish-large ibritish-small ibulgarian icatalan iczech idanish idutch ienglish-common iesperanto iestonian ifaroese ifrench-gut igaelic igalician-minimos ihungarian iirish iitalian ilithuanian imanx ingerman inorwegian iogerman ipolish iportuguese irussian ispanish ispell iswedish iswiss itagalog iukrainian myspell-af myspell-bg myspell-ca myspell-cs myspell-da myspell-de-at myspell-de-ch myspell-de-de myspell-de-de-1901 myspell-de-de-oldspell myspell-el-gr myspell-en-au myspell-en-gb myspell-en-us myspell-en-za myspell-eo myspell-es myspell-et myspell-fa myspell-fo myspell-fr myspell-ga myspell-gd myspell-gv myspell-he myspell-hr myspell-hu myspell-hy myspell-it myspell-ku myspell-lt myspell-lv myspell-nb myspell-nl myspell-nn myspell-nr myspell-ns myspell-pl myspell-pt myspell-pt-br myspell-pt-pt myspell-ru myspell-sk myspell-sl myspell-ss myspell-st myspell-sw myspell-th myspell-tl myspell-tn myspell-tools myspell-ts myspell-uk myspell-ve myspell-xh myspell-zu

解决Linux/Ubuntu上搜狗输入法崩溃的问题

Linux上最好的中文输入法是搜狗输入法,如果不考虑它的崩溃问题的话,早些安装的搜狗输入法频繁崩溃,很烦人,但是其他的输入法的联想输入能力明显没有搜狗的好,后来尝试了修改了皮肤使用方法,使用了一段时间没有崩溃过,看来应该是这个原因了。
方法:打开fcitx设置,切换到附加组件选项卡,取消经典界面的使用(也许需要点一下下面的高级)。
经典界面.jpg

另外,请安装最新版的搜狗输入法,如果还崩溃的话,考虑一下是否使用了自定义皮肤。

以往重启输入法就行了,今天重启还是没用,上论坛一看,好多人都是今早出了问题,估计是昨天更新引起的,搬运工解决办法:

删除~/.config 下的搜狗输入配置文件夹: SogouPY 、 SogouPY.users 、 sogou-qimpanel

然后重启搜狗输入法或者重装搜狗输入法都可以

sudo apt-get install dia(开源流程图应用)

夜宵面:
圆葱从腰部剖开焯水然后用此水煮面条
煎鸡蛋
将煎鸡蛋的锅中油倒出(只留下带油的锅)然后加入:水+番茄酱+酱油+蚝油+黑胡椒粉(依据个人口味添加)+味精+花椒+白酒+9度白醋+豆瓣酱+焯过水后的圆葱圈+盐+蜂蜜+葱+姜+蒜=神汤汁

西点神水
:开水(为了融化黑巧克力)+果酱+香草精+桂花(依据个人口味添加)+酸奶+牛奶+白酒Or朗姆酒+黄Or青柠檬汁+豆蔻粉+肉桂粉+盐+蜂蜜+枫树糖浆+咖啡+黑糖+黑巧克力

新中点:
原料:黄油+牛奶+面粉+白糖
发酵
然后炸制
然后进行适当腌制(不要腌的太透,否则就不酥了):咖啡(依据个人口味添加)+柠檬汁(适量)+白糖
最后撒上桂花等鲜花粉


man sh

-c string If the -c option is present, then commands are read from
string. If there are arguments after the string, they are
assigned to the positional parameters, starting with $0.
-c "string" 从strings中读取命令

例如:
sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list.d/aftershot-dependencies.list'

WPS 和永中office很好用

用户设置都在~/.config下面,只要拷贝了相应文件,就能顺利完成用户设置的迁移

playonlinux->plugins->Playonlinux Vault可以备份和恢复软件而不用像网上说的那样拷贝.playonlinux或做软连接Or拷贝wineprefix(当然你要运行还得有相应版本的wine,不然是没法运行的
Playonlinux Vault.png
安装flash player
To install the new pepperflashplugin-nofree:

1. Open terminal (Ctrl+Alt+T) and run the command below to add the PPA:

sudo add-apt-repository ppa:jonathonf/pepperflashplugin-nonfree
2. Then update and install the new installer:

sudo apt-get update

sudo apt-get install pepperflashplugin-nonfree
For those who don’t want to add PPA, grab the .deb package directly from PPA page.

When a new flash release is out, just one command to install the updates:

sudo update-pepperflashplugin-nonfree --install
3. The PPA also contains, browser-plugin-freshplayer-pepperflash, an adapter to make pepper flash work for Firefox based browsers, install it via:

sudo apt-get install browser-plugin-freshplayer-pepperflash
Uninstall:

To remove the installer, simply run command:

sudo apt-get remove pepperflashplugin-nonfree browser-plugin-freshplayer-pepperflash && sudo apt autoremove
And the PPA can be removed by going to System Settings -> Software & Updates -> Other Software tab.


sudo mkdir /usr/lib/pepperflashplugin-nonfree/
sudo cp /usr/lib/adobe-flashplugin/manifest.json /usr/lib/pepperflashplugin-nonfree/
sudo cp /usr/lib/adobe-flashplugin/libpepflashplayer.so /usr/lib/pepperflashplugin-nonfree/
然后就可以再brave中启用flash插件了

必知命令:
man
man 是 Linux 的帮助手册,即 manual 。因为大多数程序都会自带手册,所以可以通过 man 命令获取帮助。执行以后,在 man page 页面中按 q 退出。

获取 ls 的帮助

$ man ls
查看有多少(针对不同方面的)同名的手册

$ man -f ls
ls (1) - list directory contents
ls (1p) - list directory contents
查看特定的手册

$ man 1p ls
info
与 man 不同的是,可以像浏览网页一样在各个节点中跳转。

从文档首页开始浏览

$ info
获取特定程序的帮助

$ info program
help
除了上面的两种方法外,还有一种简单使用的方法,那就是 --help 参数,一般程序都会有这个参数,会输出最简单有用的介绍。

$ man --help ### 获取 man 的帮助
$ info --help ### 获取 info 的帮助
$ ls --help ### 获取 ls 的帮助
如何简单操作?
在 Terminal(终端) 中,有许多操作技巧,这里就介绍几个简单的。

光标
up(方向键上) 可以调出输入历史执行记录,快速执行命令
down(方向键下) 配合 up 选择历史执行记录
Home 移动光标到本行开头
End 移动光标到本行结尾
PgUp 向上翻页
PaDN 向下翻页
ctrl + c 终止当前程序
Tab 补全
Tab 补全是非常有用的一个功能,可以用来自动补全命令或文件名,省时准确。

未输入状态下连按两次 Tab 列出所有可用命令
已输入部分命令名或文件名,按 Tab 进行自动补全,多用你就肯定会喜欢的了。
常用命令
以下命令按照通常的使用频度排列。

cd
cd 是打开某个路径的命令,也就是打开某个文件夹,并跳转到该处。

$ cd path ### path 为你要打开的路径。
其中 path 有绝对路径和相对路径之分,绝对路径强调从 / 起,一直到所在路径。相对路径则相对于当前路径来说,假设当前家目录有etc 文件夹(绝对路径应为 /home/username/etc),如果直接 cd etc 则进入此文件夹,但若是 cd /etc/ 则是进入系统 etc ,多琢磨一下就可以理解了。另外在 Linux 中, . 代表当前目录, .. 代表上级目录,因此返回上级目录可以 cd .. 。

ls
ls 即 list ,列出文件。

$ ls ### 仅列出当前目录可见文件
$ ls -l ### 列出当前目录可见文件详细信息
$ ls -hl ### 列出详细信息并以可读大小显示文件大小
$ ls -al ### 列出所有文件(包括隐藏)的详细信息
注意: Linux 中 以 . 开头的文件或文件夹均为隐藏文件或隐藏文件夹。

pwd

pwd 用于返回当前工作目录的名字,为绝对路径名。

$ pwd
/home
mkdir
mkdir 用于新建文件夹。

$ mkdir folder
$ mkdir -p folder/subfolder ### -p 参数为当父目录存在时忽略,若不存在则建立,用此参数可建立多级文件夹
rm
rm 即 remove ,删除文件。

$ rm filename ### 删除 filename
$ rm -i filename ### 删除 filename 前提示,若多个文件则每次提示
$ rm -rf folder/subfolder/ ### 递归删除 subfolder 下所有文件及文件夹,包括 subfolder 自身
$ rm -d folder ### 删除空文件夹
cp
cp 即 copy ,复制文件。

$ cp source dest ### 将 source 复制到 dest
$ cp folder/* dest ### 将 folder 下所有文件(不含子文件夹中的文件)复制到 dest
$ cp -r folder dest ### 将 folder 下所有文件(包含子文件夹中的所有文件)复制到 dest
mv
mv 即 move ,移动文件。

$ mv source folder ### 将 source 移动到 folder 下,完成后则为 folder/source
$ mv -i source folder ### 在移动时,若文件已存在则提示 **是否覆盖**
$ mv source dest ### 在 dest 不为目录的前提下,重命名 source 为 dest
cat
cat 用于输出文件内容到 Terminal 。

$ cat /etc/locale.gen ### 输出 locale.gen 的内容
$ cat -n /etc/locale.gen ### 输出 locale.gen 的内容并显示行号
more
more 与 cat 相似,都可以查看文件内容,所不同的是,当一个文档太长时, cat 只能展示最后布满屏幕的内容,前面的内容是不可见的。这时候可用 more 逐行显示内容。

$ more /etc/locale.gen
$ more +100 /etc/locale.gen ### 从 100 行开始显示
less
less 与 more 相似,不过 less 支持上下滚动查看内容,而 more 只支持逐行显示。

$ less /etc/locale.gen
$ less +100 /etc/locale.gen
nano
nano 是一个简单实用的文本编辑器,使用简单。

$ nano filename ### 编辑 filename 文件,若文件不存在,则新打开一个文件,若退出时保存,则创建该文件
编辑完后,ctrl + X 提示是否保存,按 y 确定保存即可。

注意:在使用过程中可用 ctrl + G 获取帮助。

reboot
reboot 为重启命令。

# reboot ### '$' 和 '#' 的区别在于 '$' 普通用户即可执行
### 而 '#' 为 root 用户才可执行,或普通用户使用 'sudo'
poweroff
poweroff 为关机命令。

# poweroff ### 马上关机
ping
ping 主要用于测试网络连通,通过对目标机器发送数据包来测试两台主机是否连通,及延时情况。

$ ping locez.com ### 通过域名 ping,若 DNS 未设置好,可能无法 ping 通
$ ping linux.cn
PING linux.cn (211.157.2.94) 56(84) bytes of data.
64 bytes from 211.157.2.94.static.in-addr.arpa (211.157.2.94): icmp_seq=1 ttl=53 time=41.5 ms
64 bytes from 211.157.2.94.static.in-addr.arpa (211.157.2.94): icmp_seq=2 ttl=53 time=40.4 ms
64 bytes from 211.157.2.94.static.in-addr.arpa (211.157.2.94): icmp_seq=3 ttl=53 time=41.9 ms
^C
--- linux.cn ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 40.406/41.287/41.931/0.644 ms
$ ping 211.157.2.94 ### 通过 IP 地址 ping ,若无法 ping 通可能是网络连接出现问题
grep
grep 主要用于返回匹配的项目,支持正则表达式。

$ grep PATTERN filename ### 返回所有含有 PATTERN 的行
$ grep zh_CN /etc/locale.gen ### 返回所有含 zh_CN 的行
mount
mount 用于挂载一个文件系统,需要 root 用户执行。一个磁盘可分为若干个分区,在分区上面可以创建文件系统,而挂载点则是提供一个访问的入口,将一个分区的文件系统挂载到某个目录中,称这个目录为挂载点,并且可以通过这个挂载点访问该文件系统中的内容。

例如一块硬盘在 Linux 中表示为 /dev/sda 那么它上面的分区应该表示为 /dev/sda1 、/dev/sda2 。

# mount ### 输出系统目前的挂载信息
# mount /dev/sda1 /mnt ### 将 sda1 挂载到 /mnt 中
# cd /mnt ### 直接通过 /mnt 访问内容
# mount -o remount,rw /mnt ### 重新挂载 sda1 到 /mnt 并设置为 可读写
# mount -a ### 挂载 fstab 文件配置好的文件系统
umount
umount 与 mount 相反,是卸载一个挂载点,即取消该入口。

# umount /mnt ### 卸载 /mnt 这个挂载点的文件系统
# umount -a ### 卸载所有已挂载的文件系统
tar
tar 主要用于创建归档文件,和解压归档文件,其本身是没有压缩功能的,但可以调用 gzip 、 bzip2 进行压缩处理。
参数解释:

-c 创建归档
-x 解压归档
-v 显示处理过程
-f 目标文件,其后必须紧跟 目标文件
-j 调用 bzip2 进行解压缩
-z 调用 gzip 进行解压缩
-t 列出归档中的文件
$ tar -cvf filename.tar . ### 将当前目录所有文件归档,但不压缩,注意后面有个 ’.‘ ,不可省略,代表当前目录的意思
$ tar -xvf filename.tar ### 解压 filename.tar 到当前文件夹
$ tar -cvjf filename.tar.bz2 . ### 使用 bzip2 压缩
$ tar -xvjf filename.tar.bz2 ### 解压 filename.tar.bz2 到当前文件夹
$ tar -cvzf filename.tar.gz ### 使用 gzip 压缩
$ tar -xvzf filename.tar.gz ### 解压 filename.tar.gz 到当前文件夹
$ tar -tf filename ### 只查看 filename 归档中的文件,不解压
ln
ln 主要用于在两个文件中创建链接,链接又分为 Hard Links (硬链接)和 Symbolic Links (符号链接或软链接),其中默认为创建硬链接,使用 -s 参数指定创建软链接。

硬链接主要是增加一个文件的链接数,只要该文件的链接数不为 0 ,该文件就不会被物理删除,所以删除一个具有多个硬链接数的文件,必须删除所有它的硬链接才可删除。
软链接简单来说是为文件创建了一个类似快捷方式的东西,通过该链接可以访问文件,修改文件,但不会增加该文件的链接数,删除一个软链接并不会删除源文件,即使源文件被删除,软链接也存在,当重新创建一个同名的源文件,该软链接则指向新创建的文件。
硬链接只可链接两个文件,不可链接目录,而软链接可链接目录,所以软链接是非常灵活的。
$ ln source dest ### 为 source 创建一个名为 dest 的硬链接
$ ln -s source dest ### 为 source 创建一个名为 dest 的软链接
chown
chown 用于改变一个文件的所有者及所在的组。

# chown user filename ### 改变 filename 的所有者为 user
# chown user:group filename ### 改变 filename 的所有者为 user,组为 group
# chown -R root folder ### 改变 folder 文件夹及其子文件的所有者为 root
chmod
chmod 永远更改一个文件的权限,主要有 读取 、 写入 、 执行 ,三种权限,其中 所有者 、 用户组 、 其他 各占三个,因此 ls -l 可以看到如下的信息

-rwxr--r-- 1 locez users 154 Aug 30 18:09 filename
其中 r=read , w=write , x=execute

# chmod +x filename ### 为 user ,group ,others 添加执行权限
# chmod -x filename ### 取消 user , group ,others 的执行权限
# chmod +w filename ### 为 user 添加写入权限
# chmod ugo=rwx filename ### 设置 user ,group ,others 具有 读取、写入、执行权限
# chmod ug=rw filename ### 设置 user ,group 添加 读取、写入权限
# chmod ugo=--- filename ### 取消所有权限
useradd
useradd 用于添加一个普通用户。

# useradd -m -g users -G audio -s /usr/bin/bash newuser
### -m 创建 home 目录, -g 所属的主组, -G 指定该用户在哪些附加组, -s 设定默认的 shell ,newuser 为新的用户名
passwd
passwd 用于改变用户登录密码。

$ passwd ### 不带参数更改当前用户密码
# passwd newuser ### 更改上述新建的 newuser 的用户密码
whereis
whereis 用于查找文件、手册等。

$ whereis bash
bash: /usr/bin/bash /etc/bash.bashrc /etc/bash.bash_logout /usr/share/man/man1/bash.1.gz /usr/share/info/bash.info.gz
$ whereis -b bash ### 仅查找 binary
bash: /usr/bin/bash /etc/bash.bashrc /etc/bash.bash_logout
$ whereis -m bash ### 仅查找 manual
bash: /usr/share/man/man1/bash.1.gz /usr/share/info/bash.info.gz
find
find 也用于查找文件,但更为强大,支持正则,并且可将查找结果传递到其他命令。

$ find . -name PATTERN ### 从当前目录查找符合 PATTERN 的文件
$ find /home -name PATTERN -exec ls -l {} \; # 从 /home 文件查找所有符合 PATTERN 的文件,并交由 ls 输出详细信息
wget
wget 是一个下载工具,简单强大。

$ wget -O newname.md https://github.com/LCTT/TranslateProjec ... /README.md ### 下载 README 文件并重命名为 newname.md
$ wget -c url ### 下载 url 并开启断点续传


恭喜你,你已经学习了完了26 个基础的 Linux 命令。虽然这里只是一些最基础的命令,但是熟练使用这些命令就踏出了你从一位 Linux 新手成为 Linux 玩家的第一步!

命令执行判断依据--;,&&,||——————————————————正则表达式

在Linux运维过程中或者日常Linux系统操作过程中会同时执行多条命令,这样的话需要通过我们的多重命令方式进行处理。

通过使用';'分号执行多个命令,如例:

#sync;sync;shutdown -h now

通过判断执行命令,&&/||执行情况 如例:

cmd1&&cmd2:

若cmd1执行完毕且正确执行($?=0),则开始执行cmd2

若cmd1执行完毕且错误执行($?!=0),则开cmd2不执行


cmd1||cmd2:

若cmd1执行完毕后正确执行($?=0),则cmd2不执行。

若cmd1执行完毕后为错误($?!=0),则开始只执行cmd2

根据上面学习的内容练习下面的练习题:

1.

判断/home目录存在则创建lshome文件

#ll /home && touch /home/lshome

2.

判断是否存在创建文件/tmp/abc,如果/tmp/abc不存在则创建

#ls -l /tmp/abc || mkdir /tmp/abc

3.判断/home/Samlee目录是否存在,如果存在则显示"exist",如果不存在则显示"not exist"

#ls -l /home/Samlee && echo "exist"||echo "not exist"


ll会列出该文件下的所有文件信息
上次由 243750496 在 2017-11-17 16:52,总共编辑 1 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#412

帖子 243750496 » 2017-11-15 13:20

Playonlinux 应用迁移后无法运行解决办法


Playonlinux APP无法迁移成功源于其旧版本wine自身freetype过老因此在$HOME/.PlayOnLinux/wine/linux-x86/<wine-version>/lib中找到libz.so的所有文件删除即可恢复正常(不用从系统中拷贝也不是因为破解后Or对应用打包前对preference设置导致Md5值不一样!!!!)

注:先安装相应的wine,然后每个版本的wine都要删除此文件(libz.so)
I have also broken 32-bit stuff on PlayOnLinux since yesterday.
Solution
I was able to track down which specific PlayOnLinux libraries ($HOME/.PlayOnLinux/wine/linux-x86/<wine-version>/lib) cause the issue.
Just remove all libz.so library files included in PlayOnLinux library folders.
After all, this is an issue with outdated lib32-zlib files in PlayOnLinux library folder.
The dependency route goes as follows:
lib32-freetype2 depends on lib32-libpng which depends on lib32-zlib. Zlib libraries are the only ones PlayOnLinux ships on its own.
Alternative solution (not as good as the first one)
You can also get PlayOnLinux 32-bit prefixes working again if you downgrade your lib32-libpng package from 1.6.29 -> 1.6.27.
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#413

帖子 243750496 » 2017-11-15 17:00

新开综合2:
DisplayCal如果需要导出icc配置文件可以选择右上方create compressed archive而不需要使用find命令
compress archive.png
gnome-tweak-tool 更改系统字体使其更好看
sudo apt-get install fonts-wqy-microhei fonts-wqy-zenhei
fonts.png
注:默认字体:Ubuntu 11;Ubuntu Regular 11;Sans Regular 11;Ubuntu Mono Regular 13;
fonts default.png
删除update-manager这样就不会总是接收到升级提示了
sudo apt-get remove update-manager

删除kde钱包:
sudo apt-get remove smplayer python3-keyring

linux免驱蓝牙:
https://item.taobao.com/item.htm?spm=a1 ... d0ltskfbc4
支持linux的5gWiFi接收器:https://item.taobao.com/item.htm?spm=a1 ... d0ltsk2cdc
————————————————————————————————————————————————————————————————
Wifi :

驱动安装:
从https://github.com/genodeftest/Netgear-A6210/tree/port-to-4.13下载NETGEAR A6210(5g wifi接收器)的驱动然后解压
注:https://github.com/genodeftest/Netgear- ... fix-only不行,这个驱动比较老不能用
sudo mv '/home/atc/Downloads/Netgear-A6210-port-to-4.13' /usr/src/netgear-a6210-2.5.0
sudo dkms install netgear-a6210/2.5.0


device not managed解决办法:
You should look at the contents of the file /var/lib/NetworkManager/NetworkManager.state. It should look something like this:

[main]
NetworkingEnabled=true
WirelessEnabled=true
WWANEnabled=true
Change any from 'false' to 'true' to re-enable networking. It may work better if you first stop NetworkManager:

Edit /etc/NetworkManager/NetworkManager.conf and change:

managed=false
to

managed=true
Restarted network-manager:

sudo service network-manager restart
No change. Then I tried:

touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
sudo service network-manager restart
All three network cards came back on-line.

或者:
If you don't have it installed, could you install the package rfkill and post the output of "rfkill list"?
If it's software blocked enter "rfkill unblock #" where # is the number of the blocked item in the list, or "rfkill unblock name". If it reports it to be hard blocked check out the wireless switch in your laptop.

I had the same problem, I solved it by commenting the lines where the unmanaged device was mentioned, by mac address, in /etc/NetworkManager/NetworkManager.conf.

[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:00:26:2d:fd:5c:e0
changed to

[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

\#[keyfile]

\#unmanaged-devices=mac:00:26:2d:fd:5c:e0


device not ready解决方法:
To fix this I had to disable secure boot in the UEFI BIOS page on startup." Yes... secure boot is useless and doesn't allow you to install some proprietary drivers such as some very common Realtek Ethernet devices and as i can see that goes for the mediatek wifi drivers-firmware too


your kernel version
running the command uname -r prints out your kernel version

生成debug信息
使用命令行:
on the target system, gather the information in a file:

For a bug report about a system crash:
apport-cli -p <package name> --save bug.crash

For a bug report about any other issue:
apport-cli -f -p <package name> --save bug.apport

使用图形界面:
ubuntu-bug network-manager --save bug



在启动时按住shift然后选中内核按e 然后修改flag(添加参数或删除所有参数)
但是修改仅此次有效 重启后恢复

1.环境:

ubuntu16.04

Linux jello 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux



2.查看当前linux内核的启动参数:

cat /proc/cmdline

笔者的输出内容如下:

BOOT_IMAGE=/boot/vmlinuz-4.4.0-89-generic root=UUID=bef418fa-4202-4513-b39b-cde6a5d9753f ro quiet splash vt.handoff=7

3.开始解析

root=UUID=bef418fa-4202-4513-b39b-cde6a5d9753f :这一串可以用root=/dev/sda1(假如根文件系统在第一个分区)来代替,但是不能用root=(hd0,msdos1)来代替

ro : 启动时以只读方式挂载根文件系统

quiet: 不进行打印信息的输出,所以去掉此项将会迎来很多打印信息

splash: 显示开机动画

vt.handoff=7 : 图形界面会去使用tty7,此项用来禁止splash占用tty7,因此如果将splash参数去掉,此项就无效了

4.添加新的启动参数

vi /boot/grub/grub.cfg

此文件中会有第2步输出的内容,在其后追加参数即可,例如:

笔者的grub.cfg文件中就有如下行:(是不是与第2步输出的信息有些类似)

linux /boot/vmlinuz-4.4.0-89-generic root=UUID=bef418fa-4202-4513-b39b-cde6a5d9753f ro quiet splash $vt_handoff

假设笔者要加入参数dwc_otg.speed=1,那么修改后如下:

linux /boot/vmlinuz-4.4.0-89-generic root=UUID=bef418fa-4202-4513-b39b-cde6a5d9753f ro quiet splash $vt_handoff dwc_otg.speed=1

至此保存此文件重启即可使此参数生效

5.为何没有使用update-grub来更新grub.cfg文件呢?

update-grub命令无法满足更细致的内核参数修改需求



内核参数

在Linux中,给kernel传递参数以控制其行为总共有三种方法:

1.build kernel之时的各个configuration选项。

2.当kernel启动之时,可以参数在kernel被GRUB或LILO等启动程序调用之时传递给kernel。

3.在kernel运行时,修改/proc或/sys目录下的文件。

这里我简单讲的就是第二种方式了,kernel在grub中配置的启动参数。

首先,kernel有哪些参数呢? 在linux的源代码中,有这样的一个文档Documentation/kernel-parameters.txt,它介绍了kernel的各个参数及其意义。

其次,kernel启动参数以空格分隔,而且是严格区分大小写的(如:mem和MEM是不一样的)。

再次,对于module特有的kernel参数写法是这样的,[module name].[parameter=XX],例如,igb.max_vfs=7这个kernel启动参数的效果就是相当于这样来动态加载module: modprobe igb max_vfs=7

另外,kernel是怎样处理这些启动参数的呢? 启动参数通常是这样的形式: name[=value_1][,value_2]...[,value_10]

"name"是关键字,内核用它来识别应该把"关键字"后面的值传递给谁,也就是如何处理这个值,是传递给处理进程还是作为环境变量或者抛给"init"。值的个数限制为10,你可以通过再次使用该关键字使用超过10个的参数。 首先,kernel检查关键字是不是 'root=', 'nfsroot=', 'nfsaddrs=', 'ro', 'rw', 'debug'或'init',然后内核在bootsetups数组里搜索于该关键字相关联的已注册的处理函数,如果找到相关的已注册的处理函数,则调用这些函数并把关键字后面的值作为参数传递给这些函数。比如,你在启动时设置参数name=a,b,c,d,内核搜索bootsetups数组,如果发现"name"已注册,则调用"name"的设置函数如name_setup(),并把a,b,c,d传递给name_setup()执行。 所有型如"name=value"参数,如果没有被上面所述的设置函数接收,将被解释为系统启动后的环境变量,比如"TERM=vt100"启动参数就会被作为一个启动后的环境变量。所有没有被内核设置函数接收也没又被设置成环境变量的参数都将留给init进程处理,比如"single"。

下面简单总结一下我在工作中常用到的一些kernel启动参数吧。

根磁盘相关启动参数:

root #指出启动的根文件系统 如:root=/dev/sda1

ro #指定根设备在启动过程中为read-only,默认情况下一般都是这样配的

rw #和ro类似,它是规定为read-write,可写

rootfstype #根文件系统类型,如:rootfstype=ext4

Console和kernel log相关启动参数:

console #console的设备和选项,如:console=tty0 console=ttyS0

debug #enable kernel debugging 启动中的所有debug信息都会打印到console上

quiet #disable all log messages 将kernel log level设置为KERN_WARNING,在启动中只非常严重的信息

loglevel #设置默认的console日志级别,如:loglevel=7 (0~7的数字分别为:KERN_EMERG,..,KERN_DEBUG)

time #设置在每条kernel log信息前加一个时间戳

内存相关的启动参数:

mem #指定kernel使用的内存量,mem=n[KMG]

hugepages #设置大页表页(4MB大小)的最多个数,hugepages=n

CPU相关的启动参数:

mce # Enable the machine check exception feature.

nosmp #Run as a single-processor machine. 不使用SMP(多处理器)

max_cpus #max_cpus=n, SMP系统最多能使用的CPU个数(即使系统中有大于n个的CPU)

Ramdisk相关的启动参数:

initrd #指定初始化ramdisk的位置,initrd=filename

noinitrd #不使用initrd的配置,即使配置了initrd参数

初始化相关启动参数:

init #在启动时去执行的程序,init=filename,默认值为/sbin/init

PCI相关的启动参数:

pci #pci相关的选项,我常使用pci=assign_buses,也使用过pci=nomsi

SELinux相关启动参数:

enforcing #SELinux enforcing状态的开关,enforcing=0表示仅仅是记录危险而不是阻止访问,enforcing=1完全enable,默认值是0

selinux #在启动时关闭或开启SELinux,selinux=0表示关闭,selinux=1表示开启selinux

另外,还是用max_loop来指定最多可使用的回路设备。



在Redhat的系统中,还有个经常看到的kernel启动参数——rhgb,rhgb表示redhat graphics boot,就是会看到图片来代替启动过程中显示的文本信息,这些信息在启动后用dmesg也可以看到
rhgb = redhat graphical boot - This is a GUI mode booting screen with most of the information hidden while the user sees a rotating activity icon spining and brief information as to what the computer is doing.

quiet = hides the majority of boot messages before rhgb starts. These are supposed to make the common user more comfortable. They get alarmed about seeing the kernel and initializing messages, so they hide them for their comfort.


github上的项目有wiki的话可以参考
如果想下载最新的代码可以从branches和tags两种方法来寻找,master不一定是最新的!

gtihub 代码变动查看:
As I answered here:

It supposed to reflect the amount of changes (in lines) of each file listed.
Plus signs for additions, minuses for deletions.

The 118 gives the amount of changed lines, and the - / + gives you the proportion of deletions/additions.
When the amount of changes can fit a line you'll get '+' per addition, '-' per deletion;
Otherwise, this is an approximation, e.g.

CHANGES.txt | 47 +++++++++++++++++++++++++++++++++
make-release.py | 77 +++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 102 insertions(+), 22 deletions(-)
On CHANGES.txt since you can see that there are no '-', and since 47 '+' are a lot you have a proportionate amount of them (i.e. 100%).
On make-release.py you'll see x39 '+' standing for 55 additions and x16 '-' standing for 22 deletions.
Exactly as their proportion, and just the amount to fit output screen.

The amount of signs per line the a G C D multiple that fits the line width.

Hope that helps.


系统升级:
sudo apt-get update && sudo apt-get dist-upgrade
sudo do-release-upgrade



cd /opt/eset/esets/bin

Type the following command to run the uninstaller script:

sudo ./esets_gil --uninstall 如果用./nod32.linux--uninstall会重新安装而不是卸载!



grep命令:

Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来。grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户。
grep的工作方式是这样的,它在一个或多个文件中搜索字符串模板。如果模板包括空格,则必须被引用,模板后的所有字符串被看作文件名。搜索的结果被送到标准输出,不影响原文件内容。
grep可用于shell脚本,因为grep通过返回一个状态值来说明搜索的状态,如果模板搜索成功,则返回0,如果搜索不成功,则返回1,如果搜索的文件不存在,则返回2。我们利用这些返回值就可进行一些自动化的文本处理工作。
1.命令格式:
grep [option] pattern file
2.命令功能:
用于过滤/搜索的特定字符。可使用正则表达式能多种命令配合使用,使用上十分灵活。
3.命令参数:
-a --text #不要忽略二进制的数据。
-A<显示行数> --after-context=<显示行数> #除了显示符合范本样式的那一列之外,并显示该行之后的内容。
-b --byte-offset #在显示符合样式的那一行之前,标示出该行第一个字符的编号。
-B<显示行数> --before-context=<显示行数> #除了显示符合样式的那一行之外,并显示该行之前的内容。
-c --count #计算符合样式的列数。
-C<显示行数> --context=<显示行数>或-<显示行数> #除了显示符合样式的那一行之外,并显示该行之前后的内容。
-d <动作> --directories=<动作> #当指定要查找的是目录而非文件时,必须使用这项参数,否则grep指令将回报信息并停止动作。
-e<范本样式> --regexp=<范本样式> #指定字符串做为查找文件内容的样式。
-E --extended-regexp #将样式为延伸的普通表示法来使用。
-f<规则文件> --file=<规则文件> #指定规则文件,其内容含有一个或多个规则样式,让grep查找符合规则条件的文件内容,格式为每行一个规则样式。
-F --fixed-regexp #将样式视为固定字符串的列表。
-G --basic-regexp #将样式视为普通的表示法来使用。
-h --no-filename #在显示符合样式的那一行之前,不标示该行所属的文件名称。
-H --with-filename #在显示符合样式的那一行之前,表示该行所属的文件名称。
-i --ignore-case #忽略字符大小写的差别。
-l --file-with-matches #列出文件内容符合指定的样式的文件名称。
-L --files-without-match #列出文件内容不符合指定的样式的文件名称。
-n --line-number #在显示符合样式的那一行之前,标示出该行的列数编号。
-q --quiet或--silent #不显示任何信息。
-r --recursive #此参数的效果和指定“-d recurse”参数相同。
-s --no-messages #不显示错误信息。
-v --revert-match #显示不包含匹配文本的所有行。
-V --version #显示版本信息。
-w --word-regexp #只显示全字符合的列。
-x --line-regexp #只显示全列符合的列。
-y #此参数的效果和指定“-i”参数相同。

4.规则表达式:
grep的规则表达式:
^ #锚定行的开始 如:'^grep'匹配所有以grep开头的行。
$ #锚定行的结束 如:'grep$'匹配所有以grep结尾的行。
. #匹配一个非换行符的字符 如:'gr.p'匹配gr后接一个任意字符,然后是p。
* #匹配零个或多个先前字符 如:'*grep'匹配所有一个或多个空格后紧跟grep的行。
.* #一起用代表任意字符。
[] #匹配一个指定范围内的字符,如'[Gg]rep'匹配Grep和grep。
[^] #匹配一个不在指定范围内的字符,如:'[^A-FH-Z]rep'匹配不包含A-R和T-Z的一个字母开头,紧跟rep的行。
\(..\) #标记匹配字符,如'\(love\)',love被标记为1。
\< #锚定单词的开始,如:'\<grep'匹配包含以grep开头的单词的行。
\> #锚定单词的结束,如'grep\>'匹配包含以grep结尾的单词的行。
x\{m\} #重复字符x,m次,如:'0\{5\}'匹配包含5个o的行。
x\{m,\} #重复字符x,至少m次,如:'o\{5,\}'匹配至少有5个o的行。
x\{m,n\} #重复字符x,至少m次,不多于n次,如:'o\{5,10\}'匹配5--10个o的行。
\w #匹配文字和数字字符,也就是[A-Za-z0-9],如:'G\w*p'匹配以G后跟零个或多个文字或数字字符,然后是p。
\W #\w的反置形式,匹配一个或多个非单词字符,如点号句号等。
\b #单词锁定符,如: '\bgrep\b'只匹配grep。
POSIX字符:
为了在不同国家的字符编码中保持一至,POSIX(The Portable Operating System Interface)增加了特殊的字符类,如[:alnum:]是[A-Za-z0-9]的另一个写法。要把它们放到[]号内才能成为正则表达式,如[A- Za-z0-9]或[[:alnum:]]。在linux下的grep除fgrep外,都支持POSIX的字符类。
[:alnum:] #文字数字字符
[:alpha:] #文字字符
[:digit:] #数字字符
[:graph:] #非空字符(非空格、控制字符)
[:lower:] #小写字符
[:cntrl:] #控制字符
[:print:] #非空字符(包括空格)
[:punct:] #标点符号
[:space:] #所有空白字符(新行,空格,制表符)
[:upper:] #大写字符
[:xdigit:] #十六进制数字(0-9,a-f,A-F)
5.使用实例:
实例1:查找指定进程
命令:
ps -ef|grep svn
输出:
[root@localhost ~]# ps -ef|grep svn
root 4943 1 0 Dec05 ? 00:00:00 svnserve -d -r /opt/svndata/grape/
root 16867 16838 0 19:53 pts/0 00:00:00 grep svn
[root@localhost ~]#
说明:
第一条记录是查找出的进程;第二条结果是grep进程本身,并非真正要找的进程。
实例2:查找指定进程个数
命令:
ps -ef|grep svn -c
ps -ef|grep -c svn
输出:
[root@localhost ~]# ps -ef|grep svn -c
2
[root@localhost ~]# ps -ef|grep -c svn
2
[root@localhost ~]#
说明:
实例3:从文件中读取关键词进行搜索
命令:
cat test.txt | grep -f test2.txt
输出:
[root@localhost test]# cat test.txt
hnlinux
peida.cnblogs.com
ubuntu
ubuntu linux
redhat
Redhat
linuxmint
[root@localhost test]# cat test2.txt
linux
Redhat
[root@localhost test]# cat test.txt | grep -f test2.txt
hnlinux
ubuntu linux
Redhat
linuxmint
[root@localhost test]#
说明:
输出test.txt文件中含有从test2.txt文件中读取出的关键词的内容行
实例3:从文件中读取关键词进行搜索 且显示行号
命令:
cat test.txt | grep -nf test2.txt
输出:
[root@localhost test]# cat test.txt
hnlinux
peida.cnblogs.com
ubuntu
ubuntu linux
redhat
Redhat
linuxmint
[root@localhost test]# cat test2.txt
linux
Redhat
[root@localhost test]# cat test.txt | grep -nf test2.txt
1:hnlinux
4:ubuntu linux
6:Redhat
7:linuxmint
[root@localhost test]#
说明:
输出test.txt文件中含有从test2.txt文件中读取出的关键词的内容行,并显示每一行的行号
实例5:从文件中查找关键词
命令:
grep 'linux' test.txt
输出:
[root@localhost test]# grep 'linux' test.txt
hnlinux
ubuntu linux
linuxmint
[root@localhost test]# grep -n 'linux' test.txt
1:hnlinux
4:ubuntu linux
7:linuxmint
[root@localhost test]#
说明:
实例6:从多个文件中查找关键词
命令:
grep 'linux' test.txt test2.txt
输出:
[root@localhost test]# grep -n 'linux' test.txt test2.txt
test.txt:1:hnlinux
test.txt:4:ubuntu linux
test.txt:7:linuxmint
test2.txt:1:linux
[root@localhost test]# grep 'linux' test.txt test2.txt
test.txt:hnlinux
test.txt:ubuntu linux
test.txt:linuxmint
test2.txt:linux
[root@localhost test]#
说明:
多文件时,输出查询到的信息内容行时,会把文件的命名在行最前面输出并且加上":"作为标示符
实例7:grep不显示本身进程
命令:
ps aux|grep \sh
ps aux | grep ssh | grep -v "grep"
输出:
[root@localhost test]# ps aux|grep ssh
root 2720 0.0 0.0 62656 1212 ? Ss Nov02 0:00 /usr/sbin/sshd
root 16834 0.0 0.0 88088 3288 ? Ss 19:53 0:00 sshd: root@pts/0
root 16901 0.0 0.0 61180 764 pts/0 S+ 20:31 0:00 grep ssh
[root@localhost test]# ps aux|grep \sh]
[root@localhost test]# ps aux|grep \sh
root 2720 0.0 0.0 62656 1212 ? Ss Nov02 0:00 /usr/sbin/sshd
root 16834 0.0 0.0 88088 3288 ? Ss 19:53 0:00 sshd: root@pts/0
[root@localhost test]# ps aux | grep ssh | grep -v "grep"
root 2720 0.0 0.0 62656 1212 ? Ss Nov02 0:00 /usr/sbin/sshd
root 16834 0.0 0.0 88088 3288 ? Ss 19:53 0:00 sshd: root@pts/0
说明:
实例8:找出已u开头的行内容
命令:
cat test.txt |grep ^u
输出:
[root@localhost test]# cat test.txt |grep ^u
ubuntu
ubuntu linux
[root@localhost test]#
说明:
实例9:输出非u开头的行内容
命令:
cat test.txt |grep ^[^u]
输出:
[root@localhost test]# cat test.txt |grep ^[^u]
hnlinux
peida.cnblogs.com
redhat
Redhat
linuxmint
[root@localhost test]#
说明:
实例10:输出以hat结尾的行内容
命令:
cat test.txt |grep hat$
输出:
[root@localhost test]# cat test.txt |grep hat$
redhat
Redhat
[root@localhost test]#
说明:
实例11:
命令:
输出:
[root@localhost test]# ifconfig eth0|grep "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
[root@localhost test]# ifconfig eth0|grep -E "([0-9]{1,3}\.){3}[0-9]"
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
[root@localhost test]#
说明:
实例12:显示包含ed或者at字符的内容行
命令:
cat test.txt |grep -E "ed|at"
输出:
[root@localhost test]# cat test.txt |grep -E "peida|com"
peida.cnblogs.com
[root@localhost test]# cat test.txt |grep -E "ed|at"
redhat
Redhat
[root@localhost test]#
说明:
实例13:显示当前目录下面以.txt 结尾的文件中的所有包含每个字符串至少有7个连续小写字符的字符串的行
命令:
grep '[a-z]\{7\}' *.txt
输出:
[root@localhost test]# grep '[a-z]\{7\}' *.txt
test.txt:hnlinux
test.txt:peida.cnblogs.com
test.txt:linuxmint
[root@localhost test]#


ctags

ctags 最先是用来生成C代码的tags文件,后来扩展成可以生成各类语言的tags, 有些语言也有专有的tags生成工具(比如java的jtags, python的 ptags).
安装:
sudo apt-get install ctags


$ctags –R .
“-R”表示递归创建,也就包括源代码根目录(当前目录)下的所有子目录。“*”表示所有文件。这条命令会在当前目录下产生一个“tags”文件,当用户在当前目录中运行vi时,会自动载入此tags文件。Tags文件中包括这些对象的列表:用#define定义的宏枚举型变量的值函数的定义、原型和声明名字空间(namespace)类型定义(typedefs)变量(包括定义和声明)类(class)、结构(struct)、枚举类型(enum)和联合(union)类、结构和联合中成员变量或函数VIM用这个“tags”文件来定位上面这些做了标记的对象。
ctags配置
使用sudo vim /etc/vim/vimrc 编辑vim的配置文档,在其中加入如下命令:
set tags=/home/zhouyl/linux-3.4.7/tags;"后面的路径是使用ctags -R 后生成的tags文件所在目录,如果需要配置多个tags,只需如下再添加即可
set tags=/home/zhouyl/rap/libpcap-1.3.0/tags;
set autochdir
使用
熟练的使用ctags仅需记住下面七条命令:
1.$ctags –R * ($为Linux系统Shell提示符,这个命令上面已经有所介绍)
2. $ vi –t tag (请把tag替换为您欲查找的变量或函数名)
3.:ts(ts助记字:tagslist, “:”开头的命令为VI中命令行模式命令)
4.:tp(tp助记字:tagspreview)---此命令不常用,可以不用记
5.:tn(tn助记字:tagsnext) ---此命令不常用,可以不用记
6.Ctrl+ ]跳到光标所在函数或者结构体的定义处
7.Ctrl+ T返回查找或跳转
“$vi –t tag” :在运行vim的时候加上“-t”参数,例如:[/usr/src]$vim -tmain这个命令将打开定义“main”(变量或函数或其它)的文件,并把光标定位到这一行。如果这个变量或函数有多处定义,
在VI命令行模式 “:ts”命令就能列出一个列表供用户选择。
“:tp”为上一个tag标记文件,
“:tn”为下一个tag标记文件。
当然,若当前tags文件中用户所查找的变量或函数名只有一个,“:tp,:tn”命令不可用。
(最方便的方法是把光标移到变量名或函数名上,然后按下“Ctrl+]”,这样就能直接跳到这个变量或函数定义的源文件中,并把光标定位到这一行。用“Ctrl+T”可以退回原来的地方。即使用户使用了N次“Ctrl+]”查找了N个变量,按N次“Ctrl+t”也能回到最初打开的文件,它会按原路返回 。
注意:运行vim的时候,必须在“tags”文件所在的目录下运行。否则,运行vim的时候还要用“:set tags=”命令设定“tags”文件的路径,这样vim才能找到“tags”文件。在完成编码时,可以手工删掉tags文件(帚把不到,灰尘不会自己跑掉^_^)。

PCB设计软件Kicad
sudo apt-get install kicad

LibrePCB:
sudo apt-get install git build-essential qt5-default qttools5-dev-tools libglu1-mesa-dev openssl zlib1g zlib1g-dev
sudo apt-get install qt5-doc qtcreator
git clone --recursive https://github.com/LibrePCB/LibrePCB.git && cd LibrePCB
mkdir LibrePCB && cd LibrePCB
qmake -r ../librepcb.pro
make -j 8
sudo checkinstall


kernel debug:
By the way, if you run journalctl -b > filename.txt, the logs from journald will be written to the file named "filename.txt". This way you don't have to copy so much stuff from a terminal.

You probably need start the kernel and NetworkManager in debug mode to tell you more.
1.how to enter the debug mode???

2.what info should i provide to vendor in debug mode??

Debug mode: Add the "debug" flag to your kernel command line. You can get there by presing "e" key during boot which will put you into grub's edit mode. Add " debug" to the command line and make sure to remove all other logging-related stuff like "quiet" and "rhgb".

I have no clue without looking at the files. If you prefer to keep this metadata private, you may want to send me an email (see my profile).

What should i remove?all?where to add debug flag?
debug kernel.jpg
In the line that reads wraps, there is a word "quiet". Replace it by "debug".

What's next if i entered debug mode?just login and shut down then to enter normal start to copy the log file out?
As written above: After reboot, try to use the network, then reboot again without these changes.

After reboot, try to use the network, then reboot again without these changes. Your linux will start normally if you don't change anything. Any changes in this grub config menu will be lost on next reboot.

btw: if don't set debug flag will i get nomal start?
As written above: Yes. Your linux will start normally if you don't change anything. Any changes in this grub config menu will be lost on next reboot.

Whether debug kernel mode will create a log file that contain key data?
No, it will not create a specific log file.

But where the log file locate
After changing the command line, booting and trying to connect to a network, use dmesg and journalctl -b as before. Or if you rebooted already, you may want to use journalctl -b -1 (or higher numbers instead of 1, see the manual for details) to select logs from previous boots.
上次由 243750496 在 2017-11-25 12:13,总共编辑 46 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#414

帖子 243750496 » 2017-11-15 21:57

Wine:


安装115浏览器Playonlinux脚本(Tools->Run a local scripts):
#!/bin/bash
# Date : (2014-10-20)
# Distribution used to test : ubuntu Budgie 17.10 64-bit
# Author :
# Licence : GPLv3
# PlayOnLinux: 4.2.5


[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

PREFIX="115"
WINEVERSION="2.20-staging"
TITLE="115"
EDITOR="115"
GAME_URL=""
AUTHOR=""

#Initialization
POL_SetupWindow_Init

POL_Debug_Init

# Presentation
POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"

# Create Prefix
POL_SetupWindow_browse "$(eval_gettext 'Please select $TITLE install file.')" "$TITLE"
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WINEVERSION"

# Configuration
#安装过程中显示中文而不是乱码或方框
export LANG=zh_CN.UTF-8
POL_System_SetArch "x86"
Set_OS "win7"

#Dependencies
POL_Call POL_Install_AdobeAir
POL_Call POL_Install_atmlib
POL_Call POL_Install_corefonts
POL_Call POL_Install_FontsSmoothRGB
POL_Call POL_Install_dotnet20
POL_Call POL_Install_gdiplus
POL_Call POL_Install_gecko
POL_Call POL_Install_mono26
POL_Call POL_Install_msxml3
POL_Call POL_Install_msxml4
POL_Call POL_Install_msxml6
POL_Call POL_Install_vcrun2005
POL_Call POL_Install_vcrun2008
POL_Call POL_Install_vcrun2010
POL_Call POL_Install_vcrun2012
POL_Call POL_Install_vcrun2013
POL_Call POL_Install_vcrun6
POL_Call POL_Install_wmp9


POL_SetupWindow_message "$(eval_gettext 'NOTICE: Ignore the error at the end of the install that says that Photoshop failed to install.')" "$TITLE"


# Installation
POL_Wine_WaitBefore "$TITLE"
POL_Wine "$APP_ANSWER"
POL_Wine_WaitExit "$TITLE"
Set_OS "win7"

# Create Shortcuts
POL_Shortcut "115br_v8.6.0.77.exe" "$TITLE"

POL_SetupWindow_message "$(eval_gettext 'NOTICE: Online updates and any 3D services do not work. If you want to update your install, you will need to download the update manually and install it in this virtual drive.')" "$TITLE"

POL_SetupWindow_Close
exit 0
115.txt
(1.88 KiB) 已下载 177 次
最后生成启动链接(Playonlinux Configuration ->115->General->make a new shortcut from this virtual drive )后在Miscellaneous->Command to exec before running the program中添加export LANG=zh_CN.UTF-8 (启动前设置中文环境)就行了


p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so: /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so: cannot open shared object file: No such file or directory
解决办法:
sudo apt-get install p11-kit:i386

纯粹使用Wine安装配置115浏览器:
sudo apt-get install winetricks wine32-development winehq-staging
export WINEARCH=win32
export WINEPREFIX=$HOME/.wine115
alias wine='env LANG=zh_CN.UTF-8 wine',如果不执行此步,则会导致中文乱码无论如何都无法消除,也就是后面就没必要做了,直接删除重装吧(不是重装ubuntu系统)
winecfg,如果不执行此步,则会导致安装后乱码但安装的时候不乱,安完后上不了网,而且很卡,连配置页面也会崩溃掉,很奇怪!!!
winetricks atmlib (wenquanyi:可选) dotnet20 gdiplus msxml3 msxml4 msxml6 vcrun2005 vcrun2008 vcrun2010 vcrun2012 vcrun2013 vcrun6(点ja安装) wmp10
修改Wine注册表, 终端输入regedit (界面和windows一样):可选
新建文本,内容如下,并改名为:fonts.reg然后导入
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arial"="wqy-microhei.ttc"
"Arial CE,238"="wqy-microhei.ttc"
"Arial CYR,204"="wqy-microhei.ttc"
"Arial Greek,161"="wqy-microhei.ttc"
"Arial TUR,162"="wqy-microhei.ttc"
"Courier New"="wqy-microhei.ttc"
"Courier New CE,238"="wqy-microhei.ttc"
"Courier New CYR,204"="wqy-microhei.ttc"
"Courier New Greek,161"="wqy-microhei.ttc"
"Courier New TUR,162"="wqy-microhei.ttc"
"FixedSys"="wqy-microhei.ttc"
"Helv"="wqy-microhei.ttc"
"Helvetica"="wqy-microhei.ttc"
"MS Sans Serif"="wqy-microhei.ttc"
"MS Shell Dlg"="wqy-microhei.ttc"
"MS Shell Dlg 2"="wqy-microhei.ttc"
"System"="wqy-microhei.ttc"
"Tahoma"="wqy-microhei.ttc"
"Times"="wqy-microhei.ttc"
"Times New Roman CE,238"="wqy-microhei.ttc"
"Times New Roman CYR,204"="wqy-microhei.ttc"
"Times New Roman Greek,161"="wqy-microhei.ttc"
"Times New Roman TUR,162"="wqy-microhei.ttc"
"Tms Rmn"="wqy-microhei.ttc"
env
命令解释:变量定义:定义在新的环境中变量,定义多个变量定义用空格隔开。格式为“变量名=值”;
alias
功能说明:设置指令的别名。
语法:alias[别名]=[指令名称]
补充说明:用户可利用alias,自定指令的别名。若仅输入alias,则可列出目前所有的别名设置。 alias的效力仅及于该次登入的操作。若要每次登入是即自动设好别名,可在/etc/profile或自己的~/.bashrc中设定指令的别名。

安装:
wine '/home/atc/Mega Cloud/PlayOnLinux APP Pacage/115/115br_v8.6.0.77.exe'
winecfg,如果不执行此步,则会导致提示需要更高版本的Windows才能实现全部功能,即系统版本太低,软件不能完美运行!!!


如果更换wine版本则旧的程序必须重新使用新的wine安装,而不能直接迁移,否则就会报错:
wine client error:0: version mismatch 542/544.
Your wineserver binary was not upgraded correctly,
or you have an older one somewhere in your PATH.
Or maybe the wrong wineserver is still running?



运行前关闭115浏览器相应的加速设置
settings.png
对下载目录进行设置:
Downloads.png
关闭114导航
blankpage.png
平时运行:
export WINEPREFIX=$HOME/.wine115
alias wine='env LANG=zh_CN.UTF-8 wine'
wine '/home/atc/.wine115/drive_c/users/atc/Local Settings/Application Data/115Chrome/Application/115chrome.exe'
注:export和alias定义后关闭终端就会消失,即为临时定义,所以下次使用的时候还是需要重复输入(不信的话,关上终端,然后输入alias保准找不到wine;输入export保准找不到WINEARCH或WINEPREFIX)


如果实在解决不了中文字体方框的问题,请从Windows中拷贝C:Windows->Fonts并改名为fonts到/home/atc/.PlayOnLinux/wine/linux-x86/2.20-staging/share/wine目录下或者/home/atc/.wine115/drive_c/windows下,然后就可以了(注:我用的是Win10的字库)
115 fonts.png
注:注册表再删除.wine115后随即重置,因此对注册表误操作后(比如改字体不满意需要改回原字体)删除.wine115就可以了!

注2:如果wine的字体不好看Or看不清那么可以不做413楼的字体美化,字体保持默认就行了(无论如何修改字体,总是不满意,那么很可能是系统字体的问题,而不是wine字体缺失或字体不对
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#415

帖子 243750496 » 2017-11-21 20:03

Writing custom keyboard firmware using Jack Humbert’s fork of TMK

1. Introduction

Welcome! The purpose of this tutorial is to take someone knowing nothing about writing custom firmware for a keyboard and give them the tools to write one for Jack Humbert’s fork of tmk_keyboard. Note that last part carefully, what is written here is written for Jack Humber's fork of TMK, and will only work with this version of tmk_keyboard.

This tutorial is split into two sections: ‘Basics’ and ‘Beyond the Basics.’ By following the ‘Basics’ section you will be taken from a blank file to the uploading of your firmware. This might very well be all you need. The ‘Beyond the Basics’ section deals with more advanced topics.

1.1 Method

The ‘Basics’ section of this tutorial will be done in the style of following the implementation of a particular keymap from start to finish. This is a keymap for a Planck ortho—linear keyboard. This has three advantages:

Programmable keyboards offer, by definition, an enormous array of possible configurations and uses. The task of outlining all of them would be impossible. Nonetheless the principles involved in any one implementation are transferrable to any other. By following one implementation you will gain the skills to write virtually any customisation.
You will see the principle of iterative refinement at work, which is a part of any project of this kind.
By following the tutorial and at each step copying what is done modified for your own requirements you can come out the other end with a finished product that is very close to—if not exactly—what you want. It is therefore recommended that you follow and adapt your requirements as they go along.
There is one main disadvantage:

You will not see all functions in use.
You will see a great many functions, however, and many I don’t use will be explained where appropriate. The skills you pick up should enable you to use these without difficulty.

1.2 Layout

Each section is numbered so that I can refer you forward or backwards easily. I begin each major section with a summary of what that section covers. This accomplishes three things.

It gives you an idea of what is about to happen. The human brain processes information better if it has a structure to hang the new material in.
You can read this and see whether you need the information that section gives.
It also serves as a reminder should you need to refresh the contents of that section.
In doing this is am shamelessly copying ancient and medieval authors whose tables of contents and section introductions are a standard to aspire to (if you’re interested look at Augustine’s On the Trinity, as a good example).

1.3 Target Audience

Who is this tutorial for? Well, you are programming custom firmware for a mechanical keyboard so I assume that you have basic technical skills. To make it through the ‘Basics’ section—all many are likely to need—you should be able to edit text files, and run commands in a terminal. That’s it. After that there are one or two things in the ‘Beyond the Basics’ section which require some c.

1.4 Some Technecalia

I have elected to use the extended rather than standard keymap. The standard keymap was extended to allow for many more function definitions and some other nice tricks. There are very few reasons not to use the extended keymap. I will not discuss the standard keymap in the tutorial.

It's okay if this does not make sense to you. But you might need the information further into your journey, so I have given it here.

1.5 Disclaimer

This information is provided as a guide and every effort has been made to make sure it is correct, but it will not be perfect. Use it at your own risk.

2. The Basics

2.1 Installing the Right Tools

Jack, I was thinking about cannibalising your existing Tutorial for this part. I'll post credit at the end naturally, but are you okay with that?

2.1.1 Summary

In this section you will download the appropriate version of the tmk_keyboard firmware as well as dfu_programmer and operating system specific development tools so that you have everything you need compile and transfer (flash) the firmware. You will then verify the installation.

2.1.2 Downloading the Software and setting up the environment.

2.1.2.3 Linux

Install AVR GCC with your favorite package manager.
Install DFU-Programmer.

2.1.3 Verify Your Installation

Clone the following repository: https://github.com/jackhumbert/tmk_keyboard
Open a Terminal and cd into tmk_keyboard/keyboard/planck
Run make. This should output a lot of information about the build process.

2.2. Keymaps

2.2.1 Summary

In this section you will create a new keymap file with the name extended_keymap_<name> in the path tmk_keyboard/keyboard/planck/extended_keymaps/, where is a value of your choice. You will then add the #include "extended_keymap_common.h" statement to the beginning, and write the default layer of the keyboard within a const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; statement as a series of rows delimited between braces and separated by commas (except for the last row) and a series of columns delimited by commas within those braces. You will then learn that keys are assigned via a KC_ and that additional layers can be created by repeating the process.

2.2.2 Creating a keymap file

Using your favourite text editor create a new file with the name extended_keymap_<name> in the folder tmk_keyboard/keyboard/planck/extended_keymaps/, where is a value of your choice. In other words, if you are in the tmk_keyboard directory go to the folder keyboard/planck/extended_keymaps or keyboard/quark/extended_keymaps and create your file.

This tutorial will be creating a file for a plank keyboard but, again, the process is similar for a quark.

2.2.3 Writing Your First Keymap

The first line of your file should be #include "extended_keymap_common.h". Don't worry about what it does, just put it at the top of your file and add a space or two afterwards.

After doing that we are now going to create your first keymap. Copy and paste the following code into your editor:

/* MIT Layout (default)
*
* ,-----------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------'
*/
[0] = {
{ , , , , , , , , , , , },
{ , , , , , , , , , , , },
{ , , , , , , , , , , , },
{ , , , , , , , , , , , }
},
At the top is a section which is commented out, this means that the software that converts this file into a form ready to send to the keyboard will ignore it. It is there so we can write in a keymap using just the alphanumeric symbols we are used to, rather than keycodes. It is human rather than machine legible.

2.2.3.1 The Alphabet


Let's take the first step in writing our keymap by adding the alphabet characters. I am a qwerty typist, so our aim to have the following:

/* MIT Layout (default)
*
* ,-----------------------------------------------------------------------.
* | | q | w | e | r | t | y | u | i | o | p | |
* |-----------------------------------------------------------------------|
* | | a | s | d | f | g | h | j | k | l | | |
* |-----------------------------------------------------------------------|
* | | z | x | c | v | b | n | m | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | spc | | | | | |
* `-----------------------------------------------------------------------'
*/
Okay, we've got our alphabet keymap conceptualised the way we want. Let's fill in the part that actually gets compiled.

[0] = {
{ , KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, },
{ , KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, , },
{ , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, , , , },
{ , , , , , KC_SPC, , , , , }
},
Each key is prefixed with KC_ followed by the key name. The alphabet keys are easy, as they are simply the capitalised version of each letter.

You might not like the above layout. Feel free to swap things around.

2.2.3.2 MIT and Grid Layout

You will notice that inside the curly braces after const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; there are a series of rows delimited between braces and separated by commas (except for the last row). Inside the curly braces that make up each row are a series of columns delimited by commas within those braces. You adjust these parameters according to the lay of the keyboard. I have shown a keymap for an MIT layout. But what about a grid? Simple. You just add another comma to the bottom row. So we get:

[0] = {
{ , , , , , , , , , , , },
{ , , , , , , , , , , , },
{ , , , , , , , , , , , },
{ , , , , , , , , , , , }
},
2.2.3.3 The Full Keyset

Okay, let's add the modifier keys and punctuation. We'll follow the default layout to begin with.

/* MIT Layout (default)
*
* ,-----------------------------------------------------------------------.
* | tab | q | w | e | r | t | y | u | i | o | p | bspc|
* |-----------------------------------------------------------------------|
* | esc | a | s | d | f | g | h | j | k | l | ; | ' |
* |-----------------------------------------------------------------------|
* |shift| z | x | c | v | b | n | m | , | . | / |enter|
* |-----------------------------------------------------------------------|
* | | ctl | alt | meta| | spc | | left| down| up |right|
* `-----------------------------------------------------------------------'
*/

[0] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
{ , KC_LCTL, KC_LALT, KC_LGUI, , KC_SPC, , KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
Don't worry about the blank spaces at the moment. Hopefully you have a good idea of how to assign the basic keys now. You might want to change the above layout, or add keys that are not present. For a full list of keycodes see tmk_keyboard/doc/keycode.txt.

2.2.4 Layers


Obviously the point of a customisable keyboard is that we can do much more than this. So lets add some more layers. Think of layers as operating like the shift key on a normal keyboard. When you press shift a range of new characters (capitals and other punctuation marks) are available on the same keys which would ordinarily produce other characters. So let's create our first layer.

Get another copy of the blank keymap above and paste it below your existing keymap, but still with the }; environment. You will end up with something like this:

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* MIT Layout (default)
*
* ,-----------------------------------------------------------------------.
* | tab | q | w | e | r | t | y | u | i | o | p | bspc|
* |-----------------------------------------------------------------------|
* | esc | a | s | d | f | g | h | j | k | l | ; | ' |
* |-----------------------------------------------------------------------|
* |shift| z | x | c | v | b | n | m | , | . | / |enter|
* |-----------------------------------------------------------------------|
* | | ctl | alt | meta| | spc | | left| down| up |right|
* `-----------------------------------------------------------------------'
*/

[0] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
{ , KC_LCTL, KC_LALT, KC_LGUI, , KC_SPC, , KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* MIT Layout (default)
*
* ,-----------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------'
*/
[1] = {
{ , , , , , , , , , , , },
{ , , , , , , , , , , , },
{ , , , , , , , , , , , },
{ , , , , , , , , , , , }
}
};
Notice two very important things. A comma has been added to the end of the first layer }, and the number in the square brackets at the beginning of the second layer is an increment by one of the previous layer, giving us [1] in this case. Remember the comma. When you're dealing with code these small details mean the difference between a successful compilation and not. The number in square brackets is how we are able to refer the layer in the code that we will be writing to select them. The first layer is layer 0, the next layer is layer 1.

This is how I have layer 1 configured, notice that I have included media keys. The first two keys on the third row are for brightness control on a Mac, which are actually the pause and scroll lock keys. Important: as I use a Mac I have used KC_MRWD and KC_MFFW to move fowards or backwards a track. In order to do this on a non-mac use KC_MNXT and KC_MPRV

/* MIT Layout (Raised)
*
* ,-----------------------------------------------------------------------.
* | | f1 | f2 | f3 | f4 | f5 | f6 | f7 | f8 | f9 | f10 | f11 |
* |-----------------------------------------------------------------------|
* | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | f12 |
* |-----------------------------------------------------------------------|
* | | br+ | br- | mute| vol-| vol+| bwd | ply | fwd | [ | ] | = |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------'
*/
[1] = {
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 },
{KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_F12 },
{KC_TRNS, KC_PAUS, KC_SLCK, KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFW, KC_LBRC, KC_RBRC, KC_EQL },
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
}
Notice the keycode KC_TRNS. This is short for transparent. What this means is that when a key with KC_TRNS is pressed the software looks each layer below until there is a keycode other than KC_TRNS and sends that keycode. In other words, with our current configuration the space bar will be treated as space bar in both layers, as in layer 1 the key is transparent and falls back to layer 0. The upshot of this is that we have to be careful with how we assign keys. If we decide to make a key toggle layers while held we can't overwrite that key in the new layer or it will not return to the original layer when released. We need to keep toggle keys transparent in the layers they switch to.

Speaking of switching layers, we now need to know how to do just that.

2.3. Functions

2.3.1 Summary

In this section you will learn that predefined functions that enable a range effects—from basic layer shifting to complex behaviour such as the assignment of dual roles to keys—are placed inside a const uint16_t PROGMEM fn_actions[] = { }; environment and assigned to the keymap as F(<function number>).

2.3.2 Activating Layers

So how do we activate our new layer? We need to use one of the predefined functions, or 'actions.' Add the following beneath everything else currently in your file:

const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(1)
};
This action makes layer 1 active on the key press event and inactive on the release event. In other words the layer is active as long as the you hold the key down.

The syntax of the function works as follows. The layer to be switched to is the one in the round brackets after the function name. We want layer 1 so we have (1).

The number in the square brackets at the start of the line is the number of the function itself. Since it is the first in our list we have [1]. In order to call the action we have written here we use the this number inside of a F() keycode, here F(1). Thus, adding it to our layer 0 we have:

[0] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
{ , KC_LCTL, KC_LALT, KC_LGUI, , KC_SPC, F(1) , KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
The key to the right of space now switches to layer 1.

2.3.3 Beyond Basic Activation

There are some very clever things that can be done with layer actions as well as modifier actions. Let's look at three examples.

2.3.3.1 Example 1

Consider our layer 1. It is good, but the keys we have there have yet further symbols accessed via shift. When shift is held 9 becomes (. Having to hold two keys down—the layer key plus shift—is inconvenient. A layer action comes to the rescue. ACTION_LAYER_MODS(<LAYER>, <MODIFIER>) activates a layer and holds a modifier key down for us at the same time.

So if we add [2] = ACTION_LAYER_MODS(1, MOD_LSFT), after our first function we solve the problem. The shift key is now held down as we access the layer. Just add F(2) to your keymap. Note, however, that shift is not KC_LSFT here but MOD_LSFT. When supplying a modifier key to a function that expects a modifier as an argument we need to use this latter form.

2.3.3.2 Example 2

I like having modifier keys such as Control and Meta within easy reach, but also rely heavily on keys such as escape. Easily accommodated, use ACTION_MODS_TAP_KEY(<MODIFIER>, <KEY>). This function allows you assign a key the behaviour of being a modifier key when held down, but sending a different keycode when tapped. If you want to have Control act as Escape when tapped (very useful for vim users) just add [3] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), and put F(3) in your keymap at the appropriate place.

2.3.3.2 Example 3

I use a typesetting environment called LaTeX much of my day. I write for this environment in emacs. Emacs commands rely on often cumberson combinations of keystrokes. I want to have a layer dedicated to such commands, but how to switch to that layer? I don't want that process itself to be cumberson. Enter ACTION_LAYER_TAP_KEY(<LAYER>, <KEYCODE>). This allows a key to send a normal (non-modifier) key when tapped, but to switch layers when held.

I can bind this to KC_L for latex and place relevant commands in places where I will easily remember them. The function would look like this: [8] = ACTION_LAYER_TAP_KEY(4, KC_L), where layer 4 is where I have set up my latex keys.

2.3.4 A List of Actions

You should now have a good feel for how layer actions work. The following list shows the action layer options that you are most likely to find useful.

To set the default layer and activate it use:

ACTION_DEFAULT_LAYER_SET(layer)

To activate a layer when key a key is pressed and deactivate when released use:

ACTION_LAYER_MOMENTARY(layer)

To turn on a layer on first tap, and then leave the layer on the second tap use:

ACTION_LAYER_TOGGLE(layer)

Register a selected keystroke on tap, but turn on a layer while held:

ACTION_LAYER_TAP_KEY(layer, key)

This action allows you to either turn on a layer by holding the key, or to toggle it after a series of taps. Number of taps it takes to toggle the layer can be configured by changing the variable TAPPING_TOGGLE in config.h. It is 5 by default.

ACTION_LAYER_TAP_TOGGLE(layer)

To switch to a layer while simulating that certain modifier keys are held down while the layer is active use:

ACTION_LAYER_MODS(<LAYER>, <MODIFIERS>)

IMPORTANT: See section 2.3.5 for information on how you can use multiple modifer keys at the same time here.

2.3.5 Modifier Functions

Another section of actions that you can perform involves modifier keys. Say that you want to have a key that simulates Control-Alt-Delete, or some other keychord. You can use the function ACTION_MODS_KEY(<MODIFIER>, <KEY>) for this. To simulate multiple modifiers being held, use a pipe |:

ACTION_MODS_KEY(MOD_LCTL | MOD_LALT, KC_DELETE)
If instead you just want to use a key to simuate multiple modifers being held down (say a particular program you use a lot requires you hold down Control and Alt a great deal) you can use ACTION_MODS(<MODIFIERS>):

ACTION_MODS(MOD_LCTL | MOD_LALT)
If you want to have a modifer apply to the next key you press without having to hold it down (i.e. If you want to use shift to capitalise a letter but tapping shift, then tapping the letter, use:

ACTION_MODS_ONESHOT(<MODIFIER>)

2.3.5.1 Example Modifier Usage

I have a layer set up on my keyboard which activates when I hold down a which allows me to use the arrow keys without leaving my home row (for those interested I have them bound vim-style to hjkl). But on a Mac there are built-in commands for moving the cursor by word or by line (Alt-left/right and Control-a/e respectively). I would like to access these in a single keystroke both for convinence and because my left hand in already holding down a key. I therefore have a keymap set up like this:

/* MIT Layout (Arrowkeys).
* I have put the actual output in the outline.
* ,-----------------------------------------------------------------------.
* | | | | | | | SOL |WDLFT|WDRGT| EOL | | |
* |-----------------------------------------------------------------------|
* | | | | | | | LEFT| DOWN| UP |RIGHT| | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | | |
* |-----------------------------------------------------------------------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------'
*/
[3] = {
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(9), F(11), F(12), F(10), KC_TRNS, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
And supporting functions like this:

const uint16_t PROGMEM fn_actions[] = {
...
[9] = ACTION_MODS_KEY(MOD_LCTL, KC_A), //Navigate text outside of evil in osx
[10] = ACTION_MODS_KEY(MOD_LCTL, KC_E), //Navigate text outside of evil in osx
[11] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT), //Navigate text outside of evil in osx
[12] = ACTION_MODS_KEY(MOD_LALT, KC_RGHT), //Navigate text outside of evil in osx
};
2.4. Macros

2.4.1 Summary

In this section you will learn that a macro is used for simulating for complex keystrokes and is placed in a const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { }; environment using a case structure.

2.4.2 Defining Macros

Say you want to have complex set of keystrokes like 'Control-c, Control-f, Control-e' happen when you press a key. Or perhaps you want a certain word to be written. Macros can do this for you.

2.5. Compilation and Flashing

2.5.1 Compilation Functions

Here is a list of some of the functions available from the command line. We will be going through the most common usage scenario, but this will serve as a handy reference for the future.

make clean: clean the environment - may be required in-between builds
make: compile the code
make COMMON=true: compile with the common (non-extended) keymap
make MATRIX=<matrix_file>: compile with the referenced matrix file. Default if unspecified is matrix_pcb.c. For handwired boards, use matrix_handwired.c.
make KEYMAP=<keymap>: compile with the extended keymap file extended_keymaps/extended_keymap_<keymap>.c
make COMMON=true KEYMAP=<keymap>: compile with the common keymap file common_keymaps/keymap_<keymap>.c
make dfu: build and flash the layout to the PCB
make dfu-force: build and force-flash the layout to the PCB (may be require for first flash)
Generally, the instructions to flash the PCB are as follows:

Make changes to the appropriate keymap file
Save the file
make clean
Press the reset button on the PCB/press the key with the RESET keycode
make <arguments> dfu - use the necessary KEYMAP=<keymap> and/or COMMON=true arguments here.

3. Beyond the Basics

3.1 Backlight Control

3.2 Magic Key

3.3 Mouse Keys

3.4 Custom Functions


——————————————————————————————————————————————————————————————————

Keycode Symbol Table
====================
Keycodes are defined in `common/keycode.h`.
Range of 00-A4 and E0-E7 are identical with HID Usage of Keyboard/Keypad Page(0x07):
<http://www.usb.org/developers/devclass_docs/Hut1_11.pdf>
Virtual keycodes are defined out of above range to support special actions.


Keycode Symbol Short name Description
--------------------------------------------------------------------------------
KC_NO 00 Reserved (no event indicated)
KC_ROLL_OVER 01 Keyboard ErrorRollOver
KC_POST_FAIL 02 Keyboard POSTFail
KC_UNDEFINED 03 Keyboard ErrorUndefined
KC_A 04 Keyboard a and A
KC_B 05 Keyboard b and B
KC_C 06 Keyboard c and C
KC_D 07 Keyboard d and D
KC_E 08 Keyboard e and E
KC_F 09 Keyboard f and F
KC_G 0A Keyboard g and G
KC_H 0B Keyboard h and H
KC_I 0C Keyboard i and I
KC_J 0D Keyboard j and J
KC_K 0E Keyboard k and K
KC_L 0F Keyboard l and L
KC_M 10 Keyboard m and M
KC_N 11 Keyboard n and N
KC_O 12 Keyboard o and O
KC_P 13 Keyboard p and P
KC_Q 14 Keyboard q and Q
KC_R 15 Keyboard r and R
KC_S 16 Keyboard s and S
KC_T 17 Keyboard t and T
KC_U 18 Keyboard u and U
KC_V 19 Keyboard v and V
KC_W 1A Keyboard w and W
KC_X 1B Keyboard x and X
KC_Y 1C Keyboard y and Y
KC_Z 1D Keyboard z and Z
KC_1 1E Keyboard 1 and !
KC_2 1F Keyboard 2 and @
KC_3 20 Keyboard 3 and #
KC_4 21 Keyboard 4 and $
KC_5 22 Keyboard 5 and %
KC_6 23 Keyboard 6 and ^
KC_7 24 Keyboard 7 and &
KC_8 25 Keyboard 8 and *
KC_9 26 Keyboard 9 and (
KC_0 27 Keyboard 0 and )
KC_ENTER KC_ENT 28 Keyboard Return (ENTER)
KC_ESCAPE KC_ESC 29 Keyboard ESCAPE
KC_BSPACE KC_BSPC 2A Keyboard DELETE (Backspace)
KC_TAB 2B Keyboard Tab
KC_SPACE KC_SPC 2C Keyboard Spacebar
KC_MINUS KC_MINS 2D Keyboard - and (underscore)
KC_EQUAL KC_EQL 2E Keyboard = and +
KC_LBRACKET KC_LBRC 2F Keyboard [ and {
KC_RBRACKET KC_RBRC 30 Keyboard ] and }
KC_BSLASH KC_BSLS 31 Keyboard \ and |
KC_NONUS_HASH KC_NUHS 32 Keyboard Non-US # and ~
KC_SCOLON KC_SCLN 33 Keyboard ; and :
KC_QUOTE KC_QUOT 34 Keyboard ‘ and “
KC_GRAVE KC_GRV 35 Keyboard Grave Accent and Tilde
KC_COMMA KC_COMM 36 Keyboard, and <
KC_DOT 37 Keyboard . and >
KC_SLASH KC_SLSH 38 Keyboard / and ?
KC_CAPSLOCK KC_CAPS 39 Keyboard Caps Lock
KC_F1 3A Keyboard F1
KC_F2 3B Keyboard F2
KC_F3 3C Keyboard F3
KC_F4 3D Keyboard F4
KC_F5 3E Keyboard F5
KC_F6 3F Keyboard F6
KC_F7 40 Keyboard F7
KC_F8 41 Keyboard F8
KC_F9 42 Keyboard F9
KC_F10 43 Keyboard F10
KC_F11 44 Keyboard F11
KC_F12 45 Keyboard F12
KC_PSCREEN KC_PSCR 46 Keyboard PrintScreen1
KC_SCKLOCK KC_SLCK 47 Keyboard Scroll Lock11
KC_PAUSE KC_PAUS 48 Keyboard Pause1
KC_INSERT KC_INS 49 Keyboard Insert1
KC_HOME 4A Keyboard Home1
KC_PGUP 4B Keyboard PageUp1
KC_DELETE KC_DELETE 4C Keyboard Delete Forward
KC_END 4D Keyboard End1
KC_PGDOWN KC_PGDN 4E Keyboard PageDown1
KC_RIGHT KC_RGHT 4F Keyboard RightArrow1
KC_LEFT 50 Keyboard LeftArrow1
KC_DOWN 51 Keyboard DownArrow1
KC_UP 52 Keyboard UpArrow1
KC_NUMLOCK KC_NLCK 53 Keypad Num Lock and Clear11
KC_KP_SLASH KC_PSLS 54 Keypad /1
KC_KP_ASTERISK KC_PAST 55 Keypad *
KC_KP_MINUS KC_PMNS 56 Keypad -
KC_KP_PLUS KC_PPLS 57 Keypad +
KC_KP_ENTER KC_PENT 58 Keypad ENTER5
KC_KP_1 KC_P1 59 Keypad 1 and End
KC_KP_2 KC_P2 5A Keypad 2 and Down Arrow
KC_KP_3 KC_P3 5B Keypad 3 and PageDn
KC_KP_4 KC_P4 5C Keypad 4 and Left Arrow
KC_KP_5 KC_P5 5D Keypad 5
KC_KP_6 KC_P6 5E Keypad 6 and Right Arrow
KC_KP_7 KC_P7 5F Keypad 7 and Home
KC_KP_8 KC_P8 60 Keypad 8 and Up Arrow
KC_KP_9 KC_P9 61 Keypad 9 and PageUp
KC_KP_0 KC_P0 62 Keypad 0 and Insert
KC_KP_DOT KC_PDOT 63 Keypad . and Delete
KC_NONUS_BSLASH KC_NUBS 64 Keyboard Non-US \ and |
KC_APPLICATION KC_APP 65 Keyboard Application10
KC_POWER 66 Keyboard Power9
KC_KP_EQUAL KC_PEQL 67 Keypad =
KC_F13 68 Keyboard F13
KC_F14 69 Keyboard F14
KC_F15 6A Keyboard F15
KC_F16 6B Keyboard F16
KC_F17 6C Keyboard F17
KC_F18 6D Keyboard F18
KC_F19 6E Keyboard F19
KC_F20 6F Keyboard F20
KC_F21 70 Keyboard F21
KC_F22 71 Keyboard F22
KC_F23 72 Keyboard F23
KC_F24 73 Keyboard F24
KC_EXECUTE 74 Keyboard Execute
KC_HELP 75 Keyboard Help
KC_MENU 76 Keyboard Menu
KC_SELECT 77 Keyboard Select
KC_STOP 78 Keyboard Stop
KC_AGAIN 79 Keyboard Again
KC_UNDO 7A Keyboard Undo
KC_CUT 7B Keyboard Cut
KC_COPY 7C Keyboard Copy
KC_PASTE 7D Keyboard Paste
KC_FIND 7E Keyboard Find
KC__MUTE 7F Keyboard Mute
KC__VOLUP 80 Keyboard Volume Up
KC__VOLDOWN 81 Keyboard Volume Down
KC_LOCKING_CAPS 82 Keyboard Locking Caps Lock12
KC_LOCKING_NUM 83 Keyboard Locking Num Lock12
KC_LOCKING_SCROLL 84 Keyboard Locking Scroll Lock12
KC_KP_COMMA KC_PCMM 85 Keypad Comma27
KC_KP_EQUAL_AS400 86 Keypad Equal Sign29
KC_INT1 KC_RO 87 Keyboard International115,28
KC_INT2 KC_KANA 88 Keyboard International216
KC_INT3 KC_JYEN 89 Keyboard International317
KC_INT4 KC_HENK 8A Keyboard International418
KC_INT5 KC_MHEN 8B Keyboard International519
KC_INT6 8C Keyboard International620
KC_INT7 8D Keyboard International721
KC_INT8 8E Keyboard International822
KC_INT9 8F Keyboard International922
KC_LANG1 90 Keyboard LANG125
KC_LANG2 91 Keyboard LANG226
KC_LANG3 92 Keyboard LANG330
KC_LANG4 93 Keyboard LANG431
KC_LANG5 94 Keyboard LANG532
KC_LANG6 95 Keyboard LANG68
KC_LANG7 96 Keyboard LANG78
KC_LANG8 97 Keyboard LANG88
KC_LANG9 98 Keyboard LANG98
KC_ALT_ERASE 99 Keyboard Alternate Erase7
KC_SYSREQ 9A Keyboard SysReq/Attention1
KC_CANCEL 9B Keyboard Cancel
KC_CLEAR 9C Keyboard Clear
KC_PRIOR 9D Keyboard Prior
KC_RETURN 9E Keyboard Return
KC_SEPARATOR 9F Keyboard Separator
KC_OUT A0 Keyboard Out
KC_OPER A1 Keyboard Oper
KC_CLEAR_AGAIN A2 Keyboard Clear/Again
KC_CRSEL A3 Keyboard CrSel/Props
KC_EXSEL A4 Keyboard ExSel
/* Modifiers */
KC_LCTRL KC_LCTL E0 Keyboard LeftControl
KC_LSHIFT KC_LSFT E1 Keyboard LeftShift
KC_LALT E2 Keyboard LeftAlt
KC_LGUI E3 Keyboard Left GUI(Windows/Apple/Meta key)
KC_RCTRL KC_RCTL E4 Keyboard RightControl
KC_RSHIFT KC_RSFT E5 Keyboard RightShift
KC_RALT E6 Keyboard RightAlt
KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key)

/*
* Virtual keycodes
*/
/* Generic Desktop Page(0x01) - System Control */
KC_SYSTEM_POWER KC_PWR System Power Down
KC_SYSTEM_SLEEP KC_SLEP System Sleep
KC_SYSTEM_WAKE KC_WAKE System Wake

/* Consumer Page(0x07) */
KC_AUDIO_MUTE KC_MUTE Mute
KC_AUDIO_VOL_UP KC_VOLU Volume Increment
KC_AUDIO_VOL_DOWN KC_VOLD Volume Decrement
KC_MEDIA_NEXT_TRACK KC_MNXT Scan Next Track
KC_MEDIA_PREV_TRACK KC_MPRV Scan Previous Track
KC_MEDIA_STOP KC_MSTP Stop
KC_MEDIA_FAST_FORWARD KC_MFFD Fast Forward
KC_MEDIA_REWIND KC_MRWD Rewind
KC_MEDIA_PLAY_PAUSE KC_MPLY Play/Pause
KC_EJCT KC_MEDIA_EJECT Stop/Eject
KC_MEDIA_SELECT KC_MSEL AL Consumer Control Configuration
KC_MAIL KC_MAIL AL Email Reader
KC_CALCULATOR KC_CALC AL Calculator
KC_MY_COMPUTER KC_MYCM AL Local Machine Browser
KC_WWW_SEARCH KC_WSCH AC Search
KC_WWW_HOME KC_WHOM AC Home
KC_WWW_BACK KC_WBAK AC Back
KC_WWW_FORWARD KC_WFWD AC Forward
KC_WWW_STOP KC_WSTP AC Stop
KC_WWW_REFRESH KC_WREF AC Refresh
KC_WWW_FAVORITES KC_WFAV AC Bookmarks

/* Mousekey - TMK specific */
KC_MS_UP KC_MS_U Mouse Cursor Up
KC_MS_DOWN KC_MS_D Mouse Cursor Down
KC_MS_LEFT KC_MS_L Mouse Cursor Left
KC_MS_RIGHT KC_MS_R Mouse Cursor Right
KC_MS_BTN1 KC_BTN1 Mouse Button 1
KC_MS_BTN2 KC_BTN2 Mouse Button 2
KC_MS_BTN3 KC_BTN3 Mouse Button 3
KC_MS_BTN4 KC_BTN4 Mouse Button 4
KC_MS_BTN5 KC_BTN5 Mouse Button 5
KC_MS_WH_UP KC_WH_U Mouse Wheel Up
KC_MS_WH_DOWN KC_WH_D Mouse Wheel Down
KC_MS_WH_LEFT KC_WH_L Mouse Wheel Left
KC_MS_WH_RIGHT KC_WH_R Mouse Wheel Right
KC_MS_ACCEL0 KC_ACL0 Mouse Acceleration 0
KC_MS_ACCEL1 KC_ACL1 Mouse Acceleration 1
KC_MS_ACCEL2 KC_ACL2 Mouse Acceleration 2

/* Fn key - TMK specific */
KC_FN0
KC_FN1
KC_FN2
KC_FN3
KC_FN4
KC_FN5
KC_FN6
KC_FN7
KC_FN8
KC_FN9
KC_FN10
KC_FN11
KC_FN12
KC_FN13
KC_FN14
KC_FN15
KC_FN16
KC_FN17
KC_FN18
KC_FN19
KC_FN20
KC_FN21
KC_FN22
KC_FN23
KC_FN24
KC_FN25
KC_FN26
KC_FN27
KC_FN28
KC_FN29
KC_FN30
KC_FN31
上次由 243750496 在 2017-11-21 22:30,总共编辑 2 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#416

帖子 243750496 » 2017-11-21 20:33

configure.h:
#define MANUFACTURER geekhack
#define PRODUCT Onekey
#define DESCRIPTION t.m.k. keyboard firmware for Onekey

/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 1



#define MANUFACTURER nathanrosspowell
#define PRODUCT FC210TP
#define DESCRIPTION t.m.k. keyboard firmware for the FC210TP

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 4



keymap.c:

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{{KC_A}},
};

/*
* Fn action definition
*/
const action_t PROGMEM fn_actions[] = {
};





const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: main layer
* ,-----------------------.
* | Esc | Tab | = | Bs |
* |-----------------------|
* |-----------------------|
* | Num | / | * | - |
* |-----------------------|
* | 7 | 8 | 9 | |
* |-----------------| + |
* | 4 | 5 | 6 | |
* |-----------------------|
* | 1 | 2 | 3 | |
* |-----------------| Ent |
* | 0 | . | |
* `-----------------------'
*/
[0] = KEYMAP(
ESC, TAB, PEQL, BSPC,
NLCK, PSLS, PAST, PMNS,
P7, P8, P9, NO,
P4, P5, P6, PPLS,
P1, P2, P3, NO,
P0, NO, PDOT, PENT )
};/*
* Fn action definition
*/
static const uint16_t PROGMEM fn_actions[] = {
};




Makefile:


SRC = keymap.c \
onekey.c \
led.c

OPT_DEFS += -DBOOTLOADER_SIZE=4096



SRC = keymap.c \
matrix.c \
led.c



OPT_DEFS += -DBOOTLOADER_SIZE=512



补充:
ifndef和endif是一对条件预编译语句,给你一个例子:


ifndef abc;//意思是如果没有定义abc这个特征符,则编译之后到endif之前的语句否则略过
//define abc;这条语句;
define abc;
endif;
比如有一段代码,有时需要根据需要不进行编译或进行编译,如以下代码:
ifdef abc;
某段代码;
endif;
意思就是如果程序中定义了abc特征符,则编译这里所说的"某段代码”,否则不进行编译,
如果程序是这样:
ifndef abc;
define abc;
endif;
ifdef abc;
某段代码;
endif;
则这里所说的“某段代码”肯定会被编译,因为在设计程序之初,可能需要根据某个条件来决定是否编译“某段代码”,但是后来发现,这样的条件编译已经没有必要,而且必须要编译“某段代码”,两种办法,一种是把ifdef abc和endif;去掉;另一种就像这里一样,在
ifdef abc;
某段代码;
endif;
之前加
ifndef abc;
define abc;
endif


static最主要有两点用途

让一个变量长期有效,而不管其是在什么地方被申明。比如:

int fun1()

{

static int s_value = 0;

....

}

那么fun1不管在什么地方被调用,当函数退出后,s_value最后的值将一直会被系统保存(相当于一个全局变量),下次s_value再被用到时,也即当fun1()再次被调用时,s_value初始值将是最近被保存过的值(请注意s_value初始化操作只会被执行一次,即上述s_value =0 这个语句)。



2.避免多个文件使用了相同的变量名而导致冲突

 比如有多个文件,分别由几个人独立开发的。假定他们在各自的文件中定义相同的“全局”变量名(仅仅指在他们独自的文件中全局),当系统集成时,由于他们使用了名字一样的“全局”变量,导致有难于遇见的问题。解决这个问题方便的做法就是在各自文件中,在相同的全局变量申明前加上static修饰符。这样系统就会为他们分配不同的内存,互不影响了。



C99版的C语言引入了inline关键字开始支持inline 函数,在这之前传统的C语言(C89)是没有inline 关键字的,也不支持inline 函数。

内联函数的功能和预处理宏的功能相似。相信大家都用过预处理宏,我们会经常定义一些宏,如
#define TABLE_COMP(x) ((x)>0?(x):0)
就定义了一个宏。
为什么要使用宏呢?因为函数的调用必须要将程序执行的顺序转移到函数
所存放在内存中的某个地址,将函数的程序内容执行完后,再返回到转去执行
该函数前的地方。这种转移操作要求在转去执行前要保存现场并记忆执行的地
址,转回后要恢复现场,并按原来保存地址继续执行。因此,函数调用要有一
定的时间和空间方面的开销,于是将影响其效率。而宏只是在预处理的地方把
代码展开,不需要额外的空间和时间方面的开销,所以调用一个宏比调用一个
函数更有效率。
但是宏也有很多的不尽人意的地方。
1、宏不能访问对象的私有成员。
2、宏的定义很容易产生二义性。
我们举个例子:
#define TABLE_MULTI(x) (x*x)
我们用一个数字去调用它,TABLE_MULTI(10),这样看上去没有什么错误,
结果返回100,是正确的,但是如果我们用TABLE_MULTI(10+10)去调用的话,
我们期望的结果是400,而宏的调用结果是(10+10*10+10),结果是120,这显
然不是我们要得到的结果。避免这些错误的方法,一是给宏的参数都加上括号。
#define TABLE_MULTI(x) ((x)*(x))
这样可以确保不会出错,但是,即使使用了这种定义,这个宏依然有可能
出错,例如使用TABLE_MULTI(a++)调用它,他们本意是希望得到(a+1)*(a+1)的
结果,而实际上呢?我们可以看看宏的展开结果: (a++)*(a++),如果a的值是
4,我们得到的结果是4*4 = 16,a = 6。而我们期望的结果是4*4 = 16,而a = 5,这又出现了问题。
事实上,在一些C的库函数中也有这些问题。例如:Toupper(*pChar++)就会对
pChar执行两次++操作,因为Toupper实际上也是一个宏。
我们可以看到宏有一些难以避免的问题,怎么解决呢?
下面就是用我要介绍的内联函数来解决这些问题,我们可以使用内联函数
来取代宏的定义。而且事实上我们可以用内联函数完全取代预处理宏。
内联函数和宏的区别在于,宏是由预处理器对宏进行替代,而内联函数是
通过编译器控制来实现的。而且内联函数是真正的函数,只是在需要用到的时
候,内联函数像宏一样的展开,所以取消了函数的参数压栈,减少了调用的开
销。你可以象调用函数一样来调用内联函数,而不必担心会产生于处理宏的一
些问题。
我们可以用Inline来定义内联函数,不过,任何在类的说明部分定义的函
数都会被自动的认为是内联函数。
下面我们来介绍一下内联函数的用法。
内联函数必须是和函数体声明在一起,才有效。像这样的申明Inline Tablefunction(int I)是没有效果的,编译器只是把函数作为普通的函数声明,我们必须定义函数体。
Inline tablefunction(int I) {return I*I};
这样我们才算定义了一个内联函数。我们可以把它作为一般的函数一样调
用。但是执行速度却比一般函数的执行速度要快。
我们也可以将定义在类的外部的函数定义为内联函数,比如:
Class TableClass{Private:Int I,j;Public:Int add(){return I+j;}Inline int dec(){return I-j;}Int GetNum();}inline int tableclass::GetNum({return I;}
上面申明的三个函数都是内联函数。在C++中,在类的内部定义了函数体的
函数,被默认为是内联函数。而不管你是否有inline关键字。
内联函数在C++类中,应用最广的,应该是用来定义存取函数。我们定义的
类中一般会把数据成员定义成私有的或者保护的,这样,外界就不能直接读写我
们类成员的数据了。
对于私有或者保护成员的读写就必须使用成员接口函数来进行。如果我们把
这些读写成员函数定义成内联函数的话,将会获得比较好的效率。
Class sample{Private:Int nTest;Public:Int readtest() { return nTest; }Void settest(int I) { nTest=I; }}
当然,内联函数也有一定的局限性。就是函数中的执行代码不能太多了,如
果,内联函数的函数体过大,一般的编译器会放弃内联方式,而采用普通的方式
调用函数。这样,内联函数就和普通函数执行效率一样了。


不过大多数 C89 的编译器都将inline作为一种附加特性早早的就加进去了。gcc 也不例外,不过gcc增加inline特性时C99还没定型,gcc中inline 的语意与C99也有些许的区别。这里就主要说说gcc 中的inline 特性。

另外,本文只讨论C语言,C++标准中很早就支持inline,不过inline的语意C和C++ 是有细微差别的。
先举一个最简单的例子:
//main.c
#include <stdio.h>

int foo(void);
int main()
{
int a = foo();
printf("a = %d", a);
return 0;
}

//foo.c
inline int inline_func(int a)
{
return a + 1;
}
int foo(void)
{
int x = 5;
x = inline_func(x);
return x;
}
这个是inline 最简单的用法,无论是gcc 还是其他支持inline 的编译器都能编译通过。
inline_func()是个函数(inline的),既然是函数,那么就应该允许加入函数声明。我们对 foo.c 进行些小的修改,看看结果。
//foo.c
inline int inline_func(int a);
inline int inline_func(int a)
{
return a + 1;
}
int foo(void)
{
int x = 5;
x = inline_func(x);
return x;
}

编译通过,但是这样的代码实际上是不符合c99标准的。c99标准中inline 关键字只能修饰函数定义,不能修饰函数声明。用gcc编译时如加入了 -std=c99 的选项(要求gcc严格遵守c99标准),就不能编译通过。报的错误如下:
In function `foo'
undefined reference to `inline_func

如果在声明时去掉inline,变成如下的代码:
int inline_func(int a);
inline int inline_func(int a)
{
return a + 1;
}
int foo(void)
{
int x = 5;
x = inline_func(x);
return x;
}

则完全没有问题,无论开启与否c99,都能编译通过。
更多的时候,我们一个inline函数要在多处使用,这时如果像普通函数那样在其他文件中也声明一下,比如下面在main.c 中添加了函数声明和调用。

int inline_func(int a);
int foo(void);
int main()
{
int a = foo();
a = inline_func(a);
printf("a = %d", a);
return 0;
}

这样编译也能通过,但是通过查看汇编代码就会发现。只有foo()函数中对inline_func() 的调用被内联了,main()中还是传统的函数调用方式。说明这样用并没有达到我们期望的效果。正确的方式应该是将inline 函数放到头文件中定义。这样每个用到它的地方才会真正的内联。

#include <stdio.h>
#include "inline_func.h"
int foo(void);
int main()
{
int a = foo();
a = inline_func(a);
printf("a = %d", a);
return 0;
}

foo.c
#include "inline_func.h"
int foo(void)
{
int x = 5;
x = inline_func(x);
return x;
}

inline_func.h
#ifndef INLINE_FUNC_H_INCLUDED
#define INLINE_FUNC_H_INCLUDED
inline int inline_func(int a)
{
return a + 1;
}

#endif // INLINE_FUNC_H_INCLUDED

这个代码在最后链接时会报错说多次定义了inline_func()。查看汇编代码就会发现,在编译main.c 和 foo.c 时都生成了 inline_func 的代码,虽然main() 和 foo 都内联了inline_func(),所以inline_func()实际上是没用到的。但是有两份 inline_func()的代码还是会造成链接是的冲突。所以上面的代码还需要修改。一种简单的办法是将inline_func() 改为static 函数,也就是让它的作用域只在编译单元内。
inline_func.h
#ifndef INLINE_FUNC_H_INCLUDED
#define INLINE_FUNC_H_INCLUDED
static inline int inline_func(int a)
{
return a + 1;
}

#endif // INLINE_FUNC_H_INCLUDED

这样修改之后就完全没问题了。其实到这里就可以了,不过有些人就喜欢在头文件中添加函数的声明,即使是inline函数也不例外。
inline_func.h
#ifndef INLINE_FUNC_H_INCLUDED
#define INLINE_FUNC_H_INCLUDED
int inline_func(int a);
static inline int inline_func(int a)
{
return a + 1;
}
#endif // INLINE_FUNC_H_INCLUDED

这样再编译又报错了。
error: static declaration of 'inline_func' follows non-static declaration

继续修改,改成这个样子就没问题了。
inline_func.h
#ifndef INLINE_FUNC_H_INCLUDED
#define INLINE_FUNC_H_INCLUDED
static int inline_func(int a);
static inline int inline_func(int a)
{
return a + 1;
}
#endif // INLINE_FUNC_H_INCLUDED

OK,就说这么多。inline 函数知道这么多基本就够用了。


uint8_t 8位无符号整型数(int)
定义是这样的:
typedef unsigned int uint8_t;

函数声明:
如果函数在主函数之后,则需要在主函数之前进行声明,如:
void aaa();
main(){
...
}
void aaa()
{....}
如果程序写在主函数之前,则不需要声明:
void aaa()
{....}
main(){
...
}

C语言代码由上到下依次执行,原则上函数定义要出现在函数调用之前,否则就会报错。但在实际开发中,经常会在函数定义之前使用它们,这个时候就需要提前声明。

所谓声明(Declaration),就是告诉编译器我要使用这个函数,你现在没有找到它的定义不要紧,请不要报错,稍后我会把定义补上。

函数声明的格式非常简单,相当于去掉函数定义中的函数体再加上分号;,如下所示:

返回值类型 函数名( 类型 形参, 类型 形参… );

也可以不写形参,只写数据类型:

返回值类型 函数名( 类型, 类型…);

函数声明给出了函数名、返回值类型、参数列表(参数类型)等与该函数有关的信息,称为函数原型(Function Prototype)。

函数原型的作用是告诉编译器与该函数有关的信息,让编译器知道函数的存在,以及存在的形式,即使函数暂时没有定义,编译器也知道如何使用它。

有了函数声明,函数定义就可以出现在任何地方了,甚至是其他文件、静态链接库、动态链接库等。

上节给出了计算sum = 1! + 2! + 3! + ... + (n-1)! + n!的代码,这节我们稍作修改,将 factorial() 和 sum() 函数的定义放到 main() 函数后面,请看下面的代码:

#include <stdio.h>
// 函数声明
long factorial(int n); //也可以写作 long factorial(int);
long sum(long n); //也可以写作 long sum(long);

int main(){
printf("1!+2!+...+9!+10! = %ld\n", sum(10));
return 0;
}
//求阶乘
long factorial(int n){
int i;
long result=1;
for(i=1; i<=n; i++){
result *= i;
}
return result;
}
// 求累加的和
long sum(long n){
int i;
long result = 0;
for(i=1; i<=n; i++){
//嵌套调用
result += factorial(i);
}
return result;
}
运行结果:
1!+2!+...+9!+10! = 4037913






一般的单片机开发板,用的按键是普通的按键开关。其结构为弹簧铁片,按下时铁片导通两端电路,松开时铁片由于弹簧作用断开两端电路。这样的普通按键存在一个弊端,就是人的手在按下的时候,由于不能直接导通,可能会由于存在氧化、杂物(灰尘)、人体颤抖等等使其产生一个震荡电路。说白了就是按下的时候,不只是一个电平变化,而是一系断开闭合的方波。而单片机的处理速度是ms级,也就是说它会把这个变化算为一个信号输入。为了避免这个,就用软件的方式,即按下按键后开始延时,延时20ms后(抖动期过后),仍然检测为按下,就说明真的按下,并且只按下一次。那么就进入按键程序了。。
如果没有延时程序,那么当你按下时,i可能不是++ 而是 i++很多次,可能是10次或者20次。
追问
也即是说Delay(一个很大值)时,需要长按键盘才算真的按了一次键盘?
追答
如果在延时中,你松开了。延时结束时程序会判断为你没按。。如果在延时中你松开了,但是在延时结束前你又按下了。还是会判断为你按了。。



unsigned char a=5,b=11;
5 == 0000 0101 (二进制)
10== 0000 1011
a | b== 0000 1111
| 是把某两个数中, 只要其中一个的某一位为1,则结果的该位就为1;
& 相反




条件运算符(?:)
是C语言中唯一的一个三目运算符,它是对第一个表达式作真/假检测,然后根据结果返回另外两个表达式中的一个。
<表达式1>?<表达式2>:<表达式3>
在运算中,首先对第一个表达式进行检验,如果为真,则返回表达式2的值;如果为假,则返回表达式3的值。
例如:
a=(b>0)?b:-b;
当b>0时,a=b;当b不大于0时,a=-b;这就是条件表达式。其实上面的意思就是把b的绝对值赋值给a。







在C中,操作符是一个看似简单,但确实很实用的一个知识点,接下来我们来看看都有那些操作符。
C的操作符有:算术操作符、移位操作符、位操作符、赋值操作符、单目操作符、关系操作符、条件操作符、逗号操作符及下标引用、函数调用和结构成员。
(一)算术操作符

算术操作符,就是我们编写代码中最常见到的简单运算,如 + 、 - 、 * 、 / 、 % 。
在这里要说的是,除了 % ,其他算术操作符都可以作用于整型和浮点型, % 只能作用于整型数据。
在运用 / 操作符时,当 / 两边为整数时,结果为整数,当两边为浮点型时,结果就为浮点型。

(二)移位操作符

移位操作符有左移(<<)和右移(>>)两种,它们都是对数据的二进制数据进行移位的。 、
左移操作符规则:

左边抛弃,右边补 0
20171220205237004.png
上图为num在二进制中的表达方式及左移一位(num << 1)后的结果。

右移操作符规则:

右移有两种规则,一种是逻辑移位,左边用0填充,右边抛弃;另一种是算术移位,左边为原值符号,右边抛弃。
20171220210117575.png
(三)位操作符

位操作符有:

& //按位与 在二进制中 , 相对应的数值有 0 结果就为 0
| //按位或 相对应的数字, 有 1 结果就为 1
^ //按位异或 相同为 0 ,不同为 1.(可用来判断二进制数字是否相同)
(操作符必须为整数)

(四)赋值操作符

赋值操作符就是我们最最最常见的 = ,但需要注意的是 = 与 == 的区别,前者是赋值操作符,后者是相等操作符。
(五)复合操作符

复合操作符,就是将两两运算式写成复合的效果,如:
+=
-=
*=
/=
>>=
<<=
|=
&=
=
它们的道理与其他操作符相同,但写出来更简洁明了。

(六)单目操作符

我们把运算过程中只有一个数值的操作符叫做单目操作符,单目操作符有:
! 逻辑反操作
- 负值
+ 正值
&· 取地址
sizeof 操作数的类型长度(以字节为单位)
~ 取一个数的二进制按位取反
-- 前置--、后置--
++ 前置++、后置++
* 间接访问操作符
(类型)强制类型转换
需要注意的是,sizeof 并非我们认为的函数,它其实是一个单目操作符。
(七)关系操作符

关系操作符有:
>
>=
<
<=
==
!=
需要注意的是,在关系操作符中,它们的使用方法很简单,但一定要小心运算过程中的陷阱使结果发生错误。
(八)逻辑操作符

逻辑操作符有:
|| 逻辑或
&& 逻辑与
在C的学习过程中,一定要注意的是逻辑或与按位或、逻辑与和按位与的区分。按位或和按位与是针对于二进制数字的,而逻辑或和逻辑与是针对于我们的语句,两者的面向对象不同,因此大家一定要区分清楚。
(九)条件操作符

条件操作符的格式是:
exp1 ? exp2 : exp3;
它与C中的条件语句很相似,但从格式上我们可以看出在进行简单的条件判断是,我们可以选用条件操作符,来代替我们的条件语句,可以达成相同的效果。

最后,对于一些复杂的表达式,我们求值时的三个影响因素:
1.操作符的优先级。
2.操作符的结合性。
3.是否控制求值顺序。

20171220213544918.jpeg
上次由 243750496 在 2017-12-29 21:12,总共编辑 8 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#417

帖子 243750496 » 2017-11-21 21:39

This is a tutorial about building your own custom firmware with Hasu's keyboard firmware.

It may seem daunting to work with Hasu's wall of code but the files you need to modify are not many and you don't actually need to fully understand the code. I myself don't understand 100% of it, so if I write some bullshits I hope Hasu will chime in.

Development environment
First of all you need to set up the develpment environment. That depends on your system.

Unfortunately Windows is not the best development environment for this kind of things. My suggestion would be to install a minimal linux distribution on a virtual machine (VirtualBox is free) and follow the linux instructions below. Most of issues people are encountering are due to Windows. I you feel lucky and insist on using windows I believe your best option is to install AtmelStudio. I can't help you with that because I haven't personally used it, but it should contain all you need to compile your firmware.

On Mac get CrossPack and from the App Store install XCode.

On Linux you need to install the development tools (eg: on Ubuntu the package should be called "build-essential") and the AVR dev tools. Again, naming varies based on the distro, search for AVR in your package manager and you should find all you need (eg: for Ubuntu should be "gcc-avr gdb-avr binutils-avr avr-libc avrdude").

To actually burn the firmware in the controller you need a programmer. You can use Atmel's FLIP or dfu-programmer, but I find the easiest to use is the Teensy loader.

If you can't actually build the firmware yourself, don't worry, you can still make the modifications needed to the code and I bet someone here on the forum can send you the HEX file you'll be uploading to the keyboard (you still need to install the programmer above).

Get the code
Download and unzip Hasu's code from github. https://github.com/tmk/tmk_keyboard/archive/master.zip

Fortunately you can ignore most of the code there. Go to the keyboard/gh60 directory. We won't never leave that directory, I've told you it was easy.

Remember to check Hasu's repository once in a while, it is very active and it often gets updated.

Main config
Open Makefile file and check the following globals:

CODE: SELECT ALL
TARGET = gh60_lufa
...
...
MCU = atmega32u4
...
...
#NKRO_ENABLE = yes


if you are using the Teensy++ change the MCU to at90usb1287. Also comment out (place a # at the beginning of the line) the NKRO_ENABLE feature. You don't need it, and it is not supported by LUFA. More about this later.

Now open the config.h file.

You can give custom values to MANUFACTURER, PRODUCT and DESCRIPTION, but that's completely optional. What's important is:

CODE: SELECT ALL
#define MATRIX_ROWS 5
#define MATRIX_COLS 14


Change the values to respectively the number of rows and columns of your keyboard.

Setting up rows and columns
Now back to the teensy. Write down how you connected the rows/cols (and eventually the capslock LED) to the teensy's pins. Remember to avoid pin D6 that is dedicated to the teensy's internal LED.

Just for the sake of this tutorial let's say you have 15 cols and 5 rows. In this example the columns are connected like this:

CODE: SELECT ALL
col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
pin: F7 B6 B5 B4 D7 C7 C6 D3 D2 D1 D0 B7 B3 B2 B1


Rows look like this instead:

CODE: SELECT ALL
row: 0 1 2 3 4
pin: F0 F1 F4 F5 F6


Remember, this is just an example, your pin configuration might be different.

You can check the name of the pins from PJRC pinout page or reading them directly from the Teensy.

Open the matrix.c file. Search for the init_cols function and change it according to your pinout

CODE: SELECT ALL
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRF &= ~(1<<7);
PORTF |= (1<<7);
DDRB &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1);
PORTB |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1);
DDRD &= ~(1<<7 | 1<<3 | 1<<2 | 1<<1 | 1<<0 );
PORTD |= (1<<7 | 1<<3 | 1<<2 | 1<<1 | 1<<0 );
DDRC &= ~(1<<7 | 1<<6);
PORTC |= (1<<7 | 1<<6);
}


It's easier than it looks. The name of the pins are composed by one letter and one number from 0 to 7. If you look at the list of columns, I have one pin starting with F and the number for that pin is 7. So to activate that pin I have to add the following to the list:

CODE: SELECT ALL
DDRF &= ~(1<<7);
PORTF |= (1<<7);


DDRF and PORTF are the hardware registers that control the port F pins. 1<<7 is a bitwise operator that picks the 8th bit of that port (remember we start counting from 0, so the 8th pin is actually number 7).

Let's proceed with the second port.

CODE: SELECT ALL
DDRB &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1);
PORTB |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1);


In this case we are on port B (DDRB and PORTB) and if you look at our cols schema you'll see that we are using the pins number B7, B6, B5, B4, B3, B2 and B1 (even if they are not consecutive on the matrix, it doesn't matter). We use | (or) to smartly react to any of the selected pins. 1<<7 means B7, 1<<6 means B6, and so on.

I believe at this point it should be clear how it works. Proceed with all the other columns.

Cool. We just initiated the columns. Now we have to read them. Search for the read_cols function:

CODE: SELECT ALL
static matrix_row_t read_cols(void)
{
return (PINF&(1<<7) ? 0 : (1<<0)) |
(PINB&(1<<6) ? 0 : (1<<1)) |
(PINB&(1<<5) ? 0 : (1<<2)) |
(PINB&(1<<4) ? 0 : (1<<3)) |
(PIND&(1<<7) ? 0 : (1<<4)) |
(PINC&(1<<7) ? 0 : (1<<5)) |
(PINC&(1<<6) ? 0 : (1<<6)) |
(PIND&(1<<3) ? 0 : (1<<7)) |
(PIND&(1<<2) ? 0 : (1<<8)) |
(PIND&(1<<1) ? 0 : (1<<9)) |
(PIND&(1<<0) ? 0 : (1<<10)) |
(PINB&(1<<7) ? 0 : (1<<11)) |
(PINB&(1<<3) ? 0 : (1<<12)) |
(PINB&(1<<2) ? 0 : (1<<13)) |
(PINB&(1<<1) ? 0 : (1<<14));
}


This function associates each pin to its col. So

CODE: SELECT ALL
(PINF&(1<<7) ? 0 : (1<<0))


Tells the controller that if pin F7 (PINF...7) is active then we are on the first column (again zero based, 1<<0 means first column).

CODE: SELECT ALL
(PINB&(1<<6) ? 0 : (1<<1))


If pin B6 (PINB...6) is high then we are on the second column (1<<1). And so on. A piece of cake.

Now to the rows. Search the unselect_rows function.

CODE: SELECT ALL
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRF &= ~0b01110011;
PORTF &= ~0b01110011;
}


Hasu chose a different syntax here. We are talking binary this time, but it's still pretty easy. If you look at the rows schema you'll see that we are using pins number 0, 1, 4, 5, 6 of the F port.

So we write to the F port with DDRF and PORTF like we did for the columns but to choose the port number we set it to 1. (actually we are unselecting them, but this is meant for newbie and I'm not going deeper into this).

0b just tells the compiler that we are talking binary. Then you have 8 zeros and ones. If you look closely you'll see that the 1s are --reading from right to left-- in the 1st, 2nd, 5th, 6th, 7th positions, or pin number 0, 1, 4, 5, 6 that are the columns that we are using for our keyboard.

Start counting from the right. The first bit is PIN0, the last is PIN7. Just set the pins you use to 1. Peachy, isn't it?

Now to selecting the rows. Search for the select_row function.

CODE: SELECT ALL
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRF |= (1<<0);
PORTF &= ~(1<<0);
break;
case 1:
DDRF |= (1<<1);
PORTF &= ~(1<<1);
break;
case 2:
DDRF |= (1<<4);
PORTF &= ~(1<<4);
break;
case 3:
DDRF |= (1<<5);
PORTF &= ~(1<<5);
break;
case 4:
DDRF |= (1<<6);
PORTF &= ~(1<<6);
break;
}
}


At this point it should pretty clear what's going on here.

case 0: means: "if we are on the first row".

CODE: SELECT ALL
DDRF |= (1<<0);
PORTF &= ~(1<<0);


Means: "select port F, bit 0".

Now modify your ports/pins according to your schema.

Lastly open the led.c file and change the port to the one you connected the LED to.

CODE: SELECT ALL
void led_set(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// output low
DDRD |= (1<<4);
PORTD &= ~(1<<4);
} else {
// Hi-Z
DDRD &= ~(1<<4);
PORTD &= ~(1<<4);
}
}


In this case we have the LED on pin D4. Let's say it were on pin F0 it would have been:

CODE: SELECT ALL
DDRF |= (1<<0);
PORTF &= ~(1<<0);


Okay, a lot to digest. That's enough for the first lesson. In the next session we will be customizing the actual key matrix and the function layers. If you have questions or you spotted some errors, just let me know.

Part 2 is just around the bend.

Welcome to part 2 of "Build your own keyboard firmware" tutorial.

It may seem hard at first but if you follow all the steps of this tutorial you'll see that it's harder to explain than to do.

We are still on keyboard/gh60 directory. All we need resides there. This time we are going to customize the actual keyboard matrix and FN layers.

Defining the matrix
First of all we need to map the matrix in the keymap_common.h file.

The bit we need is:

CODE: SELECT ALL
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
}


The above schema should reflect your keyboard matrix, or how you wired the switches together.

Take the first row:

CODE: SELECT ALL
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \


It means that all switches in the first row are straight connected together. If you need more keys you can keep adding them like so:

CODE: SELECT ALL
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \


Here I've added two new keys in the first row (K0E and K0F). Remember to add ", \" (coma+backslash) at the end of each line.

You have to repeat the same key configuration in block of code below.

CODE: SELECT ALL
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \


As you can see it's the same thing we did above with a slightly different syntax.

Now look at the last row:

CODE: SELECT ALL
K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \


This time we have a jump from K42 to K45. In fact the lower row usually has fewer keys and there's a gap between the ALT key and the SPACEBAR switches. Be careful checking which column each switch is connected to.

CODE: SELECT ALL
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \


In the second block we have to identify empty spaces with the
CODE: SELECT ALL
KC_NO
code. So while in the first block we just jump from one column to another if no physical connection is present, in the second block we need to fill the void with KC_NO.

Have a look at the matrix of the HHFox (you better copy the code below and paste into a text editor).

CODE: SELECT ALL
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
K10, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \
K30, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
K41, K43, K48, K4B, K4C \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E }, \
{ KC_##K10, KC_NO , KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \
{ KC_##K20, KC_NO , KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_NO , KC_##K2E }, \
{ KC_##K30, KC_NO , KC_NO , KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E }, \
{ KC_NO , KC_##K41, KC_NO , KC_##K43, KC_NO , KC_NO , KC_NO , KC_NO , KC_##K48, KC_NO, KC_NO , KC_##K4B, KC_##K4C, KC_NO , KC_NO } \
}


That exactly resembles the hand wired matrix. It's a bit boring to write up but nothing too complex. Just be careful at writing down the letters and numbers correctly.

You can safely ignore the KEYMAP_ANSI thing.

Keymap
And finally the fun part! By default the makefile is building the keymap for the Poker keyboard, so for the sake of simplicity we are going to modify that file. Open the keymap_poker.c.

Clean everything up and replace it with:

CODE: SELECT ALL
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

const uint16_t PROGMEM fn_actions[] = {

};


The first is the array of keymaps. The first element in the array will be our main qwerty (or whatever) keymap. You can copy/paste an already made keymap or start over. The base Poker keymap is as follow:

CODE: SELECT ALL
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSLS, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, FN0, \
LALT, FN1, SPC, PAUS,RALT),


Please note that this is just the list of characters from left to right as you see them on the keyboard. You don't need to add spaces or special codes. Here we are adding some spaces and new lines just to make it more readable, but technically this could be all in one line.

Basically just read the characters on your keyboard from left to right, from top to bottom.

The keymap for the HHFox would look like so:

CODE: SELECT ALL
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSLS, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
LALT, FN1, SPC, PAUS,RALT),
};


If you want to be able to burn your firmware without accessing the teensy reset switch you better add the PAUS key, and it must be on the first layer (not an FN layer).

Function layers
Function keys are defined with the FNx syntax, where x is a number from 0 to 5.

To add a function layer we just add a new keymap to the array. The following is the first FN layer of the HHFox.

CODE: SELECT ALL
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSLS, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
LALT, FN1, SPC, PAUS,FN2),

/* 1: FN 1 */
KEYMAP(MUTE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, VOLU, VOLD, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, UP, TRNS, DEL, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MYCM, TRNS, TRNS, PGDN, LEFT, RGHT, TRNS, \
TRNS, TRNS, TRNS, CALC, TRNS, TRNS, TRNS, TRNS, HOME, END, DOWN, TRNS, TRNS, \
LGUI, TRNS, TRNS, PSCR, RCTL),
};


Same s h i t as above, the only difference is that we use the keyword TRNS (transparent) for all the keys that do not change in behavior when the function key is pressed.

So far we just defined the function layer, to actually activate it we need to add something in the fn_action array

CODE: SELECT ALL
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
};


This means that the F N [0] key will trigger the layer (1) with a ACTION_LAYER_MOMENTARY action. You can define many actions, the most common/useful of which are:

ACTION_LAYER_MOMENTARY(layer), activate layer when holding down the FN key
ACTION_LAYER_TOGGLE(layer), activate on first press, deactivate on second press
ACTION_LAYER_TAP_KEY(layer, key), works like ACTION_LAYER_MOMENTARY when holding but executes the specified key on tap (quick press/release phase)

Let's add a tap action to the HHFox.

CODE: SELECT ALL
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_LAYER_TAP_KEY(1, KC_ESC),
};


Holding the FN1 key we activate the first function layer (same as F N 0), but by quickly tapping the same key we get the ESC key instead. Pretty cool, huh? Thank Hasu for that.

The following would be the final keymap for the HHFox (please note this is not my actual key config). I've taken the liberty of adding a second function layer that is toggled by pressing the FN2 key.

CODE: SELECT ALL
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSLS, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, FN0, \
LALT, FN1, SPC, PAUS,RALT),

/* 1: FN 1 */
KEYMAP(MUTE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, VOLU, VOLD, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, UP, TRNS, DEL, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MYCM, TRNS, TRNS, PGDN, LEFT, RGHT, TRNS, \
TRNS, TRNS, TRNS, CALC, TRNS, TRNS, TRNS, TRNS, HOME, END, DOWN, TRNS, TRNS, \
LGUI, TRNS, TRNS, PSCR, RCTL),

/* 2: FN 2 */
KEYMAP(MUTE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, VOLU, VOLD, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, PGUP, UP, TRNS, DEL, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MYCM, TRNS, TRNS, PGDN, LEFT, RGHT, TRNS, \
TRNS, TRNS, TRNS, CALC, TRNS, TRNS, TRNS, TRNS, HOME, END, DOWN, TRNS, TRNS, \
LGUI, TRNS, TRNS, PSCR, SLEP),
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_LAYER_TAP_KEY(1, KC_ESC),
[2] = ACTION_LAYER_TOGGLE(2)
};


Oh the joy! We are done!

To the compile!
Exit. Open the terminal go to the gh60 directory and run:

CODE: SELECT ALL
make -f Makefile


If you did everything fine you'll end up with a file called gh60_lufa.hex.

Connect your keyboard to the USB. On linux you need to do nothing, everything is already working. On Mac and Windows you'll probably have to follow a quick installation.

When done, run the teensy loader, activate the "Auto" button, load the firmware (the hex file) and press the reset button on the teensy. The firmware will be uploaded and the keyboard will start working right away!

Troubleshooting
Now one of the following scenarios might happen:

Everything's fine and your keyboard will be working right away
Cool! You're a keyboard master!

The keyboard starts firing random characters on screen and the computer starts beeping
Disconnect the keyboard, fast! This is most likely a software problem. Double check your code. When you are ready to re-flash, load the new firmware in the teensy loader, reconnect the keyboard and quickly press the reset button.

The keyboard works but some keys are faulty
This is likely a hardware problem. Check your wiring and double check for shorts.

I closed my keyboard and I don't have access to the hardware reset button
Assuming your keyboard is correctly working, software reset is it accomplished with LSHIFT + RSHIFT + PAUSE.

Everything seems to work but some mods return the wrong key
Disconnect the keyboard and reconnect holding down the BACKSPACE.

That's all for now. Thanks for watching. If you have any trouble don't hesitate to ask.


————————————————————————————————————————————
static void init_cols(void)
{
DDRF &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7);
PORTF |= (1<<4 | 1<<5 | 1<<6 | 1<<7);
}

static matrix_row_t read_cols(void)
{
return (PINF&(1<<4) ? 0 : (1<<0)) |
(PINF&(1<<5) ? 0 : (1<<1)) |
(PINF&(1<<6) ? 0 : (1<<2)) |
(PINF&(1<<7) ? 0 : (1<<3));
}

static void unselect_rows(void)
{
DDRC &= ~(1<<6);
PORTC |= (1<<6);
DDRD &= ~(1<<1 | 1<<0 | 1<<4 | 1<<7);
PORTD |= (1<<1 | 1<<0 | 1<<4 | 1<<7);
DDRE &= ~(1<<6);
PORTE |= (1<<6);
}

static void select_row(uint8_t row)
{
switch (row) {
case 0:
DDRD |= (1<<1);
PORTD &= ~(1<<1);
break;
case 1:
DDRD |= (1<<0);
PORTD &= ~(1<<0);
break;
case 2:
DDRD |= (1<<4);
PORTD &= ~(1<<4);
break;
case 3:
DDRC |= (1<<6);
PORTC &= ~(1<<6);
break;
case 4:
DDRD |= (1<<7);
PORTD &= ~(1<<7);
break;
case 5:
DDRE |= (1<<6);
PORTE &= ~(1<<6);
break;
}
}
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#418

帖子 243750496 » 2017-11-22 1:56

正式开始:
teensy pro mini.jpg
收:rx0 发:tx1 有两组并不冲突,一组用于串口通讯,另一组用于程序下载,为了方便尽量使用右边这组,因为这一列都是用于程序下载的端口,同一时间只能传输数据或者下载二选一。

DTR端口:如果不连那么Uploading时需要按Reset,不按则会失败。连接DTR后直接上传就可以成功,但需要烧录器支持
单片机用来指MCU或者开发板都可以

键位数为n则最多时需要2n个IO口脚(当然聪明的设计者不会这么笨),最少时用行列式设计,需要2倍根号n或2倍根号(n+1)或者2倍根号(n+2)个IO口脚


关于c代码、hex、Programmer、bootloader、还有额外的(avrdude、arduino、teensy、avrispmarkII)这5部分什么关系:
写好c代码然后编译生成hex(就是相当于arm的exe文件,但arm是精简指令集,英特尔是x86指令集因而x86的hex文件不能用于arm这是肯定的)然后用烧写软件比如avrdude 等支持的programmer如avrispmarkll烧写到带bootloader 的teensy 或arduino

注:如果bootloader (类似于pc机的预引导机制BIOS )乱拷是不行的

但是换了开发板芯片没动一般也可以用,另外hex文件是存储在mcu上的

编译动作时(Upload 是一个动作由c生成hex是一个动作)都需要翻译,但不是java虚拟机似的实时翻译,而是翻译好以后就不再翻译类似Qt


sudo apt-get install git unzip build-essential make gcc-avr avr-libc binutils-avr dfu-programmer binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib dfu-util avr-dude gerbv(librepcb官方推荐的PCB输出文件查看器)
https://github.com/LibrePCB/demo-workspace
从此处下载demo-workspace并改名LibrePCB_demo-workspace然后在File->Switch Workspace里选择此文件夹
Switch Wotkspace.png
重启LibrePCB软件就可以Add Component了
add component.png
关于kicad 请看优酷ppptalk的视频
DRC,是设计规则检查的意思,是对PCB图进行的检查,当画完了PCB图,即布线后,要对整体的PCB设计进行一次检查,看有没有不符合设计规则要求的布线等问题,检查时,可以设置一些设计参数。对原理图检查叫ERC。
原理图只需要连线正确,而封装必须严格按照芯片手册(Datasheet)来
芯片引脚都是逆时针编号增大,而且只在第一个引脚处有个圆圈,这个圆圈只是个象征性的标志(即引脚的开始),并不是通过孔,也没有什么实际的意义
PCB设计时可以设计测试点,他就等于两根线(一个测试用线+一个正常连线)连接一个引脚,就像下图所示:

测试点.jpg

先新建库:Library Manager->Add a new library->Creat local library
create library.png
然后打开库:Open Library Editor
open editor.png
File->New
file new.png
1、建立分类Component Category:Keyboard
1 create component category.png
2、建立Symbol
2 create symbol.png
2-1、选择之前创建的分类Keyboard
2-1 choose the category that created before.png
2-2、绘制
2-3、在图层上添加说明
2-3 draw and choose layer.png
3、建立Component
3 create Component.png
3-1、选择之前建立的分类Component Category:Keyboard
3-1 choose the category that created before.png
3-2、选择仅原理图使用:Schematic-Only
3-2 check  Schematic-Only .png
3-3、选择Symbol(注意实际上只需选择Axoplast,CONN_1仅用来举例)
3-3 choose symbol no use of conn_1.png
3-4、点击加号
3-4 type add.png
注意此处如果点了Required那么如果不放置他ERC检测就会出现报错,如图:
ERC error 1.png
第二次选择引脚是否要被检测,如果需要请点击Required,这样没连接的引脚会报错
3-5 ERC check whether it is connected.png
然后assign signal by name
3-6 assign signal.png
右侧可以选择显示哪一种命名,如果是not connect然后又选了Component Signal name
就会显示一个无穷的符号(8一模一样,但不是8!!!!!
由于没有设置Schematic net name因此和no text一样不显示
Symbol pin name是引脚的原名,signal是引脚信号名(可以理解为别名,可重复,比如命名GND1-3全部为GND,但如果不区分123那么在绘制元件原理图会报错,且无法保存更无法在电路原理图中使用了)
注意是原理图而不是Device中使用(不论是否缺少引脚,别名是什么,都不影响Device中1对1的配对,即该是多少个引脚就需要在Device设置多少个,也不论引脚的别名是什么)
test designator in schematics.png
result.png
4、建立分类Pacage Category:Keyboard
4 create Package Category.png
5、建立Pacage
5 create Package.png
5-1、选择之前创建的分类Keyboard(这里会报错,无视他即可)
5-1 ignore it.png
5-2、添加引脚:add new pad
5-2 add new pad .png
5-3、绘制
5-4、双击可以修改属性:
5-4 Double click THT Pad.png
6、新建设备:Device
6 create Device.png
6-1、选择之前创建的分类Keyboard
6-1 choose the category that created before.png
6-2、选择之前创建的元件(Component)和封装(Pacage)
6-2 just choose and click finish.png
6-3、选择Component Signal
6-3 choose Component Signal.png
注意:如果需要删除Symbol、Component、Pacage、Device中任意一个需要打开后选择File->Remove Elements
how to remove elements.png
如果在编辑器主界面删除是没有用的
can not  remove elements here.png
还有如果封装时只有2个Pad但是却添加了超过2个THT Pad就会无法保存,爆出Logic Error

由于软件不完善,更新库中的Symbol、Component、Pacage、Device需要拷贝库文件夹,否则使用时将不会得到更新
如果更新了库中的Symbol、Component、Pacage、Device中任意一个,需要将/home/atc/Nutstore/LibrePCB-Local/v0.1/libraries/local/ATC_Keyboard.lplib/下的所有文件夹
拷贝到Project的目录下:/home/atc/Nutstore/LibrePCB-Local/projects/My_First_Keyboard/library/(注意先删除源文件再拷贝)

而且目前无法使用图层功能

打通孔时需要从通孔向目标引线而不是目标向通孔引,如果是通孔引向通孔或者报错,是因为软件bug(仍处于开发版不完善导致的),可以通过通孔引出一根线,在两通孔距离的一般双击结束划线,然后再从另一通孔将线对接即可
via 1.png
via 2.png
同样由于不完善pcb制板前我们需要手动创建BOM表(Csv文件)



如果需要画一个类似通孔的螺丝位可以使用通孔工具,但是需要设置Pad Name(不然会报错),然后在Device中选择no connection即可(当然Component和schematic中不能有引脚出现)
Hole.png
Hole 2.png
只能通过使用text edit修改配置文件来设置板子尺寸
Drawing the board outline is not yet possible in the board editor. What you can do is to modify the board file to add the outlines
You can copy it from here: https://github.com/LibrePCB/demo-worksp ... t.lp#L5532
Before modifying the file, you need to close the application
[telegram/Urban] at the end of the file, before the last ")" you need to insert this text:
3:54 AM [telegram/Urban] (polygon (layer brd_outlines) (width 0.0)
3:54 AM [telegram/Urban] (fill false) (grab false) (pos 0.0 0.0)
3:54 AM [telegram/Urban] (segment (pos 58.0 0.0) (angle 0.0))
3:54 AM [telegram/Urban] (segment (pos 58.0 16.5) (angle 0.0))
3:54 AM [telegram/Urban] (segment (pos 0.0 16.5) (angle 0.0))
3:54 AM [telegram/Urban] (segment (pos 0.0 0.0) (angle 0.0))
3:54 AM [telegram/Urban] )
3:55 AM [telegram/Urban] and adjust the numbers, this example is a 58.0 x 16.5mm board


librecad 需要设置Option->Application Preference->Appearance中的snap indicator lines为Isometric然后Option->Drawing Preference->Gird->Crossair设置才会有效
isometric.png
isometric2.png
设置运行启用标签模式运行:Option->Application Preference->Default->Start in Tab Mode
start in tab mode.png

VCC和GND都从一个设备出入比如USB口
gerber文件是工厂才需要检查的,只要画好了PCB文档,没有DRC和ERC报错就可以打印板子了
一般工厂制完板后会有检测(是否是质量问题的短路或断路),如果是设计问题那么就没办法了所以尽管可能没有报错但是仍然需要检查有没有:断路、短路、相交(同层导线相交)




linux下的Notepad安装:
sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq


https://deskthority.net/workshop-f7/how ... ml#p141386
keymap_common.h中为什么从K0D(16进制)直接到了K10,原因是方便对照着改而不需要计算了

#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
}





单片机赋0的固定写法: DDRC &= ~
DDRC &= ~0b11000000;(0b为二进制标识)

DDRD&= ~(1<<7 | 1<<6)
相等

单片机赋1的固定写法: DDRC |=
PORTD |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);

在单片机程序中,给IO口赋值,|=,&=和=,这些赋值有什么区别,什么情况下该用哪个???
bitwise OR assignment operator:|=这个是或运算完再赋值
bitwise AND assignment operator:&=这个是与运算完再幅值
=这个是直接幅值
Bitwise NOT Operator (~)

————————————————————————————————————————————————————————
for the sake of the demonstration:

here are two code compiled with avr-gcc-4.7.2:

void main() {
DDRC |= (1<<5);
}

and another:

void main() {
DDRC |= 0b100000;
}

% diff -s t2.s t.s
Files t2.s and t.s are identical
that's because 1<<N is detected at compile time, and transform to its constant equivalent, making both expressions identical when sent to the microcontroller.

About operations, please have a look at truth tables:

| a b -> a&b | | a b -> a|b |
| 0 0 0 | | 0 0 0 |
| 0 1 0 | | 0 1 1 |
| 1 0 0 | | 1 0 1 |
| 1 1 1 | | 1 1 1 |

the hint to remember both truth tables is the following:

if one of the operands is a 0 and you're doing a &, then the result will be 0 (force to 0)
if one of the operands is a 1 and you're doing a |, then the result will be 1 (force to 1)
So if you take an example a bit more complicated:

101010 | 010101 = 111111
101010 & 010101 = 000000

and finaly, when you want to set a bit:

REGISTER = 00000001
REGISTER |= 1<<5 <=> REGISTER = 00000001 | 00100000
REGISTER == 00100001

if you want to reset that bit:

REGISTER &= ~(1<<5) <=> REGISTER = 00100001 & ~(00100000) <=> REGISTER = 00100001 & 11011111
REGISTER == 00000001


————————————————————————————————————————————————————————

如果全部触发则返回0b1111111111111

return (PIND&(1<<0) ? 0 : (1<<0)) |1左移0位
(PIND&(1<<1) ? 0 : (1<<1)) |1左移1位
(PIND&(1<<2) ? 0 : (1<<2)) |1左移2位
(PIND&(1<<3) ? 0 : (1<<3)) |1左移3位
(PIND&(1<<4) ? 0 : (1<<4)) |1左移4位
(PIND&(1<<5) ? 0 : (1<<5)) |1左移5位
(PIND&(1<<6) ? 0 : (1<<6)) |1左移6位
(PIND&(1<<7) ? 0 : (1<<7)) |1左移7位
(PINC&(1<<0) ? 0 : (1<<8)) |1左移8位
(PINC&(1<<1) ? 0 : (1<<9)) |1左移9位
(PINC&(1<<2) ? 0 : (1<<10)) |1左移10位
(PINC&(1<<3) ? 0 : (1<<11)) |1左移11位
(PINC&(1<<4) ? 0 : (1<<12)) |1左移12位
(PINC&(1<<5) ? 0 : (1<<13));1左移13位


延时消抖(待按键稳定后再读取):
_delay_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols();

通过延时30us消抖读取按键变化(弹起Or按下),每额外延时5ms存储一次,并反馈debug信息是否有弹起,并进一步消抖
uint8_t matrix_scan(void)
{
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
select_row(i);
_delay_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols();
if (matrix_debouncing != cols) {
matrix_debouncing = cols;
if (debouncing) {
debug("bounce!: "); debug_hex(debouncing); debug("\n");
}
debouncing = DEBOUNCE;
}
unselect_rows();
}

if (debouncing) {
if (--debouncing) {先debouncing-1然后执行程序
_delay_ms(1);
} else {
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix = matrix_debouncing;
}
}
}


你看哈,i=0时,化为二进制为00000000所以对应的彩灯都为低,都亮,为1的时候二进制为00000001,最后一位为1,所以对应的灯不亮,其余亮,为2的时候二进制为00000010,倒数第二位为1,对应的灯不亮,其余亮~~~~~i为254时二进制为11111110,只有最后一位为0所以只有一个灯亮,255时二进制11111111都为高电平1,灯都不亮!这样循环的时候就形成流水灯了,另外跟你说一下,灯的一端是固定接了高电平的,所以我们需要在另外一端通过程序控制为低电平才能是灯导通,发光,这里就是用P0口控制
你说的IO口只能0或1是指IO口的某一位,如p0.0,p0.1-------p0.7每个p口有8位


/*
Copyright 2017 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* scan matrix
*/
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include "debug.h"
#include "timer.h"
#include "matrix.h"


#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
/* matrix state(1:on, 0:off) */
/*
static matrix_row_t row_debounced = 0;
static matrix_row_t row_debouncing = 0;
static bool debouncing = false;
static uint16_t debouncing_time = 0;
*/
static uint8_t debouncing = DEBOUNCE;

/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];

static matrix_row_t read_cols(void);
static void init_cols(void);
static void unselect_rows(void);
static void select_row(uint8_t row);

/*
void matrix_init(void)
{
debug_enable = true;
debug_matrix = true;
debug_mouse = true;

// PB0: Input with pull-up(DDR:0, PORT:1)
DDRB &= ~(1<<0);
PORTB |= (1<<0);
}
*/
void matrix_init(void)
{
// initialize row and col
unselect_rows();
init_cols();

// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
matrix = 0;
matrix_debouncing = 0;
}
}
/*
uint8_t matrix_scan(void)
{
matrix_row_t r = (PINB&(1<<0) ? 0 : 1);
if (row_debouncing != r) {
row_debouncing = r;
debouncing = true;
debouncing_time = timer_read();
}

if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
row_debounced = row_debouncing;
debouncing = false;
}
return 1;
}
*/

uint8_t matrix_scan(void)
{
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
select_row(i);
_delay_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols();
if (matrix_debouncing != cols) {
matrix_debouncing = cols;
if (debouncing) {
debug("bounce!: "); debug_hex(debouncing); debug("\n");
}
debouncing = DEBOUNCE;
}
unselect_rows();
}

if (debouncing) {
if (--debouncing) {
_delay_ms(1);
} else {
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix = matrix_debouncing;
}
}
}

return 1;
}

inline
matrix_row_t matrix_get_row(uint8_t row)
{
/*
return row_debounced;
*/
return matrix[row];
}

/*
Col: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Pin: D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5
*/

static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRD &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
PORTD |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
DDRC &= ~(1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);值为00000000&11000000=00000000
PORTC |= (1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);值为00000000|00111111=00111111
}

static matrix_row_t read_cols(void)
{
return (PIND&(1<<0) ? 0 : (1<<0)) |
(PIND&(1<<1) ? 0 : (1<<1)) |
(PIND&(1<<2) ? 0 : (1<<2)) |
(PIND&(1<<3) ? 0 : (1<<3)) |
(PIND&(1<<4) ? 0 : (1<<4)) |
(PIND&(1<<5) ? 0 : (1<<5)) |
(PIND&(1<<6) ? 0 : (1<<6)) |
(PIND&(1<<7) ? 0 : (1<<7)) |
(PINC&(1<<0) ? 0 : (1<<8)) |
(PINC&(1<<1) ? 0 : (1<<9)) |
(PINC&(1<<2) ? 0 : (1<<10)) |
(PINC&(1<<3) ? 0 : (1<<11)) |
(PINC&(1<<4) ? 0 : (1<<12)) |
(PINC&(1<<5) ? 0 : (1<<13));
}

/*
Row: 1 2 3 4 5
Pin: C6 C7 A7 A6 A5
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRC &= ~0b11000000;//等于1000000&00111111=00000000:case0;等于10000000&00111111=00000000:case1初始值为:00000000&00111111=00000000
PORTC &= ~0b11000000;//等于00000000&00111111=00000000:case0;等于00000000&00111111=00000000:case1初始值为:00000000&00111111=00000000
DDRA &= ~0b11100000;//等于10000000&00011111=00000000:case2;等于01000000&00011111=00000000:case3;等于00100000&00011111=00000000:case4初始值为:00000000&00011111=00000000
PORTA &= ~0b11100000;//等于00000000&00011111=00000000:case2;等于00000000&00011111=00000000:case3;等于00000000&00011111=00000000:case4初始值为:00000000&00011111=00000000
}

static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRC |= (1<<6);//等于00111111|01000000=01111111case0
PORTC &= ~(1<<6);//等于00111111&10111111=00111111case0
break;
case 1:
DDRC |= (1<<7);//等于00111111|10000000=10111111:case1
PORTC &= ~(1<<7);//等于00111111&01111111=00111111:case1
break;
case 2:
DDRA |= (1<<7);//等于00000000|10000000=10000000
PORTA &= ~(1<<7);//等于00000000|01111111=00000000
break;
case 3:
DDRA |= (1<<6);//等于00000000|01000000=01000000
PORTA &= ~(1<<6);//等于00000000|10111111=00000000
break;
case 4:
DDRA |= (1<<5);//等于00000000|00100000=00100000
PORTA &= ~(1<<5);//等于00000000|11011111=00000000
break;
}
}


由于单片机芯片每次只能扫描一种状态(每大端口(C端口或C组端口):比如C,而不是C0~7中的小端口如:C1端口),切换状态需要使用Hiz(又称三态Or高阻态),如果不用高阻态重置状态就会出现处理器无法理解到底是新的(行:row的)高电平还是旧的(列:col的)高电平没变
上次由 243750496 在 2018-01-01 19:21,总共编辑 72 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#419

帖子 243750496 » 2017-11-25 13:47

PC机键盘简介
随着IBM PC机的发展,键盘也分为XT, AT, PS/2键盘以至于后来的USB键盘. PC系列机使用的键盘有83键、84键、101键、102键和104键等多种。XT和AT机的标准键盘分别为83键和84键,而286机以上微机的键盘则 普遍使用101键、102键或104键。83键键盘是最早使用的一种PC机键盘,其键号与扫描码是一致的。这个扫描码被直接发送到主机箱并转换为 ASCII码;随着高档PC机的出现,键盘功能和按键数目得到了扩充,键盘排列也发生了变化,产生的扫描码与83键键盘的扫描码不同。为了保持PC系列微 机的向上兼容性,需将84/101/102/104键键盘的扫描码转换为83键键盘的扫描码,一般将前者叫作行列位置扫描码,而将后者称为系统扫描码。显 然,对于83键键盘,这两种扫描码是相同的。

键盘是由一组排列成矩阵方式的按键开关组成,通常有编码键盘和非编码键盘两种类型,IBM系列个人微型计算机的键盘属于非编码类型。微机键盘主要由单片 机、译码器和键开关矩阵三大部分组成。其中单片机采用了INTEL8048单片微处理器控制,这是一个40引脚的芯片,内部集成了8位 CPU、1024×8位的ROM、64×8位的RAM、8位的定时器/计数器等器件。由于键盘排列成矩阵格式,被按键的识别和行列位置扫描码的产生,是由 键盘内部的单片机通过译码器来实现的。单片机在周期性扫描行、列的同时,读回扫描信号线结果,判断是否有键按下,并计算按键的位置以获得扫描码。当有键按 下时,键盘分两次将位置扫描码发送到键盘接口;按下一次,叫接通扫描码;释放时再发一次,叫断开扫描码。因此可以用硬件或软件的方法对键盘的行、列分别进 行扫视,去查找按下的键,输出扫描位置码,通过查表转换为ASCII码返回。

键盘是与主机箱分开的一个独立装置,通过一根5芯电缆与主机箱连接,系统主板上的键盘接口按照键盘代码串行传送的应答约定,接受键盘发送来的扫描码;键盘 在扫描过程中,7位计数器循环计数。当高5位(D6一D2)状态为全“0”时,经译码器在O列线上输出一个“0”,其余均为“1”;而计数器的低二位 (D1D0)通过4选1多路选择器控制0—3行的扫描。计数器计一个数则扫描一行,计4个数全部行线扫描一遍,同时由计数器内部向D2进位,使另一列线1 变低,行线再扫描一遍。只要没有键按下,多路选择器就一直输出高电平,则时钟一直使计数器循环计数,对键盘轮番扫描。当有一个键被按下时,若扫描到该键所 在的行和列时,多路选择器就会输出一个低电平,去封锁时钟门,使计数器停止计数。这时计数器输出的数据就是被按键的位置码(即扫描码)。8048利用程序 读取这个键码后,在最高位添上一个“O”,组成一个字节的数据,然后从P22引脚以串行方式输出。在8048检测到键按下后,还要继续对键盘扫描检测,以 发现该键是否释放。当检测到释放时,8048在刚才读出的7位位置码的前面(最高位)加上一个“1”,作为“释放扫描码”,也从 P22引脚串行送出去,以便和“按下扫描码”相区别。送出“释放扫描码”的目的是为识别组合键和上、下档键提供条件。

同时,主机还向键盘发送控制信号,主机CPU响应键盘中断请求时,通过外围接口芯片8255A一5的PA口读取键盘扫描码并进行相应转换处理和暂存;通过PB口的PB6和PB7来控制键盘接口工作。

从用途上看,键盘可分为台式机键盘、笔记本电脑键盘和工控机键盘三大类;其中台式机键盘从按键结构上又可分为两类,即机械键盘和电容键盘(又称有触点键盘 和无触点键盘)。机械键盘存在着开关容易损坏、易污染、易老化的缺点,现已基本淘汰。电容键盘在可靠性上比前者有质的飞跃,使用寿命较长,目前大多为电容 键盘。

早期的键盘是由美国IBM公司推出的,当时采用的计算机键盘为83键键盘。不久IBM又推出了84键的键盘设计标准,将键盘分为三个区,即功能区、打字键 区及负责光标控制和编辑的副键盘区,这种键盘主要区域的划分标准一直沿用至今。随着微软Windows视窗操作系统的广泛应用,IBM公司于1986年首 次推出了101键的标准键盘,除添加了F11、F12两个功能键之外,还在键盘的中部多加了一组专用的光标控制和编辑的键,使键盘功能得到了进一步扩充, 成为当时业界的标准键盘。后来,为与微软的Win95操作系统相配合,IBM又推出了104键键盘,新增了3个功能键(亦称Windows快捷键或热键 <HotKey>),使以前需要打开好几个窗口才能完成的某些功能,通过快捷键的设定直接启动菜单完成,而不必再点击鼠标,这样就使计算机的 操作更加便易。目前,这种104键的键盘(亦称Win95键盘)的设计已成为业界和市场上最为普遍、最为流行的一种标准,业界通称为标准键盘。实际上,所 谓的标准键盘并没有标准,只因其应用较为广泛而被业界通称为标准键盘。由于软件的不断升级更新,为配合软件的需要,所谓的标准键盘的键数也在随之扩增,并 因其又被业界所通常采纳而又被业界通称为标准键盘。

但是,无论是机械键盘或者电容键盘,还是从早期的83键键盘发展到目前通称的标准键盘104键键盘,其应用都是主要依赖于硬件CPU和软件操作系统。以下就键盘的构造及工作原理等问题进行介绍。

(一)键盘构造及工作原理



PS/2设备履行一种双向同步串行协议。换句话说,每次数据线上发送一位数据并且每在时钟线上发一个脉冲就被读入。设备可以发送数据到主机,而主机也可以发送数据到设备,但主机总是在总线上有优先权,它可以在任何时候抑制来自设备的通信,只需把时钟线电平拉低即可。


  键盘的内部结构主要包括控制电路板、按键、底板和面板等。电路板是整个键盘的控制核心,位于键盘的内部,主要担任按键扫描识别、编码和传输接口工作;它将各个键所表示的数字或字母转换成计算机可以识别的信号,是用户和计算机之间主要的沟通者之一。

键盘主要由键开关矩阵、单片机和译码器三大部分组成。键开关矩阵即键盘按键由一组排列成矩阵方式的按键开关组成,所输入的信号由按键所在的位置决定。单片 机即键盘内部采用的Intel 8048单片机微处理器,这是一个40引脚的芯片,内部集成了8位CPU、1024×8位的ROM、64×8位的RAM以 及8位的定时器/计数器等。译码器即信号编码转译装置,把键盘的字符信号通过编码翻译转换成相应的二进制码。由于键盘排列成矩阵格式,被按键的识别和行列 位置扫描码的产生,是由键盘内部的单片机通过译码器来实现的。根据键盘向主机送入的二进制代码类型,可把键盘分为编码键盘和非编码键盘两种。IBM PC机的键盘属于非编码键盘,其特点是不直接提供所按键的编码信息,而是用较为简单的硬件和一套专用程序来识别所按键的位置,并提供与所按键相对应的中间 代码,然后再把中间代码转换成要对应的编码。这样,非编码键盘就为系统软件在定义键盘的某些操作功能上提供了更大的灵活性。

计算机键盘通常采用行列扫描法来确定按下键所在的行列位置。所谓行列扫描法是指,把键盘按键排列成n行×m列的n*m行列点阵,把行、列线分别连接到两个 并行接口双向传送的连接线上,点阵上的键一旦被按动,该键所在的行列点阵信号就被认为已接通。按键所排列成的矩阵,需要用硬件或软件的方法轮转顺序地对其 行、列分别进行扫描,以查询和确认是否有键按动。如有键按动,键盘就会向主机发送被按键所在的行列点阵的位置编码,称为键扫描码。单片机通过周期性扫描 行、列线,读回扫描信号结果,判断是否有键按下,并计算按键的位置以获得扫描码。键被按下时,单片机分两次将位置扫描码发送到键盘接口:按下一次,叫接通 扫描码;按完释放一次,叫断开扫描码。这样,通过硬件或软件的方法对键盘分别进行行、列扫视,就可以确定按下键所在位置,获得并输出扫描位置码,然后转换 为ASCII码,经过键盘I/O电路送入主机,并由显示器显示出来。

键盘要增加键数是很容易的,任何矩阵键盘通过增加键盘的行或列便可实现增加按键数。如64 键的键盘排列成8行×8列的行列点阵,128键的键盘排列成8行×16列的行列点阵,256键的键盘排列成16行×16列的行列点阵,这在1992年7月 出版的《微处理机为基础之设计》出版物上已作介绍(此对比文献在2001年12月13日已递交)。因此,键盘结构采用矩阵式早已是公有技术。

(二)键盘的按键增加及功能改进

随着计算机CPU(硬件)和Windows操作系统(软件)的不断升级换代,计算机的发展进入到了包括多媒体在内的高速多功能时代。与此相适应,计算机键 盘也出现了一些新的变化,主要表现在键盘键数的增加及功能的整合。美国苹果(Apple)公司早在1992年就曾推出过设有调整音量按键的键盘。时下流行 的多媒体键盘,也叫多功能键盘,其特征是增加了一些快捷键(或功能键),通过设定主板BIOS或软件设定,使这些新增的键可以实现开关电脑、休眠启动、 CD播放、音量调整、一键上网等特殊功能。此外还出现了一些多功能集成的键盘,如将扫描仪、录音设备或手写板、鼠标等整合为一体的键盘,以及带有文字编辑 或指纹识别功能的智能键盘等。

如前所述,IBM定义的101键键盘与微软(Microsoft)所定义的三键共同形成的104 键Win95键盘一般被称作标准键盘,那么标准键盘的104键之外如何增加按键扩充功能呢?从目前键盘发展情况看,可以有多种方法。单就增加键盘按键的设 定技术看,一般来讲,按键的增加取决于三个方面的因素:一是CPU能识别,二是操作系统能响应,三是键盘内部电路结构能安排。从前面的介绍可知,CPU和 操作系统这两个因素是计算机必备的现成技术,不成问题。这样,增加键盘按键的关键就在于键盘的内部结构。以下两种方法可以直接简便地增加键盘按键。

目前PC机键盘按键一直沿用IBM的行列矩阵方式布局排列,称为扫描矩阵,其内部电路结构的核心是8048(包括其后续升级系列)单片机微处理器。根据单 片机微处理器特定的I/O(即Input/Output输入/输出)电路,IBM将键盘按键的行列矩阵定义为8行×16列=128键,而现行的标准键盘只 使用了其中的104键,故尚有128-104=24键的阵点闲余,尚未定义。因此,增加按键的方法之一是,直接在这尚未定义的24个闲余按键阵点中继续定 义新键以扩增新的功能键。方法之二是,通过改变单片机微处理器I/O电路的配线方式,可以把IBM的原8行×16列扫描矩阵变为(8+n)行×16列,如 (8+1)行×16列=144键等,这样就会在128键之外获得新增加的一行16个键位,再根据需要为其定义功能。以上两种方法都可以达到增加104键的 标准键盘的按键数的目的。简而言之,第一种方法是在原扫描矩阵8行×16列的行列点阵中尚未利用的24个点上,根据需要可任意增加1至24个新键;第二种 方法是在单片机微处理器原扫描矩阵8行×16列基础上再增加一行,变为9行×16列扫描矩阵,再根据需要任意增加新键,并不会带来单片机微处理器本身原有 功能的更新。如IBM 的83键盘发展到原来的标准键盘101键,其要增加的键数只要通过增加键盘的行或列,并在增加的行列阵点上进行定义便可实现;而原来的101键的标准键盘 后发展到目前的104键的标准键盘,其增加的3个键数可以不增加键盘的行和列,只要在原扫描矩阵中尚未定义的点上直接定义就可以。无论是第一种方法还是第 二种方法,都已经属于公有技术领域的技术。
什么是键盘的键位冲突?

简单的说,也就是当你同时按下键盘上的几个键的时候,这几个键不能同时反映出来,这就叫做键盘的键位冲突。例如说,你能想象当你按下Ctrl-Alt-Del时,系统只能接收到前两个键,而死活不承认你按了Del键吗?
       当然,现实中是不会有这样的键盘的,按不下Ctrl-Alt-Del的键盘根本就没法出厂,但其他一些常见的键位冲突就不稀奇了。例如,经常有一些键盘不能同时对例如A-S-空格这样的按键组合作出反应,这样在FPS游戏中,使用者就会大为吃亏。

       对于键位冲突问题,电脑用户中有两种完全不同的态度,绝大多数人根本意识不到键位冲突问题的存在,直到遇到冲突的时候才叫苦不迭,并且大呼“为什么他就能 做这个动作?”;而另一部分人,特别是一些游戏高手,又在孜孜不倦的寻找“没有键位冲突的键盘”。这两种人都是对键位冲突的原因认识不清楚的。

       键位冲突的直接起因,是键盘的非编码结构。在2月号的专题中,我们提到过现在的键盘几乎都是非编码的薄膜接触式键盘,那么什么是非编码键盘呢?在专题里我们没有详细的解释,下面我们就来详细说明一下非编码键盘的原理与结构。

       传统的键盘,是编码式键盘,它的每个键按下时都会产生唯一的按键编码,并且通过专有的一组导线传输到键盘接口电路,由于其线路和编码的唯一性,这种键盘是不存在键位冲突的问题的,但是编码键盘结构复杂,现在已经很少使用了。

       而现代的薄膜接触式键盘,任何一个按键都有上下两层薄膜的触点,我们将它拆开来仔细看一看(如图),就会发现在任何一层薄膜上,导线数都远少于按键数,而 且每一条导线都同时连通多个按键的触点,而且,上层和下层的任何两条导线都最多只在一个按键上重合。也就是说,上层的1号导线可能会同时经过1、2、3、 4、5……等按键,而下层的1号导线可能同时经过1、Q、A、Z……等按键,且两条导线只在1键上重合。


       什么是键盘的键位冲突?简单的说,也就是当你同时按下键盘上的几个键的时候,这几个键不能同时反映出来,这就叫做键盘的键位冲突。例如说,你能想象当你按下Ctrl-Alt-Del时,系统只能接收到前两个键,而死活不承认你按了Del键吗?

       当然,现实中是不会有这样的键盘的,按不下Ctrl-Alt-Del的键盘根本就没法出厂,但其他一些常见的键位冲突就不稀奇了。例如,经常有一些键盘不能同时对例如A-S-空格这样的按键组合作出反应,这样在FPS游戏中,使用者就会大为吃亏。

       对于键位冲突问题,电脑用户中有两种完全不同的态度,绝大多数人根本意识不到键位冲突问题的存在,直到遇到冲突的时候才叫苦不迭,并且大呼“为什么他就能 做这个动作?”;而另一部分人,特别是一些游戏高手,又在孜孜不倦的寻找“没有键位冲突的键盘”。这两种人都是对键位冲突的原因认识不清楚的。

       键位冲突的直接起因,是键盘的非编码结构。在2月号的专题中,我们提到过现在的键盘几乎都是非编码的薄膜接触式键盘,那么什么是非编码键盘呢?在专题里我们没有详细的解释,下面我们就来详细说明一下非编码键盘的原理与结构。

       传统的键盘,是编码式键盘,它的每个键按下时都会产生唯一的按键编码,并且通过专有的一组导线传输到键盘接口电路,由于其线路和编码的唯一性,这种键盘是不存在键位冲突的问题的,但是编码键盘结构复杂,现在已经很少使用了。

       而现代的薄膜接触式键盘,任何一个按键都有上下两层薄膜的触点,我们将它拆开来仔细看一看(如图),就会发现在任何一层薄膜上,导线数都远少于按键数,而 且每一条导线都同时连通多个按键的触点,而且,上层和下层的任何两条导线都最多只在一个按键上重合。也就是说,上层的1号导线可能会同时经过1、2、3、 4、5……等按键,而下层的1号导线可能同时经过1、Q、A、Z……等按键,且两条导线只在1键上重合。

       这样,根据上层薄膜和下层薄膜所经过的按键,就可以排出一个类似下面的表格:


 
上层导线1 上层导线2 上层导线3 上层导线4 上层导线5

下层导线1 1 2 3 4 5

下层导线2 Q W E R T

下层导线3 A S D F G

下层导线4 Z X C V B

     在非编码键盘的接口控制电路中,就存储着这样一张表格,当按下某个按键,例如“Q”时,那么在这一点上,上下两个触点就会连通,反映到接口电路中,就会检 测到上层导线1与下层导线2被连通了。相对应在表中一查,就会知道,被按下的是字母“Q”,然后通过接口输出其ASCII码。
       与老式的编码式键盘相比,非编码键盘的结构要简单许多,省略了复杂的编码电路和蜘蛛网似的走线,而且更重要的是,由于非编码式键盘将按键结构和输出键码分 离,所以当需要制造不同键位排列的键盘时,不需要重新设计键盘线路,而只要将控制电路中的键位排列表格重新刷新就可以了。例如在德文键盘上,子母“Y”和 “Z”的位置是互调的,那么如果要把一条英文键盘生产线改造成德文键盘生产线,什么都不用改变,只须在控制芯片中刷进一个新的排列表,将“上层导线1-下 层导线4”的位置写作“Y”,“Z”字也作同样处理就行了,显然比重新布线要简单了很多。这也就是为什么非编码式键盘大行其道的原因。

       但是非编码式键盘带来的就是“键位冲突”的问题。以上面的按键排列表为例,当按下一个按键时,键盘肯定会正常识别的;当按下两个按键时,例如同时按下 “Q”与“D”,此时上层导线1与下层导线2连通,而上层导线3与下层导线3连通,系统完全可以正常识别;或者同时按下“Q”与“E”,此时,上层导线 1、下层导线2、上层导线3同时连通,系统同样可以正常识别出是按下了这三个按键。

       但在同时按下3个或3个以上按键时,情况就复杂了。

       在一种情况下,例如同时按下“Q”、“D”、“B”时,此时,从表中我们可以看出,上层导线1-下层导线2、上层导线3-下层导线3、上层导线5-下层导线4都分别连通,此时系统完全可以正常识别出按下了这三个按键。

       但当按下的第三个按键不是“B”,而是“E”呢?

       此时,我们可以发现,由于第三组连通的导线变成了上层导线3-下层导线2,所以,此时反映到接口控制芯片的信号是:上层导线1-下层导线2-上层导线3-下层导线3统统被连通到了一起。

       但是,问题就在于,除了按下的第三个按键是“E”以外,如果按下的第三个键是用来连通上层导线1和下层导线3的“A”,也会有同样的信号组合?事实上, “Q”、“E”、“A”、“D”四个按键中按下任何三个都会有同样的信号组合,那么此时接口电路怎么判断呢?究竟是按下了哪三个按键或者是同时把四个按键 都按下了呢?

       这个时候,大多数键盘选择的方式,就是按照一个固定的规则输出固定的按键组合代码,对于其他可能的组合方式统统予以忽略,换句话说,在上面的键盘中,可能 无论你怎么按这四个按键,它可能永远只会输出“Q”-“E”-“D”的组合,尽管可能你按下的实际是“Q”-“A”-“D”(这里只是一个假设,实际上为 了避免误码,大多数键盘根本只输出两个按键而已)。于是,“键位冲突”就出现了。

       由于非编码键盘的固有结构,“键位冲突”是不可避免的。于是就需要键盘的设计者绞尽脑汁修改键盘的线路排列和待查表格,尽量使可能会有的常用组合按键避开 冲突键位——尽管要做到所有的按键都不发生冲突是不可能的,但你总不能让Ctrl-Alt-Del相互冲突吧?那这样的键盘还怎么用?还有如果四个方向键 相互冲突,那赛车类的游戏还怎么玩?

       不过,由于市场上的游戏实在太多,每个游戏都可能会有自己常用的按键组合,甚至每个人都有自己的习惯按键,键盘的设计者当然不可能面面俱到,有经验的设计 师可能会考虑得多一些,至少对最常见的游戏和最常见的按键设置能够保证不出现问题,但要考虑到所有情况当然是不可能的。
       所以,当你购买键盘的时候,绝对不要忽略“键位冲突”的问题,一定要把键盘装到电脑上,试一试自己常玩的游戏是否能够正常使用(只有实际试用才能试出键位 冲突问题,由于它与键位表相关,所以看外表是看不出来的)。同时,一些游戏高手朋友也不要白费心机去寻找什么“没有键位冲突的键盘”了,只要它依然是非编 码键盘,那么键位冲突就是不可避免的,只要它的键位冲突不对你所玩的游戏构成影响,这就足够了。



专业术语:
I/O:输入/输出(Input/Output
Pin是“针”的意思,在这里指“引脚”的意思。
比如一个元件有10个腿,也就是10个引脚,就是10Pin。
引脚就是芯片外接的引脚啊,一个芯片至少有VCC,GND引脚,象51单片机还有IO引脚,串口引脚等,引脚就是物理外接的一个个管腿啊
端口是从功能上描述单片机,引脚是从电路原理上描述单片机。


RC filter :RC滤波器
在电子电路中,VCC是电路的供电电压,VDD是芯片的工作电压:
电路板上的GND(Ground)代表地线或0线
VCC是数字电源,AVCC是模拟电源。有AVCC的单片机是包含模拟器件的单片机,例如AD转换电路。
一般要求AVCC和VCC之间电压差不能超过一定数值,例如AVR单片机规定不能超过0.3V。
应用时,VCC直接接系统电源,芯片外的其它数字逻辑器件也接VCC,芯片外的模拟电路的电源和AVCC相连。VCC和AVCC之间用一个低通滤波器连接。滤波器典型参数为:电感10μH,两边的电容0.1μF。
V*与AV*的区别是:数字与模拟的区别
CC与DD的区别是:供电电压与工作电压的区别(通常VCC>VDD);

数字电路供电VCC
模拟电路供电AVCC
VDD是指工作电压,就是供电进芯片的
AVDD是模拟电压或者叫模拟正电源,是从芯片向外供电的

1、对于数字电路来说,VCC是电路的供电电压,VDD是芯片的工作电压(通常Vcc>Vdd),VSS是接地点。
2、有些IC既有VDD引脚又有VCC引脚,说明这种器件自身带有电压转换功能。
3、在场效应管(或COMS器件)中,VDD为漏极,VSS为源极,VDD和VSS指的是元件引脚,而不表示供电电压。
4、一般来说VCC=模拟电源,VDD=数字电源,VSS=数字地,VEE=负电源

ADC (analog to digital converter)
pull-up resistor: 上拉电阻(器)
上拉就是将不确定的信号通过一个电阻钳位在高电平,电阻同时起限流作用。下拉同理,也是将不确定的信号通过一个电阻钳位在低电平。
上拉是对器件输入电流,下拉是输出电流;强弱只是上拉电阻的阻值不同,没有什么严格区分;
如人们常说到张某工作很有水平、李某办事水平很差。这样的话都知其含义所在。即指“张某”与“李某”相比而言。故借“水平”来比喻“电平”能使人便于理解。
What is a Logic Level?
Put simply, a logic level is a specific voltage or a state in which a signal can exist. We often refer to the two states in a digital circuit to be ON or OFF. Represented in binary, an ON translates to a binary 1, and an OFF translates to a binary 0. In Arduino, we call these signals HIGH or LOW, respectively. There are several different technologies that have evolved over the past 30 years in electronics to define the various voltage levels.

Logic 0 or Logic 1

Digital electronics rely on binary logic to store, process, and transmit data or information. Binary Logic refers to one of two states – ON or OFF. This is commonly translated as a binary 1 or binary 0. A binary 1 is also referred to as a HIGH signal and a binary 0 is referred to as a LOW signal.

The strength of a signal is typically described by its voltage level. How is a logic 0 (LOW) or a logic 1 (HIGH) defined? Manufacturers of chips generally define these in their spec sheets. The most common standard is TTL or Transistor-Transistor Logic.

What is a Pull-up Resistor
Let’s say you have an MCU with one pin configured as an input. If there is nothing connected to the pin and your program reads the state of the pin, will it be high (pulled to VCC) or low (pulled to ground)? It is difficult to tell. This phenomena is referred to as floating. To prevent this unknown state, a pull-up or pull-down resistor will ensure that the pin is in either a high or low state, while also using a low amount of current.

For simplicity, we will focus on pull-ups since they are more common than pull-downs. They operate using the same concepts, except the pull-up resistor is connected to the high voltage (this is usually 3.3V or 5V and is often refereed to as VCC) and the pull-down resistor is connected to ground.

Pull-ups are often used with buttons and switches.
4.jpg
4.jpg (9.66 KiB) 查看 18504 次
With a pull-up resistor, the input pin will read a high state when the button is not pressed. In other words, a small amount of current is flowing between VCC and the input pin (not to ground), thus the input pin reads close to VCC. When the button is pressed, it connects the input pin directly to ground. The current flows through the resistor to ground, thus the input pin reads a low state. Keep in mind, if the resistor wasn’t there, your button would connect VCC to ground, which is very bad and is also known as a short.

个人认为短路用的保护性小电阻和电子元器件内部的超大电阻形成对比,因而通过时电流会很大,所以也可以叫上拉电阻为短路电阻或大电流电阻
So what value resistor should you choose?

The short and easy answer is that you want a resistor value on the order of 10kΩ for the pull-up.

A low resistor value is called a strong pull-up (more current flows), a high resistor value is called a weak pull-up (less current flows).
5.jpg
5.jpg (10.43 KiB) 查看 18504 次
The value of the pull-up resistor needs to be chosen to satisfy two conditions:

When the button is pressed, the input pin is pulled low. The value of resistor R1 controls how much current you want to flow from VCC, through the button, and then to ground.

When the button is not pressed, the input pin is pulled high. The value of the pull-up resistor controls the voltage on the input pin.

For condition 1, you don’t want the resistor’s value too low. The lower the resistance, the more power will be used when the button is hit. You generally want a large resistor value (10kΩ), but you don’t want it too large as to conflict with condition 2. A 4MΩ resistor might work as a pull-up, but its resistance is so large (or weak) that it may not do its job 100% of the time.

The general rule for condition 2 is to use a pull-up resistor (R1) that is an order of magnitude (1/10th) less than the input impedance (R2) of the input pin. An input pin on a microcontroller has an impedance that can vary from 100k-1MΩ. For this discussion, impedance is just a fancy way of saying resistance and is represented by R2 in the picture above. So, when the button is not pressed, a very small amount of current flows from VCC through R1 and into the input pin. The pull-up resistor R1 and input pin impedance R2 divides the voltage, and this voltage needs to be high enough for the input pin to read a high state.

For example, if you use a 1MΩ resistor for the pull-up R1 and the input pin’s impedance R2 is on the order of 1MΩ (forming a voltage divider), the voltage on the input pin is going to be around half of VCC, and the microcontroller might not register the pin being in a high state. On a 5V system, what does the MCU read on the input pin if the voltage is 2.5V? Is it a high or a low? The MCU doesn’t know and you might read either a high or a low. A resistance of 10k to 100kΩ for R1 should avoid most problems.

Since pull-up resistors are so commonly needed, many MCUs, like the ATmega328 microcontroller on the Arduino platform, have internal pull-ups that can be enabled and disabled. To enable internal pull-ups on an Arduino, you can use the following line of code in your setup() function:

COPY CODEpinMode(5, INPUT_PULLUP); // Enable internal pull-up resistor on pin 5
Another thing to point out is that the larger the resistance for the pull-up, the slower the pin is to respond to voltage changes. This is because the system that feeds the input pin is essentially a capacitor coupled with the pull-up resistor, thus forming a RC filter, and RC filters take some time to charge and discharge. If you have a really fast changing signal (like USB), a high value pull-up resistor can limit the speed at which the pin can reliably change state. This is why you will often see 1k to 4.7KΩ resistors on USB signal lines.

All of these factors play into the decision on what value pull-up resistor to use.



What is a Circuit?
Short and Open Circuits
What is a “Load”?

The reason we want to build circuits is to make electricity do useful things for us. The way we do that is by putting things in the circuit that use the current flow to light up, make noise, run programs, etc.

These things are called loads, because they “load down” the power supply, just like you’re “loaded down” when you’re carrying something. The same way you could be loaded down with too much weight, it’s possible to load down a power supply too much, which will slow down the current flow. But unlike you, it’s also possible to load down a circuit too little - this may let too much current flow (imagine running too fast if you weren’t carrying any weight), which can burn out your parts or even the power supply.

You’ll learn all about voltage, current, and loads in the next tutorial: Voltage, Current, Resistance, and Ohm’s Law. But for now, let’s learn about two special cases of circuit: short circuit, and open circuit. Knowing about these will help tremendously when you’re troubleshooting your own circuits.

Short Circuit

DON’T DO THIS, but if you connect a wire directly from the positive to the negative side of a power supply, you’ll create what is called a short circuit. This is a very bad idea.
1.png
1.png (1.27 KiB) 查看 18508 次
This seems like the best possible circuit, so why is it a bad idea? Remember that electrical current wants to flow from a higher voltage to a lower voltage, and if you put a load into the current, you can do something useful like light up an LED.

If you DO have a load in the current, the current flow through your circuit will be limited to that which your device consumes, which is usually a very small amount. However, if you DON’T put anything in to restrict the current flow, there won’t be anything to slow down the current, and it will try to be infinite!

Your power supply can’t provide infinite current, but it will provide as much as it can, which may be a lot. This could cause your wire to burn up, damage the power supply, drain your battery, or other exciting things. Most of the time your power supply will have some sort of safety mechanism built into it to limit the maximum current in the event of a short circuit, but not always. This is the reason all homes and buildings have circuit breakers, to prevent fires from starting in the event of a short circuit somewhere in the wiring.

A closely related problem is accidentally letting too much current flow through part of your circuit, causing a part to burn up. This isn’t quite a short circuit, but it’s close. This most often happens when you use the incorrect resistor value, which lets too much current flow through another component such as an LED.
2.png
2.png (8.42 KiB) 查看 18508 次
The bottom line: if you notice that things are suddenly becoming hot or a part suddenly burns out, immediately turn off the power and look for possible short circuits.

Open Circuit

The opposite of a short circuit is an open circuit. This is a circuit where the loop isn’t fully connected (and therefore this isn’t really a circuit at all).
3.png
3.png (1.81 KiB) 查看 18508 次
Unlike the short circuit above, nothing will get hurt by this “circuit”, but your circuit won’t work either. If you’re new at circuits, it can often be hard to find where the break is, especially if you’re using breadboards where all the conductors are hidden.

If your circuit doesn’t work, the most likely cause is an open circuit. This is usually due to a broken connection or a loose wire. (Short circuits can steal all the power from the rest of your circuit, so be sure to look for those as well.)

TIP: if you can’t easily find where your circuit is open, a multimeter can be very useful tool. If you set it to measure volts, you can use it to check the voltage at various points in your powered circuit, and eventually find the point where voltage isn’t getting through.


[/size]
上次由 243750496 在 2017-11-29 4:58,总共编辑 1 次。
243750496
帖子: 1038
注册时间: 2012-06-09 15:40

Re: Ubuntu&Fedora装机&Mac装机(Mac装机将会持续更新)

#420

帖子 243750496 » 2017-11-29 4:25

额外知识:

buckling spring 屈蹲弹簧轴薄膜式机械键盘


Ghosting(键位冲突),即存在ghost key
https://deskthority.net/wiki/KiCAD_keyb ... sign_guide

处理ghosting的办法:
1、添加开关不是整流!!!因为键盘USB输入的已经是直流的了)二极管,硬件阻止
Diodes can only be used on keyboards which have a rigid printed circuit board.
薄膜键盘无处添加整流二极管
Membrane keyboards such as rubber dome and most buckling spring keyboards have nowhere to mount diodes, and cannot support diode protection.
电容键盘免疫
Capacitive keyboards do not have electrical switches and as such are immune to this problem from the start, although typically they do have a PCB.

2、通过软件阻止
Keyboards without a PCB solve this problem using blocking: the controller will limit the number of keys pressed concurrently to a safe limit. Since ghosting occurs when three out of four keys are pressed within a square section of the matrix (which typically does not correspond to a group of four physical keys), the safe limit is considered to be two keys: any third key pressed after that is simply not registered, to protect against the third key causing ghosting to occur. Such keyboards are referred to as two-key rollover, or 2KRO. Keyboards with diode protection that can detect an unlimited number of simultaneous keypresses are termed N-key rollover, or NKRO.


所以如下图,机械键盘的轴体构造=开关+整流二极管:
axoplast.png
关于机械键盘的一些必知知识:

键帽高度开始:
常见键帽高度按从高到低的顺序排列为:OEM(代工厂)-SP-Cherry(原厂)
球帽分为SA-DSA。
简单分辨的话。普通键帽除了Cherry和GMK制作的键帽以外,几乎全部都是OEM高度。SP也就是熟悉的情人节啊、奶酪绿啊、雨滴啊这些键帽的生产厂,因此SP的高度也自成一派。
球帽SA和DSA高度比较容易分辨。SA高度从侧面看没有明显的人体工程学曲线。DSA则有符合人体工程学的曲线。
总得来说。除了SA和DSA在使用上有明显区别。其余高度在成套使用时并不会有明显区别。。当然如果是选择个性键帽之类的。需要考虑你所使用的大部分是什么高度。否则会不好看噢。。
常常会从
冠希之类的大神口中听到类似R1 R2 R3 R4、A高 B高之类的话。
首先。从侧面来看。我们通常只需要记住2个高度。1、空格这一行为R1。2、数字区和F区为R4。。R就是row的意思啦。。
A高B高神马的。无视掉就好了。。哈哈。。
为何记住这2个就够了呢?成套键帽的。。按照正常的键位布局。可以无视掉R1……*&……*&之类的问题。。个性键帽的话。几乎所有都集中在这2个高度上噢。。所以记住就ok啦。。当然有例外的。就是丧心病狂的RACE系列。R5啊。。妈妈的。换个键帽都不好找。。
提醒:即使区分了R1……%&*之类的。还是需要区分是原厂高度还是别的高度噢。。
下一部分-
配列以及倍数识别!:
神马60啊。80多啊。100多啊。。这里简单说一下就好了。
用常见的键盘距离。
Poker2那样。只有主键区的。也就是下面图中的这种。被称为60%。键数59-62不等。好像是62- -。Leopold的FC660M也在这个区间内。虽然比较奇葩。。60%键盘的好处就是外壳几乎都通用-当然除了一些特殊的例如KMAC HAPPY、356mini什么的。另外就是便携和对称好看啦。。
常见的80%键盘应该比较熟悉就是Filco87啊。xx87什么什么的。这类键盘具有F区和方向键以及上面的功能键区。没有数字区。。个人认为是非常非常合适的大小。毕竟大部分人来说数字区就只有输密码的用途。但是全键盘携带实在是太。。。不方便了。。80%键盘大致有84 86 87三种区别在于是否有win键和menu键。使用的R1部分就有1x 1.25x 1.5x 和6.25x 7x的区别了。。。当然还有奇葩的什么冷的92。
100%的键盘。这个不要太多。。几乎每个键盘厂家都有100%键盘。简单来说一下。100%的键盘大致分为103 104 108三种。主要区别就是数字区上方是否有4个键。
75%的键盘。race啊各种紧凑型84啊什么的。。这个知道就行了。今天主要是说键帽。这类键盘不适合玩儿键帽- -。
键盘配列的区别主要集中在主键区。也就是60%区域。下面就用gh60给的几个具有代表性的示例图来讨论一下键帽的配列和倍数的识别。
首先,倍数是根据键帽靠
底边的长度来判定的。所以不区分球帽或者什么。倍数的判定标准统一。字母区键帽为1x。也就是1倍。
首先登场的是最简洁也是最常见的winkey。
主要标志就是左下角3个等宽的Ctrl-Win-Alt和右下角4个等长Alt-Fn-Menu-Ctrl。
右Shift是一根完整的。且比左侧Shift长。
识别好Winkey配列。有助于我们识别键帽的倍数。就把它作为一个基准好了。
1202_1.jpg
这里,我们将普通的字母区那样的键帽定义为1x。由图中我们可以看到。
左下角和右下角的3个和4个键。都是等长的。且长度较字母区长。但是并没有长超过一半。这就是我们常说的1.25x。。
再来看左侧的Shift。我们知道了下面的Ctrl和Win是1.25x。那2个1.25x加起来就是2.5x。Shift的长度比这要短一点。所以是2.25x。
右侧的Shift与下面的Menu和Ctrl比较要长一点。所以是2.75x。
这样我们可以用Shift那一行计算出正行的长度是15x。
由计算我们可以得出空格的长度是6.25x啦。。
下面来看另一个配列。这种我们称之为winkey+1.75。目前量产键盘中好像只有Pure采用了这样的配列。不是Pure Pro- -。是Pure。。分辨起来也比较简单。与winkey的唯一区别就是右侧Shift倍分成了1个1.75x的Shift和1个1倍的。一般是fn。。
其余部分与winkey完全相同噢!!!
1202_2.jpg
我们继续来看下一个。
这种配列我们称之为Winkeyless。按英文翻译的话就是没有Win。这样就很奇怪了。。左边的Win键明明在啊。。少掉的不知道是Fn还是Menu啊。
实际上呢。按较早的键盘配列。Winkey的右下角部分是Alt-Win-Menu-Ctrl。目前来说。大部分键盘都采用了多层的设计。因此会有一个Fn层。所以很多都把右下方的Win改为Fn啦。。Winkeyless与Winkey相比。少掉的就是不经常使用的Menu。。
1202_3.jpg
下面我们来看看键帽的倍数。
与上面的Winkey比较。Shift那一行没有什么变化。而空格这一行。左下角和右下角均变为了3个键。长度也有所区别。。变为了1.5x 1x 1.5x的组合。
同样通过计算。我们可以得出空格变长啦!! 长到7x啦!!!
识别Winkeyless就要记得标志性的左下角和右下角噢!!
1202_4.jpg
最后一个。看图我想大家都能看出来就是Winkeyless+1.75啦。。区别呢就同Winkey和Winkey+1.75的区别一样咯。。
在这里呢。
给大家列举出一些常见的需要注意的键帽倍数。
以80%键盘为例。
87通常是Winkey配列。所以几乎所有键帽都可以用噢!例如Ducky白透啊神马的。。
86通常是Winkeyless配列。大部分键帽套装需要购买的增补就是为它准备的啦!!!
84。这里的84指的是87布局的而不是紧凑型的那种。。通常也需要购买增补才可以使用!这里和86相比的就是没有了左下角和右下角2个1x的键。Windows用起来可能会稍微有些别扭吧。。
以上纯属个人见解!!and。有些键盘不适用以上倍数配列标准的。便无法更换全部键帽。例如贼船K70什么的反人类的R1。真的是作死啊!!!!

键盘配列
键盘配列.jpg
当然常见的 主要是以下几种,最多的应该就是POKER 配列,见下图。
个人比较推荐这种配列,配键帽也会比较好配,我自己的也是这个配列
键盘配列 Poker.jpg
第二种比较流行的就是,pure配列。他和Poker配列的主要区别在于,右侧的shift键拆分成了2个键。
总体来说还是不错的,但是可能右侧的shift键 需要另外配了。
键盘配列 Pure.png
第三种,程序猿专用 ,HHKB配列,虽说我也是计算鸡专业毕业的,但是毕业后就把所有的东西都还给老师了。大概程序猿们看到会比较亲切吧-。-反正我是不懂。
键盘配列 HHBK.png










GPIO这个问题很多人都混淆。
本身的概念
GPIO是General-Purpose Input / Output。
-------------
到了单片机上,单片机有很多管脚(PIN)
-------------
PIN除了一些特殊的,比如电源,比如地线,晶振接线等等,很多都可以任意定义成两种功能中的一种:1. 模块的管脚,2. GPIO
--------------
当定义为模块管脚时,PIN起模块中定义的功能。比如定义成SPI模块的管脚,那就按照具体芯片的规定,或者定义成MOSI,或者定义成MISO,或者定义成SCLK,这些不是任意的。SPI是模块,MISO等是功能管脚。
--------------
当定义成GPIO时,可以定义成高阻,输入,或者输出。这时候,就可以用作操作控制位,点LED灯等功能了。
--------------
很多模块的功能管脚,严格意义上来讲也是IO,比如CANH,CANL,所以这里为了避免混淆,就将没有定义成模块功能管脚的那些单片机管脚定义成General Purpose的IO了,以示区别






二极管在电路图中画法
19F10890-D656-4EDC-8D75-793A2D211B30.png
19F10890-D656-4EDC-8D75-793A2D211B30.png (1.22 KiB) 查看 18094 次
国外图纸一般极性电容有2种表示方法,一种是正极为空心矩形,负极为实矩形。
另一种,正极为水平直线,负极为向下弯的弧线。
国内一般统一采用双水平线,正极以 + 符号区分。



电阻、电感、电容中只有电解电容分正负极,其它是不分正负极的。
电解电容器分正负极性,区别在电容器的外表面出线处标有十.一,字样,它必须按要求接入电路。至于充电,这可不是充电器,它不需要你对它充电。


〢,短竖线短些、粗些。长竖线表示正极,短竖线表示负极。边上注明电压值。





1、NC :None Connect,无连接
即该引脚与器件内部功能电路不做连接,是一个空引脚。
2、NC:Normal Close,常闭。
指继电器触点在正常情况下是闭合的
与之相对的是NO:Normal Open,常开。


SCK 是SPI 的时钟 MISO 主机人从机出;MOSI 主机出从机入; 名字相同的对应相接
追问
MISO 主机入从机出;MOSI 主机出从机入;与TXD,RXD什么关系啊?
追答
确切的说没什么关系! 只是功能上有点类似!MISO、MOSI是SPI的通信口、TXD和RXD是串口的通信口!他们是两种通信方式! 是全双工的、全双工意思是:在发送的时候 同时也可以接收!例:A与B通信 A给B发个2、在A发之前 B的发送寄存器里比如有个3、那么在B收到2的时候、A的接收寄存器里也收到了3;不管A是否需要 B传数、只要A给B发数 B都会把其发送寄存器里的数送过来! SPI里要规定主机和从机! 主机提供SCK、即通信的速度!串口里不用规定主从机




串口2条线的 一个RX 一个TX,
SPI是4线串口 分别是 CS(片选) CLK(时钟) MISO(数据输入) MOSI(数据输出);
串口一般是一对一接收,
SPI可以挂载多个SPI设备,通过CS选通设备。
  SPI(Serial Peripheral Interface--串行外设接口)总线系统是一种同步串行外设接口,它可以使MCU与各种外围设备以串行方式进行通信以交换信息。SPI有三个寄存器分别为:控制寄存器SPCR,状态寄存器SPSR,数据寄存器SPDR。外围设备包括FLASHRAM、网络控制器、LCD显示驱动器、A/D转换器和MCU等。SPI总线系统可直接与各个厂家生产的多种标准外围器件直接接口,该接口一般使用4条线:串行时钟线(SCLK)、主机输入/从机输出数据线MISO、主机输出/从机输入数据线MOSI和低电平有效的从机选择线NSS(有的SPI接口芯片带有中断信号线INT、有的SPI接口芯片没有主机输出/从机输入数据线MOSI)。
  串行接口 (Serial Interface) 是指数据一位一位地顺序传送,其特点是通信线路简单,只要一对传输线就可以实现双向通信(可以直接利用电话线作为传输线),从而大大降低了成本,特别适用于远距离通信,但传送速度较慢。一条信息的各位数据被逐位按顺序传送的通讯方式称为串行通讯。串行通讯的特点是:数据位的传送,按位顺序进行,最少只需一根传输线即可完成;成本低但传送速度慢。串行通讯的距离可以从几米到几千米;根据信息的传送方向,串行通讯可以进一步分为单工、半双工和全双工三种。



相信很多人都对单片机与计算机或者芯片通信时,RXD与TXD如何连接比较困惑。因为在一些电路图中,有的是直连接法,有的是交叉接法,让人有点摸不着头脑。
首先需要明白两个概念,就是DTE和DCE。DTE是指数据终端设备,典型的DTE就是计算机和单片机。DCE是指数据通信设备,典型的DCE就是MODEM。RS232串口标准中的RXD和TXD都是站在DTE立场上的,而不是DCE。明白了这一点,再讲下面的接线方法,就很好理解了。
单片机与计算机进行串口通信时,单片机的RXD接计算机的TXD,单片机的TXD接计算机的RXD。
(1)使用串口直通线。设计电路时,单片机的RXD连接电路板DB9的TXD,单片机的TXD连接电路板DB9的RXD,具体实现可在232电平转换芯片处反接。
(2)使用串口交叉线。设计电路时,因为串口线已做交叉,单片机的RXD连接电路板DB9的RXD,单片机的TXD连接电路板DB9的TXD,均直连即可。
这就可以解释为什么有的电路中使用直连接法,有的电路中使用交叉接法,就是因为使用的串口线不同。
单片机与串口设备(如GPRS模块、载波芯片等)通信时,一律将RXD与TXD反接,即单片机的RXD接设备的TXD,单片机的TXD接设备的RXD。(特殊标注其RXD与单片机RXD直连的除外,如华为的EM310)



模块的MISO连接到单片机的MISO,MOSI连接到单片机的MOSI其他SCK连到SCK,CS跟CE可以随意连接,IRQ连接到单片机的外部中断即可正常工作。


通信有很多协议,就像人交流一样有很多语言,英语,汉语日语什么的
I2C有两条线, SDA, SCL
UART三条线, TX,RX,GND,如果单向的话可能只两条
SPI的话四条线,不要CS片选的话剩三条MISO,MOSI,CLK
I2C中SCL为时钟信号,SDA为双向数据通道。
串口中TX为发送,RX为接收,所以串口通讯两个单片机之间TX接RX,RX接TX。
SPI中CLK是时钟,MISO就是主设备读,从设备写。MOSI就是主设备写,从设备读。
sda、scl这些名词是iic总线协议里面的,也就是说如果如果选择iic作为通道,那只需要两根线就可以实现通讯,iic是半双工,通讯之间的设备有主从之分。rx,tx这在串口、并口通讯里看到比较多,比如uart、modem,它们一个发数据、一个接收数据,另外还要clk时钟配合。
I2C 和 SPI 是同步传输,因此需要主机发送时钟信号。SCL 就是 I2C 接口的串行时钟信号(Serial CLock)。

UART 协议是异步通讯协议,是发送和接收端各自依靠自己的精准时钟来控制发送和采样的。因此,在它的通讯线中没有时钟信号线。

I2C 是典型的“两线传输”架构,它的数据线是双向的。因此只能单工通讯。

UART 支持双工通讯,也就是两端同时发送和接收,因此它的数据线分为 TXD (发送)和 RXD(接收)两条。


先学习各个通讯接口和协议,那么芯片的引脚就自然清楚了。


UART
UART是通用异步收发传输器,使用RxD和TxD两根线实现异步全双工通信;为确保通信可靠,可以在通信两边接共地;因此,完整的UART通信只需最少3根线即可。

与UART不同,I2C 是同步半双工通信协议。I2C使用SCL,SDA两根双向数据线进行通信

SPI是同步全双工串行通信协议。SPI定义了4根信号线:
SCK:时钟线,主机提供
MISO:主入从出
MOSI:主出从入
SS:片选。
片选信号可选,因此通信最少需要3根信号线。SPI在时钟上升沿下进行双向数据交换,主机在输出的同时,也会接收到从机的数据。在设计上,主机从机均需要一个移位寄存器。SPI不区分读写方向,只进行数据交换,要读也必须写,才能将数据交换过来。



我们最常见的51单片机是美国Atmel公司生产的AT系列单片机和中国宏晶公司生产的STC系列单片机。早期的AT89C51系列(89后面是字母C)单片机,下载程序时需要使用专门的烧写器烧写进去,单片机烧写程序时必须从电路上取下来,非常麻烦。后来推出了支持ISP(In System Programming)在线编程的AT89S51系列单片机,只需连接几根线即可烧写程序,也不需取下单片机。


232主要型号有:232BL,232RL。
232基本属性:
· 将RS232,RS422,RS485信号转换成USB信号的专用芯片。
· 232RL整合了EEPROM,可用于IO的配置以及存储USB VID,PID,序列号和产品描述信息。
  232BL无内部EEPROM。


电容大小的表示方法
1F(法拉)=1000m F(毫法)、1m F=1000u F(微法)、1uF=1000nF(纳法)、1n F=1000P F(皮法)。n是表示n F(纳法)、


电脑是232电平单片机是ttl电平
所以要么需要内置串口芯片比如CH340,FTDI,CP2012等,要么就需要外置USB转ttl
不能D+ -> TX and D- RX就以为能扩展出USB了



芯片引脚标记要按datasheet来绝对不能乱
AT90USB1286 datasheet.png
但是如果知道哪些是常用的那么可以将他们分组
AT90USB1286 .png
但引脚标号不变

XTAL是晶振引脚接口

滤波电容用在电源整流电路中,用来滤除交流成分。使输出的直流更平滑。(从电源输入滤波)
单片机中晶振=晶振+2个负载电容 用于产生单片机的工作频率使用(工作频率滤波使其处于稳定的工作频率)

晶振与单片机的脚XTAL0和脚XTAL1构成的振荡电路中会产生偕波(也就是不希望存在的其他频率的波)这个波对电路的影响不大但会降低电路的时钟振荡器的稳定性为了电路的稳定性起见ATMEL公司只是建议在晶振的两引脚处接入两个10pf-50pf的瓷片电容接地来削减偕波对电路的稳定性的影响所以晶振所配的电容在10pf-50pf之间都可以的没有什么计算公式。


电源位置接Uvcc的位置添加的滤波电容1u-10u皆可,如果较真的话就需要涉及到阻抗匹配计算了,所以一般不用太仔细

LED压降为2V,并联LED的话总压降不变(因为并联电压一样),三个LED并联压降为2V(LED是发光器件不是电阻,不同颜色压降也是有差异的,一般差0.几V,同型号不同颜色可以忽略),那么电阻的电压为3V(VCC=5V),所以需要连接一个限流电阻3V/X X就是限流电阻的大小,防止烧坏LED 推荐330欧
arduino pro mini.png
格子选1.27mm(2.54的一半),然后根据目测一个空位是2.54,半个是1.27,孔的Drill是1.016或1.0922或者1.1,SizeX和Y都是1.7272或1.7526或者1.6,然后一个一个按照格子上码上即可
arduino pro mini librepcb.png
想要查看封装的标注是否与引脚名一样,只需新建一个Device,然后就会显示出来了,不需要在封装内一个一个点开校对
device show up the pin name.png
不用太纠结外面的边框因为他没大用(确定板子大小放置引脚,然后就没用了),只要孔的位置对了,稍微窄一点也是可以的,比如如图就少了一个无用引脚位(变窄了),原尺寸为1.3 × 0.7 inches=33.02*17.78mm结果去掉了一个2.54mm的方形引脚J1,宽度没变
pro micro.jpg
pro micro kicad.png
小窍门:将左下角放到坐标原点这样比对称放置输入数值更方便准确
librepcb from center.png
Board Editor中格子大小要设置成0.254mm然后再排列元件,如果出现对不上的情况只需要将格子设为2.54然后缩小5倍到0.079375即可
这样是误差最小的!!!!!!!!!!!!!

设置reset引脚需要将HWB引脚用10k电阻串联接地
We want a resistor here because it tells the microcontroller that when we press the reset button, we want to go into the bootloader so that we can flash a new layout onto it!
注:The fuses are also programmed to run the USB bootloader when the HWB button is grounded at power up or reset.





ATmega16U4/ATmega32U4(Pro Micro)(From Datasheet)
Pin Descriptions
VCC
Digital supply voltage.
2.2.2
GND
Ground.
2.2.3
Port B (PB7..PB0)
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port B output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port B pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port B has better driving capabilities than the other ports.
Port B also serves the functions of various special features of the ATmega16U4/ATmega32U4
as listed on page 70.
2.2.4
Port C (PC7,PC6)
Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port C output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port C pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
5
7766BS–AVR–07/08Only bits 6 and 7 are present on the product pinout.
Port C also serves the functions of special features of the ATmega16U4/ATmega32U4 as listed
on page 73.
2.2.5
Port D (PD7..PD0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port D output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port D pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port D also serves the functions of various special features of the ATmega16U4/ATmega32U4
as listed on page 75.
2.2.6
Port E (PE6,PE2)
Port E is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port E output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port E pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port E pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Only bits 2 and 6 are present on the product pinout.
Port E also serves the functions of various special features of the ATmega16U4/ATmega32U4
as listed on page 78.
2.2.7
Port F (PF7..PF4, PF1,PF0)
Port F serves as analog inputs to the A/D Converter.
Port F also serves as an 8-bit bi-directional I/O port, if the A/D Converter channels are not used.
Port pins can provide internal pull-up resistors (selected for each bit). The Port F output buffers
have symmetrical drive characteristics with both high sink and source capability. As inputs, Port
F pins that are externally pulled low will source current if the pull-up resistors are activated. The
Port F pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Bits 2 and 3 are not present on the product pinout.
Port F also serves the functions of the JTAG interface. If the JTAG interface is enabled, the pull-
up resistors on pins PF7(TDI), PF5(TMS), and PF4(TCK) will be activated even if a reset occurs.
2.2.8
D-
USB Full speed / Low Speed Negative Data Upstream Port. Should be connected to the USB D-
connector pin with
a serial 22 Ohms resistor.
2.2.9
D+
USB Full speed / Low Speed Positive Data Upstream Port. Should be connected to the USB D+
connector pin with
a serial 22 Ohms resistor.
2.2.10
UGND
USB Pads Ground.

2.2.11
UVCC
USB Pads Internal Regulator Input supply voltage.
2.2.12
UCAP
USB Pads Internal Regulator Output supply voltage. Should be connected to an external capac-
itor (1μF).
2.2.13
VBUS
USB VBUS monitor input.
2.2.14
RESET
Reset input. A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running. The minimum pulse length is given in Table 8-1 on page
48. Shorter pulses are not guaranteed to generate a reset.
2.2.15
XTAL1
Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
2.2.16
XTAL2
Output from the inverting Oscillator amplifier.
2.2.17
AVCC
AVCC is the supply voltage pin (input) for all the A/D Converter channels. If the ADC is not used,
it should be externally connected to V CC . If the ADC is used, it should be connected to V CC
through a low-pass filter.
2.2.18
AREF
This is the analog reference pin (input) for the A/D Converter.

只有地线(GND)是负极,其他都是正极(包括电源输入Vcc),所以只从有电压的地方往GND方向看就是正常电流方向,而且GND有就近原则(不会走最远的接地线路)
另外短路时电压变小,有电压LED才会亮,单片机不谈电流


https://www.autodesk.com/products/eagle ... 的信用卡支付就可以了![/u]
sudo apt-get install libxrender1:i386 libxrandr2:i386 libxcursor1:i386 libfreetype6:i386 libfontconfig1:i386 libxext6:i386 libx11-6:i386 libxi6:i386 libssl1.0.0:i386 libstdc++6:i386 libgcc1:i386 libc6:i386 libc6-i386 libxfixes3:i386 libexpat1:i386 libxcb1:i386 libxdmcp6:i386 libxau6:i386

AT90USB64/128(Teensy 2.0++
2.2 Pin descriptions
2.2.1 VCC
Digital supply voltage.
2.2.2 GND
Ground.
2.2.3 AVCC
Analog supply voltage.
2.2.4 Port A (PA7..PA0)
Port A is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each bit). The
Port A output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port A pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port A pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port A also serves the functions of various special features of the Atmel AT90USB64/128 as
listed on page 78.
2.2.5 Port B (PB7..PB0)
Port B is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each bit). The
Port B output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port B pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port B has better driving capabilities than the other ports.
Port B also serves the functions of various special features of the AT90USB64/128 as listed on
page 79.
2.2.6 Port C (PC7..PC0)
Port C is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each bit). The
Port C output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port C pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port C also serves the functions of special features of the AT90USB64/128 as listed on page 82.
2.2.7 Port D (PD7..PD0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port D output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port D pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port D also serves the functions of various special features of the AT90USB64/128 as listed on
page 83.

2.2.8 Port E (PE7..PE0)
Port E is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each bit). The
Port E output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port E pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port E pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port E also serves the functions of various special features of the AT90USB64/128 as listed on
page 86.
2.2.9 Port F (PF7..PF0)
Port F serves as analog inputs to the A/D Converter.
Port F also serves as an 8-bit bidirectional I/O port, if the A/D Converter is not used. Port pins
can provide internal pull-up resistors (selected for each bit). The Port F output buffers have symmetrical
drive characteristics with both high sink and source capability. As inputs, Port F pins
that are externally pulled low will source current if the pull-up resistors are activated. The Port F
pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the
JTAG interface is enabled, the pull-up resistors on pins PF7(TDI), PF5(TMS), and PF4(TCK) will
be activated even if a reset occurs.
Port F also serves the functions of the JTAG interface.
2.2.10 DUSB
Full speed / Low Speed Negative Data Upstream Port. Should be connected to the USB Dconnector
pin with
a serial 22Ω resistor.
2.2.11 D+
USB Full speed / Low Speed Positive Data Upstream Port. Should be connected to the USB D+
connector pin with
a serial 22Ω resistor.
2.2.12 UGND
USB Pads Ground.
2.2.13 UVCC
USB Pads Internal Regulator Input supply voltage.
2.2.14 UCAP
USB Pads Internal Regulator Output supply voltage. Should be connected to an external capacitor
(1µF).
2.2.15 VBUS
USB VBUS monitor and OTG negociations.
2.2.16 RESET
Reset input. A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running. The minimum pulse length is given in Table 9-1 on page
58. Shorter pulses are not guaranteed to generate a reset.
2.2.17 XTAL1
Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.


2.2.18 XTAL2
Output from the inverting oscillator amplifier.
2.2.19 AVCC
AVCC is the supply voltage pin for Port F and the A/D Converter. It should be externally connected
to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC
through a low-pass filter.
2.2.20 AREF
This is the analog reference pin for the A/D Converter

USB设备分为HOST(主设备)和SLAVE(从设备),只有当一台HOST与一台SLAVE连接时才能实现数据的传输,OTG设备就是我们的“EX”既能充当HOST,亦能充当SLAVE

USB电流最大为500mA(USB1、2、3都是一样的电流上限

单片机VCC是输出端口,如果没有USB输入,那么可以选择vin(即RAW接口),VCC不是电源输入!!!!
三极管可以放大电流


上了irc.freenode.net 的#vim 却无法与别人交谈
提示要注册用户

比如我要注册tczengming
/nick tczengming

/msg nickserv register 密码 邮件地址
这个邮件地址有些irc服务器是必须填的,因为它要求你用来验证注册的。
如果没有它,可能会提示,我就因为这个原因整了好半天。

[14:34] [通知] -NickServ- Insufficient parameters for REGISTER
[14:34] [通知] -NickServ- Syntax: REGISTER

然后打开邮箱,看里面的提示操作就注册成功了。
比如:
/msg NickServ VERIFY REGISTER tczengming snuwrmfzzuze


注:IRC频道注册后用户名也可以于其他IRC频道登录(通用





键盘冲突如何解决?
no added diode.jpg
还是以这张图为例,由于工作或者游戏需要,我们同时按下了Q、2、W按键。那么键盘是怎么处理的呢?首先,芯片通过扫描后得到以下信息:A1与B2是同时开启的(Q按键点亮)、另外A2与B2也是同时开启的(W按键点亮)、A2与B1也是同时开启的(2按键点亮)。


按下同一个矩阵的四个角时便会出现键位冲突的现象

但是,由于线路采用的是串联设计,所有当我们按下这三个按键时,芯片也会得到A1与B1是处于开启状态的(1按键点亮)。

事实上,当我们按下这四个按键中的任何三个按键时,电脑得到的反馈都是相同的,而使得电脑无法处理我们刚才输入的信息。而设计矩阵的工程师也考虑到了这个问题,所以他们采用了保护处理,当我们在按下任意一个矩阵的两个交叉点时,键盘的另外两个交叉点,就会自动被锁定了,以防止电脑出现茫然的现象。根据上图也就是说,当我们按下Q、W这两个按键的同时,1、2按键已经被自动锁定了,用户即使按下去,电脑也得不到反馈,以让电脑能够正确的显示出Q、W按键信息。

这就是我们所说的键位冲突的问题。为什么不同的键盘会有不同的键位冲突呢?这因为不同品牌型号的键盘线路设计不可能是完全相同的,因此它们存在冲突的键位也不一样。只要不构成四角组合关系,大部分键都是可以随便同按的,普通的键盘,即使有这样那样的冲突,也足够日常使用了。


二极管的出现帮我们解决了很多问题

但是很多游戏对于键盘的按键冲突还是有着比较高的要求的,市场上那些无冲突键盘又是采用了什么样的设计呢?这里便要提到一个二极管的名词。

相信大家对于二极管都不会陌生,二极管有一个特性,电流只能从它的阳极流向阴极,而反向则难以通过。之前提到的键位冲突是因为当A1和B2、A2和B2、A2和B1分别连通时,程序误以为A1和B1也连通,因此当发现3个按键互相形成回路时,就屏蔽第三颗按键的设计。现在,我们在每个按键的电路中增加一个二极管,让电流只能从A端传向B端,而不能从B跑向A。
added diode.jpg

加入二极管后信号只会单项传输

回到之前的例子,同时按下Q、W、2三个键。尽管W键接通了A2和B2,但由于二极管的限制,信息只能从A2到B2传导,而不能从B2到A2,这就不会使芯片检测到1按键也是接通状态,便可以正确识别我们刚才按下了Q、w、2这三个按键了。

于是市场便出现了各种防冲突键盘。



键帽材质
ABS
化学名称:丙烯腈-丁二烯-苯乙烯塑料
英文名称:Acrylonitrile Butadiene Styrene plastic
ABS塑料(树脂)是丙烯腈、丁二烯和苯乙烯的三元共聚物(A代表丙烯腈,B代表丁二烯,S代表苯乙烯)。它应该是PC行业中应用最最广泛的材料了,机箱面板、显示器外壳、键盘鼠标等等,几乎所有地方都能见到它的身影。它有着无味道无毒害的特点,可以在极低零下40摄氏度下使用、融化温度高达217摄氏度(热变形温度为93-118摄氏度),承受冲击能力强不易变形,且绝缘性好,不容易受湿度和频率影响。
ABS材料的键帽是所有材料中最多的,当然最主要的原因就是工艺成熟价格便宜,从几十元的普通键盘到上千元的高端货都能见到ABS材料键帽。ABS键帽颜色多样,可以做成半透明的以适应背光灯需要,这是其它材料无法企及的。这种材料制成的键帽相对其它几种材质最柔软,不是非常坚硬触感温和,有一定抗打油能力,但是不如POM和PBT。
POM
化学名称:聚甲醛
英文名称:Polyoxymethylene
POM材料又称赛钢或者特灵,可见其质地坚硬。它可以稳定工作在零下40摄氏度到100摄氏度之间,相对ABS来说不够稳定达到240摄氏度的时候会分解,不过对于键盘键帽来说是不可能超过100摄氏度的,完全不用担心只要你不拿烟头烫。POM材料是一种高密度高结晶的线性聚合物,所以有着优异耐磨性,强度高绝缘耐磨。抗氧化抗腐蚀能力强。可耐烃类、醇类、醛类、醚类、汽油、润滑油及弱碱等有机溶剂。
POM材料的键帽相对ABS要少,所以原厂键盘中不多见。是一种耐用朴素的材料。无论是耐用性还是坚固程度POM都比ABS好,抗打油能力也是成倍增长,至少用两三年不会出现打油问题(打油出现因人而异)。手感上介于PBT和ABS之间。
PBT
化学名称:聚对苯二甲酸丁二醇酯
英文名称:Polybutylene terephthalate
PBT塑料是一种更优秀的材料,它相比POM还要坚硬,整块的材料如石头一般。强度高、耐疲劳、不宜形变,高温下也不容易变化,抗老化效果非常理想,因此可以说它是最稳定的键帽材料。绝缘性优良。
PBT比较少见,但是在机械键盘圈里经常被人提起,它应该是目前最靠谱最优秀的键帽材料了,无论是抗打油、坚硬度都是一流的,抗腐蚀抗氧化效果也非常好,号称永远不打油。另外它高温环境下遇水易分解,正是因为这种特性所以专门有店铺利用水煮给PBT键帽上色,染色后的键帽颜色不脱落自然美观。当然价格也是非常昂贵的,一套37枚主按键区的彩虹色键帽要卖到一百元左右。
尼龙
尼龙这种材料在汽车、电气设备、机械部构、交通器材、纺织、造纸机械等方面得到广泛应用。最常见的就是丝袜,无论是窈窕美女还是彪悍劫匪都用得到。这种材料的键帽不是主流,但是在机械键盘中也有出售,手感温润特别像玉石的感觉。


键帽工艺
电脑是在不断发展和进步着的。同样,作为耗材,外设产品和用户的关系也越来越密切。尤其键盘已成为我们接触次数最多和最常用的输入设备。键盘结构经历了机械式、塑料薄膜式、无接点静电电容式、导电橡胶式的发展历程,而键盘上字符的印刷方式也有了很大的进步和提高。
美国一批无刻印键盘爱好者专门找Cherry公司定制的产品,并且要求Cherry公司一年内不允许出售给其他地区。这款键盘对很多识货的IT媒体编辑来说拥有着致命的吸引力,反而很多并不了解键盘的买家对无刻印键盘感到莫名其妙。如果你了解无刻印键盘的历史,并且喜欢他那种纯色的感觉,那么他一定是你最佳的选择。
代表:Cherry G80-3000LPCXY-2
激光蚀刻
所谓激光蚀刻就是使用激光刻字技术在键帽上灼烧出黑色的凹槽而已。因为其刻下的痕迹是线性的,所以常见的激光蚀刻键盘上的箭头等都是空心的。
市面上众多的白色键盘基本都是使用的这一键帽技术,主要是厂家看中了它的成本低廉,尽管其生产线价格高昂,但其日产量是其它印刷方式的十倍以上,而且由于是烧刻的字迹,所以不需要任何其他措施就能有很清晰牢固的字迹。 其大规模另一个原因就是比较环保,不会有有害的生成物产生。
但激光蚀刻也有几个致命的缺陷,这也决定了它不能用于高档键盘的生产。首先,由于激光蚀刻属于蚀刻,而没有使用油墨,所以只能印出单一的黑色字体,这样在高档键盘上常有的多色套印设计就无法做到;其次,高档键盘出于对外观设计和耐用性的需要,大多使用了非白色系的颜色设计,并在键帽材料中添加了耐磨性的填料,但由于激光蚀刻的自身特性,使得它在非白色系和添加了其它填料的键盘上不能蚀刻出理想的清晰字迹;最后,激光蚀刻机的结构设计和编程方式使得它最好用来制造标准键位设计的键盘,人体工学等非标准结构的产品很难在普通的激光蚀刻机上印刷出来。正因如此,所以在大厂的产品生产线上,激光蚀刻只是被用在中低档的生产线上以利用其生产速度快、成本低的优势;而在高档产品生产线上,由于有更高的印刷品质要求,所以只能继续使用传统的高成本的油墨印刷法。
代表:Cherry L标号键盘以及市面大部分白色键盘
移印法
移印法是相当古老的一种键帽印刷方式,因其不太实用且效率较低,已经废弃,不再使用。
移印法就是使用一组字母铅字作为原始字模,通过自动机械将其上面刷上油墨以后,再将一组软橡胶块压在其上面,这样抬起橡胶块的时候,字迹油墨就会转移到橡胶块上,然后再将橡胶块移到空白键盘上,将橡胶块一压,油墨就被印到了键盘上。
在照相排版技术出现以前,书籍、报纸和杂志等都是这样印出来的。与激光蚀刻和丝网印刷相比,移印法没有任何印刷条件的限制,可以用来印刷任何一种形式的键盘。但是移印法的缺点也很明显,它的印刷速度极慢,印一个键盘的时间几乎可以让10多个激光蚀刻的键盘走下流水线。所以,除了那些买不起激光蚀刻机的小厂没有办法只好用这种没有任何技术要求的印刷方式以外,键盘生产大厂一般只用它来印刷那些不计成本的高档产品。其次由于其印刷工艺的影响,在移印法印刷的键盘上进行覆膜要比丝网印刷困难得多,所以很多使用移印法印刷的键盘并没有进行覆膜,而是通过研究油墨的成分提高印刷的牢固程度来增强键盘的寿命。
代表:微软OFFICE键盘
丝网印刷
其原理就是将一个特制的丝网覆盖在空白的键盘上,其中有字迹的地方被镂空,然后将油墨从上面刮过,这样在镂空的部分就会印上字迹。
丝网印刷的特点是可以在印刷完字迹以后再用特制的丝网刷上一层塑胶,在干涸以后就会形成一层覆盖在印刷字迹上的塑料保护膜,可以阻止长时间使用对字迹的磨损,这也就是通常所说的键盘覆膜技术。该塑胶的英文专业术语为:Coating
与激光蚀刻相比,丝网印刷可以通过多块丝网的反复套印自由印刷出多种颜色,而且也没有对键盘材质的要求限制。但由于其印刷方式的限制,仍然不能印刷形状过于复杂的键盘。
代表:DELL81XX系键盘
含浸印刷
含浸印刷(又叫热升华法),是一种和普通的油墨印刷截然不同的印刷方式,它使用的并非是常见的液体状颜料类油墨,而是固体树脂类油墨。这种油墨在高温下会升华成气态,以气态分子形式渗入可渗透性的印刷品表面后凝华,从而与印刷表面在物理层面上成为一个整体,而不仅仅像普通颜料类油墨那样“粘”在印刷表面上,所以其印刷的牢固性极高。而且树脂类油墨先天在光泽、形态等方面更为优秀。
含浸印刷最常见的就是陶瓷杯“烤印”照片的服务。含浸印刷用于键盘印刷时,油墨会完全“渗入”按键的PBT及ABS塑料内层,所以几乎是不可能被磨掉的,而且含浸印刷的文字极具立体感和光泽度。但含浸印刷的过程比普通颜料油墨印刷实在复杂太多,而且成本极高,所以目只有RealForce键盘使用这种印刷方式。
代表:TopreRealforce 101
激光填料法
激光填料法的原理有点类似“纹身”,纹身就是用针在皮肤上纹出细细的纹路,然后用颜料填涂,这样颜色就会渗入皮肤的纹路,以后就不会被水洗掉或磨掉。而激光填料技术也是如此,先用激光蚀刻技术印刷一遍文字(但要比通常激光蚀刻印得浅一些,以保证表面的平整),然后使用油墨印刷方式进行二次印刷,这样固化的油墨就会渗入激光留下的刻痕并留在其中,此后就不会轻易被磨去了。
使用激光填料技术印刷的键盘,由于经过了油墨的二次印刷,所以就弥补了激光蚀刻字体不好和不能印刷彩色的缺陷,而由于有激光的刻痕作为基础,其牢固性要远远高于单纯的油墨印刷。个人认为,这种键帽处理方法是激光蚀刻和油墨印刷的结合体
代表:LogitechELITE (BTC OEM)
镂空印字法
首先说明一点这种方法在手机的键盘上几乎全都是用这种方式印刷的。且只有APPLE的一些笔记本键盘使用过这个印字方法。
这种印刷方式说起来很简单,就是使用透明材料制造按键,然后用不透明的涂料覆盖按键表面后,按照文字的样子将表面镂空成“阴文”。如果将不透明涂料涂在按键内侧不接触手指的一面,那么文字自然就会变得永不磨损。 其实,苹果电脑使用这种印刷方式的主要目的并不是为了字迹牢固,而是为了美观。因为这种镂空出来的字体由于是“刻”出来的,所以要比油墨印的更加清晰明快,而且像手机键盘一样,镂空文字的按键下面可以安装背光电路,使得笔记本键盘像手机键盘一样具有绝佳的背光效果。
但镂空印字法的缺陷也很明显,这种透明材质在用于制造键盘时,其弹性、硬度、耐磨度都先天不及普通键帽材料。实际上,不管是不是使用镂空文字印刷,透明键帽材质至今没有一种在触感上赶得上传统的黑白ABS塑料。
代表:APPLE笔记本键盘 Logitech G15
二色成形
二色成型是利用模具将两种不同颜色的塑料结合在一起,利用两种塑料颜色的差异性来显示字体。
二色成形的优势在于字体颜色鲜艳、耐用度高、不易有掉字的现象,制造技术好的话键帽触感表现就会十分不错。缺点则是难表现出较细的文字、颜色种类单调、笔画复杂度低,而且其制造的固定成本昂贵。


注:
开关二极管随便用,不一定非得用4148(默认使用4148

列线(PD4、PD5)作为检测线:当同时按下K2、K3时
PD5列线上对PD0、PD1进行检测,结果是PD1有连通
然后在PD4列线上对PD0、PD1进行检测,结果是PD0有连通
所以检测结果是:K2、K3同时按下

当同时按下K2、K3、K4时
在PD4列线上对PD0、PD1进行检测,结果是PD0、PD1有连通
PD5列线上对PD0、PD1进行检测,结果是PD1有连通
但是还有一条线即如图所示,经过K3->K4->PD0导致PD0在检测列线PD5时有连通(只要列线检测行线时PD0是有电流通过,那么PD0就是连通的,所以K1:PD0,PD5是激活的,所以鬼键K1就产生了
ghost key.jpg
由于开关二极管的单向导通性,因而可以添加到电路中用于防止鬼键的产生
with diode.jpg
矩阵式键盘扫描方法有两种:逐行扫描和线反转法(反应较为迅速,推荐
我所见过的矩阵键盘一般有两种识别方法:扫描法和线反转法。以4X4矩阵键盘为例,扫描法是依次将每一行置为0,然后读取列的状态,这样就可以通过四次扫描将整个矩阵键盘的按键状况辨别出来,这个方法所需的代码量比较长;而线反转法则显得比较简洁,它通过先将4行全部置0(0xf0),然后读列的状态,接着,将列全部置0(0x0f),读行的状态,通过(行|列)就能确定整个行列的状态了。扫描法比线反转法占用更多的程序储存空间(ProgramSpace),但占用的更少的数据储存空间(Data Space)。
这回我们来讲讲键盘,大家肯定见过银行柜员机吧,取钱输入密码就要用到键盘,超市购物取回寄存物品要输入密码,还有你现在在用的PC机的键盘。但是键盘的是怎么工作的呢?一般有2种方式:(1)扫描法,不断扫描键盘的状态,送CPU判断并处理。如果键盘数目一大的话,显然不适合(2)线反转法,通过行列状态的改变来判断有无键被按下!



Configuring the Pin
Each port pin consists of three register bits: DDxn, PORTxn, and PINxn. As shown in “” on page 83, the DDxn
bits are accessed at the DDRx I/O address, the PORTxn bits at the PORTx I/O address, and the PINxn bits at
the PINx I/O address.
The DDxn bit in the DDRx Register selects the direction of this pin. If DDxn is written logic one, Pxn is
configured as an output pin. If DDxn is written logic zero, Pxn is configured as an input pin.
If PORTxn is written logic one when the pin is configured as an input pin, the pull-up resistor is activated. To
switch the pull-up resistor off, PORTxn has to be written logic zero or the pin has to be configured as an output
pin. The port pins are tri-stated when reset condition becomes active, even if no clocks are running.
If PORTxn is written logic one when the pin is configured as an output pin, the port pin is driven high (one). If
PORTxn is written logic zero when the pin is configured as an output pin, the port pin is driven low (zero).


DDR设为0(即引脚设置为输入)如果这时PORT设置为1,那么上拉电阻开启
如果要关上上拉电阻,要么PORT重置为0,要么DDR设置为1(即引脚设为输出引脚,上拉电阻不启用)
如果DDR和PORT都设为1或0那么


ms是毫秒=0.001秒
us是微秒=0.000001秒
1ms=1000us
上次由 243750496 在 2017-12-30 20:28,总共编辑 7 次。
回复