Skip to content

Commit 3b38a5f

Browse files
committed
wiringPi: Refactor source codes
Change-Id: Id121bfc6cb211b78b7ade56d235d43bdf11fc690
1 parent 175d1f6 commit 3b38a5f

37 files changed

+694
-2879
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ lib*.so.*
55
debian-template/wiringPi
66
debian-template/wiringpi-*.deb
77
gpio/gpio
8+
.DS_Store
9+
.vscode

debian-template/wiringPi/DEBIAN/control

Lines changed: 0 additions & 10 deletions
This file was deleted.

debian-template/wiringPi/DEBIAN/postinst

Lines changed: 0 additions & 5 deletions
This file was deleted.

debian-template/wiringPi/DEBIAN/postrm

Lines changed: 0 additions & 2 deletions
This file was deleted.

gpio/gpio_odroid.c

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <sys/stat.h>
3434

3535
#include <wiringPi.h>
36-
#include <wiringOdroid.h>
3736
#include <wpiExtensions.h>
3837

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

627626

628-
/*
629-
* doUsbP:
630-
* Control USB Power - High (1.2A) or Low (600mA)
631-
* gpio usbp high/low
632-
*********************************************************************************
633-
*/
634-
635-
static void doUsbP (int argc, char *argv [])
636-
{
637-
int model, rev, mem, maker, overVolted ;
638-
639-
if (argc != 3) {
640-
fprintf (stderr, "Usage: %s usbp high|low\n", argv [0]) ;
641-
exit (1) ;
642-
}
643-
644-
// Make sure we're on a B+
645-
piBoardId (&model, &rev, &mem, &maker, &overVolted) ;
646-
647-
if (!((model == PI_MODEL_BP) || (model == PI_MODEL_2))) {
648-
fprintf (stderr, "USB power contol is applicable to B+ and v2 boards only.\n") ;
649-
exit (1) ;
650-
}
651-
652-
// Make sure we start in BCM_GPIO mode
653-
wiringPiSetupGpio () ;
654-
655-
if ((strcasecmp (argv [2], "high") == 0) || (strcasecmp (argv [2], "hi") == 0)) {
656-
digitalWrite (PI_USB_POWER_CONTROL, 1) ;
657-
pinMode (PI_USB_POWER_CONTROL, OUTPUT) ;
658-
printf ("Switched to HIGH current USB (1.2A)\n") ;
659-
return ;
660-
}
661-
662-
if ((strcasecmp (argv [2], "low") == 0) || (strcasecmp (argv [2], "lo") == 0)) {
663-
digitalWrite (PI_USB_POWER_CONTROL, 0) ;
664-
pinMode (PI_USB_POWER_CONTROL, OUTPUT) ;
665-
printf ("Switched to LOW current USB (600mA)\n") ;
666-
return ;
667-
}
668-
669-
fprintf (stderr, "Usage: %s usbp high|low\n", argv [0]) ;
670-
exit (1) ;
671-
}
672-
673-
674627
/*
675628
* doGbw:
676629
* gpio gbw channel value
@@ -1189,29 +1142,29 @@ int main (int argc, char *argv [])
11891142
for (i = 2 ; i < argc ; ++i)
11901143
argv [i - 1] = argv [i] ;
11911144
--argc ;
1192-
wpMode = WPI_MODE_GPIO ;
1145+
wpMode = MODE_GPIO ;
11931146
} else if (strcasecmp (argv [1], "-1") == 0) { // Check for -1 argument
11941147
wiringPiSetupPhys () ;
11951148

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

12031156
for (i = 2 ; i < argc ; ++i)
12041157
argv [i - 1] = argv [i] ;
12051158
--argc ;
1206-
wpMode = WPI_MODE_PIFACE ;
1159+
wpMode = MODE_PIFACE ;
12071160
} else if (strcasecmp (argv [1], "-z") == 0) { // Check for -z argument so we don't actually initialise wiringPi
12081161
for (i = 2 ; i < argc ; ++i)
12091162
argv [i - 1] = argv [i] ;
12101163
--argc ;
1211-
wpMode = WPI_MODE_UNINITIALISED ;
1164+
wpMode = MODE_UNINITIALISED ;
12121165
} else { // Default to wiringPi mode
12131166
wiringPiSetup () ;
1214-
wpMode = WPI_MODE_PINS ;
1167+
wpMode = MODE_PINS ;
12151168
}
12161169

12171170
// Check for -x argument to load in a new extension

gpio/readall_odroid.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
#include <wiringPi.h>
3535
/*----------------------------------------------------------------------------*/
36-
#include <wiringOdroid.h>
3736

3837
extern int wpMode ;
3938

