樹莓派 3B+ 筦窺︰先後接續

蕭規曹隨》典故引文︰

蕭何與曹參兩人自少年微賤時便已是好友,後來西漢建國,蕭何身為宰相,曹參身為大將,地位不凡的兩人卻反而有了嫌隙。蕭何擔任相國時,參考前朝文獻制訂典章及制度。蕭死前,推薦曹參繼任 。曹參上任後,認為蕭何訂下的法令已很完備,所以繼續沿用而不作改動。

曹參就任漢相國期間,整日飲酒食肉,政治上清靜無為,繼續執行蕭何留下的政策,不予變動。漢惠帝認為自己被曹參輕視,於是命其子御史大夫曹窋勸諫,曹參把曹窋鞭笞了兩百下並趕出門外,漢惠帝於是親自責問曹參。

曹參摘帽,向皇帝俯首謝罪:「陛下您認為,您與先帝相比,誰較為英明神武?」皇帝回道:「我怎敢與先帝比?」曹參又問說:「我跟蕭何比,誰較賢能?」皇帝說道:「你好像不太比得上他。 」曹參接著說:「陛下說得對,且高祖跟蕭何平定了天下,法令都健全具備。陛下只要垂拱而治,我們這些官吏堅守崗位,遵守他們的法令而不犯過失,不是很適合嗎?」

時人歌頌:「蕭何制定法律,調和整齊如一;曹參繼任相國,遵法而不犯過失。施載清淨無為的政策,人民因而安寧統一。」史稱「蕭規曹隨」。

 

在《『騛罿』── 非同的禪!!》一文裡,我們談過︰

吉多的 Python 『非同』於其他程式語言,居然把『空白』符號寫進了它的『文法』裡,竟然用『對齊的空白』表示程式區塊。如是種種『見地』,匯聚成一條稱作『非同的』pythonic Way 大道。吉多他的『中心思想』,集中的表現在由 Tim Peters 先生所寫的『 Python 的禪』,收錄在『 this 』模組 module 裡︰

Readability counts.
可讀性能加分

或許因為太多人問︰是否有一天,將有一版 Python 可以使用『“{ ” 與 “} ”』來表達『程式區塊』??以至於有了這個特別『復活蛋』之幽默回答!!

pi@raspberrypi ~ python</span> <span style="color: #339966;">Python 2.7.3 (default, Mar 18 2014, 05:13:23)</span> <span style="color: #339966;">[GCC 4.6.3] on linux2</span> <span style="color: #339966;">Type "help", "copyright", "credits" or "license" for more information.</span> <span style="color: #339966;">>>><span style="color: #ff0000;"> <strong><span style="color: #ff99cc;">from __future__ import</span> braces</strong></span></span> <span style="color: #339966;">File "<stdin>", line 1</span> <span style="color: #3366ff;"><strong><span style="color: #cc99ff;">SyntaxError:</span> not a chance</strong></span> <span style="color: #339966;">>>></span>  <span style="color: #008080;">看來這是『<strong>沒機會</strong>』 <strong>not a chance</strong> 的了…,甚至有…</span>  <span style="color: #ff9900;">>>> import __<strong><a style="color: #ff9900;" title="Thue 之改寫系統《三》" href="http://www.freesandal.org/?p=6474">hello</a></strong>__</span> <span style="color: #ff9900;"> Hello world...</span> <span style="color: #ff9900;"> >>></span>  <span style="color: #008080;">其實這個『<strong>空白</strong>』就是源自《<strong><a style="color: #008080;" title="始中終!!" href="http://www.freesandal.org/?p=24700">始中終!!</a></strong>》所說的『<strong><a style="color: #008080;" href="http://en.wikipedia.org/wiki/ABC_%28programming_language%29">ABC</a></strong>』語言,在今天都還有個名稱叫做『<strong><a style="color: #008080;" href="http://zh.wikipedia.org/wiki/%E8%B6%8A%E4%BD%8D%E8%A7%84%E5%88%99">越位規則</a></strong>』,正宛如不同的程式語言有不同的『<strong>聖歌</strong>』 <strong>mantra</strong> 一樣, Python 的禪是︰</span>  <span style="color: #ff99cc;">There should be one- and preferably only one -obvious way to do it.</span> <span style="color: #ff99cc;">總有一個,最好是唯一的一個,明白的作法</span>  <span style="color: #008080;">。而 Perl 與 Ruby 的咒語說︰</span>  <span style="color: #cc99ff;">There's more than one way to do it.</span> <span style="color: #cc99ff;">凡事都有多種作法</span>  <span style="color: #008080;">事實上也沒有太多好爭論的。</span>  <span style="color: #808080;">─ 《<a style="color: #808080;" href="http://www.freesandal.org/?p=25601">PHYSICAL COMPUTING ︰ PYTHON 《補充》︰ IDE 用法…</a>》</span>     <span style="color: #666699;">『蕭規曹隨』是講︰</span>  <span style="color: #cc99ff;">好的法令制度,切莫將之改壞!</span>  <span style="color: #666699;">一如派生二到派生三︰</span> <pre class="lang:default decode:true ">pi@raspberrypi:~ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from __future__ import braces
File “<stdin>”, line 1
SyntaxError: not a chance

>>> import __hello__
Hello world!
>>>

 

先後接續也☆

所以有關『UARTS』與『Bluetooth』之事,請讀

THE RASPBERRY PI UARTS

The SoCs used on the Raspberry Pis have two built-in UARTs, a PL011 and a mini UART. They are implemented using different hardware blocks, so they have slightly different characteristics. However, both are 3.3V devices, which means extra care must be taken when connecting up to an RS232 or other system that utilises different voltage levels. An adapter must be used to convert the voltage levels between the two protocols. Alternatively, 3.3V USB UART adapters can be purchased for very low prices.

By default, on Raspberry Pis equipped with the wireless/Bluetooth module (Raspberry Pi 3 and Raspberry Pi Zero W), the PL011 UART is connected to the BT module, while the mini UART is used for Linux console output. On all other models the PL011 is used for the Linux console output.

In Linux device terms, by default, /dev/ttyS0 refers to the mini UART, and /dev/ttyAMA0 refers to the PL011. The primary UART is that assigned to the Linux console, which depends on the Raspberry Pi model as described above, and can be accessed via /dev/serial0.

Mini UART and CPU core frequency

The baud rate of the mini UART is linked to the core frequency of the VPU on the VC4 GPU. This means that as the VPU frequency governor varies the core frequency, the baud rate of the UART also changes. This makes the UART of limited use in the default state. Also, when the Linux console uses the mini UART (Raspberry Pi 3, Raspberry Pi Zero W), as a consequence of the UART being disabled, the console is also disabled.

The Linux console can be re-enabled by adding enable_uart=1 to config.txt. This also fixes the core_freq to 250Mhz (unless force_turbo is set, when it will fixed to 400Mhz), which means that the UART baud rate stays consistent.

The default value of the enable_uart flag depends on the actual roles of the UARTs, so that if ttyAMA0 is assigned to the BT module, enable_uart defaults to 0. If the mini UART is assigned to the BT module, then enable_uart defaults to 1. Note that if the UARTs are reassigned using a Device Tree Overlay (see below), enable_uart defaults will still obey this rule.

 

或參考

‧ W!O+ 的《小伶鼬工坊演義》︰樹莓派 3 三兩事之 UART 篇

‧ W!O+ 的《小伶鼬工坊演義》︰樹莓派 3 三兩事之藍牙篇【上】

哩☺