Skip to content

Commit

Permalink
wiringPi: Refactor source codes
Browse files Browse the repository at this point in the history
Change-Id: Id121bfc6cb211b78b7ade56d235d43bdf11fc690
  • Loading branch information
joshua-yang committed Nov 29, 2018
1 parent 175d1f6 commit 3b38a5f
Show file tree
Hide file tree
Showing 37 changed files with 694 additions and 2,879 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ lib*.so.*
debian-template/wiringPi
debian-template/wiringpi-*.deb
gpio/gpio
.DS_Store
.vscode
10 changes: 0 additions & 10 deletions debian-template/wiringPi/DEBIAN/control

This file was deleted.

5 changes: 0 additions & 5 deletions debian-template/wiringPi/DEBIAN/postinst

This file was deleted.

2 changes: 0 additions & 2 deletions debian-template/wiringPi/DEBIAN/postrm

This file was deleted.

57 changes: 5 additions & 52 deletions gpio/gpio_odroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <sys/stat.h>

#include <wiringPi.h>
#include <wiringOdroid.h>
#include <wpiExtensions.h>

#include <gertboard.h>
Expand Down Expand Up @@ -625,52 +624,6 @@ static void doPadDrive (int argc, char *argv [])
}


/*
* doUsbP:
* Control USB Power - High (1.2A) or Low (600mA)
* gpio usbp high/low
*********************************************************************************
*/

static void doUsbP (int argc, char *argv [])
{
int model, rev, mem, maker, overVolted ;

if (argc != 3) {
fprintf (stderr, "Usage: %s usbp high|low\n", argv [0]) ;
exit (1) ;
}

// Make sure we're on a B+
piBoardId (&model, &rev, &mem, &maker, &overVolted) ;

if (!((model == PI_MODEL_BP) || (model == PI_MODEL_2))) {
fprintf (stderr, "USB power contol is applicable to B+ and v2 boards only.\n") ;
exit (1) ;
}

// Make sure we start in BCM_GPIO mode
wiringPiSetupGpio () ;

if ((strcasecmp (argv [2], "high") == 0) || (strcasecmp (argv [2], "hi") == 0)) {
digitalWrite (PI_USB_POWER_CONTROL, 1) ;
pinMode (PI_USB_POWER_CONTROL, OUTPUT) ;
printf ("Switched to HIGH current USB (1.2A)\n") ;
return ;
}

if ((strcasecmp (argv [2], "low") == 0) || (strcasecmp (argv [2], "lo") == 0)) {
digitalWrite (PI_USB_POWER_CONTROL, 0) ;
pinMode (PI_USB_POWER_CONTROL, OUTPUT) ;
printf ("Switched to LOW current USB (600mA)\n") ;
return ;
}

fprintf (stderr, "Usage: %s usbp high|low\n", argv [0]) ;
exit (1) ;
}


/*
* doGbw:
* gpio gbw channel value
Expand Down Expand Up @@ -1189,29 +1142,29 @@ int main (int argc, char *argv [])
for (i = 2 ; i < argc ; ++i)
argv [i - 1] = argv [i] ;
--argc ;
wpMode = WPI_MODE_GPIO ;
wpMode = MODE_GPIO ;
} else if (strcasecmp (argv [1], "-1") == 0) { // Check for -1 argument
wiringPiSetupPhys () ;

for (i = 2 ; i < argc ; ++i)
argv [i - 1] = argv [i] ;
--argc ;
wpMode = WPI_MODE_PHYS ;
wpMode = MODE_PHYS ;
} else if (strcasecmp (argv [1], "-p") == 0) { // Check for -p argument for PiFace
piFaceSetup (200) ;

for (i = 2 ; i < argc ; ++i)
argv [i - 1] = argv [i] ;
--argc ;
wpMode = WPI_MODE_PIFACE ;
wpMode = MODE_PIFACE ;
} else if (strcasecmp (argv [1], "-z") == 0) { // Check for -z argument so we don't actually initialise wiringPi
for (i = 2 ; i < argc ; ++i)
argv [i - 1] = argv [i] ;
--argc ;
wpMode = WPI_MODE_UNINITIALISED ;
wpMode = MODE_UNINITIALISED ;
} else { // Default to wiringPi mode
wiringPiSetup () ;
wpMode = WPI_MODE_PINS ;
wpMode = MODE_PINS ;
}

// Check for -x argument to load in a new extension
Expand Down
9 changes: 4 additions & 5 deletions gpio/readall_odroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include <wiringPi.h>
/*----------------------------------------------------------------------------*/
#include <wiringOdroid.h>

extern int wpMode ;

