教育和學習︰ Up《grade》【七上】

由於好奇 UP Board 之

Pinout

The 40-pin input/output header is comprised of the pins shown in the table below. The layout and functionality is similar to that of the Raspberry Pi 2.

Pinout Table

IMPORTANT: Please note that the Linux GPIO numbers above are different from both the physical pin numbers and the UP pinout. The Linux GPIO numbers are assigned to match the Raspberry Pi BCM GPIO numbering scheme.

For comparison with Raspberry Pi layouts, visit: http://pinout.xyz

 

安排類似樹莓派哩!?且見UP 社群談及

RPi.GPIO

RPi.GPIO is a popular Python library used on Raspberry Pi platforms to control GPIO pins.

In addition to GPIO control, it is also used by many other libraries to query the Raspberry Pi hardware version as header pin layouts differed between certain versions. And, currently, it also provides some useful software PWM functionality on all GPIO pins.

As the UP board has a similar header pin layout to the Raspberry Pi 2, we have created a port of the RPi.GPIO library for UP. This allows many existing Python scripts developed for Raspberry Pi to be used on UP also.

More information about RPi.GPIO is available here: https://pypi.python.org/pypi/RPi.GPIO (Note: version numbers are not quite in sync yet – something that will be resolved in the near future.)

Setup

RPi.GPIO for UP is already installed by default with ubilinux. To ensure that the most up-to-date version is installed, please run the following commands:

sudo apt-get update
sudo apt-get install python-rpi.gpio

………

 

安裝與範例,故想在 UP Ubuntu 上嘗試一番也。

結果竟以失敗告終呦?!

up@up-UP-CHT01:~sudo apt-get install python-rpi.gpio [sudo] password for up:  正在讀取套件清單... 完成 正在重建相依關係           正在讀取狀態資料... 完成 E: 找不到套件 python-rpi.gpio E: Couldn't find any package by glob 'python-rpi.gpio' E: 無法按 regex 找到 python-rpi.gpio 套件 up@up-UP-CHT01:~

 

或許只能在 ubilinux 裡跑乎??

雖然察之以系統 GPIO 的界面 OK 矣。

compose   input4::scrolllock  upboard:red:
input4::kana      mmc0::              upboard:yellow:
root@up-UP-CHT01:/sys/class/leds# cd upboard\:green\:
root@up-UP-CHT01:/sys/class/leds/upboard:green:# ls
brightness  device  max_brightness  power  subsystem  trigger  uevent
root@up-UP-CHT01:/sys/class/leds/upboard:green:# echo 1 > brightness 
root@up-UP-CHT01:/sys/class/leds/upboard:green:# echo 0 > brightness 
root@up-UP-CHT01:/sys/class/leds/upboard:green:#

※ 參考

一般 SoC 的製造者為著便利使用者能夠開發的多種多樣『應用』與『整合』,通常會有為數不少的『 GPIO 』接腳 ── 通用可變化功能性與輸出入 ──,為什麼呢?因為應用上的『需求規格』才能決定多少種『輸入』,至少幾個『輸出』,需要怎樣的週邊裝置『擴充性』等等。然而 Linux kernel 建基於 PC x86,這一個『架構平台』 platform 曾經一直是由『 Intel 』與『 Microsoft 』所主導,因而『 GPIO 』的軟體設計也就依此『架構平台』而定的了!更因著商業『競爭』和『保護』,許多『系統單晶片』的 Linux 『中介軟體』 Middleware 的提供者,各自『修補』 patch 『核心』 kernel ,於是『 GPIO 』的『軟體架構』問題日益嚴重。

二零零六年,在

LKML.ORG? 】︰

In case you haven’t read the titlebar of your webbrowser’s window: this site is the (unofficial) Linux Kernel Mailing List archive. This mailing list is a rather high-volume list, where (technical) discussions on the design of, and bugs in the Linux kernel take place. If that scares you, please read the FAQ.

David Brownell 的一封《電郵》【 Re: [-mm patch 1/4] GPIO framework for AVR32 】開啟了『 GPIO 』之『軟體架構』的討論,大體可說到二零零八年【※Re: [ patch 2.6.24-rc6-mm 2/9] gpiolib: add gpio provider infrastructure 】之前, Linux kernel 的
GPIO Sysfs Interface for Userspace 》整體已經完成。讀者可以參考《  GPIO Interfaces 》與《 Linux/include/linux/gpio.h 》文件作進一步了解。

─── 摘自《PHYSICAL COMPUTING ︰《三》 GPIO 溯源《上》

 

總是不方便寫程式耶!!