GPIOは、集積回路やコンピュータボード上の一般的なピンであり、その動作(入力ピンであるか出力ピンであるかを含む)は、実行時にユーザによって制御可能である。GPIOは"General-purpose input/output"の略で、「汎用入出力」を意味する。
マイクロプロセッサ、マイクロコントローラ、インタフェースデバイスは、外界と接続するための一つまたは複数のGPIOインタフェースを持っている。
GPIOピンにはあらかじめ定義された目的がなく、デフォルトでは使用されない[1][2]。
すでに構築済みのシステムにシステムインテグレータがデジタル制御線を追加したい場合に、あらかじめチップにGPIOをつけておけば、そのための回路を追加する必要がなくなる。例えば、RealtekのALC260チップ(音声コーデック用)には8つのGPIOピンがあり、デフォルトでは使用されない。エイサーのラップトップでは、ALC260のGPIOの1つ目のピン(GPIO0)を使用して、ラップトップの内蔵スピーカと外付けヘッドフォンジャックのためのアンプをオンにしている。
使用法Raspberry Pi Zero with headerless GPIO array along the top
メーカーは以下のような場合にGPIOを使用する。 GPIOの機能には以下のものがある[2]。 GPIOデバイスの種類は非常に広範囲である。時には、デバイスは非常に単純であり、入出力を切り替えられるピンのグループである。一方では、それぞれのピンが異なるロジック電圧の入出力が出来るよう柔軟に設定可能であり、ドライブ能力やプルアップ/プルダウンも設定可能である。普遍的ではないが、典型的には入出力電圧は、GPIOを持つデバイスの供給電圧に制限される。制限を越えた電圧により、デバイスが損傷を受けることがある。 個別のGPIOの読み書きや入出力の設定は、一つまたは複数の制御レジスタを読み書きすることで行う。いくつかのGPIOには5V耐性の入力ピンがある。低い供給電圧(2V)であっても、デバイスは損傷を受けることなく、5Vの入力を受け入れられる。 しばしばGPIOはピンのグループ(典型的には8ピン)であるGPIOポートで扱われることがある。通常は個別のGPIOピンごとに入力または出力に個別に設定出来るが、GPIOポートはグループごとの入出力設定となる[4]。
ピンが少ないデバイス : システムオンチップ、組み込みおよびカスタムハードウェア、プログラマブルロジックデバイス(FPGAなど)などの集積回路
多機能のチップ : 電源管理、音声コーデック、ビデオカード
組み込みアプリケーション(Arduino、BeagleBone、PSoCキット、Raspberry Pi[3]など)は、さまざまな環境センサー(赤外線カメラ、ビデオ、温度、ジャイロスコープ、加速度計など)からの読み取り、直流モータ・音声・液晶ディスプレイ・ステータスLEDなどへの出力の書き込みにGPIOを使用する。
機能
GPIOのピンは入力用にも出力用にも設定できる[4]。
GPIOのピンは有効にも無効にも設定できる。
入力値は読み出しできる(通常は二進数)。
出力値は書き込みと読み出しができる。
入力値は割り込みとして使用できる。
ポート
関連項目
SGPIO(英語版
I2C
プログラムI/O
シリアル・ペリフェラル・インタフェース
出典^ White, Jon, ed (2016). Raspberry Pi - The Complete Manual (7 ed.). Imagine Publishing. pp. 36. .mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation.cs-ja1 q,.mw-parser-output .citation.cs-ja2 q{quotes:"「""」""『""』"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free a,.mw-parser-output .citation .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited a,.mw-parser-output .id-lock-registration a,.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription a,.mw-parser-output .citation .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:#d33}.mw-parser-output .cs1-visible-error{color:#d33}.mw-parser-output .cs1-maint{display:none;color:#3a3;margin-left:0.3em}.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}ISBN 978-1785463709
^ a b “General Purpose Input/Output”. OracleR Java ME Embedded Developer's Guide (8 ed.). Oracle Corporation. (2014). https://docs.oracle.com/javame/8.0/me-dev-guide/gpio.htm
^ “GPIO - Raspberry Pi Documentation”. Raspberry Pi Foundation. 2016年11月3日閲覧。
^ a b Balachandran, Sasang (2009). ⇒General Purpose Input/Output (GPIO). Michigan State University College of Engineering. ⇒http://www.egr.msu.edu/classes/ece480/capstone/fall09/group03/AN_balachandran.pdf
外部リンク
⇒ALSA Development List
Linux Kernel Doc on GPIO
⇒LinuxTV GPIO Pins Info