@@ -277,9 +276,9 @@ static void readallPhysOdroid (int model, int rev, int physPin, const char *phys
277276
if ((physToWpi [physPin] == -1) || (physPinToGpio (physPin) == -1))
278277
printf (" | | ") ;
279278
else {
280-
if (wpMode == WPI_MODE_GPIO)
279+
if (wpMode == MODE_GPIO)
281280
pin = physPinToGpio (physPin);
282-
else if (wpMode == WPI_MODE_PHYS)
281+
else if (wpMode == MODE_PHYS)
283282
pin = physPin ;
284283
else
285284
pin = physToWpi [physPin];
@@ -297,9 +296,9 @@ static void readallPhysOdroid (int model, int rev, int physPin, const char *phys
297296
if ((physToWpi [physPin] == -1) || (physPinToGpio (physPin) == -1))
298297
printf (" | | ") ;
299298
else {
300-
if (wpMode == WPI_MODE_GPIO)
299+
if (wpMode == MODE_GPIO)
301300
pin = physPinToGpio (physPin);
302-
else if (wpMode == WPI_MODE_PHYS)
301+
else if (wpMode == MODE_PHYS)
303302
pin = physPin ;
304303
else
305304
pin = physToWpi [physPin];

pins/odroid_c1.aux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
\relax

pins/odroid_c1.dvi

8.68 KB
Binary file not shown.

pins/odroid_c1.log

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
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
2+
entering extended mode
3+
restricted \write18 enabled.
4+
%&-line parsing enabled.
5+
**odroid_c1.tex odroid_c1.dvi
6+
(./odroid_c1.tex
7+
LaTeX2e <2017-04-15>
8+
Babel <3.12> and hyphenation patterns for 3 language(s) loaded.
9+
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
10+
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
11+
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo
12+
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
13+
)
14+
\c@part=\count79
15+
\c@section=\count80
16+
\c@subsection=\count81
17+
\c@subsubsection=\count82
18+
\c@paragraph=\count83
19+
\c@subparagraph=\count84
20+
\c@figure=\count85
21+
\c@table=\count86
22+
\abovecaptionskip=\skip41
23+
\belowcaptionskip=\skip42
24+
\bibindent=\dimen102
25+
)
26+
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
27+
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
28+
29+
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
30+
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
31+
)
32+
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
33+
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
34+
)
35+
Package graphics Info: Driver file: dvips.def on input line 99.
36+
37+
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/dvips.def
38+
File: dvips.def 2017/06/20 v3.1d Graphics/color driver for dvips
39+
))
40+
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty
41+
Package: color 2016/07/10 v1.1e Standard LaTeX Color (DPC)
42+
43+
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg
44+
File: color.cfg 2016/01/02 v1.6 sample color configuration
45+
)
46+
Package color Info: Driver file: dvips.def on input line 147.
47+
48+
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def
49+
File: dvipsnam.def 2016/06/17 v3.0m Driver-dependent file (DPC,SPQR)
50+
))
51+
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/helvet.sty
52+
Package: helvet 2005/04/12 PSNFSS-v9.2a (WaS)
53+
54+
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
55+
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
56+
\KV@toks@=\toks14
57+
)) (./odroid_c1.aux)
58+
\openout1 = `odroid_c1.aux'.
59+
60+
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 19.
61+
LaTeX Font Info: ... okay on input line 19.
62+
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 19.
63+
LaTeX Font Info: ... okay on input line 19.
64+
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 19.
65+
LaTeX Font Info: ... okay on input line 19.
66+
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 19.
67+
LaTeX Font Info: ... okay on input line 19.
68+
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 19.
69+
LaTeX Font Info: ... okay on input line 19.
70+
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 19.
71+
LaTeX Font Info: ... okay on input line 19.
72+
LaTeX Font Info: Try loading font information for OT1+phv on input line 19.
73+
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1phv.fd
74+
File: ot1phv.fd 2001/06/04 scalable font definitions for OT1/phv.
75+
)
76+
LaTeX Font Info: Font shape `OT1/phv/bx/n' in size <10.95> not available
77+
(Font) Font shape `OT1/phv/b/n' tried instead on input line 39.
78+
LaTeX Font Info: External font `cmex10' loaded for size
79+
(Font) <10.95> on input line 44.
80+
LaTeX Font Info: External font `cmex10' loaded for size
81+
(Font) <8> on input line 44.
82+
LaTeX Font Info: External font `cmex10' loaded for size
83+
(Font) <6> on input line 44.
84+
85+
Overfull \hbox (45.36154pt too wide) in paragraph at lines 44--96
86+
[]
87+
[]
88+
89+
[1
90+
91+
] (./odroid_c1.aux) )
92+
Here is how much of TeX's memory you used:
93+
770 strings out of 494932
94+
10317 string characters out of 6180877
95+
70176 words of memory out of 5000000
96+
4123 multiletter control sequences out of 15000+600000
97+
7689 words of font info for 26 fonts, out of 8000000 for 9000
98+
14 hyphenation exceptions out of 8191
99+
23i,8n,19p,198b,201s stack positions out of 5000i,500n,10000p,200000b,80000s
100+
101+
Output written on odroid_c1.dvi (1 page, 8888 bytes).

pins/odroid_c1.pdf

17.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)