LangC.txt
---------------------------------------------------------------------------------------------------
単純なコンパイル
ex. [ソース].c
コンパイル
$ gcc [ソース].c
a.out が作成される 実行属性はデフォルトで付く?
gcc と g++ の違いは?
実行
./a.out
-- テストソース
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
char **ppStr;
ppStr = argv;
for (i = 0; i < argc; i++, ppStr++) {
printf("%s\n", *ppStr);
}
printf("\n");
printf("Hello World!\n");
return (1);
}
---------------------------------------------------------------------------------------------------
分割コンパイル
-- makefile
######################################################################
# gcc make sample
######################################################################
################################
# Tool
################################
CC = gcc
#CCFLG = -c -Wall
CCFLG = -c -W
#CCFLG = -c
# -c compile only named [source-file].o
# -Wall ex. warning: return type of ‘main’ is not ‘int’ [-Wmain]
LK = gcc
LKFLG =
################################
# Terget
# Execute $ sudo ./EXENAME
################################
TARGET = t1
EXENAME = $(TARGET).exe
MAKNAME = makefile
#MAKNAME = $(TARGET).mk
################################
# Header List
################################
HEADS1 = sub.h
HEADS2 =
################################
# Link List
################################
OBJS = main.o \
sub.o
################################
# Linkage Command
################################
$(EXENAME): $(OBJS) $(MAKNAME)
$(LK) $(LKFLG) -o $(EXENAME) $(OBJS) 2> lerr
cat lerr
################################
# Compile Command
################################
.c.o:
$(CC) $(CCFLG) $< 2> cerr
cat cerr
################################
# Source List
################################
main.o : main.c $(MAKNAME) $(HEADS1)
sub.o : sub.c $(MAKNAME) $(HEADS1)
###################################################
'2>': 致命エラーリダイレクション
エディタに「タグジャンプ」機能があれば、cerr/lerr からソースに飛べる(飛べない時もある)
警告エラーは標準出力
-- end of makefile
-- main.c
#include <stdio.h>
#include <stdlib.h>
#include "sub.h"
void main(int argc, char *argv[])
{
int d;
switch (argc) {
case 0: case 1:
d = 2;
break;
default:
d = atoi(argv[1]);
}
printf("%s\n", SubFunc00(d));
}
-- sub.h
#ifndef _SUB_H_
#define _SUB_H_
#include "sub.h"
char *SubFunc00(int data);
#endif
-- sub.c
#include <stdio.h>
#include "sub.h"
#define x_TEST_LINKAGE_
#ifdef _TEST_LINKAGE_
void SubFuncXX(void);
#endif
char *SubFunc00(int data)
{
static char str[0x100];
int ans;
ans = data * data;
sprintf(str, "%8d", ans);
#ifdef _TEST_LINKAGE_
SubFuncXX();
#endif
return (str);
}
---------------------------------------------------------------------------------------------------
https://www.asus.com/jp/Single-Board-Computer/Tinker-Board/ の 「GPIO API C」の手順
---------------------------------------------------------------------------------------------------
1. ターミナルを開き、C GPIOライブラリをダウンロードします
wget http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/GPIO_API_for_C.zip
↑ ※ エラーになる
http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882
ページ少し上、Download [GPIO API for C] のリンクのアドレスのコピー
wget 以降をこのアドレスで試す
wget http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882
カレントにダウンロードされる (1)
名前が長いのでコピーしてリネームする
_cp GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882 GPIO_API_for_C.ZIP
2. "GPIO_API_for_C.zip"をフォルダに解凍します
unzip GPIO_API_for_C.zip
cd GPIO_API_for_C/
unzip GPIO_API_for_C.zip
拡張子が ".ZIP" だったので unzip 失敗する
unzip GPIO_API_for_C.ZIP で展開された (2.1) 以下抜粋
inflating: build
inflating: COPYING.LESSER
creating: debian/
inflating: <略>
creating: devLib/
creating: examples/
creating: examples/Gertboard/
creating: examples/q2w/
creating: examples/PiFace/
creating: examples/PiGlow/
creating: gpio/
creating: pins/
creating: wiringPi/
cd GPIO_API_for_C/
cd 出来ない 解凍位置が違うの?
ホームの下に "GPIO_API_for_C" を mkdir し、そこに zip をコピーして実行すべきだったのか?
次以降の手順で 「"build" を実行可能属性にして実行」してインストールする様だが、「カレントに build が存在する」条件と思える
で、"cd GPIO_API_for_C" を行った所に build がなくてはならない
~/GPIO_API_for_C を作成 GPIO_API_for_C.ZIP をそこにコピーして解凍 で cd 以降の辻褄が合いそう 試す
とりあえず、今展開されているファイルは全部削除
build COPYING.LESSER 以外は「新たに作られたディレクトリ」を前提と推測 この2つのファイルだけは用心
build をのぞいたら、コメント中に "Raspberry Pi" の文字がたくさん(笑 消してよさそう
COPYING.LESSER はよくわからない 消しちゃえ!
展開時のメッセージにある新規ディレクトリもザクザク消す
ディレクトリ GPIO_API_for_C を作成
zip を移動 長い名前の zip も持って来る
先に $ cd GPIO_API_for_C/ してから $ unzip GPIO_API_for_C.ZIP
気になる点:
README.TXT なるどこにでもありそうな名前が ~/GPIO_API_for_C にある ~ に元からあったら上書きされてしまっているかも
newversion なるこれまたどこにでもありそうな名前がある GUI PCManFM の表示では「シェルスクリプト」となっているのが気になるが …先へ進もう
これで、「手順」を続けられるはず
3. C GPIOライブラリをTinker Boardにインストールします
sudo chmod +x build
sudo ./build (3.2) うまくいったのか?
4. インストールが成功したかどうかを確認します。
gpio -v (4.1)
gpio readall (4.2)
なにか、3.4. と一気に来たけど、大丈夫か? ここまでで、(3.2) は後でもう少し調べて見るとして、
4 のコマンド gpio って実行ファイルだよね? どこ?
$ which gpio
/usr/local/bin/gpio にいるって
$ _ls /usr/local/bin/gpio
-rwsr-xr-x 1 root root 33004 12月 19 21:53 /usr/local/bin/gpio
タイムスタンプからすると、3. の build で出来たみたい
ソースファイルのあたりをつける ~/GPIO_API_for_C/gpio/ ここかな?
$ _ls ~/GPIO_API_for_C/gpio/gpio
-rwxr-xr-x 1 root root 33004 12月 19 21:53 /home/linaro/GPIO_API_for_C/gpio/gpio
~/GPIO_API_for_C/gpio に makefile があったので、覗く make 完了後、/usr/local/bin に実行ファイル gpio をコピーしている模様 ビンゴ!
実行プログラム gpio の理解は gpio.txt に続く
5. 参考コード
下記フォルダ下にいくつかのサンプルコードがあります /GPIO_API_for_C/wiringpitest or /GPIO_API_for_C/examples
---------------------------------------------------------------------------------------------------
(1) wget
linaro@Tinker01:~$ wget http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882
--2017-12-19 20:29:19-- http://dlcdnet.asus.com/pub/ASUS/mb/Linux/Tinker_Board_2GB/GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882
dlcdnet.asus.com (dlcdnet.asus.com) をDNSに問いあわせています... 2600:140b:12::48f6:bde8, 2600:140b:12::48f6:bdf2, 72.246.189.16, ...
dlcdnet.asus.com (dlcdnet.asus.com)|2600:140b:12::48f6:bde8|:80 に接続しています... 失敗しました: 接続を拒否されました.
dlcdnet.asus.com (dlcdnet.asus.com)|2600:140b:12::48f6:bdf2|:80 に接続しています... 失敗しました: 接続を拒否されました.
dlcdnet.asus.com (dlcdnet.asus.com)|72.246.189.16|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 245009 (239K) [application/zip]
`GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882' に保存中
GPIO_API_for_C.ZIP?_ga=2.263803084. 100%[===================================================================>] 239.27K --.-KB/s in 0.1s
2017-12-19 20:29:20 (2.04 MB/s) - `GPIO_API_for_C.ZIP?_ga=2.263803084.1977487471.1497925364-1326992642.1492409882' へ保存完了 [245009/245009]
---------------------------------------------------------------------------------------------------
(2.1) unzip
linaro@Tinker01:~$ unzip GPIO_API_for_C.ZIP
Archive: GPIO_API_for_C.ZIP
inflating: build
inflating: COPYING.LESSER
creating: debian/
inflating: debian/copyright
inflating: debian/libwiringpi2.install
extracting: debian/libwiringpi-dev.dirs
inflating: debian/changelog
extracting: debian/compat
inflating: debian/control
inflating: debian/libwiringpi2.shlibs
extracting: debian/wiringpi.dirs
inflating: debian/libwiringpi-dev.install
inflating: debian/.gitignore
inflating: debian/rules
inflating: debian/wiringpi.install
creating: devLib/
inflating: devLib/ds1302.h
inflating: devLib/font.h
inflating: devLib/ds1302.c
inflating: devLib/lcd128x64.c
inflating: devLib/piGlow.h
inflating: devLib/piFaceOld.c
inflating: devLib/maxdetect.h
inflating: devLib/maxdetect.c
inflating: devLib/piNes.h
inflating: devLib/Makefile
inflating: devLib/lcd.c
inflating: devLib/gertboard.h
inflating: devLib/piFace.c
inflating: devLib/piGlow.c
inflating: devLib/piNes.c
inflating: devLib/piFace.h
inflating: devLib/gertboard.c
inflating: devLib/lcd.h
inflating: devLib/lcd128x64.h
creating: examples/
inflating: examples/spiSpeed.c
inflating: examples/softPwm.c
inflating: examples/blink.sh
inflating: examples/blink6drcs.c
inflating: examples/blink12drcs.c
creating: examples/Gertboard/
inflating: examples/Gertboard/7segments.c
inflating: examples/Gertboard/voltmeter.c
inflating: examples/Gertboard/vumeter.c
inflating: examples/Gertboard/Makefile
inflating: examples/Gertboard/temperature.c
inflating: examples/Gertboard/gertboard.c
inflating: examples/Gertboard/record.c
inflating: examples/Gertboard/buttons.c
inflating: examples/max31855.c
inflating: examples/serialRead.c
inflating: examples/ds1302.c
inflating: examples/COPYING.LESSER
inflating: examples/delayTest.c
inflating: examples/blink8.c
creating: examples/q2w/
inflating: examples/q2w/button.c
inflating: examples/q2w/blink.sh
inflating: examples/q2w/binary.c
inflating: examples/q2w/blink-io.c
inflating: examples/q2w/volts.c
inflating: examples/q2w/Makefile
inflating: examples/q2w/bright.c
inflating: examples/q2w/blink.c
inflating: examples/isr-osc.c
inflating: examples/wfi.c
inflating: examples/okLed.c
inflating: examples/asusPwm.c
creating: examples/PiFace/
inflating: examples/PiFace/reaction.c
inflating: examples/PiFace/Makefile
inflating: examples/PiFace/motor.c
inflating: examples/PiFace/blink.c
inflating: examples/PiFace/metro.c
inflating: examples/PiFace/ladder.c
inflating: examples/PiFace/buttons.c
inflating: examples/softTone.c
inflating: examples/blink.rtb
inflating: examples/Makefile
inflating: examples/lcd.c
inflating: examples/isr.c
inflating: examples/servo.c
inflating: examples/blink.c
creating: examples/PiGlow/
inflating: examples/PiGlow/piGlow1.c
inflating: examples/PiGlow/piGlow0.c
inflating: examples/PiGlow/piglow.c
inflating: examples/PiGlow/Makefile
inflating: examples/clock.c
inflating: examples/blink12.c
inflating: examples/README.TXT
inflating: examples/lcd-adafruit.c
inflating: examples/serialTest.c
inflating: examples/header.h
inflating: examples/speed.c
inflating: examples/lowPower.c
inflating: examples/pwm.c
inflating: examples/rht03.c
inflating: examples/nes.c
creating: gpio/
inflating: gpio/gpio.c
inflating: gpio/COPYING.LESSER
inflating: gpio/test_pwm.sh
inflating: gpio/Makefile
inflating: gpio/readall.c
inflating: gpio/test.sh
inflating: gpio/gpio.1
inflating: gpio/pins.c
extracting: gpio/version.h
inflating: gpio/pintest
inflating: INSTALL
inflating: newVersion
inflating: People
creating: pins/
inflating: pins/pins.tex
inflating: pins/Makefile
inflating: pins/pins.pdf
inflating: README.TXT
inflating: release functioon.txt
extracting: VERSION
creating: wiringPi/
inflating: wiringPi/softPwm.c
inflating: wiringPi/wiringSerial.c
inflating: wiringPi/mcp3004.h
inflating: wiringPi/mcp23017.h
inflating: wiringPi/wiringSerial.h
inflating: wiringPi/max5322.h
inflating: wiringPi/mcp23016.c
inflating: wiringPi/mcp23008.c
inflating: wiringPi/pcf8591.h
inflating: wiringPi/wiringShift.h
inflating: wiringPi/mcp3002.c
inflating: wiringPi/mcp23s17.c
inflating: wiringPi/max31855.c
inflating: wiringPi/wpiExtensions.h
inflating: wiringPi/COPYING.LESSER
inflating: wiringPi/softTone.h
inflating: wiringPi/softServo.c
inflating: wiringPi/sn3218.h
inflating: wiringPi/mcp23x0817.h
inflating: wiringPi/sn3218.c
inflating: wiringPi/piThread.c
inflating: wiringPi/wiringPiSPI.c
inflating: wiringPi/sr595.h
inflating: wiringPi/drcSerial.h
inflating: wiringPi/mcp4802.h
inflating: wiringPi/sr595.c
inflating: wiringPi/mcp23s17.h
inflating: wiringPi/softTone.c
inflating: wiringPi/softServo.h
inflating: wiringPi/piHiPri.c
inflating: wiringPi/wiringPi.h
inflating: wiringPi/mcp3002.h
inflating: wiringPi/wpiExtensions.c
inflating: wiringPi/mcp23s08.h
inflating: wiringPi/Makefile
inflating: wiringPi/mcp23s08.c
inflating: wiringPi/wiringShift.c
inflating: wiringPi/mcp23016reg.h
inflating: wiringPi/mcp23017.c
inflating: wiringPi/max5322.c
inflating: wiringPi/pcf8574.h
inflating: wiringPi/mcp23016.h
inflating: wiringPi/softPwm.h
inflating: wiringPi/pcf8591.c
inflating: wiringPi/mcp3422.c
inflating: wiringPi/mcp4802.c
inflating: wiringPi/mcp3004.c
inflating: wiringPi/mcp23x08.h
inflating: wiringPi/wiringPi.c
inflating: wiringPi/drcSerial.c
inflating: wiringPi/max31855.h
inflating: wiringPi/wiringPiI2C.c
inflating: wiringPi/pcf8574.c
inflating: wiringPi/wiringPiSPI.h
inflating: wiringPi/wiringPiI2C.h
inflating: wiringPi/mcp23008.h
inflating: wiringPi/mcp3422.h
---------------------------------------------------------------------------------------------------
(3.2) ./build
linaro@Tinker01:~/GPIO_API_for_C$ sudo ./build
wiringPi Build script
=====================
WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
wiringPi.c:204:8: warning: type defaults to ‘int’ in declaration of ‘asusversion’ [-Wimplicit-int]
static asusversion=0;
^~~~~~~~~~~
wiringPiI2C.c: In function ‘MiarmI2CSetup’:
wiringPiI2C.c:236:7: warning: variable ‘rev’ set but not used [-Wunused-but-set-variable]
int rev ;
^~~
wiringPi.c: In function ‘asus_pullUpDnControl’:
wiringPi.c:1510:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(pmu+PMU_GPIO0C_P/4) = (*(grf+PMU_GPIO0C_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1524:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO5B_P/4) = (*(grf+GRF_GPIO5B_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1532:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO5C_P/4) = (*(grf+GRF_GPIO5C_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1540:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO6A_P/4) = (*(grf+GRF_GPIO6A_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1546:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO7A_P/4) = (*(grf+GRF_GPIO7A_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1553:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO7B_P/4) = (*(grf+GRF_GPIO7B_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1560:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO7C_P/4) = (*(grf+GRF_GPIO7C_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[Compile] softTone.c
wiringPi.c:1569:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO8A_P/4) = (*(grf+GRF_GPIO8A_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:1574:77: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
*(grf+GRF_GPIO8B_P/4) = (*(grf+GRF_GPIO8B_P/4) | (0x03<<((pin%8)*2+16))) & (~(0x03<<((pin%8)*2))) | (bit1<<((pin%8)*2+1)) | (bit0<<((pin%8)*2));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
wiringPi.c: In function ‘digitalWriteByte’:
wiringPi.c:2839:11: warning: unused variable ‘pinClr’ [-Wunused-variable]
uint32_t pinClr = 0 ;
^~~~~~
wiringPi.c:2838:11: warning: unused variable ‘pinSet’ [-Wunused-variable]
uint32_t pinSet = 0 ;
^~~~~~
wiringPi.c: In function ‘wiringPiSetup’:
wiringPi.c:3274:32: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void *’ [-Wformat=]
printf ("jason pwm_map = %x\n",grf_map) ;
^
wiringPi.c:3294:32: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void *’ [-Wformat=]
printf ("jason pwm_map = %x\n",pwm_map) ;
^
wiringPi.c:3317:32: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void *’ [-Wformat=]
printf ("jason pmu_map = %x\n",pmu_map) ;
^
wiringPi.c:3341:39: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void *’ [-Wformat=]
printf ("jason cru_map = %x\n",cru_map) ;
^
[Compile] mcp23s08.c
wiringPi.c: In function ‘asus_set_pin_mode’:
wiringPi.c:1433:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
[Compile] mcp23s17.c
At top level:
wiringPi.c:502:16: warning: ‘gpioToGPLEV’ defined but not used [-Wunused-variable]
static uint8_t gpioToGPLEV [] =
^~~~~~~~~~~
wiringPi.c:492:16: warning: ‘gpioToGPCLR’ defined but not used [-Wunused-variable]
static uint8_t gpioToGPCLR [] =
^~~~~~~~~~~
wiringPi.c:483:16: warning: ‘gpioToGPSET’ defined but not used [-Wunused-variable]
static uint8_t gpioToGPSET [] =
^~~~~~~~~~~
wiringPi.c:409:12: warning: ‘physToGpioR2’ defined but not used [-Wunused-variable]
static int physToGpioR2 [64] =
^~~~~~~~~~~~
wiringPi.c:361:12: warning: ‘pinToGpioR2’ defined but not used [-Wunused-variable]
static int pinToGpioR2 [64] =
^~~~~~~~~~~
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp3422.c
[Compile] mcp4802.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Compile] wpiExtensions.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]
WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] gertboard.c
[Compile] piNes.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]
GPIO Utility
[Compile] pins.c
[Compile] gpio.c
[Compile] readall.c
gpio.c:1190:13: warning: ‘doVersion’ defined but not used [-Wunused-function]
static void doVersion (char *argv [])
^~~~~~~~~
[Link]
[Install]
All Done.
NOTE: To compile programs with wiringPi, you need to add:
-lwiringPi
to your compile line(s) To use the Gertboard, MaxDetect, etc.
code (the devLib), you need to also add:
-lwiringPiDev
to your compile line(s).
---------------------------------------------------------------------------------------------------
(4.1) gpio -v
linaro@Tinker01:~/GPIO_API_for_C$ gpio -v
gpio version: 2.31
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
asus Pi Details:
Type: ASUS pi, Revision: 02, Memory: 2048MB, Maker: Asus
---------------------------------------------------------------------------------------------------
(4.2) gpio readall
linaro@Tinker01:~/GPIO_API_for_C$ gpio -v
gpio version: 2.31
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
asus Pi Details:
Type: ASUS pi, Revision: 02, Memory: 2048MB, Maker: Asus
linaro@Tinker01:~/GPIO_API_for_C$ gpio readall
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
| CPU | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | CPU |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 252 | 8 | SDA.1 | | 1 | 3 || 4 | | | 5V | | |
| 253 | 9 | SCL.1 | | 1 | 5 || 6 | | | 0v | | |
| 17 | 7 | GPIO0C1 | OUT | 1 | 7 || 8 | 1 | SERL | TxD1 | 15 | 161 |
| | | 0v | | | 9 || 10 | 1 | SERL | RxD1 | 16 | 160 |
| 164 | 0 | GPIO5B4 | IN | 1 | 11 || 12 | 1 | | GPIO6A0 | 1 | 184 |
| 166 | 2 | GPIO5B6 | SERL | 1 | 13 || 14 | | | 0v | | |
| 167 | 3 | GPIO5B7 | SERL | 1 | 15 || 16 | 1 | IN | GPIO5B2 | 4 | 162 |
| | | 3.3v | | | 17 || 18 | 1 | IN | GPIO5B3 | 5 | 163 |
| 257 | 12 | MOSI1 | | 0 | 19 || 20 | | | 0v | | |
| 256 | 13 | MISO1 | | 1 | 21 || 22 | 0 | IN | GPIO5C3 | 6 | 171 |
| 254 | 14 | SCLK1 | | 1 | 23 || 24 | 1 | | CE0 | 10 | 255 |
| | | 0v | | | 25 || 26 | 1 | | CE1 | 11 | 251 |
| 233 | 30 | SDA.2 | OUT | 1 | 27 || 28 | 1 | | SCL.2 | 31 | 234 |
| 165 | 21 | GPIO5B5 | IN | 1 | 29 || 30 | | | 0v | | |
| 168 | 22 | GPIO5C0 | IN | 1 | 31 || 32 | 1 | SERL | GPIO7C7 | 26 | 239 |
| 238 | 23 | GPIO7C6 | SERL | 1 | 33 || 34 | | | 0v | | |
| 185 | 24 | GPIO6A1 | | 0 | 35 || 36 | 1 | SERL | GPIO7A7 | 27 | 223 |
| 224 | 25 | GPIO7B0 | SERL | 1 | 37 || 38 | 1 | | GPIO6A3 | 28 | 187 |
| | | 0v | | | 39 || 40 | 0 | | GPIO6A4 | 29 | 188 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| CPU | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | CPU |
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------