Expand Down Expand Up @@ -277,9 +276,9 @@ static void readallPhysOdroid (int model, int rev, int physPin, const char *phys
if ((physToWpi [physPin] == -1) || (physPinToGpio (physPin) == -1))
printf (" | | ") ;
else {
if (wpMode == WPI_MODE_GPIO)
if (wpMode == MODE_GPIO)
pin = physPinToGpio (physPin);
else if (wpMode == WPI_MODE_PHYS)
else if (wpMode == MODE_PHYS)
pin = physPin ;
else
pin = physToWpi [physPin];
Expand All @@ -297,9 +296,9 @@ static void readallPhysOdroid (int model, int rev, int physPin, const char *phys
if ((physToWpi [physPin] == -1) || (physPinToGpio (physPin) == -1))
printf (" | | ") ;
else {
if (wpMode == WPI_MODE_GPIO)
if (wpMode == MODE_GPIO)
pin = physPinToGpio (physPin);
else if (wpMode == WPI_MODE_PHYS)
else if (wpMode == MODE_PHYS)
pin = physPin ;
else
pin = physToWpi [physPin];
Expand Down
1 change: 1 addition & 0 deletions pins/odroid_c1.aux
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\relax
Binary file added pins/odroid_c1.dvi
Binary file not shown.
101 changes: 101 additions & 0 deletions pins/odroid_c1.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex 2018.1.11) 11 JAN 2018 17:00
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**odroid_c1.tex odroid_c1.dvi
(./odroid_c1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)

(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: dvips.def on input line 99.

(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/dvips.def
File: dvips.def 2017/06/20 v3.1d Graphics/color driver for dvips
))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
Package: color 2016/07/10 v1.1e Standard LaTeX Color (DPC)

(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package color Info: Driver file: dvips.def on input line 147.

(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def
File: dvipsnam.def 2016/06/17 v3.0m Driver-dependent file (DPC,SPQR)
))
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/helvet.sty
Package: helvet 2005/04/12 PSNFSS-v9.2a (WaS)

(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)) (./odroid_c1.aux)
\openout1 = `odroid_c1.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Try loading font information for OT1+phv on input line 19.
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1phv.fd
File: ot1phv.fd 2001/06/04 scalable font definitions for OT1/phv.
)
LaTeX Font Info: Font shape `OT1/phv/bx/n' in size <10.95> not available
(Font) Font shape `OT1/phv/b/n' tried instead on input line 39.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 44.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 44.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 44.

Overfull \hbox (45.36154pt too wide) in paragraph at lines 44--96
[]
[]

[1

] (./odroid_c1.aux) )
Here is how much of TeX's memory you used:
770 strings out of 494932
10317 string characters out of 6180877
70176 words of memory out of 5000000
4123 multiletter control sequences out of 15000+600000
7689 words of font info for 26 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
23i,8n,19p,198b,201s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on odroid_c1.dvi (1 page, 8888 bytes).
Binary file added pins/odroid_c1.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions pins/odroid_c2.aux
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\relax
Binary file added pins/odroid_c2.dvi
Binary file not shown.
101 changes: 101 additions & 0 deletions pins/odroid_c2.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex 2018.1.11) 11 JAN 2018 17:00
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**odroid_c2.tex odroid_c2.dvi
(./odroid_c2.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)

(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: dvips.def on input line 99.

(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/dvips.def
File: dvips.def 2017/06/20 v3.1d Graphics/color driver for dvips
))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
Package: color 2016/07/10 v1.1e Standard LaTeX Color (DPC)

(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package color Info: Driver file: dvips.def on input line 147.

(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def
File: dvipsnam.def 2016/06/17 v3.0m Driver-dependent file (DPC,SPQR)
))
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/helvet.sty
Package: helvet 2005/04/12 PSNFSS-v9.2a (WaS)

(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)) (./odroid_c2.aux)
\openout1 = `odroid_c2.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Try loading font information for OT1+phv on input line 19.
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1phv.fd
File: ot1phv.fd 2001/06/04 scalable font definitions for OT1/phv.
)
LaTeX Font Info: Font shape `OT1/phv/bx/n' in size <10.95> not available
(Font) Font shape `OT1/phv/b/n' tried instead on input line 39.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 44.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 44.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 44.

Overfull \hbox (57.53778pt too wide) in paragraph at lines 44--96
[]
[]

[1

] (./odroid_c2.aux) )
Here is how much of TeX's memory you used:
770 strings out of 494932
10317 string characters out of 6180877
70176 words of memory out of 5000000
4123 multiletter control sequences out of 15000+600000
7689 words of font info for 26 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
23i,8n,19p,198b,201s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on odroid_c2.dvi (1 page, 8896 bytes).
Binary file added pins/odroid_c2.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions pins/odroid_n1.aux
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\relax
Binary file added pins/odroid_n1.dvi
Binary file not shown.
Loading

0 comments on commit 3b38a5f

Please sign in to comment.