From 8533ddbe8f9993eafe46b8d80fd349c70fb37c56 Mon Sep 17 00:00:00 2001 From: YANG HONGBO Date: Mon, 17 Nov 2014 15:35:08 +0000 Subject: [PATCH 1/2] remove hardcopy WiringPi source code --- WiringPi/COPYING.LESSER | 165 -- WiringPi/INSTALL | 36 - WiringPi/People | 30 - WiringPi/README.TXT | 26 - WiringPi/build | 87 - WiringPi/devLib/Makefile | 130 -- WiringPi/devLib/ds1302.c | 240 -- WiringPi/devLib/ds1302.h | 44 - WiringPi/devLib/font.h | 2577 --------------------- WiringPi/devLib/gertboard.c | 164 -- WiringPi/devLib/gertboard.h | 45 - WiringPi/devLib/lcd.c | 495 ---- WiringPi/devLib/lcd.h | 52 - WiringPi/devLib/lcd128x64.c | 673 ------ WiringPi/devLib/lcd128x64.h | 39 - WiringPi/devLib/maxdetect.c | 165 -- WiringPi/devLib/maxdetect.h | 40 - WiringPi/devLib/piFace.c | 112 - WiringPi/devLib/piFace.h | 32 - WiringPi/devLib/piFaceOld.c | 178 -- WiringPi/devLib/piGlow.c | 118 - WiringPi/devLib/piGlow.h | 45 - WiringPi/devLib/piNes.c | 113 - WiringPi/devLib/piNes.h | 45 - WiringPi/examples/COPYING.LESSER | 165 -- WiringPi/examples/Gertboard/7segments.c | 221 -- WiringPi/examples/Gertboard/Makefile | 74 - WiringPi/examples/Gertboard/buttons.c | 83 - WiringPi/examples/Gertboard/gertboard.c | 96 - WiringPi/examples/Gertboard/record.c | 60 - WiringPi/examples/Gertboard/temperature.c | 78 - WiringPi/examples/Gertboard/voltmeter.c | 73 - WiringPi/examples/Gertboard/vumeter.c | 152 -- WiringPi/examples/Makefile | 158 -- WiringPi/examples/PiFace/Makefile | 85 - WiringPi/examples/PiFace/blink.c | 59 - WiringPi/examples/PiFace/buttons.c | 103 - WiringPi/examples/PiFace/ladder.c | 337 --- WiringPi/examples/PiFace/metro.c | 111 - WiringPi/examples/PiFace/motor.c | 120 - WiringPi/examples/PiFace/reaction.c | 194 -- WiringPi/examples/README.TXT | 18 - WiringPi/examples/blink.c | 48 - WiringPi/examples/blink.rtb | 30 - WiringPi/examples/blink.sh | 37 - WiringPi/examples/blink12.c | 111 - WiringPi/examples/blink8.c | 57 - WiringPi/examples/clock.c | 201 -- WiringPi/examples/delayTest.c | 107 - WiringPi/examples/header.h | 23 - WiringPi/examples/isr-osc.c | 118 - WiringPi/examples/isr.c | 110 - WiringPi/examples/lcd-adafruit.c | 347 --- WiringPi/examples/lcd.c | 286 --- WiringPi/examples/nes.c | 67 - WiringPi/examples/okLed.c | 82 - WiringPi/examples/pwm.c | 58 - WiringPi/examples/q2w/Makefile | 81 - WiringPi/examples/q2w/binary.c | 79 - WiringPi/examples/q2w/blink-io.c | 61 - WiringPi/examples/q2w/blink.c | 50 - WiringPi/examples/q2w/blink.sh | 37 - WiringPi/examples/q2w/bright.c | 59 - WiringPi/examples/q2w/button.c | 63 - WiringPi/examples/q2w/volts.c | 62 - WiringPi/examples/rht03.c | 64 - WiringPi/examples/serialRead.c | 48 - WiringPi/examples/serialTest.c | 75 - WiringPi/examples/servo.c | 57 - WiringPi/examples/softPwm.c | 89 - WiringPi/examples/softTone.c | 54 - WiringPi/examples/speed.c | 95 - WiringPi/examples/wfi.c | 161 -- WiringPi/gpio/COPYING.LESSER | 165 -- WiringPi/gpio/Makefile | 84 - WiringPi/gpio/extensions.c | 414 ---- WiringPi/gpio/extensions.h | 26 - WiringPi/gpio/gpio.1 | 329 --- WiringPi/gpio/gpio.c | 1233 ---------- WiringPi/gpio/pintest | 193 -- WiringPi/gpio/test.sh | 44 - WiringPi/pins/Makefile | 18 - WiringPi/pins/pins.pdf | Bin 9833 -> 0 bytes WiringPi/pins/pins.tex | 116 - WiringPi/wiringPi/COPYING.LESSER | 165 -- WiringPi/wiringPi/Makefile | 176 -- WiringPi/wiringPi/drc.c | 203 -- WiringPi/wiringPi/drc.h | 34 - WiringPi/wiringPi/max31855.c | 81 - WiringPi/wiringPi/max31855.h | 33 - WiringPi/wiringPi/max5322.c | 84 - WiringPi/wiringPi/max5322.h | 33 - WiringPi/wiringPi/mcp23008.c | 149 -- WiringPi/wiringPi/mcp23008.h | 33 - WiringPi/wiringPi/mcp23016.c | 164 -- WiringPi/wiringPi/mcp23016.h | 33 - WiringPi/wiringPi/mcp23016reg.h | 48 - WiringPi/wiringPi/mcp23017.c | 195 -- WiringPi/wiringPi/mcp23017.h | 33 - WiringPi/wiringPi/mcp23s08.c | 189 -- WiringPi/wiringPi/mcp23s08.h | 33 - WiringPi/wiringPi/mcp23s17.c | 236 -- WiringPi/wiringPi/mcp23s17.h | 33 - WiringPi/wiringPi/mcp23x08.h | 73 - WiringPi/wiringPi/mcp23x0817.h | 87 - WiringPi/wiringPi/mcp3002.c | 76 - WiringPi/wiringPi/mcp3002.h | 33 - WiringPi/wiringPi/mcp3004.c | 76 - WiringPi/wiringPi/mcp3004.h | 33 - WiringPi/wiringPi/mcp3422.c | 116 - WiringPi/wiringPi/mcp3422.h | 43 - WiringPi/wiringPi/mcp4802.c | 76 - WiringPi/wiringPi/mcp4802.h | 33 - WiringPi/wiringPi/pcf8574.c | 126 - WiringPi/wiringPi/pcf8574.h | 33 - WiringPi/wiringPi/pcf8591.c | 90 - WiringPi/wiringPi/pcf8591.h | 33 - WiringPi/wiringPi/piHiPri.c | 51 - WiringPi/wiringPi/piThread.c | 63 - WiringPi/wiringPi/sn3218.c | 75 - WiringPi/wiringPi/sn3218.h | 33 - WiringPi/wiringPi/softPwm.c | 130 -- WiringPi/wiringPi/softPwm.h | 34 - WiringPi/wiringPi/softServo.c | 211 -- WiringPi/wiringPi/softServo.h | 35 - WiringPi/wiringPi/softTone.c | 121 - WiringPi/wiringPi/softTone.h | 38 - WiringPi/wiringPi/sr595.c | 109 - WiringPi/wiringPi/sr595.h | 34 - WiringPi/wiringPi/wiringPi.c | 1715 -------------- WiringPi/wiringPi/wiringPi.h | 190 -- WiringPi/wiringPi/wiringPiI2C.c | 232 -- WiringPi/wiringPi/wiringPiI2C.h | 42 - WiringPi/wiringPi/wiringPiSPI.c | 121 - WiringPi/wiringPi/wiringPiSPI.h | 35 - WiringPi/wiringPi/wiringSerial.c | 213 -- WiringPi/wiringPi/wiringSerial.h | 38 - WiringPi/wiringPi/wiringShift.c | 83 - WiringPi/wiringPi/wiringShift.h | 41 - 139 files changed, 19804 deletions(-) delete mode 100644 WiringPi/COPYING.LESSER delete mode 100644 WiringPi/INSTALL delete mode 100644 WiringPi/People delete mode 100644 WiringPi/README.TXT delete mode 100755 WiringPi/build delete mode 100644 WiringPi/devLib/Makefile delete mode 100644 WiringPi/devLib/ds1302.c delete mode 100644 WiringPi/devLib/ds1302.h delete mode 100644 WiringPi/devLib/font.h delete mode 100644 WiringPi/devLib/gertboard.c delete mode 100644 WiringPi/devLib/gertboard.h delete mode 100644 WiringPi/devLib/lcd.c delete mode 100644 WiringPi/devLib/lcd.h delete mode 100644 WiringPi/devLib/lcd128x64.c delete mode 100644 WiringPi/devLib/lcd128x64.h delete mode 100755 WiringPi/devLib/maxdetect.c delete mode 100755 WiringPi/devLib/maxdetect.h delete mode 100644 WiringPi/devLib/piFace.c delete mode 100644 WiringPi/devLib/piFace.h delete mode 100644 WiringPi/devLib/piFaceOld.c delete mode 100644 WiringPi/devLib/piGlow.c delete mode 100644 WiringPi/devLib/piGlow.h delete mode 100644 WiringPi/devLib/piNes.c delete mode 100644 WiringPi/devLib/piNes.h delete mode 100644 WiringPi/examples/COPYING.LESSER delete mode 100644 WiringPi/examples/Gertboard/7segments.c delete mode 100644 WiringPi/examples/Gertboard/Makefile delete mode 100644 WiringPi/examples/Gertboard/buttons.c delete mode 100644 WiringPi/examples/Gertboard/gertboard.c delete mode 100644 WiringPi/examples/Gertboard/record.c delete mode 100644 WiringPi/examples/Gertboard/temperature.c delete mode 100644 WiringPi/examples/Gertboard/voltmeter.c delete mode 100644 WiringPi/examples/Gertboard/vumeter.c delete mode 100644 WiringPi/examples/Makefile delete mode 100644 WiringPi/examples/PiFace/Makefile delete mode 100644 WiringPi/examples/PiFace/blink.c delete mode 100644 WiringPi/examples/PiFace/buttons.c delete mode 100755 WiringPi/examples/PiFace/ladder.c delete mode 100644 WiringPi/examples/PiFace/metro.c delete mode 100644 WiringPi/examples/PiFace/motor.c delete mode 100644 WiringPi/examples/PiFace/reaction.c delete mode 100644 WiringPi/examples/README.TXT delete mode 100644 WiringPi/examples/blink.c delete mode 100644 WiringPi/examples/blink.rtb delete mode 100644 WiringPi/examples/blink.sh delete mode 100644 WiringPi/examples/blink12.c delete mode 100644 WiringPi/examples/blink8.c delete mode 100644 WiringPi/examples/clock.c delete mode 100644 WiringPi/examples/delayTest.c delete mode 100644 WiringPi/examples/header.h delete mode 100644 WiringPi/examples/isr-osc.c delete mode 100644 WiringPi/examples/isr.c delete mode 100644 WiringPi/examples/lcd-adafruit.c delete mode 100644 WiringPi/examples/lcd.c delete mode 100644 WiringPi/examples/nes.c delete mode 100644 WiringPi/examples/okLed.c delete mode 100644 WiringPi/examples/pwm.c delete mode 100644 WiringPi/examples/q2w/Makefile delete mode 100644 WiringPi/examples/q2w/binary.c delete mode 100644 WiringPi/examples/q2w/blink-io.c delete mode 100644 WiringPi/examples/q2w/blink.c delete mode 100755 WiringPi/examples/q2w/blink.sh delete mode 100644 WiringPi/examples/q2w/bright.c delete mode 100644 WiringPi/examples/q2w/button.c delete mode 100644 WiringPi/examples/q2w/volts.c delete mode 100644 WiringPi/examples/rht03.c delete mode 100644 WiringPi/examples/serialRead.c delete mode 100644 WiringPi/examples/serialTest.c delete mode 100644 WiringPi/examples/servo.c delete mode 100644 WiringPi/examples/softPwm.c delete mode 100644 WiringPi/examples/softTone.c delete mode 100644 WiringPi/examples/speed.c delete mode 100644 WiringPi/examples/wfi.c delete mode 100644 WiringPi/gpio/COPYING.LESSER delete mode 100644 WiringPi/gpio/Makefile delete mode 100644 WiringPi/gpio/extensions.c delete mode 100644 WiringPi/gpio/extensions.h delete mode 100644 WiringPi/gpio/gpio.1 delete mode 100644 WiringPi/gpio/gpio.c delete mode 100755 WiringPi/gpio/pintest delete mode 100755 WiringPi/gpio/test.sh delete mode 100644 WiringPi/pins/Makefile delete mode 100644 WiringPi/pins/pins.pdf delete mode 100644 WiringPi/pins/pins.tex delete mode 100644 WiringPi/wiringPi/COPYING.LESSER delete mode 100644 WiringPi/wiringPi/Makefile delete mode 100644 WiringPi/wiringPi/drc.c delete mode 100644 WiringPi/wiringPi/drc.h delete mode 100644 WiringPi/wiringPi/max31855.c delete mode 100644 WiringPi/wiringPi/max31855.h delete mode 100644 WiringPi/wiringPi/max5322.c delete mode 100644 WiringPi/wiringPi/max5322.h delete mode 100644 WiringPi/wiringPi/mcp23008.c delete mode 100644 WiringPi/wiringPi/mcp23008.h delete mode 100644 WiringPi/wiringPi/mcp23016.c delete mode 100644 WiringPi/wiringPi/mcp23016.h delete mode 100644 WiringPi/wiringPi/mcp23016reg.h delete mode 100644 WiringPi/wiringPi/mcp23017.c delete mode 100644 WiringPi/wiringPi/mcp23017.h delete mode 100644 WiringPi/wiringPi/mcp23s08.c delete mode 100644 WiringPi/wiringPi/mcp23s08.h delete mode 100644 WiringPi/wiringPi/mcp23s17.c delete mode 100644 WiringPi/wiringPi/mcp23s17.h delete mode 100644 WiringPi/wiringPi/mcp23x08.h delete mode 100644 WiringPi/wiringPi/mcp23x0817.h delete mode 100644 WiringPi/wiringPi/mcp3002.c delete mode 100644 WiringPi/wiringPi/mcp3002.h delete mode 100644 WiringPi/wiringPi/mcp3004.c delete mode 100644 WiringPi/wiringPi/mcp3004.h delete mode 100644 WiringPi/wiringPi/mcp3422.c delete mode 100644 WiringPi/wiringPi/mcp3422.h delete mode 100644 WiringPi/wiringPi/mcp4802.c delete mode 100644 WiringPi/wiringPi/mcp4802.h delete mode 100644 WiringPi/wiringPi/pcf8574.c delete mode 100644 WiringPi/wiringPi/pcf8574.h delete mode 100644 WiringPi/wiringPi/pcf8591.c delete mode 100644 WiringPi/wiringPi/pcf8591.h delete mode 100644 WiringPi/wiringPi/piHiPri.c delete mode 100644 WiringPi/wiringPi/piThread.c delete mode 100644 WiringPi/wiringPi/sn3218.c delete mode 100644 WiringPi/wiringPi/sn3218.h delete mode 100644 WiringPi/wiringPi/softPwm.c delete mode 100644 WiringPi/wiringPi/softPwm.h delete mode 100644 WiringPi/wiringPi/softServo.c delete mode 100644 WiringPi/wiringPi/softServo.h delete mode 100644 WiringPi/wiringPi/softTone.c delete mode 100644 WiringPi/wiringPi/softTone.h delete mode 100644 WiringPi/wiringPi/sr595.c delete mode 100644 WiringPi/wiringPi/sr595.h delete mode 100644 WiringPi/wiringPi/wiringPi.c delete mode 100644 WiringPi/wiringPi/wiringPi.h delete mode 100644 WiringPi/wiringPi/wiringPiI2C.c delete mode 100644 WiringPi/wiringPi/wiringPiI2C.h delete mode 100644 WiringPi/wiringPi/wiringPiSPI.c delete mode 100644 WiringPi/wiringPi/wiringPiSPI.h delete mode 100644 WiringPi/wiringPi/wiringSerial.c delete mode 100644 WiringPi/wiringPi/wiringSerial.h delete mode 100644 WiringPi/wiringPi/wiringShift.c delete mode 100644 WiringPi/wiringPi/wiringShift.h diff --git a/WiringPi/COPYING.LESSER b/WiringPi/COPYING.LESSER deleted file mode 100644 index 65c5ca8..0000000 --- a/WiringPi/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/WiringPi/INSTALL b/WiringPi/INSTALL deleted file mode 100644 index 8e0c43c..0000000 --- a/WiringPi/INSTALL +++ /dev/null @@ -1,36 +0,0 @@ - -How to install wiringPi -======================= - -The easiest way is to use the supplied 'build' script: - - ./build - -that should do a complete install or upgrade of wiringPi for you. - -That will install a dynamic library. - -Some distributions do not have /usr/local/lib in the default LD_LIBRARY_PATH. To -fix this, you need to edit /etc/ld.so.conf and add in a single line: - - /usr/local/lib - -then run the ldconfig command. - - sudo ldconfig - -If you want to install a static library, you may need to do this manually: - - cd wiringPi - make static - sudo make install-static - - -To un-install wiringPi: - - ./build uninstall - -Gordon Henderson - -projects@drogon.net -https://projects.drogon.net/ diff --git a/WiringPi/People b/WiringPi/People deleted file mode 100644 index 92d1ea4..0000000 --- a/WiringPi/People +++ /dev/null @@ -1,30 +0,0 @@ - -Just a quick note to some people who've provided help, suggestions, -bug-fixes, etc. along the way... - -Nick Lott: (And others) - Hints about making it work with C++ - -Philipp Stefan Neininger: - Minor bug in the Makefile to do with cross compiling - -Chris McSweeny - Hints and tips about the use of arithmetic in gettimeofday() - inside the dealyMicrosecondsHard() function. - And spotting a couple of schoolboy errors in the (experimental) - softServo code, prompting me to completely re-write it. - -Armin (Via projects website) - Some pointers about the i2c-dev.h files. - -Arno Wagner - Suggestions for the mmap calls in wiringPiSetup() - -CHARLES Thibaut: - A small issue in softTone - -Xian Stannard - Fixing some typos in the man page! - -Andre Crone - Suggested the __WIRING_PI.H__ round wiringPi.h diff --git a/WiringPi/README.TXT b/WiringPi/README.TXT deleted file mode 100644 index 7789b2e..0000000 --- a/WiringPi/README.TXT +++ /dev/null @@ -1,26 +0,0 @@ - -wiringPi README -=============== - -Please note that the official way to get wiringPi is via git from -git.drogon.net and not GitHub. - -ie. - - git clone git://git.drogon.net/wiringPi - -The version of wiringPi held on GitHub by "Gadgetoid" is used to build the -wiringPython, Ruby, Perl, etc. wrappers for these other languages. This -version may lag the official Drogon release. Pull requests may not be -accepted to Github.... - -Please see - - http://wiringpi.com/ - -for the official documentation, etc. and the best way to submit bug reports, etc. -is by sending an email to projects@drogon.net - -Thanks! - - -Gordon diff --git a/WiringPi/build b/WiringPi/build deleted file mode 100755 index 776c756..0000000 --- a/WiringPi/build +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -check-make-ok() -{ - if [ $? != 0 ]; then - echo "" - echo "Make Failed..." - echo "Please check the messages and fix any problems. If you're still stuck," - echo "then please email all the output and as many details as you can to" - echo " projects@drogon.net" - echo "" - exit 1 - fi -} - -if [ x$1 = "xclean" ]; then - cd wiringPi - echo -n "wiringPi: " ; make clean - cd ../devLib - echo -n "DevLib: " ; make clean - cd ../gpio - echo -n "gpio: " ; make clean - cd ../examples - echo -n "Examples: " ; make clean - cd Gertboard - echo -n "Gertboard: " ; make clean - cd ../PiFace - echo -n "PiFace: " ; make clean - cd ../q2w - echo -n "Quick2Wire: " ; make clean - exit -fi - -if [ x$1 = "xuninstall" ]; then - cd wiringPi - echo -n "wiringPi: " ; sudo make uninstall - cd ../devLib - echo -n "DevLib: " ; sudo make uninstall - cd ../gpio - echo -n "gpio: " ; sudo make uninstall - exit -fi - - - echo "wiringPi Build script" - echo "=====================" - echo - - echo - echo "WiringPi Library" - cd wiringPi - sudo make uninstall - make - check-make-ok - sudo make install - check-make-ok - - echo - echo "WiringPi Devices Library" - cd ../devLib - sudo make uninstall - make - check-make-ok - sudo make install - check-make-ok - - echo - echo "GPIO Utility" - cd ../gpio - make - check-make-ok - sudo make install - check-make-ok - -# echo -# echo "Examples" -# cd ../examples -# make -# cd .. - -echo -echo All Done. -echo "" -echo "NOTE: This is wiringPi v2, and if you need to use the lcd, Piface," -echo " Gertboard, MaxDetext, etc. routines then you must change your" -echo " compile scripts to add -lwiringPiDev" -echo "" diff --git a/WiringPi/devLib/Makefile b/WiringPi/devLib/Makefile deleted file mode 100644 index a106d93..0000000 --- a/WiringPi/devLib/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -# Makefile: -# wiringPi device - Wiring Compatable library for the Raspberry Pi -# -# Copyright (c) 2012-2013 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# https://projects.drogon.net/raspberry-pi/wiringpi/ -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - -DYN_VERS_MAJ=2 -DYN_VERS_MIN=0 - -VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN) -DESTDIR=/usr -PREFIX=/local - -STATIC=libwiringPiDev.a -DYNAMIC=libwiringPiDev.so.$(VERSION) - -#DEBUG = -g -O0 -DEBUG = -O2 -CC = gcc -INCLUDE = -I. -CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC - -LIBS = - -############################################################################### - -SRC = ds1302.c maxdetect.c piNes.c \ - gertboard.c piFace.c \ - lcd128x64.c lcd.c - -OBJ = $(SRC:.c=.o) - -all: $(DYNAMIC) - -static: $(STATIC) - -$(STATIC): $(OBJ) - @echo "[Link (Static)]" - @ar rcs $(STATIC) $(OBJ) - @ranlib $(STATIC) -# @size $(STATIC) - -$(DYNAMIC): $(OBJ) - @echo "[Link (Dynamic)]" - @$(CC) -shared -Wl,-soname,libwiringPiDev.so -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ) - -.c.o: - @echo [Compile] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -.PHONEY: clean -clean: - @echo "[Clean]" - @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.* - -.PHONEY: tags -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - - -.PHONEY: install-headers -install-headers: - @echo "[Install Headers]" - @install -m 0755 -d $(DESTDIR)$(PREFIX)/include - @install -m 0644 ds1302.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 maxdetect.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 piNes.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 gertboard.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 piFace.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 lcd128x64.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include - -.PHONEY: install -install: $(DYNAMIC) install-headers - @echo "[Install Dynamic Lib]" - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib - @install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) - @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so - @ldconfig - -.PHONEY: install-static -install-static: $(STATIC) install-headers - @echo "[Install Static Lib]" - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib - @install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib - -.PHONEY: uninstall -uninstall: - @echo "[UnInstall]" - @rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h - @rm -f $(DESTDIR)$(PREFIX)/include/maxdetect.h - @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h - @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h - @rm -f $(DESTDIR)$(PREFIX)/include/piFace.h - @rm -f $(DESTDIR)$(PREFIX)/include/lcd128x64.h - @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h - @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.* - @ldconfig - - -.PHONEY: depend -depend: - makedepend -Y $(SRC) - -# DO NOT DELETE - -ds1302.o: ds1302.h -maxdetect.o: maxdetect.h -piNes.o: piNes.h -gertboard.o: gertboard.h -piFace.o: piFace.h -lcd128x64.o: font.h lcd128x64.h -lcd.o: lcd.h diff --git a/WiringPi/devLib/ds1302.c b/WiringPi/devLib/ds1302.c deleted file mode 100644 index cf64de7..0000000 --- a/WiringPi/devLib/ds1302.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * ds1302.c: - * Real Time clock - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include - -#include - -#include "ds1302.h" - -// Register defines - -#define RTC_SECS 0 -#define RTC_MINS 1 -#define RTC_HOURS 2 -#define RTC_DATE 3 -#define RTC_MONTH 4 -#define RTC_DAY 5 -#define RTC_YEAR 6 -#define RTC_WP 7 -#define RTC_TC 8 -#define RTC_BM 31 - - -// Locals - -static int dPin, cPin, sPin ; - -/* - * dsShiftIn: - * Shift a number in from the chip, LSB first. Note that the data is - * sampled on the trailing edge of the last clock, so it's valid immediately. - ********************************************************************************* - */ - -static unsigned int dsShiftIn (void) -{ - uint8_t value = 0 ; - int i ; - - pinMode (dPin, INPUT) ; delayMicroseconds (1) ; - - for (i = 0 ; i < 8 ; ++i) - { - value |= (digitalRead (dPin) << i) ; - digitalWrite (cPin, HIGH) ; delayMicroseconds (1) ; - digitalWrite (cPin, LOW) ; delayMicroseconds (1) ; - } - - return value; -} - - -/* - * dsShiftOut: - * A normal LSB-first shift-out, just slowed down a bit - the Pi is - * a bit faster than the chip can handle. - ********************************************************************************* - */ - -static void dsShiftOut (unsigned int data) -{ - int i ; - - pinMode (dPin, OUTPUT) ; - - for (i = 0 ; i < 8 ; ++i) - { - digitalWrite (dPin, data & (1 << i)) ; delayMicroseconds (1) ; - digitalWrite (cPin, HIGH) ; delayMicroseconds (1) ; - digitalWrite (cPin, LOW) ; delayMicroseconds (1) ; - } -} - - -/* - * ds1302regRead: ds1302regWrite: - * Read/Write a value to an RTC Register or RAM location on the chip - ********************************************************************************* - */ - -static unsigned int ds1302regRead (const int reg) -{ - unsigned int data ; - - digitalWrite (sPin, HIGH) ; delayMicroseconds (1) ; - dsShiftOut (reg) ; - data = dsShiftIn () ; - digitalWrite (sPin, LOW) ; delayMicroseconds (1) ; - - return data ; -} - -static void ds1302regWrite (const int reg, const unsigned int data) -{ - digitalWrite (sPin, HIGH) ; delayMicroseconds (1) ; - dsShiftOut (reg) ; - dsShiftOut (data) ; - digitalWrite (sPin, LOW) ; delayMicroseconds (1) ; -} - - -/* - * ds1302rtcWrite: ds1302rtcRead: - * Writes/Reads the data to/from the RTC register - ********************************************************************************* - */ - -unsigned int ds1302rtcRead (const int reg) -{ - return ds1302regRead (0x81 | ((reg & 0x1F) << 1)) ; -} - -void ds1302rtcWrite (int reg, unsigned int data) -{ - ds1302regWrite (0x80 | ((reg & 0x1F) << 1), data) ; -} - - -/* - * ds1302ramWrite: ds1302ramRead: - * Writes/Reads the data to/from the RTC register - ********************************************************************************* - */ - -unsigned int ds1302ramRead (const int addr) -{ - return ds1302regRead (0xC1 | ((addr & 0x1F) << 1)) ; -} - -void ds1302ramWrite (const int addr, const unsigned int data) -{ - ds1302regWrite ( 0xC0 | ((addr & 0x1F) << 1), data) ; -} - -/* - * ds1302clockRead: - * Read all 8 bytes of the clock in a single operation - ********************************************************************************* - */ - -void ds1302clockRead (int clockData [8]) -{ - int i ; - unsigned int regVal = 0x81 | ((RTC_BM & 0x1F) << 1) ; - - digitalWrite (sPin, HIGH) ; delayMicroseconds (1) ; - - dsShiftOut (regVal) ; - for (i = 0 ; i < 8 ; ++i) - clockData [i] = dsShiftIn () ; - - digitalWrite (sPin, LOW) ; delayMicroseconds (1) ; -} - - -/* - * ds1302clockWrite: - * Write all 8 bytes of the clock in a single operation - ********************************************************************************* - */ - -void ds1302clockWrite (const int clockData [8]) -{ - int i ; - unsigned int regVal = 0x80 | ((RTC_BM & 0x1F) << 1) ; - - digitalWrite (sPin, HIGH) ; delayMicroseconds (1) ; - - dsShiftOut (regVal) ; - for (i = 0 ; i < 8 ; ++i) - dsShiftOut (clockData [i]) ; - - digitalWrite (sPin, LOW) ; delayMicroseconds (1) ; -} - - -/* - * ds1302trickleCharge: - * Set the bits on the trickle charger. - * Probably best left alone... - ********************************************************************************* - */ - -void ds1302trickleCharge (const int diodes, const int resistors) -{ - if (diodes + resistors == 0) - ds1302rtcWrite (RTC_TC, 0x5C) ; // Disabled - else - ds1302rtcWrite (RTC_TC, 0xA0 | ((diodes & 3) << 2) | (resistors & 3)) ; -} - - - - -/* - * ds1302setup: - * Initialise the chip & remember the pins we're using - ********************************************************************************* - */ - -void ds1302setup (const int clockPin, const int dataPin, const int csPin) -{ - dPin = dataPin ; - cPin = clockPin ; - sPin = csPin ; - - digitalWrite (dPin, LOW) ; - digitalWrite (cPin, LOW) ; - digitalWrite (sPin, LOW) ; - - pinMode (dPin, OUTPUT) ; - pinMode (cPin, OUTPUT) ; - pinMode (sPin, OUTPUT) ; - - ds1302rtcWrite (RTC_WP, 0) ; // Remove write-protect -} diff --git a/WiringPi/devLib/ds1302.h b/WiringPi/devLib/ds1302.h deleted file mode 100644 index e82b3ed..0000000 --- a/WiringPi/devLib/ds1302.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ds1302.h: - * Real Time clock - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned int ds1302rtcRead (const int reg) ; -extern void ds1302rtcWrite (const int reg, const unsigned int data) ; - -extern unsigned int ds1302ramRead (const int addr) ; -extern void ds1302ramWrite (const int addr, const unsigned int data) ; - -extern void ds1302clockRead (int clockData [8]) ; -extern void ds1302clockWrite (const int clockData [8]) ; - -extern void ds1302trickleCharge (const int diodes, const int resistors) ; - -extern void ds1302setup (const int clockPin, const int dataPin, const int csPin) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/devLib/font.h b/WiringPi/devLib/font.h deleted file mode 100644 index ce99e16..0000000 --- a/WiringPi/devLib/font.h +++ /dev/null @@ -1,2577 +0,0 @@ -/**********************************************/ -/* */ -/* Font file generated by cpi2fnt */ -/* ------------------------------ */ -/* Combined with the alpha-numeric */ -/* portion of Greg Harp's old PEARL */ -/* font (from earlier versions of */ -/* linux-m86k) by John Shifflett */ -/* */ -/**********************************************/ - -static const int fontHeight = 8 ; -static const int fontWidth = 8 ; - -static unsigned char font [] = -{ - /* 0 0x00 '^@' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 1 0x01 '^A' */ - 0x7e, /* 01111110 */ - 0x81, /* 10000001 */ - 0xa5, /* 10100101 */ - 0x81, /* 10000001 */ - 0xbd, /* 10111101 */ - 0x99, /* 10011001 */ - 0x81, /* 10000001 */ - 0x7e, /* 01111110 */ - - /* 2 0x02 '^B' */ - 0x7e, /* 01111110 */ - 0xff, /* 11111111 */ - 0xdb, /* 11011011 */ - 0xff, /* 11111111 */ - 0xc3, /* 11000011 */ - 0xe7, /* 11100111 */ - 0xff, /* 11111111 */ - 0x7e, /* 01111110 */ - - /* 3 0x03 '^C' */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0x10, /* 00010000 */ - 0x00, /* 00000000 */ - - /* 4 0x04 '^D' */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0x10, /* 00010000 */ - 0x00, /* 00000000 */ - - /* 5 0x05 '^E' */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - - /* 6 0x06 '^F' */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - - /* 7 0x07 '^G' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 8 0x08 '^H' */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xe7, /* 11100111 */ - 0xc3, /* 11000011 */ - 0xc3, /* 11000011 */ - 0xe7, /* 11100111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - - /* 9 0x09 '^I' */ - 0x00, /* 00000000 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x42, /* 01000010 */ - 0x42, /* 01000010 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 10 0x0a '^J' */ - 0xff, /* 11111111 */ - 0xc3, /* 11000011 */ - 0x99, /* 10011001 */ - 0xbd, /* 10111101 */ - 0xbd, /* 10111101 */ - 0x99, /* 10011001 */ - 0xc3, /* 11000011 */ - 0xff, /* 11111111 */ - - /* 11 0x0b '^K' */ - 0x0f, /* 00001111 */ - 0x07, /* 00000111 */ - 0x0f, /* 00001111 */ - 0x7d, /* 01111101 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x78, /* 01111000 */ - - /* 12 0x0c '^L' */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - - /* 13 0x0d '^M' */ - 0x3f, /* 00111111 */ - 0x33, /* 00110011 */ - 0x3f, /* 00111111 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x70, /* 01110000 */ - 0xf0, /* 11110000 */ - 0xe0, /* 11100000 */ - - /* 14 0x0e '^N' */ - 0x7f, /* 01111111 */ - 0x63, /* 01100011 */ - 0x7f, /* 01111111 */ - 0x63, /* 01100011 */ - 0x63, /* 01100011 */ - 0x67, /* 01100111 */ - 0xe6, /* 11100110 */ - 0xc0, /* 11000000 */ - - /* 15 0x0f '^O' */ - 0x18, /* 00011000 */ - 0xdb, /* 11011011 */ - 0x3c, /* 00111100 */ - 0xe7, /* 11100111 */ - 0xe7, /* 11100111 */ - 0x3c, /* 00111100 */ - 0xdb, /* 11011011 */ - 0x18, /* 00011000 */ - - /* 16 0x10 '^P' */ - 0x80, /* 10000000 */ - 0xe0, /* 11100000 */ - 0xf8, /* 11111000 */ - 0xfe, /* 11111110 */ - 0xf8, /* 11111000 */ - 0xe0, /* 11100000 */ - 0x80, /* 10000000 */ - 0x00, /* 00000000 */ - - /* 17 0x11 '^Q' */ - 0x02, /* 00000010 */ - 0x0e, /* 00001110 */ - 0x3e, /* 00111110 */ - 0xfe, /* 11111110 */ - 0x3e, /* 00111110 */ - 0x0e, /* 00001110 */ - 0x02, /* 00000010 */ - 0x00, /* 00000000 */ - - /* 18 0x12 '^R' */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - - /* 19 0x13 '^S' */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - - /* 20 0x14 '^T' */ - 0x7f, /* 01111111 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7b, /* 01111011 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x00, /* 00000000 */ - - /* 21 0x15 '^U' */ - 0x3e, /* 00111110 */ - 0x61, /* 01100001 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x86, /* 10000110 */ - 0x7c, /* 01111100 */ - - /* 22 0x16 '^V' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x7e, /* 01111110 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 23 0x17 '^W' */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - - /* 24 0x18 '^X' */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 25 0x19 '^Y' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 26 0x1a '^Z' */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0xfe, /* 11111110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 27 0x1b '^[' */ - 0x00, /* 00000000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xfe, /* 11111110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 28 0x1c '^\' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 29 0x1d '^]' */ - 0x00, /* 00000000 */ - 0x24, /* 00100100 */ - 0x66, /* 01100110 */ - 0xff, /* 11111111 */ - 0x66, /* 01100110 */ - 0x24, /* 00100100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 30 0x1e '^^' */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 31 0x1f '^_' */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 32 0x20 ' ' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 33 0x21 '!' */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 34 0x22 '"' */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 35 0x23 '#' */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x00, /* 00000000 */ - - /* 36 0x24 '$' */ - 0x18, /* 00011000 */ - 0x3e, /* 00111110 */ - 0x60, /* 01100000 */ - 0x3c, /* 00111100 */ - 0x06, /* 00000110 */ - 0x7c, /* 01111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 37 0x25 '%' */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x66, /* 01100110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 38 0x26 '&' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x68, /* 01101000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 39 0x27 ''' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 40 0x28 '(' */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x00, /* 00000000 */ - - /* 41 0x29 ')' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - - /* 42 0x2a '*' */ - 0x00, /* 00000000 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0xff, /* 11111111 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 43 0x2b '+' */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 44 0x2c ',' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - - /* 45 0x2d '-' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 46 0x2e '.' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 47 0x2f '/' */ - 0x03, /* 00000011 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - - /* 48 0x30 '0' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xde, /* 11011110 */ - 0xfe, /* 11111110 */ - 0xf6, /* 11110110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 49 0x31 '1' */ - 0x18, /* 00011000 */ - 0x78, /* 01111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 50 0x32 '2' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 51 0x33 '3' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0x06, /* 00000110 */ - 0x1c, /* 00011100 */ - 0x06, /* 00000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 52 0x34 '4' */ - 0x1c, /* 00011100 */ - 0x3c, /* 00111100 */ - 0x6c, /* 01101100 */ - 0xcc, /* 11001100 */ - 0xfe, /* 11111110 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x00, /* 00000000 */ - - /* 53 0x35 '5' */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xfc, /* 11111100 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 54 0x36 '6' */ - 0x38, /* 00111000 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 55 0x37 '7' */ - 0xfe, /* 11111110 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0x00, /* 00000000 */ - - /* 56 0x38 '8' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 57 0x39 '9' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - - /* 58 0x3a ':' */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 59 0x3b ';' */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - - /* 60 0x3c '<' */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x00, /* 00000000 */ - - /* 61 0x3d '=' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 62 0x3e '>' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - - /* 63 0x3f '?' */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 64 0x40 '@' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xde, /* 11011110 */ - 0xde, /* 11011110 */ - 0xde, /* 11011110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 65 0x41 'A' */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 66 0x42 'B' */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0x00, /* 00000000 */ - - /* 67 0x43 'C' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 68 0x44 'D' */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0x00, /* 00000000 */ - - /* 69 0x45 'E' */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xf8, /* 11111000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 70 0x46 'F' */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xf8, /* 11111000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - - /* 71 0x47 'G' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xce, /* 11001110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 72 0x48 'H' */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 73 0x49 'I' */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 74 0x4a 'J' */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 75 0x4b 'K' */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ - 0xd8, /* 11011000 */ - 0xf0, /* 11110000 */ - 0xd8, /* 11011000 */ - 0xcc, /* 11001100 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 76 0x4c 'L' */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 77 0x4d 'M' */ - 0x82, /* 10000010 */ - 0xc6, /* 11000110 */ - 0xee, /* 11101110 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 78 0x4e 'N' */ - 0xc6, /* 11000110 */ - 0xe6, /* 11100110 */ - 0xf6, /* 11110110 */ - 0xde, /* 11011110 */ - 0xce, /* 11001110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 79 0x4f 'O' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 80 0x50 'P' */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - - /* 81 0x51 'Q' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xf6, /* 11110110 */ - 0xde, /* 11011110 */ - 0x7c, /* 01111100 */ - 0x06, /* 00000110 */ - - /* 82 0x52 'R' */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0xd8, /* 11011000 */ - 0xcc, /* 11001100 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 83 0x53 'S' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0x60, /* 01100000 */ - 0x38, /* 00111000 */ - 0x0c, /* 00001100 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 84 0x54 'T' */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 85 0x55 'U' */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 86 0x56 'V' */ - 0xc3, /* 11000011 */ - 0xc3, /* 11000011 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 87 0x57 'W' */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xd6, /* 11010110 */ - 0xfe, /* 11111110 */ - 0xee, /* 11101110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 88 0x58 'X' */ - 0xc3, /* 11000011 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0xc3, /* 11000011 */ - 0x00, /* 00000000 */ - - /* 89 0x59 'Y' */ - 0xc3, /* 11000011 */ - 0xc3, /* 11000011 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 90 0x5a 'Z' */ - 0xfe, /* 11111110 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 91 0x5b '[' */ - 0x3c, /* 00111100 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 92 0x5c '\' */ - 0xc0, /* 11000000 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x06, /* 00000110 */ - 0x03, /* 00000011 */ - 0x00, /* 00000000 */ - - /* 93 0x5d ']' */ - 0x3c, /* 00111100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 94 0x5e '^' */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 95 0x5f '_' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - - /* 96 0x60 '`' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 97 0x61 'a' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0x06, /* 00000110 */ - 0x7e, /* 01111110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 98 0x62 'b' */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0x00, /* 00000000 */ - - /* 99 0x63 'c' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 100 0x64 'd' */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x7e, /* 01111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 101 0x65 'e' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 102 0x66 'f' */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x60, /* 01100000 */ - 0xf0, /* 11110000 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0x00, /* 00000000 */ - - /* 103 0x67 'g' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0x7c, /* 01111100 */ - - /* 104 0x68 'h' */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 105 0x69 'i' */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 106 0x6a 'j' */ - 0x06, /* 00000110 */ - 0x00, /* 00000000 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - - /* 107 0x6b 'k' */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xcc, /* 11001100 */ - 0xd8, /* 11011000 */ - 0xf0, /* 11110000 */ - 0xd8, /* 11011000 */ - 0xcc, /* 11001100 */ - 0x00, /* 00000000 */ - - /* 108 0x6c 'l' */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 109 0x6d 'm' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xec, /* 11101100 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 110 0x6e 'n' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 111 0x6f 'o' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 112 0x70 'p' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfc, /* 11111100 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - - /* 113 0x71 'q' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - - /* 114 0x72 'r' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xdc, /* 11011100 */ - 0xe6, /* 11100110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - - /* 115 0x73 's' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x06, /* 00000110 */ - 0xfc, /* 11111100 */ - 0x00, /* 00000000 */ - - /* 116 0x74 't' */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x7c, /* 01111100 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x36, /* 00110110 */ - 0x1c, /* 00011100 */ - 0x00, /* 00000000 */ - - /* 117 0x75 'u' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 118 0x76 'v' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - - /* 119 0x77 'w' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xd6, /* 11010110 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0x00, /* 00000000 */ - - /* 120 0x78 'x' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 121 0x79 'y' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc3, /* 11000011 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - - /* 122 0x7a 'z' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x0c, /* 00001100 */ - 0x38, /* 00111000 */ - 0x60, /* 01100000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 123 0x7b '{' */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x70, /* 01110000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x0e, /* 00001110 */ - 0x00, /* 00000000 */ - - /* 124 0x7c '|' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 125 0x7d '}' */ - 0x70, /* 01110000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x70, /* 01110000 */ - 0x00, /* 00000000 */ - - /* 126 0x7e '~' */ - 0x72, /* 01110010 */ - 0x9c, /* 10011100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 127 0x7f '' */ - 0x00, /* 00000000 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 128 0x80 '€' */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x0c, /* 00001100 */ - 0x78, /* 01111000 */ - - /* 129 0x81 '' */ - 0xcc, /* 11001100 */ - 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 130 0x82 '‚' */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 131 0x83 'ƒ' */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 132 0x84 '„' */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 133 0x85 '…' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 134 0x86 '†' */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 135 0x87 '‡' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x7e, /* 01111110 */ - 0x0c, /* 00001100 */ - 0x38, /* 00111000 */ - - /* 136 0x88 'ˆ' */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 137 0x89 '‰' */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 138 0x8a 'Š' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 139 0x8b '‹' */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 140 0x8c 'Œ' */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 141 0x8d '' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 142 0x8e 'Ž' */ - 0xc6, /* 11000110 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 143 0x8f '' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 144 0x90 '' */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xf8, /* 11111000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 145 0x91 '‘' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0xd8, /* 11011000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 146 0x92 '’' */ - 0x3e, /* 00111110 */ - 0x6c, /* 01101100 */ - 0xcc, /* 11001100 */ - 0xfe, /* 11111110 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xce, /* 11001110 */ - 0x00, /* 00000000 */ - - /* 147 0x93 '“' */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 148 0x94 '”' */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 149 0x95 '•' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 150 0x96 '–' */ - 0x78, /* 01111000 */ - 0x84, /* 10000100 */ - 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 151 0x97 '—' */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 152 0x98 '˜' */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0xfc, /* 11111100 */ - - /* 153 0x99 '™' */ - 0xc6, /* 11000110 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - - /* 154 0x9a 'š' */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 155 0x9b '›' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 156 0x9c 'œ' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x64, /* 01100100 */ - 0xf0, /* 11110000 */ - 0x60, /* 01100000 */ - 0x66, /* 01100110 */ - 0xfc, /* 11111100 */ - 0x00, /* 00000000 */ - - /* 157 0x9d '' */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 158 0x9e 'ž' */ - 0xf8, /* 11111000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xfa, /* 11111010 */ - 0xc6, /* 11000110 */ - 0xcf, /* 11001111 */ - 0xc6, /* 11000110 */ - 0xc7, /* 11000111 */ - - /* 159 0x9f 'Ÿ' */ - 0x0e, /* 00001110 */ - 0x1b, /* 00011011 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ - 0x00, /* 00000000 */ - - /* 160 0xa0 ' ' */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 161 0xa1 '¡' */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 162 0xa2 '¢' */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - - /* 163 0xa3 '£' */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 164 0xa4 '¤' */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0x00, /* 00000000 */ - 0xdc, /* 11011100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - - /* 165 0xa5 '¥' */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0x00, /* 00000000 */ - 0xe6, /* 11100110 */ - 0xf6, /* 11110110 */ - 0xde, /* 11011110 */ - 0xce, /* 11001110 */ - 0x00, /* 00000000 */ - - /* 166 0xa6 '¦' */ - 0x3c, /* 00111100 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x3e, /* 00111110 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 167 0xa7 '§' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 168 0xa8 '¨' */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x63, /* 01100011 */ - 0x3e, /* 00111110 */ - 0x00, /* 00000000 */ - - /* 169 0xa9 '©' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 170 0xaa 'ª' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 171 0xab '«' */ - 0x63, /* 01100011 */ - 0xe6, /* 11100110 */ - 0x6c, /* 01101100 */ - 0x7e, /* 01111110 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x0f, /* 00001111 */ - - /* 172 0xac '¬' */ - 0x63, /* 01100011 */ - 0xe6, /* 11100110 */ - 0x6c, /* 01101100 */ - 0x7a, /* 01111010 */ - 0x36, /* 00110110 */ - 0x6a, /* 01101010 */ - 0xdf, /* 11011111 */ - 0x06, /* 00000110 */ - - /* 173 0xad '­' */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 174 0xae '®' */ - 0x00, /* 00000000 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x66, /* 01100110 */ - 0x33, /* 00110011 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 175 0xaf '¯' */ - 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0x66, /* 01100110 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 176 0xb0 '°' */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - - /* 177 0xb1 '±' */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - - /* 178 0xb2 '²' */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - - /* 179 0xb3 '³' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 180 0xb4 '´' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 181 0xb5 'µ' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 182 0xb6 '¶' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 183 0xb7 '·' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 184 0xb8 '¸' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 185 0xb9 '¹' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x06, /* 00000110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 186 0xba 'º' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 187 0xbb '»' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x06, /* 00000110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 188 0xbc '¼' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x06, /* 00000110 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 189 0xbd '½' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 190 0xbe '¾' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 191 0xbf '¿' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 192 0xc0 'À' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 193 0xc1 'Á' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 194 0xc2 'Â' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 195 0xc3 'Ã' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 196 0xc4 'Ä' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 197 0xc5 'Å' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 198 0xc6 'Æ' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 199 0xc7 'Ç' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 200 0xc8 'È' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x30, /* 00110000 */ - 0x3f, /* 00111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 201 0xc9 'É' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x3f, /* 00111111 */ - 0x30, /* 00110000 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 202 0xca 'Ê' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf7, /* 11110111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 203 0xcb 'Ë' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xf7, /* 11110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 204 0xcc 'Ì' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x30, /* 00110000 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 205 0xcd 'Í' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 206 0xce 'Î' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf7, /* 11110111 */ - 0x00, /* 00000000 */ - 0xf7, /* 11110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 207 0xcf 'Ï' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 208 0xd0 'Ð' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 209 0xd1 'Ñ' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 210 0xd2 'Ò' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 211 0xd3 'Ó' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x3f, /* 00111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 212 0xd4 'Ô' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 213 0xd5 'Õ' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 214 0xd6 'Ö' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x3f, /* 00111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 215 0xd7 '×' */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xff, /* 11111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* 216 0xd8 'Ø' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 217 0xd9 'Ù' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 218 0xda 'Ú' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 219 0xdb 'Û' */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - - /* 220 0xdc 'Ü' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - - /* 221 0xdd 'Ý' */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - - /* 222 0xde 'Þ' */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - - /* 223 0xdf 'ß' */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 224 0xe0 'à' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0xc8, /* 11001000 */ - 0xdc, /* 11011100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* 225 0xe1 'á' */ - 0x78, /* 01111000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xd8, /* 11011000 */ - 0xcc, /* 11001100 */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ - 0x00, /* 00000000 */ - - /* 226 0xe2 'â' */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - - /* 227 0xe3 'ã' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x00, /* 00000000 */ - - /* 228 0xe4 'ä' */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - - /* 229 0xe5 'å' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ - 0x00, /* 00000000 */ - - /* 230 0xe6 'æ' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x7c, /* 01111100 */ - 0xc0, /* 11000000 */ - - /* 231 0xe7 'ç' */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* 232 0xe8 'è' */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - - /* 233 0xe9 'é' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - - /* 234 0xea 'ê' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0xee, /* 11101110 */ - 0x00, /* 00000000 */ - - /* 235 0xeb 'ë' */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x3e, /* 00111110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* 236 0xec 'ì' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 237 0xed 'í' */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x7e, /* 01111110 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7e, /* 01111110 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ - - /* 238 0xee 'î' */ - 0x1e, /* 00011110 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0x7e, /* 01111110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x1e, /* 00011110 */ - 0x00, /* 00000000 */ - - /* 239 0xef 'ï' */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* 240 0xf0 'ð' */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 241 0xf1 'ñ' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 242 0xf2 'ò' */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 243 0xf3 'ó' */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - - /* 244 0xf4 'ô' */ - 0x0e, /* 00001110 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* 245 0xf5 'õ' */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ - - /* 246 0xf6 'ö' */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 247 0xf7 '÷' */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 248 0xf8 'ø' */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 249 0xf9 'ù' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 250 0xfa 'ú' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 251 0xfb 'û' */ - 0x0f, /* 00001111 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0xec, /* 11101100 */ - 0x6c, /* 01101100 */ - 0x3c, /* 00111100 */ - 0x1c, /* 00011100 */ - - /* 252 0xfc 'ü' */ - 0x6c, /* 01101100 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 253 0xfd 'ý' */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 254 0xfe 'þ' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* 255 0xff 'ÿ' */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - -}; diff --git a/WiringPi/devLib/gertboard.c b/WiringPi/devLib/gertboard.c deleted file mode 100644 index 5aeaef7..0000000 --- a/WiringPi/devLib/gertboard.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * gertboard.c: - * Access routines for the SPI devices on the Gertboard - * Copyright (c) 2012 Gordon Henderson - * - * The Gertboard has: - * - * An MCP3002 dual-channel A to D convertor connected - * to the SPI bus, selected by chip-select A, and: - * - * An MCP4802 dual-channel D to A convertor connected - * to the SPI bus, selected via chip-select B. - * - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - - -#include -#include -#include -#include -#include - -#include -#include - -#include "gertboard.h" - -// The A-D convertor won't run at more than 1MHz @ 3.3v - -#define SPI_ADC_SPEED 1000000 -#define SPI_DAC_SPEED 1000000 -#define SPI_A2D 0 -#define SPI_D2A 1 - - -/* - * gertboardAnalogWrite: - * Write an 8-bit data value to the MCP4802 Analog to digital - * convertor on the Gertboard. - ********************************************************************************* - */ - -void gertboardAnalogWrite (const int chan, const int value) -{ - uint8_t spiData [2] ; - uint8_t chanBits, dataBits ; - - if (chan == 0) - chanBits = 0x30 ; - else - chanBits = 0xB0 ; - - chanBits |= ((value >> 4) & 0x0F) ; - dataBits = ((value << 4) & 0xF0) ; - - spiData [0] = chanBits ; - spiData [1] = dataBits ; - - wiringPiSPIDataRW (SPI_D2A, spiData, 2) ; -} - - -/* - * gertboardAnalogRead: - * Return the analog value of the given channel (0/1). - * The A/D is a 10-bit device - ********************************************************************************* - */ - -int gertboardAnalogRead (const int chan) -{ - uint8_t spiData [2] ; - - uint8_t chanBits ; - - if (chan == 0) - chanBits = 0b11010000 ; - else - chanBits = 0b11110000 ; - - spiData [0] = chanBits ; - spiData [1] = 0 ; - - wiringPiSPIDataRW (SPI_A2D, spiData, 2) ; - - return ((spiData [0] << 7) | (spiData [1] >> 1)) & 0x3FF ; -} - - -/* - * gertboardSPISetup: - * Initialise the SPI bus, etc. - ********************************************************************************* - */ - -int gertboardSPISetup (void) -{ - if (wiringPiSPISetup (SPI_A2D, SPI_ADC_SPEED) < 0) - return -1 ; - - if (wiringPiSPISetup (SPI_D2A, SPI_DAC_SPEED) < 0) - return -1 ; - - return 0 ; -} - - -/* - * New wiringPi node extension methods. - ********************************************************************************* - */ - -static int myAnalogRead (struct wiringPiNodeStruct *node, const int chan) -{ - return gertboardAnalogRead (chan - node->pinBase) ; -} - -static void myAnalogWrite (struct wiringPiNodeStruct *node, const int chan, const int value) -{ - gertboardAnalogWrite (chan - node->pinBase, value) ; -} - - -/* - * gertboardAnalogSetup: - * Create a new wiringPi device node for the analog devices on the - * Gertboard. We create one node with 2 pins - each pin being read - * and write - although the operations actually go to different - * hardware devices. - ********************************************************************************* - */ - -int gertboardAnalogSetup (const int pinBase) -{ - struct wiringPiNodeStruct *node ; - int x ; - - if (( x = gertboardSPISetup ()) != 0) - return x; - - node = wiringPiNewNode (pinBase, 2) ; - node->analogRead = myAnalogRead ; - node->analogWrite = myAnalogWrite ; - - return 0 ; -} diff --git a/WiringPi/devLib/gertboard.h b/WiringPi/devLib/gertboard.h deleted file mode 100644 index 3fa1919..0000000 --- a/WiringPi/devLib/gertboard.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * gertboard.h: - * Access routines for the SPI devices on the Gertboard - * Copyright (c) 2012 Gordon Henderson - * - * The Gertboard has an MCP4802 dual-channel D to A convertor - * connected to the SPI bus, selected via chip-select B. - * - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -// Old routines - -extern void gertboardAnalogWrite (const int chan, const int value) ; -extern int gertboardAnalogRead (const int chan) ; -extern int gertboardSPISetup (void) ; - -// New - -extern int gertboardAnalogSetup (const int pinBase) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/devLib/lcd.c b/WiringPi/devLib/lcd.c deleted file mode 100644 index 6c0e474..0000000 --- a/WiringPi/devLib/lcd.c +++ /dev/null @@ -1,495 +0,0 @@ -/* - * lcd.c: - * Text-based LCD driver. - * This is designed to drive the parallel interface LCD drivers - * based in the Hitachi HD44780U controller and compatables. - * - * Copyright (c) 2012 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include - -#include "lcd.h" - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - -// HD44780U Commands - -#define LCD_CLEAR 0x01 -#define LCD_HOME 0x02 -#define LCD_ENTRY 0x04 -#define LCD_CTRL 0x08 -#define LCD_CDSHIFT 0x10 -#define LCD_FUNC 0x20 -#define LCD_CGRAM 0x40 -#define LCD_DGRAM 0x80 - -// Bits in the entry register - -#define LCD_ENTRY_SH 0x01 -#define LCD_ENTRY_ID 0x02 - -// Bits in the control register - -#define LCD_BLINK_CTRL 0x01 -#define LCD_CURSOR_CTRL 0x02 -#define LCD_DISPLAY_CTRL 0x04 - -// Bits in the function register - -#define LCD_FUNC_F 0x04 -#define LCD_FUNC_N 0x08 -#define LCD_FUNC_DL 0x10 - -#define LCD_CDSHIFT_RL 0x04 - -struct lcdDataStruct -{ - int bits, rows, cols ; - int rsPin, strbPin ; - int dataPins [8] ; - int cx, cy ; -} ; - -struct lcdDataStruct *lcds [MAX_LCDS] ; - -static int lcdControl ; - -// Row offsets - -static const int rowOff [4] = { 0x00, 0x40, 0x14, 0x54 } ; - - -/* - * strobe: - * Toggle the strobe (Really the "E") pin to the device. - * According to the docs, data is latched on the falling edge. - ********************************************************************************* - */ - -static void strobe (const struct lcdDataStruct *lcd) -{ - -// Note timing changes for new version of delayMicroseconds () - - digitalWrite (lcd->strbPin, 1) ; delayMicroseconds (50) ; - digitalWrite (lcd->strbPin, 0) ; delayMicroseconds (50) ; -} - - -/* - * sentDataCmd: - * Send an data or command byte to the display. - ********************************************************************************* - */ - -static void sendDataCmd (const struct lcdDataStruct *lcd, unsigned char data) -{ - register unsigned char myData = data ; - unsigned char i, d4 ; - - if (lcd->bits == 4) - { - d4 = (myData >> 4) & 0x0F; - for (i = 0 ; i < 4 ; ++i) - { - digitalWrite (lcd->dataPins [i], (d4 & 1)) ; - d4 >>= 1 ; - } - strobe (lcd) ; - - d4 = myData & 0x0F ; - for (i = 0 ; i < 4 ; ++i) - { - digitalWrite (lcd->dataPins [i], (d4 & 1)) ; - d4 >>= 1 ; - } - } - else - { - for (i = 0 ; i < 8 ; ++i) - { - digitalWrite (lcd->dataPins [i], (myData & 1)) ; - myData >>= 1 ; - } - } - strobe (lcd) ; -} - - -/* - * putCommand: - * Send a command byte to the display - ********************************************************************************* - */ - -static void putCommand (const struct lcdDataStruct *lcd, unsigned char command) -{ - digitalWrite (lcd->rsPin, 0) ; - sendDataCmd (lcd, command) ; - delay (2) ; -} - -static void put4Command (const struct lcdDataStruct *lcd, unsigned char command) -{ - register unsigned char myCommand = command ; - register unsigned char i ; - - digitalWrite (lcd->rsPin, 0) ; - - for (i = 0 ; i < 4 ; ++i) - { - digitalWrite (lcd->dataPins [i], (myCommand & 1)) ; - myCommand >>= 1 ; - } - strobe (lcd) ; -} - - -/* - ********************************************************************************* - * User Callable code below here - ********************************************************************************* - */ - -/* - * lcdHome: lcdClear: - * Home the cursor or clear the screen. - ********************************************************************************* - */ - -void lcdHome (const int fd) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - putCommand (lcd, LCD_HOME) ; - lcd->cx = lcd->cy = 0 ; - delay (5) ; -} - -void lcdClear (const int fd) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - putCommand (lcd, LCD_CLEAR) ; - putCommand (lcd, LCD_HOME) ; - lcd->cx = lcd->cy = 0 ; - delay (5) ; -} - - -/* - * lcdDisplay: lcdCursor: lcdCursorBlink: - * Turn the display, cursor, cursor blinking on/off - ********************************************************************************* - */ - -void lcdDisplay (const int fd, int state) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - if (state) - lcdControl |= LCD_DISPLAY_CTRL ; - else - lcdControl &= ~LCD_DISPLAY_CTRL ; - - putCommand (lcd, LCD_CTRL | lcdControl) ; -} - -void lcdCursor (const int fd, int state) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - if (state) - lcdControl |= LCD_CURSOR_CTRL ; - else - lcdControl &= ~LCD_CURSOR_CTRL ; - - putCommand (lcd, LCD_CTRL | lcdControl) ; -} - -void lcdCursorBlink (const int fd, int state) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - if (state) - lcdControl |= LCD_BLINK_CTRL ; - else - lcdControl &= ~LCD_BLINK_CTRL ; - - putCommand (lcd, LCD_CTRL | lcdControl) ; -} - - -/* - * lcdSendCommand: - * Send any arbitary command to the display - ********************************************************************************* - */ - -void lcdSendCommand (const int fd, unsigned char command) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - putCommand (lcd, command) ; -} - - -/* - * lcdPosition: - * Update the position of the cursor on the display. - * Ignore invalid locations. - ********************************************************************************* - */ - -void lcdPosition (const int fd, int x, int y) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - if ((x > lcd->cols) || (x < 0)) - return ; - if ((y > lcd->rows) || (y < 0)) - return ; - - putCommand (lcd, x + (LCD_DGRAM | rowOff [y])) ; - - lcd->cx = x ; - lcd->cy = y ; -} - - -/* - * lcdCharDef: - * Defines a new character in the CGRAM - ********************************************************************************* - */ - -void lcdCharDef (const int fd, int index, unsigned char data [8]) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - int i ; - - putCommand (lcd, LCD_CGRAM | ((index & 7) << 3)) ; - - digitalWrite (lcd->rsPin, 1) ; - for (i = 0 ; i < 8 ; ++i) - sendDataCmd (lcd, data [i]) ; -} - - -/* - * lcdPutchar: - * Send a data byte to be displayed on the display. We implement a very - * simple terminal here - with line wrapping, but no scrolling. Yet. - ********************************************************************************* - */ - -void lcdPutchar (const int fd, unsigned char data) -{ - struct lcdDataStruct *lcd = lcds [fd] ; - - digitalWrite (lcd->rsPin, 1) ; - sendDataCmd (lcd, data) ; - - if (++lcd->cx == lcd->cols) - { - lcd->cx = 0 ; - if (++lcd->cy == lcd->rows) - lcd->cy = 0 ; - - putCommand (lcd, lcd->cx + (LCD_DGRAM | rowOff [lcd->cy])) ; - } -} - - -/* - * lcdPuts: - * Send a string to be displayed on the display - ********************************************************************************* - */ - -void lcdPuts (const int fd, const char *string) -{ - while (*string) - lcdPutchar (fd, *string++) ; -} - - -/* - * lcdPrintf: - * Printf to an LCD display - ********************************************************************************* - */ - -void lcdPrintf (const int fd, const char *message, ...) -{ - va_list argp ; - char buffer [1024] ; - - va_start (argp, message) ; - vsnprintf (buffer, 1023, message, argp) ; - va_end (argp) ; - - lcdPuts (fd, buffer) ; -} - - -/* - * lcdInit: - * Take a lot of parameters and initialise the LCD, and return a handle to - * that LCD, or -1 if any error. - ********************************************************************************* - */ - -int lcdInit (const int rows, const int cols, const int bits, - const int rs, const int strb, - const int d0, const int d1, const int d2, const int d3, const int d4, - const int d5, const int d6, const int d7) -{ - static int initialised = 0 ; - - unsigned char func ; - int i ; - int lcdFd = -1 ; - struct lcdDataStruct *lcd ; - - if (initialised == 0) - { - initialised = 1 ; - for (i = 0 ; i < MAX_LCDS ; ++i) - lcds [i] = NULL ; - } - -// Simple sanity checks - - if (! ((bits == 4) || (bits == 8))) - return -1 ; - - if ((rows < 0) || (rows > 20)) - return -1 ; - - if ((cols < 0) || (cols > 20)) - return -1 ; - -// Create a new LCD: - - for (i = 0 ; i < MAX_LCDS ; ++i) - { - if (lcds [i] == NULL) - { - lcdFd = i ; - break ; - } - } - - if (lcdFd == -1) - return -1 ; - - lcd = (struct lcdDataStruct *)malloc (sizeof (struct lcdDataStruct)) ; - if (lcd == NULL) - return -1 ; - - lcd->rsPin = rs ; - lcd->strbPin = strb ; - lcd->bits = 8 ; // For now - we'll set it properly later. - lcd->rows = rows ; - lcd->cols = cols ; - lcd->cx = 0 ; - lcd->cy = 0 ; - - lcd->dataPins [0] = d0 ; - lcd->dataPins [1] = d1 ; - lcd->dataPins [2] = d2 ; - lcd->dataPins [3] = d3 ; - lcd->dataPins [4] = d4 ; - lcd->dataPins [5] = d5 ; - lcd->dataPins [6] = d6 ; - lcd->dataPins [7] = d7 ; - - lcds [lcdFd] = lcd ; - - digitalWrite (lcd->rsPin, 0) ; pinMode (lcd->rsPin, OUTPUT) ; - digitalWrite (lcd->strbPin, 0) ; pinMode (lcd->strbPin, OUTPUT) ; - - for (i = 0 ; i < bits ; ++i) - { - digitalWrite (lcd->dataPins [i], 0) ; - pinMode (lcd->dataPins [i], OUTPUT) ; - } - delay (35) ; // mS - - -// 4-bit mode? -// OK. This is a PIG and it's not at all obvious from the documentation I had, -// so I guess some others have worked through either with better documentation -// or more trial and error... Anyway here goes: -// -// It seems that the controller needs to see the FUNC command at least 3 times -// consecutively - in 8-bit mode. If you're only using 8-bit mode, then it appears -// that you can get away with one func-set, however I'd not rely on it... -// -// So to set 4-bit mode, you need to send the commands one nibble at a time, -// the same three times, but send the command to set it into 8-bit mode those -// three times, then send a final 4th command to set it into 4-bit mode, and only -// then can you flip the switch for the rest of the library to work in 4-bit -// mode which sends the commands as 2 x 4-bit values. - - if (bits == 4) - { - func = LCD_FUNC | LCD_FUNC_DL ; // Set 8-bit mode 3 times - put4Command (lcd, func >> 4) ; delay (35) ; - put4Command (lcd, func >> 4) ; delay (35) ; - put4Command (lcd, func >> 4) ; delay (35) ; - func = LCD_FUNC ; // 4th set: 4-bit mode - put4Command (lcd, func >> 4) ; delay (35) ; - lcd->bits = 4 ; - } - else - { - func = LCD_FUNC | LCD_FUNC_DL ; - putCommand (lcd, func ) ; delay (35) ; - putCommand (lcd, func ) ; delay (35) ; - putCommand (lcd, func ) ; delay (35) ; - } - - if (lcd->rows > 1) - { - func |= LCD_FUNC_N ; - putCommand (lcd, func) ; delay (35) ; - } - -// Rest of the initialisation sequence - - lcdDisplay (lcdFd, TRUE) ; - lcdCursor (lcdFd, FALSE) ; - lcdCursorBlink (lcdFd, FALSE) ; - lcdClear (lcdFd) ; - - putCommand (lcd, LCD_ENTRY | LCD_ENTRY_ID) ; - putCommand (lcd, LCD_CDSHIFT | LCD_CDSHIFT_RL) ; - - return lcdFd ; -} diff --git a/WiringPi/devLib/lcd.h b/WiringPi/devLib/lcd.h deleted file mode 100644 index 0a0e598..0000000 --- a/WiringPi/devLib/lcd.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * lcd.h: - * Text-based LCD driver. - * This is designed to drive the parallel interface LCD drivers - * based in the Hitachi HD44780U controller and compatables. - * - * Copyright (c) 2012 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#define MAX_LCDS 8 - -#ifdef __cplusplus -extern "C" { -#endif - -extern void lcdHome (const int fd) ; -extern void lcdClear (const int fd) ; -extern void lcdDisplay (const int fd, int state) ; -extern void lcdCursor (const int fd, int state) ; -extern void lcdCursorBlink (const int fd, int state) ; -extern void lcdSendCommand (const int fd, unsigned char command) ; -extern void lcdPosition (const int fd, int x, int y) ; -extern void lcdCharDef (const int fd, int index, unsigned char data [8]) ; -extern void lcdPutchar (const int fd, unsigned char data) ; -extern void lcdPuts (const int fd, const char *string) ; -extern void lcdPrintf (const int fd, const char *message, ...) ; - -extern int lcdInit (const int rows, const int cols, const int bits, - const int rs, const int strb, - const int d0, const int d1, const int d2, const int d3, const int d4, - const int d5, const int d6, const int d7) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/devLib/lcd128x64.c b/WiringPi/devLib/lcd128x64.c deleted file mode 100644 index accd5c3..0000000 --- a/WiringPi/devLib/lcd128x64.c +++ /dev/null @@ -1,673 +0,0 @@ -/* - * lcd128x64.c: - * Graphics-based LCD driver. - * This is designed to drive the parallel interface LCD drivers - * based on the generic 12864H chips - * - * There are many variations on these chips, however they all mostly - * seem to be similar. - * This implementation has the Pins from the Pi hard-wired into it, - * in particular wiringPi pins 0-7 so that we can use - * digitalWriteByete() to speed things up somewhat. - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -#include - -#include "font.h" -#include "lcd128x64.h" - -// Size - -#define LCD_WIDTH 128 -#define LCD_HEIGHT 64 - -// Hardware Pins -// Note pins 0-7 are the 8-bit data port - -#define CS1 10 -#define CS2 11 -#define STROBE 12 -#define RS 13 - -// Software copy of the framebuffer -// it's 8-bit deep although the display itself is only 1-bit deep. - -static unsigned char frameBuffer [LCD_WIDTH * LCD_HEIGHT] ; - -static int maxX, maxY ; -static int lastX, lastY ; -static int xOrigin, yOrigin ; -static int lcdOrientation = 0 ; - -/* - * strobe: - * Toggle the strobe (Really the "E") pin to the device. - * According to the docs, data is latched on the falling edge. - ********************************************************************************* - */ - -static void strobe (void) -{ - digitalWrite (STROBE, 1) ; delayMicroseconds (1) ; - digitalWrite (STROBE, 0) ; delayMicroseconds (5) ; -} - - -/* - * sentData: - * Send an data or command byte to the display. - ********************************************************************************* - */ - -static void sendData (const int data, const int chip) -{ - digitalWrite (chip, 0) ; - digitalWriteByte (data) ; - strobe () ; - digitalWrite (chip, 1) ; -} - - -/* - * sendCommand: - * Send a command byte to the display - ********************************************************************************* - */ - -static void sendCommand (const int command, const int chip) -{ - digitalWrite (RS, 0) ; - sendData (command, chip) ; - digitalWrite (RS, 1) ; -} - - -/* - * setCol: SetLine: - * Set the column and line addresses - ********************************************************************************* - */ - -static void setCol (int col, const int chip) - { sendCommand (0x40 | (col & 0x3F), chip) ; } - -static void setLine (int line, const int chip) - { sendCommand (0xB8 | (line & 0x07), chip) ; } - - -/* - * lcd128x64update: - * Copy our software version to the real display - ********************************************************************************* - */ - -void lcd128x64update (void) -{ - int line, x, y, fbLoc ; - unsigned char byte ; - -// Left side - - for (line = 0 ; line < 8 ; ++line) - { - setCol (0, CS1) ; - setLine (line, CS1) ; - - for (x = 63 ; x >= 0 ; --x) - { - byte = 0 ; - for (y = 0 ; y < 8 ; ++y) - { - fbLoc = x + (((7 - line) * 8) + (7 - y)) * LCD_WIDTH ; - if (frameBuffer [fbLoc] != 0) - byte |= (1 << y) ; - } - sendData (byte, CS1) ; - } - } - -// Right side - - for (line = 0 ; line < 8 ; ++line) - { - setCol (0, CS2) ; - setLine (line, CS2) ; - - for (x = 127 ; x >= 64 ; --x) - { - byte = 0 ; - for (y = 0 ; y < 8 ; ++y) - { - fbLoc = x + (((7 - line) * 8) + (7 - y)) * LCD_WIDTH ; - if (frameBuffer [fbLoc] != 0) - byte |= (1 << y) ; - } - sendData (byte, CS2) ; - } - } -} - - -/* - * lcd128x64setOrigin: - * Set the display offset origin - ********************************************************************************* - */ - -void lcd128x64setOrigin (int x, int y) -{ - xOrigin = x ; - yOrigin = y ; -} - - -/* - * lcd128x64setOrientation: - * Set the display orientation: - * 0: Normal, the display is portrait mode, 0,0 is top left - * 1: Landscape - * 2: Portrait, flipped - * 3: Landscape, flipped - ********************************************************************************* - */ - -void lcd128x64setOrientation (int orientation) -{ - lcdOrientation = orientation & 3 ; - - lcd128x64setOrigin (0,0) ; - - switch (lcdOrientation) - { - case 0: - maxX = LCD_WIDTH ; - maxY = LCD_HEIGHT ; - break ; - - case 1: - maxX = LCD_HEIGHT ; - maxY = LCD_WIDTH ; - break ; - - case 2: - maxX = LCD_WIDTH ; - maxY = LCD_HEIGHT ; - break ; - - case 3: - maxX = LCD_HEIGHT ; - maxY = LCD_WIDTH ; - break ; - } -} - - -/* - * lcd128x64orientCoordinates: - * Adjust the coordinates given to the display orientation - ********************************************************************************* - */ - -void lcd128x64orientCoordinates (int *x, int *y) -{ - register int tmp ; - - *x += xOrigin ; - *y += yOrigin ; - *y = maxY - *y - 1 ; - - switch (lcdOrientation) - { - case 0: - break; - - case 1: - tmp = maxY - *y - 1 ; - *y = *x ; - *x = tmp ; - break; - - case 2: - *x = maxX - *x - 1 ; - *y = maxY - *y - 1 ; - break; - - case 3: - *x = maxX - *x - 1 ; - tmp = *y ; - *y = *x ; - *x = tmp ; - break ; - } -} - - -/* - * lcd128x64getScreenSize: - * Return the max X & Y screen sizes. Needs to be called again, if you - * change screen orientation. - ********************************************************************************* - */ - -void lcd128x64getScreenSize (int *x, int *y) -{ - *x = maxX ; - *y = maxY ; -} - - -/* - ********************************************************************************* - * Standard Graphical Functions - ********************************************************************************* - */ - - -/* - * lcd128x64point: - * Plot a pixel. - ********************************************************************************* - */ - -void lcd128x64point (int x, int y, int colour) -{ - lastX = x ; - lastY = y ; - - lcd128x64orientCoordinates (&x, &y) ; - - if ((x < 0) || (x >= LCD_WIDTH) || (y < 0) || (y >= LCD_HEIGHT)) - return ; - - frameBuffer [x + y * LCD_WIDTH] = colour ; -} - - -/* - * lcd128x64line: lcd128x64lineTo: - * Classic Bressenham Line code - ********************************************************************************* - */ - -void lcd128x64line (int x0, int y0, int x1, int y1, int colour) -{ - int dx, dy ; - int sx, sy ; - int err, e2 ; - - lastX = x1 ; - lastY = y1 ; - - dx = abs (x1 - x0) ; - dy = abs (y1 - y0) ; - - sx = (x0 < x1) ? 1 : -1 ; - sy = (y0 < y1) ? 1 : -1 ; - - err = dx - dy ; - - for (;;) - { - lcd128x64point (x0, y0, colour) ; - - if ((x0 == x1) && (y0 == y1)) - break ; - - e2 = 2 * err ; - - if (e2 > -dy) - { - err -= dy ; - x0 += sx ; - } - - if (e2 < dx) - { - err += dx ; - y0 += sy ; - } - } - -} - -void lcd128x64lineTo (int x, int y, int colour) -{ - lcd128x64line (lastX, lastY, x, y, colour) ; -} - - -/* - * lcd128x64rectangle: - * A rectangle is a spoilt days fishing - ********************************************************************************* - */ - -void lcd128x64rectangle (int x1, int y1, int x2, int y2, int colour, int filled) -{ - register int x ; - - if (filled) - { - /**/ if (x1 == x2) - lcd128x64line (x1, y1, x2, y2, colour) ; - else if (x1 < x2) - for (x = x1 ; x <= x2 ; ++x) - lcd128x64line (x, y1, x, y2, colour) ; - else - for (x = x2 ; x <= x1 ; ++x) - lcd128x64line (x, y1, x, y2, colour) ; - } - else - { - lcd128x64line (x1, y1, x2, y1, colour) ; - lcd128x64lineTo (x2, y2, colour) ; - lcd128x64lineTo (x1, y2, colour) ; - lcd128x64lineTo (x1, y1, colour) ; - } -} - - -/* - * lcd128x64circle: - * This is the midpoint circle algorithm. - ********************************************************************************* - */ - -void lcd128x64circle (int x, int y, int r, int colour, int filled) -{ - int ddF_x = 1 ; - int ddF_y = -2 * r ; - - int f = 1 - r ; - int x1 = 0 ; - int y1 = r ; - - if (filled) - { - lcd128x64line (x, y + r, x, y - r, colour) ; - lcd128x64line (x + r, y, x - r, y, colour) ; - } - else - { - lcd128x64point (x, y + r, colour) ; - lcd128x64point (x, y - r, colour) ; - lcd128x64point (x + r, y, colour) ; - lcd128x64point (x - r, y, colour) ; - } - - while (x1 < y1) - { - if (f >= 0) - { - y1-- ; - ddF_y += 2 ; - f += ddF_y ; - } - x1++ ; - ddF_x += 2 ; - f += ddF_x ; - if (filled) - { - lcd128x64line (x + x1, y + y1, x - x1, y + y1, colour) ; - lcd128x64line (x + x1, y - y1, x - x1, y - y1, colour) ; - lcd128x64line (x + y1, y + x1, x - y1, y + x1, colour) ; - lcd128x64line (x + y1, y - x1, x - y1, y - x1, colour) ; - } - else - { - lcd128x64point (x + x1, y + y1, colour) ; lcd128x64point (x - x1, y + y1, colour) ; - lcd128x64point (x + x1, y - y1, colour) ; lcd128x64point (x - x1, y - y1, colour) ; - lcd128x64point (x + y1, y + x1, colour) ; lcd128x64point (x - y1, y + x1, colour) ; - lcd128x64point (x + y1, y - x1, colour) ; lcd128x64point (x - y1, y - x1, colour) ; - } - } -} - - -/* - * lcd128x64ellipse: - * Fast ellipse drawing algorithm by - * John Kennedy - * Mathematics Department - * Santa Monica College - * 1900 Pico Blvd. - * Santa Monica, CA 90405 - * jrkennedy6@gmail.com - * -Confirned in email this algorithm is in the public domain -GH- - ********************************************************************************* - */ - -static void plot4ellipsePoints (int cx, int cy, int x, int y, int colour, int filled) -{ - if (filled) - { - lcd128x64line (cx + x, cy + y, cx - x, cy + y, colour) ; - lcd128x64line (cx - x, cy - y, cx + x, cy - y, colour) ; - } - else - { - lcd128x64point (cx + x, cy + y, colour) ; - lcd128x64point (cx - x, cy + y, colour) ; - lcd128x64point (cx - x, cy - y, colour) ; - lcd128x64point (cx + x, cy - y, colour) ; - } -} - -void lcd128x64ellipse (int cx, int cy, int xRadius, int yRadius, int colour, int filled) -{ - int x, y ; - int xChange, yChange, ellipseError ; - int twoAsquare, twoBsquare ; - int stoppingX, stoppingY ; - - twoAsquare = 2 * xRadius * xRadius ; - twoBsquare = 2 * yRadius * yRadius ; - - x = xRadius ; - y = 0 ; - - xChange = yRadius * yRadius * (1 - 2 * xRadius) ; - yChange = xRadius * xRadius ; - - ellipseError = 0 ; - stoppingX = twoBsquare * xRadius ; - stoppingY = 0 ; - - while (stoppingX >= stoppingY) // 1st set of points - { - plot4ellipsePoints (cx, cy, x, y, colour, filled) ; - ++y ; - stoppingY += twoAsquare ; - ellipseError += yChange ; - yChange += twoAsquare ; - - if ((2 * ellipseError + xChange) > 0 ) - { - --x ; - stoppingX -= twoBsquare ; - ellipseError += xChange ; - xChange += twoBsquare ; - } - } - - x = 0 ; - y = yRadius ; - - xChange = yRadius * yRadius ; - yChange = xRadius * xRadius * (1 - 2 * yRadius) ; - - ellipseError = 0 ; - stoppingX = 0 ; - stoppingY = twoAsquare * yRadius ; - - while (stoppingX <= stoppingY) //2nd set of points - { - plot4ellipsePoints (cx, cy, x, y, colour, filled) ; - ++x ; - stoppingX += twoBsquare ; - ellipseError += xChange ; - xChange += twoBsquare ; - - if ((2 * ellipseError + yChange) > 0 ) - { - --y ; - stoppingY -= twoAsquare ; - ellipseError += yChange ; - yChange += twoAsquare ; - } - } -} - - -/* - * lcd128x64putchar: - * Print a single character to the screen - ********************************************************************************* - */ - -void lcd128x64putchar (int x, int y, int c, int bgCol, int fgCol) -{ - int y1, y2 ; - - unsigned char line ; - unsigned char *fontPtr ; - -// Can't print if we're offscreen - -//if ((x < 0) || (x >= (maxX - fontWidth)) || (y < 0) || (y >= (maxY - fontHeight))) -// return ; - - fontPtr = font + c * fontHeight ; - - for (y1 = fontHeight - 1 ; y1 >= 0 ; --y1) - { - y2 = y + y1 ; - line = *fontPtr++ ; - lcd128x64point (x + 0, y2, (line & 0x80) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 1, y2, (line & 0x40) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 2, y2, (line & 0x20) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 3, y2, (line & 0x10) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 4, y2, (line & 0x08) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 5, y2, (line & 0x04) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 6, y2, (line & 0x02) == 0 ? bgCol : fgCol) ; - lcd128x64point (x + 7, y2, (line & 0x01) == 0 ? bgCol : fgCol) ; - } -} - - -/* - * lcd128x64puts: - * Send a string to the display. Obeys \n and \r formatting - ********************************************************************************* - */ - -void lcd128x64puts (int x, int y, const char *str, int bgCol, int fgCol) -{ - int c, mx, my ; - - mx = x ; my = y ; - - while (*str) - { - c = *str++ ; - - if (c == '\r') - { - mx = x ; - continue ; - } - - if (c == '\n') - { - mx = x ; - my -= fontHeight ; - continue ; - } - - lcd128x64putchar (mx, my, c, bgCol, fgCol) ; - - mx += fontWidth ; - if (mx >= (maxX - fontWidth)) - { - mx = 0 ; - my -= fontHeight ; - } - } -} - - -/* - * lcd128x64clear: - * Clear the display to the given colour. - ********************************************************************************* - */ - -void lcd128x64clear (int colour) -{ - register int i ; - register unsigned char *ptr = frameBuffer ; - - for (i = 0 ; i < (maxX * maxY) ; ++i) - *ptr++ = colour ; -} - - - - -/* - * lcd128x64setup: - * Initialise the display and GPIO. - ********************************************************************************* - */ - -int lcd128x64setup (void) -{ - int i ; - - for (i = 0 ; i < 8 ; ++i) - pinMode (i, OUTPUT) ; - - digitalWrite (CS1, 1) ; - digitalWrite (CS2, 1) ; - digitalWrite (STROBE, 0) ; - digitalWrite (RS, 1) ; - - pinMode (CS1, OUTPUT) ; - pinMode (CS2, OUTPUT) ; - pinMode (STROBE, OUTPUT) ; - pinMode (RS, OUTPUT) ; - - sendCommand (0x3F, CS1) ; // Display ON - sendCommand (0xC0, CS1) ; // Set display start line to 0 - - sendCommand (0x3F, CS2) ; // Display ON - sendCommand (0xC0, CS2) ; // Set display start line to 0 - - lcd128x64clear (0) ; - lcd128x64setOrientation (0) ; - lcd128x64update () ; - - return 0 ; -} diff --git a/WiringPi/devLib/lcd128x64.h b/WiringPi/devLib/lcd128x64.h deleted file mode 100644 index b448bbc..0000000 --- a/WiringPi/devLib/lcd128x64.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * lcd128x64.h: - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -extern void lcd128x64setOrigin (int x, int y) ; -extern void lcd128x64setOrientation (int orientation) ; -extern void lcd128x64orientCoordinates (int *x, int *y) ; -extern void lcd128x64getScreenSize (int *x, int *y) ; -extern void lcd128x64point (int x, int y, int colour) ; -extern void lcd128x64line (int x0, int y0, int x1, int y1, int colour) ; -extern void lcd128x64lineTo (int x, int y, int colour) ; -extern void lcd128x64rectangle (int x1, int y1, int x2, int y2, int colour, int filled) ; -extern void lcd128x64circle (int x, int y, int r, int colour, int filled) ; -extern void lcd128x64ellipse (int cx, int cy, int xRadius, int yRadius, int colour, int filled) ; -extern void lcd128x64putchar (int x, int y, int c, int bgCol, int fgCol) ; -extern void lcd128x64puts (int x, int y, const char *str, int bgCol, int fgCol) ; -extern void lcd128x64update (void) ; -extern void lcd128x64clear (int colour) ; - -extern int lcd128x64setup (void) ; diff --git a/WiringPi/devLib/maxdetect.c b/WiringPi/devLib/maxdetect.c deleted file mode 100755 index 23eabf8..0000000 --- a/WiringPi/devLib/maxdetect.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * maxdetect.c: - * Driver for the MaxDetect series sensors - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -//#include -//#include -//#include - -#include - -#include "maxdetect.h" - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - - -/* - * maxDetectLowHighWait: - * Wait for a transition from high to low on the bus - ********************************************************************************* - */ - -static void maxDetectLowHighWait (const int pin) -{ - unsigned int timeOut = millis () + 2000 ; - - while (digitalRead (pin) == HIGH) - if (millis () > timeOut) - return ; - - while (digitalRead (pin) == LOW) - if (millis () > timeOut) - return ; -} - - -/* - * maxDetectClockByte: - * Read in a single byte from the MaxDetect bus - ********************************************************************************* - */ - -static unsigned int maxDetectClockByte (const int pin) -{ - unsigned int byte = 0 ; - int bit ; - - for (bit = 0 ; bit < 8 ; ++bit) - { - maxDetectLowHighWait (pin) ; - -// bit starting now - we need to time it. - - delayMicroseconds (30) ; - byte <<= 1 ; - if (digitalRead (pin) == HIGH) // It's a 1 - byte |= 1 ; - } - - return byte ; -} - - -/* - * maxDetectRead: - * Read in and return the 4 data bytes from the MaxDetect sensor. - * Return TRUE/FALSE depending on the checksum validity - ********************************************************************************* - */ - -int maxDetectRead (const int pin, unsigned char buffer [4]) -{ - int i ; - unsigned int checksum ; - unsigned char localBuf [5] ; - -// Wake up the RHT03 by pulling the data line low, then high -// Low for 10mS, high for 40uS. - - pinMode (pin, OUTPUT) ; - digitalWrite (pin, 0) ; delay (10) ; - digitalWrite (pin, 1) ; delayMicroseconds (40) ; - pinMode (pin, INPUT) ; - -// Now wait for sensor to pull pin low - - maxDetectLowHighWait (pin) ; - -// and read in 5 bytes (40 bits) - - for (i = 0 ; i < 5 ; ++i) - localBuf [i] = maxDetectClockByte (pin) ; - - checksum = 0 ; - for (i = 0 ; i < 4 ; ++i) - { - buffer [i] = localBuf [i] ; - checksum += localBuf [i] ; - } - checksum &= 0xFF ; - - return checksum == localBuf [4] ; -} - - -/* - * readRHT03: - * Read the Temperature & Humidity from an RHT03 sensor - ********************************************************************************* - */ - -int readRHT03 (const int pin, int *temp, int *rh) -{ - static unsigned int nextTime = 0 ; - static int lastTemp = 0 ; - static int lastRh = 0 ; - static int lastResult = TRUE ; - - unsigned char buffer [4] ; - -// Don't read more than once a second - - if (millis () < nextTime) - { - *temp = lastTemp ; - *rh = lastRh ; - return lastResult ; - } - - lastResult = maxDetectRead (pin, buffer) ; - - if (lastResult) - { - *temp = lastTemp = (buffer [2] * 256 + buffer [3]) ; - *rh = lastRh = (buffer [0] * 256 + buffer [1]) ; - nextTime = millis () + 2000 ; - return TRUE ; - } - else - { - return FALSE ; - } -} diff --git a/WiringPi/devLib/maxdetect.h b/WiringPi/devLib/maxdetect.h deleted file mode 100755 index a1fd742..0000000 --- a/WiringPi/devLib/maxdetect.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * maxdetect.h: - * Driver for the MaxDetect series sensors - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - - -#ifdef __cplusplus -extern "C" { -#endif - -// Main generic function - -int maxDetectRead (const int pin, unsigned char buffer [4]) ; - -// Individual sensors - -int readRHT03 (const int pin, int *temp, int *rh) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/devLib/piFace.c b/WiringPi/devLib/piFace.c deleted file mode 100644 index 4475c7f..0000000 --- a/WiringPi/devLib/piFace.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * piFace.: - * This file to interface with the PiFace peripheral device which - * has an MCP23S17 GPIO device connected via the SPI bus. - * - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - - -#include -#include - -#include -#include - -#include "piFace.h" - - -/* - * myDigitalWrite: - * Perform the digitalWrite function on the PiFace board - ********************************************************************************* - */ - -void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - digitalWrite (pin + 16, value) ; -} - - -/* - * myDigitalRead: - * Perform the digitalRead function on the PiFace board - * With a slight twist - if we read from base + 8, then we - * read from the output latch... - ********************************************************************************* - */ - -int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - if ((pin - node->pinBase) >= 8) - return digitalRead (pin + 8) ; - else - return digitalRead (pin + 16 + 8) ; -} - - -/* - * myPullUpDnControl: - * Perform the pullUpDnControl function on the PiFace board - ********************************************************************************* - */ - -void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int pud) -{ - pullUpDnControl (pin + 16 + 8, pud) ; -} - - -/* - * piFaceSetup - * We're going to create an instance of the mcp23s17 here, then - * provide our own read/write routines on-top of it... - * The supplied PiFace code (in Pithon) treats it as an 8-bit device - * where you write the output ports and read the input port using the - * same pin numbers, however I have had a request to be able to read - * the output port, so reading 8..15 will read the output latch. - ********************************************************************************* - */ - -int piFaceSetup (const int pinBase) -{ - int i ; - struct wiringPiNodeStruct *node ; - -// Create an mcp23s17 instance: - - mcp23s17Setup (pinBase + 16, 0, 0) ; - -// Set the direction bits - - for (i = 0 ; i < 8 ; ++i) - { - pinMode (pinBase + 16 + i, OUTPUT) ; // Port A is the outputs - pinMode (pinBase + 16 + 8 + i, INPUT) ; // Port B inputs. - } - - node = wiringPiNewNode (pinBase, 16) ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->pullUpDnControl = myPullUpDnControl ; - - return 0 ; -} diff --git a/WiringPi/devLib/piFace.h b/WiringPi/devLib/piFace.h deleted file mode 100644 index 4965314..0000000 --- a/WiringPi/devLib/piFace.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * piFace.h: - * Control the PiFace Interface board for the Raspberry Pi - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int piFaceSetup (const int pinBase) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/devLib/piFaceOld.c b/WiringPi/devLib/piFaceOld.c deleted file mode 100644 index 1b1c0dd..0000000 --- a/WiringPi/devLib/piFaceOld.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * piFace.: - * Arduino compatable (ish) Wiring library for the Raspberry Pi - * Copyright (c) 2012-2013 Gordon Henderson - * - * This file to interface with the PiFace peripheral device which - * has an MCP23S17 GPIO device connected via the SPI bus. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - - -#include -#include - -#include -#include - -#include "../wiringPi/mcp23x0817.h" - -#include "piFace.h" - -#define PIFACE_SPEED 4000000 -#define PIFACE_DEVNO 0 - - - -/* - * writeByte: - * Write a byte to a register on the MCP23S17 on the SPI bus. - ********************************************************************************* - */ - -static void writeByte (uint8_t reg, uint8_t data) -{ - uint8_t spiData [4] ; - - spiData [0] = CMD_WRITE ; - spiData [1] = reg ; - spiData [2] = data ; - - wiringPiSPIDataRW (PIFACE_DEVNO, spiData, 3) ; -} - -/* - * readByte: - * Read a byte from a register on the MCP23S17 on the SPI bus. - ********************************************************************************* - */ - -static uint8_t readByte (uint8_t reg) -{ - uint8_t spiData [4] ; - - spiData [0] = CMD_READ ; - spiData [1] = reg ; - - wiringPiSPIDataRW (PIFACE_DEVNO, spiData, 3) ; - - return spiData [2] ; -} - - -/* - * myDigitalWrite: - * Perform the digitalWrite function on the PiFace board - ********************************************************************************* - */ - -void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - uint8_t mask, old ; - - pin -= node->pinBase ; - mask = 1 << pin ; - old = readByte (MCP23x17_GPIOA) ; - - if (value == 0) - old &= (~mask) ; - else - old |= mask ; - - writeByte (MCP23x17_GPIOA, old) ; -} - - -/* - * myDigitalRead: - * Perform the digitalRead function on the PiFace board - ********************************************************************************* - */ - -int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - uint8_t mask, reg ; - - mask = 1 << ((pin - node->pinBase) & 7) ; - - if (pin < 8) - reg = MCP23x17_GPIOB ; // Input regsiter - else - reg = MCP23x17_OLATA ; // Output latch regsiter - - if ((readByte (reg) & mask) != 0) - return HIGH ; - else - return LOW ; -} - - -/* - * myPullUpDnControl: - * Perform the pullUpDnControl function on the PiFace board - ********************************************************************************* - */ - -void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int pud) -{ - uint8_t mask, old ; - - mask = 1 << (pin - node->pinBase) ; - old = readByte (MCP23x17_GPPUB) ; - - if (pud == 0) - old &= (~mask) ; - else - old |= mask ; - - writeByte (MCP23x17_GPPUB, old) ; -} - - -/* - * piFaceSetup - * Setup the SPI interface and initialise the MCP23S17 chip - * We create one node with 16 pins - each if the first 8 pins being read - * and write - although the operations actually go to different - * hardware ports. The top 8 let you read the state of the output register. - ********************************************************************************* - */ - -int piFaceSetup (const int pinBase) -{ - int x ; - struct wiringPiNodeStruct *node ; - - if ((x = wiringPiSPISetup (PIFACE_DEVNO, PIFACE_SPEED)) < 0) - return x ; - -// Setup the MCP23S17 - - writeByte (MCP23x17_IOCON, IOCON_INIT) ; - writeByte (MCP23x17_IODIRA, 0x00) ; // Port A -> Outputs - writeByte (MCP23x17_IODIRB, 0xFF) ; // Port B -> Inputs - - node = wiringPiNewNode (pinBase, 16) ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->pullUpDnControl = myPullUpDnControl ; - - return 0 ; -} diff --git a/WiringPi/devLib/piGlow.c b/WiringPi/devLib/piGlow.c deleted file mode 100644 index 44e3db8..0000000 --- a/WiringPi/devLib/piGlow.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * piGlow.c: - * Easy access to the Pimoroni PiGlow board. - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -#include "piGlow.h" - -#define PIGLOW_BASE 577 - -static int leg0 [6] = { 6, 7, 8, 5, 4, 9 } ; -static int leg1 [6] = { 17, 16, 15, 13, 11, 10 } ; -static int leg2 [6] = { 0, 1, 2, 3, 14, 12 } ; - - -/* - * piGlow1: - * Light up an individual LED - ********************************************************************************* - */ - -void piGlow1 (const int leg, const int ring, const int intensity) -{ - int *legLeds ; - - if ((leg < 0) || (leg > 2)) return ; - if ((ring < 0) || (ring > 5)) return ; - - /**/ if (leg == 0) - legLeds = leg0 ; - else if (leg == 1) - legLeds = leg1 ; - else - legLeds = leg2 ; - - analogWrite (PIGLOW_BASE + legLeds [ring], intensity) ; -} - -/* - * piGlowLeg: - * Light up all 6 LEDs on a leg - ********************************************************************************* - */ - -void piGlowLeg (const int leg, const int intensity) -{ - int i ; - int *legLeds ; - - if ((leg < 0) || (leg > 2)) - return ; - - /**/ if (leg == 0) - legLeds = leg0 ; - else if (leg == 1) - legLeds = leg1 ; - else - legLeds = leg2 ; - - for (i = 0 ; i < 6 ; ++i) - analogWrite (PIGLOW_BASE + legLeds [i], intensity) ; -} - - -/* - * piGlowRing: - * Light up 3 LEDs in a ring. Ring 0 is the outermost, 5 the innermost - ********************************************************************************* - */ - -void piGlowRing (const int ring, const int intensity) -{ - if ((ring < 0) || (ring > 5)) - return ; - - analogWrite (PIGLOW_BASE + leg0 [ring], intensity) ; - analogWrite (PIGLOW_BASE + leg1 [ring], intensity) ; - analogWrite (PIGLOW_BASE + leg2 [ring], intensity) ; -} - -/* - * piGlowSetup: - * Initialise the board & remember the pins we're using - ********************************************************************************* - */ - -void piGlowSetup (int clear) -{ - sn3218Setup (PIGLOW_BASE) ; - - if (clear) - { - piGlowLeg (0, 0) ; - piGlowLeg (1, 0) ; - piGlowLeg (2, 0) ; - } -} diff --git a/WiringPi/devLib/piGlow.h b/WiringPi/devLib/piGlow.h deleted file mode 100644 index d501c2c..0000000 --- a/WiringPi/devLib/piGlow.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * piglow.h: - * Easy access to the Pimoroni PiGlow board. - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - - -#define PIGLOW_RED 0 -#define PIGLOW_YELLOW 1 -#define PIGLOW_ORANGE 2 -#define PIGLOW_GREEN 3 -#define PIGLOW_BLUE 4 -#define PIGLOW_WHITE 5 - - -#ifdef __cplusplus -extern "C" { -#endif - -extern void piGlow1 (const int leg, const int ring, const int intensity) ; -extern void piGlowLeg (const int leg, const int intensity) ; -extern void piGlowRing (const int ring, const int intensity) ; -extern void piGlowSetup (int clear) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/devLib/piNes.c b/WiringPi/devLib/piNes.c deleted file mode 100644 index a115050..0000000 --- a/WiringPi/devLib/piNes.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * piNes.c: - * Driver for the NES Joystick controller on the Raspberry Pi - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include - -#include "piNes.h" - -#define MAX_NES_JOYSTICKS 8 - -#define NES_RIGHT 0x01 -#define NES_LEFT 0x02 -#define NES_DOWN 0x04 -#define NES_UP 0x08 -#define NES_START 0x10 -#define NES_SELECT 0x20 -#define NES_B 0x40 -#define NES_A 0x80 - - -#define PULSE_TIME 25 - -// Data to store the pins for each controller - -struct nesPinsStruct -{ - unsigned int cPin, dPin, lPin ; -} ; - -static struct nesPinsStruct nesPins [MAX_NES_JOYSTICKS] ; - -static int joysticks = 0 ; - - -/* - * setupNesJoystick: - * Create a new NES joystick interface, program the pins, etc. - ********************************************************************************* - */ - -int setupNesJoystick (int dPin, int cPin, int lPin) -{ - if (joysticks == MAX_NES_JOYSTICKS) - return -1 ; - - nesPins [joysticks].dPin = dPin ; - nesPins [joysticks].cPin = cPin ; - nesPins [joysticks].lPin = lPin ; - - digitalWrite (lPin, LOW) ; - digitalWrite (cPin, LOW) ; - - pinMode (lPin, OUTPUT) ; - pinMode (cPin, OUTPUT) ; - pinMode (dPin, INPUT) ; - - return joysticks++ ; -} - - -/* - * readNesJoystick: - * Do a single scan of the NES Joystick. - ********************************************************************************* - */ - -unsigned int readNesJoystick (int joystick) -{ - unsigned int value = 0 ; - int i ; - - struct nesPinsStruct *pins = &nesPins [joystick] ; - -// Toggle Latch - which presents the first bit - - digitalWrite (pins->lPin, HIGH) ; delayMicroseconds (PULSE_TIME) ; - digitalWrite (pins->lPin, LOW) ; delayMicroseconds (PULSE_TIME) ; - -// Read first bit - - value = digitalRead (pins->dPin) ; - -// Now get the next 7 bits with the clock - - for (i = 0 ; i < 7 ; ++i) - { - digitalWrite (pins->cPin, HIGH) ; delayMicroseconds (PULSE_TIME) ; - digitalWrite (pins->cPin, LOW) ; delayMicroseconds (PULSE_TIME) ; - value = (value << 1) | digitalRead (pins->dPin) ; - } - - return value ^ 0xFF ; -} diff --git a/WiringPi/devLib/piNes.h b/WiringPi/devLib/piNes.h deleted file mode 100644 index 897f181..0000000 --- a/WiringPi/devLib/piNes.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * piNes.h: - * Driver for the NES Joystick controller on the Raspberry Pi - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#define MAX_NES_JOYSTICKS 8 - -#define NES_RIGHT 0x01 -#define NES_LEFT 0x02 -#define NES_DOWN 0x04 -#define NES_UP 0x08 -#define NES_START 0x10 -#define NES_SELECT 0x20 -#define NES_B 0x40 -#define NES_A 0x80 - -#ifdef __cplusplus -extern "C" { -#endif - -extern int setupNesJoystick (int dPin, int cPin, int lPin) ; -extern unsigned int readNesJoystick (int joystick) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/examples/COPYING.LESSER b/WiringPi/examples/COPYING.LESSER deleted file mode 100644 index 65c5ca8..0000000 --- a/WiringPi/examples/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/WiringPi/examples/Gertboard/7segments.c b/WiringPi/examples/Gertboard/7segments.c deleted file mode 100644 index 8797e49..0000000 --- a/WiringPi/examples/Gertboard/7segments.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 7segments.c: - * Simple test program to see if we can drive a 7-segment LED - * display using the GPIO and little else on the Raspberry Pi - * - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - */ - -#undef PHOTO_HACK - -#include - -#include -#include -#include -#include - -/* - * Segment mapping - * - * --a-- - * | | - * f b - * | | - * --g-- - * | | - * e c - * | | - * --d-- p - */ - -// GPIO Pin Mapping - -static int digits [6] = { 7, 11, 10, 13, 12, 14 } ; -static int segments [7] = { 6, 5, 4, 3, 2, 1, 0 } ; - - -static const int segmentDigits [] = -{ -// a b c d e f g Segments -// 6 5 4 3 2 1 0, // wiringPi pin No. - - 1, 1, 1, 1, 1, 1, 0, // 0 - 0, 1, 1, 0, 0, 0, 0, // 1 - 1, 1, 0, 1, 1, 0, 1, // 2 - 1, 1, 1, 1, 0, 0, 1, // 3 - 0, 1, 1, 0, 0, 1, 1, // 4 - 1, 0, 1, 1, 0, 1, 1, // 5 - 1, 0, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 0, 0, 0, 0, // 7 - 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 0, 1, 1, // 9 - 1, 1, 1, 0, 1, 1, 1, // A - 0, 0, 1, 1, 1, 1, 1, // b - 1, 0, 0, 1, 1, 1, 0, // C - 0, 1, 1, 1, 1, 0, 1, // d - 1, 0, 0, 1, 1, 1, 1, // E - 1, 0, 0, 0, 1, 1, 1, // F - 0, 0, 0, 0, 0, 0, 0, // blank -} ; - - -// display: -// A global variable which is written to by the main program and -// read from by the thread that updates the display. Only the first -// 6 characters are used. - -char display [8] ; - - -/* - * displayDigits: - * This is our thread that's run concurrently with the main program. - * Essentially sit in a loop, parsing and displaying the data held in - * the "display" global. - ********************************************************************************* - */ - -PI_THREAD (displayDigits) -{ - int digit, segment ; - int index, d, segVal ; - - piHiPri (50) ; - - for (;;) - { - for (digit = 0 ; digit < 6 ; ++digit) - { - for (segment = 0 ; segment < 7 ; ++segment) - { - d = toupper (display [digit]) ; - /**/ if ((d >= '0') && (d <= '9')) // Digit - index = d - '0' ; - else if ((d >= 'A') && (d <= 'F')) // Hex - index = d - 'A' + 10 ; - else - index = 16 ; // Blank - - segVal = segmentDigits [index * 7 + segment] ; - - digitalWrite (segments [segment], segVal) ; - } - digitalWrite (digits [digit], 1) ; - delay (2) ; - digitalWrite (digits [digit], 0) ; - } - } -} - - -/* - * setup: - * Initialise the hardware and start the thread - ********************************************************************************* - */ - -void setup (void) -{ - int i, c ; - - wiringPiSetup () ; - -// 7 segments - - for (i = 0 ; i < 7 ; ++i) - { digitalWrite (segments [i], 0) ; pinMode (segments [i], OUTPUT) ; } - -// 6 digits - - for (i = 0 ; i < 6 ; ++i) - { digitalWrite (digits [i], 0) ; pinMode (digits [i], OUTPUT) ; } - - strcpy (display, " ") ; - piThreadCreate (displayDigits) ; - delay (10) ; // Just to make sure it's started - -// Quick countdown LED test sort of thing - - c = 999999 ; - for (i = 0 ; i < 10 ; ++i) - { - sprintf (display, "%06d", c) ; - delay (400) ; - c -= 111111 ; - } - - strcpy (display, " ") ; - delay (400) ; - -#ifdef PHOTO_HACK - sprintf (display, "%s", "123456") ; - for (;;) - delay (1000) ; -#endif - -} - - -/* - * teenager: - * No explanation needed. (Nor one given!) - ********************************************************************************* - */ - -void teenager (void) -{ - char *message = " feedbeef babe cafe b00b " ; - int i ; - - for (i = 0 ; i < strlen (message) - 4 ; ++i) - { - strncpy (display, &message [i], 6) ; - delay (200) ; - } - delay (1000) ; - for (i = 0 ; i < 3 ; ++i) - { - strcpy (display, " ") ; - delay (150) ; - strcpy (display, " b00b ") ; - delay (250) ; - } - delay (1000) ; - strcpy (display, " ") ; - delay (1000) ; -} - - -/* - ********************************************************************************* - * main: - * Let the fun begin - ********************************************************************************* - */ - -int main (void) -{ - struct tm *t ; - time_t tim ; - - setup () ; - teenager () ; - - tim = time (NULL) ; - for (;;) - { - while (time (NULL) == tim) - delay (5) ; - - tim = time (NULL) ; - t = localtime (&tim) ; - - sprintf (display, "%02d%02d%02d", t->tm_hour, t->tm_min, t->tm_sec) ; - - delay (500) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/Gertboard/Makefile b/WiringPi/examples/Gertboard/Makefile deleted file mode 100644 index 7569261..0000000 --- a/WiringPi/examples/Gertboard/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# -# Makefile: -# Gertboard - Examples using wiringPi -# -# Copyright (c) 2013 Gordon Henderson -################################################################################# - -#DEBUG = -g -O0 -DEBUG = -O3 -CC = gcc -INCLUDE = -I/usr/local/include -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe - -LDFLAGS = -L/usr/local/lib -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm - -# Should not alter anything below this line -############################################################################### - -SRC = gertboard.c \ - buttons.c 7segments.c \ - voltmeter.c temperature.c vumeter.c \ - record.c - -OBJ = $(SRC:.c=.o) - -BINS = $(SRC:.c=) - -all: $(BINS) - -gertboard: gertboard.o - @echo [link] - @$(CC) -o $@ gertboard.o $(LDFLAGS) $(LDLIBS) - -buttons: buttons.o - @echo [link] - @$(CC) -o $@ buttons.o $(LDFLAGS) $(LDLIBS) - -7segments: 7segments.o - @echo [link] - @$(CC) -o $@ 7segments.o $(LDFLAGS) $(LDLIBS) - -voltmeter: voltmeter.o - @echo [link] - @$(CC) -o $@ voltmeter.o $(LDFLAGS) $(LDLIBS) - -temperature: temperature.o - @echo [link] - @$(CC) -o $@ temperature.o $(LDFLAGS) $(LDLIBS) - -vumeter: vumeter.o - @echo [link] - @$(CC) -o $@ vumeter.o $(LDFLAGS) $(LDLIBS) - -record: record.o - @echo [link] - @$(CC) -o $@ record.o $(LDFLAGS) $(LDLIBS) - -.c.o: - @echo [CC] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -clean: - @echo [Clean] - @rm -f $(OBJ) *~ core tags $(BINS) - -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - -depend: - makedepend -Y $(SRC) - -# DO NOT DELETE diff --git a/WiringPi/examples/Gertboard/buttons.c b/WiringPi/examples/Gertboard/buttons.c deleted file mode 100644 index 5f76764..0000000 --- a/WiringPi/examples/Gertboard/buttons.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * buttons.c: - * Read the Gertboard buttons. Each one will act as an on/off - * tiggle switch for 3 different LEDs - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -// Array to keep track of our LEDs - -int leds [] = { 0, 0, 0 } ; - -// scanButton: -// See if a button is pushed, if so, then flip that LED and -// wait for the button to be let-go - -void scanButton (int button) -{ - if (digitalRead (button) == HIGH) // Low is pushed - return ; - - leds [button] ^= 1 ; // Invert state - digitalWrite (4 + button, leds [button]) ; - - while (digitalRead (button) == LOW) // Wait for release - delay (10) ; -} - -int main (void) -{ - int i ; - - printf ("Raspberry Pi Gertboard Button Test\n") ; - - wiringPiSetup () ; - -// Setup the outputs: -// Pins 3, 4, 5, 6 and 7 output: -// We're not using 3 or 4, but make sure they're off anyway -// (Using same hardware config as blink12.c) - - for (i = 3 ; i < 8 ; ++i) - { - pinMode (i, OUTPUT) ; - digitalWrite (i, 0) ; - } - -// Setup the inputs - - for (i = 0 ; i < 3 ; ++i) - { - pinMode (i, INPUT) ; - pullUpDnControl (i, PUD_UP) ; - leds [i] = 0 ; - } - - for (;;) - { - for (i = 0 ; i < 3 ; ++i) - scanButton (i) ; - delay (1) ; - } -} diff --git a/WiringPi/examples/Gertboard/gertboard.c b/WiringPi/examples/Gertboard/gertboard.c deleted file mode 100644 index aefcb12..0000000 --- a/WiringPi/examples/Gertboard/gertboard.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * gertboard.c: - * Simple test for the SPI bus on the Gertboard - * - * Hardware setup: - * D/A port 0 jumpered to A/D port 0. - * - * We output a sine wave on D/A port 0 and sample A/D port 0. We then - * plot the input value on the terminal as a sort of vertical scrolling - * oscilloscipe. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include - -// Gertboard D to A is an 8-bit unit. - -#define B_SIZE 256 - -#include -#include - -int main (void) -{ - double angle ; - int i, inputValue ; - int buffer [B_SIZE] ; - int cols ; - struct winsize w ; - - - printf ("Raspberry Pi Gertboard SPI test program\n") ; - printf ("=======================================\n") ; - - ioctl (fileno (stdin), TIOCGWINSZ, &w); - cols = w.ws_col - 2 ; - -// Always initialise wiringPi. Use wiringPiSys() if you don't need -// (or want) to run as root - - wiringPiSetupSys () ; - -// Initialise the Gertboard analog hardware at pin 100 - - gertboardAnalogSetup (100) ; - -// Generate a Sine Wave and store in our buffer - - for (i = 0 ; i < B_SIZE ; ++i) - { - angle = ((double)i / (double)B_SIZE) * M_PI * 2.0 ; - buffer [i] = (int)rint ((sin (angle)) * 127.0 + 128.0) ; - } - -// Loop, output the sine wave on analog out port 0, read it into A-D port 0 -// and display it on the screen - - for (;;) - { - for (i = 0 ; i < B_SIZE ; ++i) - { - analogWrite (100, buffer [i]) ; - - inputValue = analogRead (100) ; - -// We don't need to wory about the scale or sign - the analog hardware is -// a 10-bit value, so 0-1023. Just scale this to our terminal - - printf ("%*s\n", (inputValue * cols) / 1023, "*") ; - delay (2) ; - } - } - - return 0 ; -} diff --git a/WiringPi/examples/Gertboard/record.c b/WiringPi/examples/Gertboard/record.c deleted file mode 100644 index 71d8718..0000000 --- a/WiringPi/examples/Gertboard/record.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * record.c: - * Record some audio via the Gertboard - * - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - */ - -#include -#include - -#include -#include - -#define B_SIZE 40000 - -int main () -{ - int i ; - struct timeval tStart, tEnd, tTaken ; - unsigned char buffer [B_SIZE] ; - - printf ("\n") ; - printf ("Gertboard demo: Recorder\n") ; - printf ("========================\n") ; - -// Always initialise wiringPi. Use wiringPiSys() if you don't need -// (or want) to run as root - - wiringPiSetupSys () ; - -// Initialise the Gertboard analog hardware at pin 100 - - gertboardAnalogSetup (100) ; - - gettimeofday (&tStart, NULL) ; - - for (i = 0 ; i < B_SIZE ; ++i) - buffer [i] = analogRead (100) >> 2 ; - - gettimeofday (&tEnd, NULL) ; - - timersub (&tEnd, &tStart, &tTaken) ; - - printf ("Time taken for %d reads: %ld.%ld\n", B_SIZE, tTaken.tv_sec, tTaken.tv_usec) ; - - gettimeofday (&tStart, NULL) ; - - for (i = 0 ; i < B_SIZE ; ++i) - analogWrite (100, buffer [i]) ; - - gettimeofday (&tEnd, NULL) ; - - timersub (&tEnd, &tStart, &tTaken) ; - - printf ("Time taken for %d writes: %ld.%ld\n", B_SIZE, tTaken.tv_sec, tTaken.tv_usec) ; - - return 0 ; -} - diff --git a/WiringPi/examples/Gertboard/temperature.c b/WiringPi/examples/Gertboard/temperature.c deleted file mode 100644 index 5985a12..0000000 --- a/WiringPi/examples/Gertboard/temperature.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * temperature.c: - * Demonstrate use of the Gertboard A to D converter to make - * a simple thermometer using the LM35. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include - -int main () -{ - int x1, x2 ; - double v1, v2 ; - - printf ("\n") ; - printf ("Gertboard demo: Simple Thermemeter\n") ; - printf ("==================================\n") ; - -// Always initialise wiringPi. Use wiringPiSys() if you don't need -// (or want) to run as root - - wiringPiSetupSys () ; - -// Initialise the Gertboard analog hardware at pin 100 - - gertboardAnalogSetup (100) ; - - printf ("\n") ; - printf ("| Channel 0 | Channel 1 | Temperature 1 | Temperature 2 |\n") ; - - for (;;) - { - -// Read the 2 channels: - - x1 = analogRead (100) ; - x2 = analogRead (101) ; - -// Convert to a voltage: - - v1 = (double)x1 / 1023.0 * 3.3 ; - v2 = (double)x2 / 1023.0 * 3.3 ; - -// Print - - printf ("| %6.3f | %6.3f |", v1, v2) ; - -// Print Temperature of both channels by converting the LM35 reading -// to a temperature. Fortunately these are easy: 0.01 volts per C. - - printf (" %4.1f | %4.1f |\r", v1 * 100.0, v2 * 100.0) ; - fflush (stdout) ; - } - - return 0 ; -} - diff --git a/WiringPi/examples/Gertboard/voltmeter.c b/WiringPi/examples/Gertboard/voltmeter.c deleted file mode 100644 index c4d2113..0000000 --- a/WiringPi/examples/Gertboard/voltmeter.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * voltmeter.c: - * Demonstrate use of the Gertboard A to D converter to make - * a simple voltmeter. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include - -int main () -{ - int x1, x2 ; - double v1, v2 ; - - printf ("\n") ; - printf ("Gertboard demo: Simple Voltmeters\n") ; - printf ("=================================\n") ; - -// Always initialise wiringPi. Use wiringPiSys() if you don't need -// (or want) to run as root - - wiringPiSetupSys () ; - -// Initialise the Gertboard analog hardware at pin 100 - - gertboardAnalogSetup (100) ; - - printf ("\n") ; - printf ("| Channel 0 | Channel 1 |\n") ; - - for (;;) - { - -// Read the 2 channels: - - x1 = analogRead (100) ; - x2 = analogRead (101) ; - -// Convert to a voltage: - - v1 = (double)x1 / 1023.0 * 3.3 ; - v2 = (double)x2 / 1023.0 * 3.3 ; - -// Print - - printf ("| %6.3f | %6.3f |\r", v1, v2) ; - fflush (stdout) ; - } - - return 0 ; -} - diff --git a/WiringPi/examples/Gertboard/vumeter.c b/WiringPi/examples/Gertboard/vumeter.c deleted file mode 100644 index 9643ace..0000000 --- a/WiringPi/examples/Gertboard/vumeter.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * vumeter.c: - * Simple VU meter - * - * Heres the theory: - * We will sample at 4000 samples/sec and put the data into a - * low-pass filter with a depth of 1000 samples. This will give - * us 1/4 a second of lag on the signal, but I think it might - * produce a more pleasing output. - * - * The input of the microphone should be at mid-pont with no - * sound input, but we might have to sample that too, to get - * our reference zero... - * - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -#ifndef TRUE -#define TRUE (1==1) -#define FALSE (!TRUE) -#endif - -#define B_SIZE 1000 -#define S_SIZE 128 - -static int buffer [B_SIZE] ; -static int bPtr = 0 ; - -/* - * ledPercent: - * Output the given value as a percentage on the LEDs - ********************************************************************************* - */ - -static void ledPercent (int percent) -{ - unsigned int output = 0 ; - - if (percent > 11) output |= 0x01 ; - if (percent > 22) output |= 0x02 ; - if (percent > 33) output |= 0x04 ; - if (percent > 44) output |= 0x08 ; - if (percent > 55) output |= 0x10 ; - if (percent > 66) output |= 0x20 ; - if (percent > 77) output |= 0x40 ; - if (percent > 88) output |= 0x80 ; - - digitalWriteByte (output) ; -} - -static unsigned int tPeriod, tNextSampleTime ; - -/* - * sample: - * Get a sample from the Gertboard. If not enough time has elapsed - * since the last sample, then wait... - ********************************************************************************* - */ - -static void sample (void) -{ - unsigned int tFuture ; - -// Calculate the future sample time - - tFuture = tPeriod + tNextSampleTime ; - -// Wait until the next sample time - - while (micros () < tNextSampleTime) - ; - - buffer [bPtr] = gertboardAnalogRead (0) ; - - tNextSampleTime = tFuture ; -} - - -int main () -{ - int quietLevel, min, max ; - int i, sum ; - unsigned int tStart, tEnd ; - - printf ("\n") ; - printf ("Gertboard demo: VU Meter\n") ; - printf ("========================\n") ; - - wiringPiSetup () ; - gertboardSPISetup () ; - - ledPercent (0) ; - for (i = 0 ; i < 8 ; ++i) - pinMode (i, OUTPUT) ; - - for (bPtr = 0 ; bPtr < B_SIZE ; ++bPtr) - buffer [bPtr] = 99 ; - - tPeriod = 1000000 / 1000 ; - - printf ("Shhhh.... ") ; fflush (stdout) ; - delay (1000) ; - printf ("Sampling quiet... ") ; fflush (stdout) ; - - tStart = micros () ; - - tNextSampleTime = micros () ; - for (bPtr = 0 ; bPtr < B_SIZE ; ++bPtr) - sample () ; - - tEnd = micros () ; - - quietLevel = 0 ; - max = 0 ; - min = 1024 ; - for (i = 0 ; i < B_SIZE ; ++i) - { - quietLevel += buffer [i] ; - if (buffer [i] > max) max = buffer [i] ; - if (buffer [i] < min) min = buffer [i] ; - } - quietLevel /= B_SIZE ; - - printf ("Done. Quiet level is: %d [%d:%d] [%d:%d]\n", quietLevel, min, max, quietLevel - min, max - quietLevel) ; - - printf ("Time taken for %d reads: %duS\n", B_SIZE, tEnd - tStart) ; - - for (bPtr = 0 ;;) - { - sample () ; - sum = 0 ; - for (i = 0 ; i < S_SIZE ; ++i) - sum += buffer [i] ; - sum /= S_SIZE ; - sum = abs (quietLevel - sum) ; - sum = (sum * 1000) / quietLevel ; - ledPercent (sum) ; - if (++bPtr > S_SIZE) - bPtr = 0 ; - } - - - return 0 ; -} diff --git a/WiringPi/examples/Makefile b/WiringPi/examples/Makefile deleted file mode 100644 index 8cc256f..0000000 --- a/WiringPi/examples/Makefile +++ /dev/null @@ -1,158 +0,0 @@ -# -# Makefile: -# wiringPi - Wiring Compatable library for the Raspberry Pi -# https://projects.drogon.net/wiring-pi -# -# Copyright (c) 2012 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# Wiring Compatable library for the Raspberry Pi -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - - -#DEBUG = -g -O0 -DEBUG = -O3 -CC = gcc -INCLUDE = -I/usr/local/include -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe - -LDFLAGS = -L/usr/local/lib -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm - -# Should not alter anything below this line -############################################################################### - -SRC = blink.c blink8.c blink12.c \ - pwm.c \ - speed.c wfi.c isr.c isr-osc.c \ - lcd.c lcd-adafruit.c clock.c \ - nes.c \ - softPwm.c softTone.c \ - delayTest.c serialRead.c serialTest.c okLed.c ds1302.c \ - rht03.c - -OBJ = $(SRC:.c=.o) - -BINS = $(SRC:.c=) - -all: - @cat README.TXT - @echo " $(BINS)" | fmt - @echo "" - -really-all: $(BINS) - -blink: blink.o - @echo [link] - @$(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS) - -blink8: blink8.o - @echo [link] - @$(CC) -o $@ blink8.o $(LDFLAGS) $(LDLIBS) - -blink12: blink12.o - @echo [link] - @$(CC) -o $@ blink12.o $(LDFLAGS) $(LDLIBS) - -speed: speed.o - @echo [link] - @$(CC) -o $@ speed.o $(LDFLAGS) $(LDLIBS) - -lcd: lcd.o - @echo [link] - @$(CC) -o $@ lcd.o $(LDFLAGS) $(LDLIBS) - -lcd-adafruit: lcd-adafruit.o - @echo [link] - @$(CC) -o $@ lcd-adafruit.o $(LDFLAGS) $(LDLIBS) - -clock: clock.o - @echo [link] - @$(CC) -o $@ clock.o $(LDFLAGS) $(LDLIBS) - -wfi: wfi.o - @echo [link] - @$(CC) -o $@ wfi.o $(LDFLAGS) $(LDLIBS) - -isr: isr.o - @echo [link] - @$(CC) -o $@ isr.o $(LDFLAGS) $(LDLIBS) - -isr-osc: isr-osc.o - @echo [link] - @$(CC) -o $@ isr-osc.o $(LDFLAGS) $(LDLIBS) - -nes: nes.o - @echo [link] - @$(CC) -o $@ nes.o $(LDFLAGS) $(LDLIBS) - -rht03: rht03.o - @echo [link] - @$(CC) -o $@ rht03.o $(LDFLAGS) $(LDLIBS) - -pwm: pwm.o - @echo [link] - @$(CC) -o $@ pwm.o $(LDFLAGS) $(LDLIBS) - -softPwm: softPwm.o - @echo [link] - @$(CC) -o $@ softPwm.o $(LDFLAGS) $(LDLIBS) - -softTone: softTone.o - @echo [link] - @$(CC) -o $@ softTone.o $(LDFLAGS) $(LDLIBS) - -delayTest: delayTest.o - @echo [link] - @$(CC) -o $@ delayTest.o $(LDFLAGS) $(LDLIBS) - -serialRead: serialRead.o - @echo [link] - @$(CC) -o $@ serialRead.o $(LDFLAGS) $(LDLIBS) - -serialTest: serialTest.o - @echo [link] - @$(CC) -o $@ serialTest.o $(LDFLAGS) $(LDLIBS) - -okLed: okLed.o - @echo [link] - @$(CC) -o $@ okLed.o $(LDFLAGS) $(LDLIBS) - -tone: tone.o - @echo [link] - @$(CC) -o $@ tone.o $(LDFLAGS) $(LDLIBS) - -ds1302: ds1302.o - @echo [link] - @$(CC) -o $@ ds1302.o $(LDFLAGS) $(LDLIBS) - - -.c.o: - @echo [CC] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -clean: - @echo "[Clean]" - @rm -f $(OBJ) *~ core tags $(BINS) - -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - -depend: - makedepend -Y $(SRC) - -# DO NOT DELETE diff --git a/WiringPi/examples/PiFace/Makefile b/WiringPi/examples/PiFace/Makefile deleted file mode 100644 index 0bde334..0000000 --- a/WiringPi/examples/PiFace/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -# -# Makefile: -# wiringPi - Wiring Compatable library for the Raspberry Pi -# https://projects.drogon.net/wiring-pi -# -# Copyright (c) 2012 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# Wiring Compatable library for the Raspberry Pi -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - - -#DEBUG = -g -O0 -DEBUG = -O3 -CC = gcc -INCLUDE = -I/usr/local/include -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe - -LDFLAGS = -L/usr/local/lib -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm - -# Should not alter anything below this line -############################################################################### - -SRC = blink.c buttons.c reaction.c ladder.c metro.c motor.c - -OBJ = $(SRC:.c=.o) - -BINS = $(SRC:.c=) - -all: $(BINS) - -blink: blink.o - @echo [link] - @$(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS) - -buttons: buttons.o - @echo [link] - @$(CC) -o $@ buttons.o $(LDFLAGS) $(LDLIBS) - -reaction: reaction.o - @echo [link] - @$(CC) -o $@ reaction.o $(LDFLAGS) $(LDLIBS) - -ladder: ladder.o - @echo [link] - @$(CC) -o $@ ladder.o $(LDFLAGS) $(LDLIBS) - -metro: metro.o - @echo [link] - @$(CC) -o $@ metro.o $(LDFLAGS) $(LDLIBS) - -motor: motor.o - @echo [link] - @$(CC) -o $@ motor.o $(LDFLAGS) $(LDLIBS) - -.c.o: - @echo [CC] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -clean: - @echo "[Clean]" - @rm -f $(OBJ) *~ core tags $(BINS) - -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - -depend: - makedepend -Y $(SRC) - -# DO NOT DELETE diff --git a/WiringPi/examples/PiFace/blink.c b/WiringPi/examples/PiFace/blink.c deleted file mode 100644 index ffb8a2e..0000000 --- a/WiringPi/examples/PiFace/blink.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * blink.c: - * Simple "blink" test for the PiFace interface board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include - -// Use 200 as the pin-base for the PiFace board, and pick a pin -// for the LED that's not connected to a relay - -#define PIFACE 200 -#define LED (PIFACE+2) - -int main (int argc, char *argv []) -{ - printf ("Raspberry Pi PiFace Blink\n") ; - printf ("=========================\n") ; - -// Always initialise wiringPi. Use wiringPiSys() if you don't need -// (or want) to run as root - - wiringPiSetupSys () ; - -// Setup the PiFace board - - piFaceSetup (PIFACE) ; - - for (;;) - { - digitalWrite (LED, HIGH) ; // On - delay (500) ; // mS - digitalWrite (LED, LOW) ; // Off - delay (500) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/PiFace/buttons.c b/WiringPi/examples/PiFace/buttons.c deleted file mode 100644 index 147a4bd..0000000 --- a/WiringPi/examples/PiFace/buttons.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * buttons.c: - * Simple test for the PiFace interface board. - * - * Read the buttons and output the same to the LEDs - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include - -int outputs [4] = { 0,0,0,0 } ; - -// Use 200 as the pin-base for the PiFace board - -#define PIFACE_BASE 200 - - -/* - * scanButton: - * Read the guiven button - if it's pressed, then flip the state - * of the correspoinding output pin - ********************************************************************************* - */ - -void scanButton (int button) -{ - if (digitalRead (PIFACE_BASE + button) == LOW) - { - outputs [button] ^= 1 ; - digitalWrite (PIFACE_BASE + button, outputs [button]) ; - printf ("Button %d pushed - output now: %s\n", - button, (outputs [button] == 0) ? "Off" : "On") ; - } - - while (digitalRead (PIFACE_BASE + button) == LOW) - delay (1) ; -} - - -/* - * start here - ********************************************************************************* - */ - -int main (void) -{ - int pin, button ; - - printf ("Raspberry Pi wiringPi + PiFace test program\n") ; - printf ("===========================================\n") ; - printf ("\n") ; - printf ( -"This program reads the buttons and uses them to toggle the first 4\n" -"outputs. Push a button once to turn an output on, and push it again to\n" -"turn it off again.\n\n") ; - -// Always initialise wiringPi. Use wiringPiSys() if you don't need -// (or want) to run as root - - wiringPiSetupSys () ; - - piFaceSetup (PIFACE_BASE) ; - -// Enable internal pull-ups & start with all off - - for (pin = 0 ; pin < 8 ; ++pin) - { - pullUpDnControl (PIFACE_BASE + pin, PUD_UP) ; - digitalWrite (PIFACE_BASE + pin, 0) ; - } - -// Loop, scanning the buttons - - for (;;) - { - for (button = 0 ; button < 4 ; ++button) - scanButton (button) ; - delay (5) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/PiFace/ladder.c b/WiringPi/examples/PiFace/ladder.c deleted file mode 100755 index 4f08a6f..0000000 --- a/WiringPi/examples/PiFace/ladder.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * ladder.c: - * - * Gordon Henderson, June 2012 - *********************************************************************** - */ - -#include -#include -#include -#include - -#include -#include - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - -#undef DEBUG - -#define NUM_LEDS 8 - - -// Map the LEDs to the hardware pins -// using PiFace pin numbers here - -#define PIFACE 200 - -const int ledMap [NUM_LEDS] = -{ -// 0, 1, 2, 3, 4, 5, 6, 7, 8 - 200, 201, 202, 203, 204, 205, 206, 207 -} ; - - -// Some constants for our circuit simulation - -const double vBatt = 9.0 ; // Volts (ie. a PP3) -const double capacitor = 0.001 ; // 1000uF -const double rCharge = 2200.0 ; // ohms -const double rDischarge = 68000.0 ; // ohms -const double timeInc = 0.01 ; // Seconds - -double vCharge, vCap, vCapLast ; - - - -/* - * setup: - * Program the GPIO correctly and initialise the lamps - *********************************************************************** - */ - -void setup (void) -{ - int i ; - - wiringPiSetupSys () ; - - if (piFaceSetup (200) == -1) - exit (1) ; - -// Enable internal pull-ups - - for (i = 0 ; i < 8 ; ++i) - pullUpDnControl (PIFACE + i, PUD_UP) ; - -// Calculate the actual charging voltage - standard calculation of -// vCharge = r2 / (r1 + r2) * vBatt -// -// -// -----+--- vBatt -// | -// R1 -// | -// +---+---- vCharge -// | | -// R2 C -// | | -// -----+---+----- - - vCharge = rDischarge / (rCharge + rDischarge) * vBatt ; - -// Start with no charge - - vCap = vCapLast = 0.0 ; -} - - -/* - * introLeds - * Put a little pattern on the LEDs to start with - ********************************************************************************* - */ - -void introLeds (void) -{ - int i, j ; - - - printf ("Pi Ladder\n") ; - printf ("=========\n\n") ; - printf (" vBatt: %6.2f volts\n", vBatt) ; - printf (" rCharge: %6.0f ohms\n", rCharge) ; - printf (" rDischarge: %6.0f ohms\n", rDischarge) ; - printf (" vCharge: %6.2f volts\n", vCharge) ; - printf (" capacitor: %6.0f uF\n", capacitor * 1000.0) ; - -// Flash 3 times: - - for (j = 0 ; j < 3 ; ++j) - { - for (i = 0 ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 1) ; - delay (500) ; - for (i = 0 ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 0) ; - delay (100) ; - } - -// All On - - for (i = 0 ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 1) ; - delay (500) ; - -// Countdown... - - for (i = NUM_LEDS - 1 ; i >= 0 ; --i) - { - digitalWrite (ledMap [i], 0) ; - delay (100) ; - } - delay (500) ; -} - - -/* - * winningLeds - * Put a little pattern on the LEDs to start with - ********************************************************************************* - */ - -void winningLeds (void) -{ - int i, j ; - -// Flash 3 times: - - for (j = 0 ; j < 3 ; ++j) - { - for (i = 0 ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 1) ; - delay (500) ; - for (i = 0 ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 0) ; - delay (100) ; - } - -// All On - - for (i = 0 ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 1) ; - delay (500) ; - -// Countup... - - for (i = 0 ; i < NUM_LEDS ; ++i) - { - digitalWrite (ledMap [i], 0) ; - delay (100) ; - } - delay (500) ; -} - - -/* - * chargeCapacitor: dischargeCapacitor: - * Add or remove charge to the capacitor. - * Standard capacitor formulae. - ********************************************************************************* - */ - -void chargeCapacitor (void) -{ - vCap = (vCapLast - vCharge) * - exp (- timeInc / (rCharge * capacitor)) + vCharge ; - -#ifdef DEBUG - printf ("+vCap: %7.4f\n", vCap) ; -#endif - - vCapLast = vCap ; -} - -void dischargeCapacitor (void) -{ - vCap = vCapLast * - exp (- timeInc / (rDischarge * capacitor)) ; - -#ifdef DEBUG - printf ("-vCap: %7.4f\n", vCap) ; -#endif - - vCapLast = vCap ; -} - - -/* - * ledBargraph: - * Output the supplied number as a bargraph on the LEDs - ********************************************************************************* - */ - -void ledBargraph (double value, int topLedOn) -{ - int topLed = (int)floor (value / vCharge * (double)NUM_LEDS) + 1 ; - int i ; - - if (topLed > NUM_LEDS) - topLed = NUM_LEDS ; - - if (!topLedOn) - --topLed ; - - for (i = 0 ; i < topLed ; ++i) - digitalWrite (ledMap [i], 1) ; - - for (i = topLed ; i < NUM_LEDS ; ++i) - digitalWrite (ledMap [i], 0) ; -} - - -/* - * ledOnAction: - * Make sure the leading LED is on and check the button - ********************************************************************************* - */ - -void ledOnAction (void) -{ - if (digitalRead (PIFACE) == LOW) - { - chargeCapacitor () ; - ledBargraph (vCap, TRUE) ; - } -} - - -/* - * ledOffAction: - * Make sure the leading LED is off and check the button - ********************************************************************************* - */ - -void ledOffAction (void) -{ - dischargeCapacitor () ; - -// Are we still pushing the button? - - if (digitalRead (PIFACE) == LOW) - { - vCap = vCapLast = 0.0 ; - ledBargraph (vCap, FALSE) ; - -// Wait until we release the button - - while (digitalRead (PIFACE) == LOW) - delay (10) ; - } -} - - -/* - *********************************************************************** - * The main program - *********************************************************************** - */ - -int main (void) -{ - unsigned int then, ledOnTime, ledOffTime ; - unsigned int ourDelay = (int)(1000.0 * timeInc) ; - - setup () ; - introLeds () ; - -// Setup the LED times - TODO reduce the ON time as the game progresses - - ledOnTime = 1000 ; - ledOffTime = 1000 ; - -// This is our Gate/Squarewave loop - - for (;;) - { - -// LED ON: - - (void)ledBargraph (vCap, TRUE) ; - then = millis () + ledOnTime ; - while (millis () < then) - { - ledOnAction () ; - delay (ourDelay) ; - } - -// Have we won yet? -// We need vCap to be in the top NUM_LEDS of the vCharge - - if (vCap > ((double)(NUM_LEDS - 1) / (double)NUM_LEDS * vCharge)) // Woo hoo! - { - winningLeds () ; - while (digitalRead (PIFACE) == HIGH) - delay (10) ; - while (digitalRead (PIFACE) == LOW) - delay (10) ; - vCap = vCapLast = 0.0 ; - } - -// LED OFF: - - (void)ledBargraph (vCap, FALSE) ; - then = millis () + ledOffTime ; - while (millis () < then) - { - ledOffAction () ; - delay (ourDelay) ; - } - - } - - return 0 ; -} diff --git a/WiringPi/examples/PiFace/metro.c b/WiringPi/examples/PiFace/metro.c deleted file mode 100644 index a4a8c1d..0000000 --- a/WiringPi/examples/PiFace/metro.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * metronome.c: - * Simple test for the PiFace interface board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -#define PIFACE 200 - -/* - * middleA: - * Play middle A (on the relays - yea!) - ********************************************************************************* - */ - -static void middleA (void) -{ - unsigned int next ; - - for (;;) - { - next = micros () + 1136 ; - digitalWrite (PIFACE + 0, 0) ; - digitalWrite (PIFACE + 1, 0) ; - while (micros () < next) - delayMicroseconds (1) ; - - next = micros () + 1137 ; - digitalWrite (PIFACE + 0, 1) ; - digitalWrite (PIFACE + 1, 1) ; - while (micros () < next) - delayMicroseconds (1) ; - - } -} - - -int main (int argc, char *argv []) -{ - int bpm, msPerBeat, state = 0 ; - unsigned int end ; - - printf ("Raspberry Pi PiFace Metronome\n") ; - printf ("=============================\n") ; - - piHiPri (50) ; - - wiringPiSetupSys () ; // Needed for timing functions - piFaceSetup (PIFACE) ; - - if (argc != 2) - { - printf ("Usage: %s \n", argv [0]) ; - exit (1) ; - } - - if (strcmp (argv [1], "a") == 0) - middleA () ; - - bpm = atoi (argv [1]) ; - - if ((bpm < 40) || (bpm > 208)) - { - printf ("%s range is 40 through 208 beats per minute\n", argv [0]) ; - exit (1) ; - } - - msPerBeat = 60000 / bpm ; - -// Main loop: -// Put some random LED pairs up for a few seconds, then blank ... - - for (;;) - { - end = millis () + msPerBeat ; - - digitalWrite (PIFACE + 0, state) ; - digitalWrite (PIFACE + 1, state) ; - - while (millis () < end) - delayMicroseconds (500) ; - - state ^= 1 ; - } - - return 0 ; -} diff --git a/WiringPi/examples/PiFace/motor.c b/WiringPi/examples/PiFace/motor.c deleted file mode 100644 index 14f5539..0000000 --- a/WiringPi/examples/PiFace/motor.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * motor.c: - * Use the PiFace board to demonstrate an H bridge - * circuit via the 2 relays. - * Then add on an external transsitor to help with PWM. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include -#include - -int outputs [2] = { 0,0 } ; - -#define PIFACE_BASE 200 -#define PWM_OUT_PIN 204 -#define PWM_UP 202 -#define PWM_DOWN 203 - -void scanButton (int button) -{ - if (digitalRead (PIFACE_BASE + button) == LOW) - { - outputs [button] ^= 1 ; - digitalWrite (PIFACE_BASE + button, outputs [button]) ; - printf ("Button %d pushed - output now: %s\n", - button, (outputs [button] == 0) ? "Off" : "On") ; - } - - while (digitalRead (PIFACE_BASE + button) == LOW) - delay (1) ; -} - - -int main (void) -{ - int pin, button ; - int pwmValue = 0 ; - - printf ("Raspberry Pi PiFace - Motor control\n") ; - printf ("==================================\n") ; - printf ("\n") ; - printf ( -"This program is designed to be used with a motor connected to the relays\n" -"in an H-Bridge type configuration with optional speeed control via PWM.\n" -"\n" -"Use the leftmost buttons to turn each relay on and off, and the rigthmost\n" -"buttons to increase ot decrease the PWM output on the control pin (pin\n" -"4)\n\n") ; - - wiringPiSetup () ; - piFaceSetup (PIFACE_BASE) ; - softPwmCreate (PWM_OUT_PIN, 100, 100) ; - -// Enable internal pull-ups & start with all off - - for (pin = 0 ; pin < 8 ; ++pin) - { - pullUpDnControl (PIFACE_BASE + pin, PUD_UP) ; - digitalWrite (PIFACE_BASE + pin, 0) ; - } - - for (;;) - { - for (button = 0 ; button < 2 ; ++button) - scanButton (button) ; - - if (digitalRead (PWM_UP) == LOW) - { - pwmValue += 10 ; - if (pwmValue > 100) - pwmValue = 100 ; - - softPwmWrite (PWM_OUT_PIN, pwmValue) ; - printf ("PWM -> %3d\n", pwmValue) ; - - while (digitalRead (PWM_UP) == LOW) - delay (5) ; - } - - if (digitalRead (PWM_DOWN) == LOW) - { - pwmValue -= 10 ; - if (pwmValue < 0) - pwmValue = 0 ; - - softPwmWrite (PWM_OUT_PIN, pwmValue) ; - printf ("PWM -> %3d\n", pwmValue) ; - - while (digitalRead (PWM_DOWN) == LOW) - delay (5) ; - } - - delay (5) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/PiFace/reaction.c b/WiringPi/examples/PiFace/reaction.c deleted file mode 100644 index 5084508..0000000 --- a/WiringPi/examples/PiFace/reaction.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * reaction.c: - * Simple test for the PiFace interface board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - - -int outputs [4] = { 0,0,0,0 } ; - -#define PIFACE 200 - -/* - * light: - * Light up the given LED - actually lights up a pair - ********************************************************************************* - */ - -void light (int led, int value) -{ - led *= 2 ; - digitalWrite (PIFACE + led + 0, value) ; - digitalWrite (PIFACE + led + 1, value) ; -} - -/* - * lightAll: - * All On or Off - ********************************************************************************* - */ - -void lightAll (int onoff) -{ - light (0, onoff) ; - light (1, onoff) ; - light (2, onoff) ; - light (3, onoff) ; -} - - -/* - * waitForNoButtons: - * Wait for all buttons to be released - ********************************************************************************* - */ - -void waitForNoButtons (void) -{ - int i, button ; - - for (;;) - { - button = 0 ; - for (i = 0 ; i < 4 ; ++i) - button += digitalRead (PIFACE + i) ; - - if (button == 4) - break ; - } -} - - -void scanButton (int button) -{ - if (digitalRead (PIFACE + button) == LOW) - { - outputs [button] ^= 1 ; - digitalWrite (PIFACE + button, outputs [button]) ; - } - - while (digitalRead (PIFACE + button) == LOW) - delay (1) ; -} - - -int main (void) -{ - int i, j ; - int led, button ; - unsigned int start, stop ; - - printf ("Raspberry Pi PiFace Reaction Timer\n") ; - printf ("==================================\n") ; - - if (piFaceSetup (PIFACE) == -1) - exit (1) ; - -// Enable internal pull-ups - - for (i = 0 ; i < 8 ; ++i) - pullUpDnControl (PIFACE + i, PUD_UP) ; - - -// Main game loop: -// Put some random LED pairs up for a few seconds, then blank ... - - for (;;) - { - printf ("Press any button to start ... \n") ; fflush (stdout) ; - - for (;;) - { - led = rand () % 4 ; - light (led, 1) ; - delay (10) ; - light (led, 0) ; - - button = 0 ; - for (j = 0 ; j < 4 ; ++j) - button += digitalRead (PIFACE + j) ; - - if (button != 4) - break ; - } - - waitForNoButtons () ; - - printf ("Wait for it ... ") ; fflush (stdout) ; - - led = rand () % 4 ; - delay (rand () % 500 + 1000) ; - light (led, 1) ; - - start = millis () ; - for (button = -1 ; button == -1 ; ) - { - for (j = 0 ; j < 4 ; ++j) - if (digitalRead (PIFACE + j) == 0) // Pushed - { - button = j ; - break ; - } - } - stop = millis () ; - button = 3 - button ; // Correct for the buttons/LEDs reversed - - light (led, 0) ; - - waitForNoButtons () ; - - light (led, 1) ; - - if (button == led) - { - printf ("You got it in %3d mS\n", stop - start) ; - } - else - { - printf ("Missed: You pushed %d - LED was %d\n", button, led) ; - for (;;) - { - light (button, 1) ; - delay (100) ; - light (button, 0) ; - delay (100) ; - i = 0 ; - for (j = 0 ; j < 4 ; ++j) - i += digitalRead (PIFACE + j) ; - if (i != 4) - break ; - } - - waitForNoButtons () ; - } - light (led, 0) ; - delay (4000) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/README.TXT b/WiringPi/examples/README.TXT deleted file mode 100644 index 33263b1..0000000 --- a/WiringPi/examples/README.TXT +++ /dev/null @@ -1,18 +0,0 @@ - -wiringPi Examples -================= - -There are now too many examples to compile them all in a sensible time, -and you probably don't want to compile or run them all anyway, so they -have been separated out. - -To compile an individual example, just type - - make exampleName - -To really compile everything: - - make really-all - -The individual tests are: - diff --git a/WiringPi/examples/blink.c b/WiringPi/examples/blink.c deleted file mode 100644 index c27a20e..0000000 --- a/WiringPi/examples/blink.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * blink.c: - * Standard "blink" program in wiringPi. Blinks an LED connected - * to the first GPIO pin. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -// LED Pin - wiringPi pin 0 is BCM_GPIO 17. - -#define LED 0 - -int main (void) -{ - printf ("Raspberry Pi blink\n") ; - - wiringPiSetup () ; - pinMode (LED, OUTPUT) ; - - for (;;) - { - digitalWrite (LED, HIGH) ; // On - delay (500) ; // mS - digitalWrite (LED, LOW) ; // Off - delay (500) ; - } - return 0 ; -} diff --git a/WiringPi/examples/blink.rtb b/WiringPi/examples/blink.rtb deleted file mode 100644 index eb7d26c..0000000 --- a/WiringPi/examples/blink.rtb +++ /dev/null @@ -1,30 +0,0 @@ -// blink.rtb: -// Blink program in Return to Basic -// -// Copyright (c) 2012-2013 Gordon Henderson. -//********************************************************************** -// This file is part of wiringPi: -// https://projects.drogon.net/raspberry-pi/wiringpi/ -// -// wiringPi is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// wiringPi is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with wiringPi. If not, see . - *********************************************************************** -// -PinMode (0, 1) // Output -CYCLE - DigitalWrite (0, 1) // Pin 0 ON - WAIT (0.5) // 0.5 seconds - DigitalWrite (0, 0) - WAIT (0.5) -REPEAT -END diff --git a/WiringPi/examples/blink.sh b/WiringPi/examples/blink.sh deleted file mode 100644 index 2aa378a..0000000 --- a/WiringPi/examples/blink.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# blink.sh: -# Standard "blink" program in wiringPi. Blinks an LED connected -# to the first GPIO pin. -# -# Copyright (c) 2012-2013 Gordon Henderson. -####################################################################### -# This file is part of wiringPi: -# https://projects.drogon.net/raspberry-pi/wiringpi/ -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -####################################################################### - -# LED Pin - wiringPi pin 0 is BCM_GPIO 17. - -LED=0 - -gpio mode $PIN out - -while true; do - gpio write $PIN 1 - sleep 0.5 - gpio write $PIN 0 - sleep 0.5 -done diff --git a/WiringPi/examples/blink12.c b/WiringPi/examples/blink12.c deleted file mode 100644 index c9b3d50..0000000 --- a/WiringPi/examples/blink12.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * blink12.c: - * Simple sequence over the first 12 GPIO pins - LEDs - * Aimed at the Gertboard, but it's fairly generic. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -// Simple sequencer data -// Triplets of LED, On/Off and delay - -int data [] = -{ - 0, 1, 1, - 1, 1, 1, - 0, 0, 0, 2, 1, 1, - 1, 0, 0, 3, 1, 1, - 2, 0, 0, 4, 1, 1, - 3, 0, 0, 5, 1, 1, - 4, 0, 0, 6, 1, 1, - 5, 0, 0, 7, 1, 1, - 6, 0, 0, 11, 1, 1, - 7, 0, 0, 10, 1, 1, - 11, 0, 0, 13, 1, 1, - 10, 0, 0, 12, 1, 1, - 13, 0, 1, - 12, 0, 1, - - 0, 0, 1, // Extra delay - -// Back again - - 12, 1, 1, - 13, 1, 1, - 12, 0, 0, 10, 1, 1, - 13, 0, 0, 11, 1, 1, - 10, 0, 0, 7, 1, 1, - 11, 0, 0, 6, 1, 1, - 7, 0, 0, 5, 1, 1, - 6, 0, 0, 4, 1, 1, - 5, 0, 0, 3, 1, 1, - 4, 0, 0, 2, 1, 1, - 3, 0, 0, 1, 1, 1, - 2, 0, 0, 0, 1, 1, - 1, 0, 1, - 0, 0, 1, - - 0, 0, 1, // Extra delay - - 0, 9, 0, // End marker - -} ; - - -int main (void) -{ - int pin ; - int dataPtr ; - int l, s, d ; - - printf ("Raspberry Pi - 12-LED Sequence\n") ; - printf ("==============================\n") ; - printf ("\n") ; - printf ("Connect LEDs up to the first 8 GPIO pins, then pins 11, 10, 13, 12 in\n") ; - printf (" that order, then sit back and watch the show!\n") ; - - wiringPiSetup () ; - - for (pin = 0 ; pin < 14 ; ++pin) - pinMode (pin, OUTPUT) ; - - dataPtr = 0 ; - - for (;;) - { - l = data [dataPtr++] ; // LED - s = data [dataPtr++] ; // State - d = data [dataPtr++] ; // Duration (10ths) - - if (s == 9) // 9 -> End Marker - { - dataPtr = 0 ; - continue ; - } - - digitalWrite (l, s) ; - delay (d * 100) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/blink8.c b/WiringPi/examples/blink8.c deleted file mode 100644 index 602d3c0..0000000 --- a/WiringPi/examples/blink8.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * blink8.c: - * Simple sequence over the first 8 GPIO pins - LEDs - * Aimed at the Gertboard, but it's fairly generic. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -int main (void) -{ - int i, led ; - - printf ("Raspberry Pi - 8-LED Sequencer\n") ; - printf ("==============================\n") ; - printf ("\n") ; - printf ("Connect LEDs to the first 8 GPIO pins and watch ...\n") ; - - wiringPiSetup () ; - - for (i = 0 ; i < 8 ; ++i) - pinMode (i, OUTPUT) ; - - for (;;) - { - for (led = 0 ; led < 8 ; ++led) - { - digitalWrite (led, 1) ; - delay (100) ; - } - - for (led = 0 ; led < 8 ; ++led) - { - digitalWrite (led, 0) ; - delay (100) ; - } - } -} diff --git a/WiringPi/examples/clock.c b/WiringPi/examples/clock.c deleted file mode 100644 index 9a53210..0000000 --- a/WiringPi/examples/clock.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * clock.c: - * Demo of the 128x64 graphics based LCD driver. - * This is designed to drive the parallel interface LCD drivers - * based on the popular 12864H controller chip. - * - * This test program assumes the following: - * (Which is currently hard-wired into the driver) - * - * GPIO 0-7 is connected to display data pins 0-7. - * GPIO 10 is CS1 - * GPIO 11 is CS2 - * GPIO 12 is STROBE - * GPIO 10 is RS - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - -double clockRadius ; -double thickness, barLen ; -int maxX, maxY ; - -double rads (double degs) -{ - return degs * M_PI / 180.0 ; -} - -void drawClockHands (void) -{ - time_t t ; - struct tm *now ; - double angle, p, x0, y0, x1, y1 ; - int h24, h, m, s ; - char text [20] ; - - time (&t) ; - now = localtime (&t) ; - - h24 = now->tm_hour ; - m = now->tm_min ; - s = now->tm_sec ; - - h = h24 ; - if (h > 12) - h -= 12 ; - -// Hour hand - - angle = h * 30 + m * 0.5 ; - x0 = sin (rads (angle)) * (clockRadius * 0.75) ; - y0 = cos (rads (angle)) * (clockRadius * 0.75) ; - for (p = -3.0 ; p <= 3.0 ; p += 0.2) - { - x1 = sin (rads (angle + p)) * (clockRadius * 0.7) ; - y1 = cos (rads (angle + p)) * (clockRadius * 0.7) ; - lcd128x64line (0, 0, x1, y1, 1) ; - lcd128x64lineTo (x0, y0, 1) ; - } - -// Minute hand - - angle = m * 6 ; - x0 = sin (rads (angle)) * (clockRadius * 0.9) ; - y0 = cos (rads (angle)) * (clockRadius * 0.9) ; - for (p = -1.0 ; p <= 1.0 ; p += 0.2) - { - x1 = sin (rads (angle + p)) * (clockRadius * 0.85) ; - y1 = cos (rads (angle + p)) * (clockRadius * 0.85) ; - lcd128x64line (0, 0, x1, y1, 1) ; - lcd128x64lineTo (x0, y0, 1) ; - } - -// Second hand - - angle = s * 6 ; - x0 = sin (rads (angle)) * (clockRadius * 0.2) ; - y0 = cos (rads (angle)) * (clockRadius * 0.2) ; - x1 = sin (rads (angle)) * (clockRadius * 0.95) ; - y1 = cos (rads (angle)) * (clockRadius * 0.95) ; - lcd128x64line (0 - x0, 0 - y0, x1, y1, 1) ; - lcd128x64circle (0, 0, clockRadius * 0.1, 0, 1) ; - lcd128x64circle (0, 0, clockRadius * 0.05, 1, 1) ; - -// Text: - - sprintf (text, "%02d:%02d:%02d", h24, m, s) ; - lcd128x64puts (32, 24, text, 0, 1) ; - - sprintf (text, "%2d/%2d/%2d", now->tm_mday, now->tm_mon + 1, now->tm_year - 100) ; - lcd128x64puts (32, -23, text, 0, 1) ; -} - -void drawClockFace (void) -{ - int m ; - double d, px1, py1, px2, py2 ; - - lcd128x64clear (0) ; - lcd128x64circle (0,0, clockRadius, 1, TRUE) ; - lcd128x64circle (0,0, clockRadius - thickness, 0, TRUE) ; - -// The four big indicators for 12,15,30 and 45 - - lcd128x64rectangle (- 3, clockRadius - barLen, 3, clockRadius, 1, TRUE) ; // 12 - lcd128x64rectangle (clockRadius - barLen, 3, clockRadius, -3, 1, TRUE) ; // 3 - lcd128x64rectangle (- 3, -clockRadius + barLen, 3, -clockRadius, 1, TRUE) ; // 6 - lcd128x64rectangle (-clockRadius + barLen, 3, -clockRadius, -3, 1, TRUE) ; // 9 - - -// Smaller 5 and 1 minute ticks - - for (m = 0 ; m < 60 ; ++m) - { - px1 = sin (rads (m * 6)) * clockRadius ; - py1 = cos (rads (m * 6)) * clockRadius ; - if ((m % 5) == 0) - d = barLen ; - else - d = barLen / 2.0 ; - - px2 = sin (rads (m * 6)) * (clockRadius - d) ; - py2 = cos (rads (m * 6)) * (clockRadius - d) ; - lcd128x64line (px1, py1, px2, py2, 1) ; - } -} - -void setup (void) -{ - lcd128x64getScreenSize (&maxX, &maxY) ; - clockRadius = maxY / 2 - 1 ; - thickness = maxX / 48 ; - barLen = thickness * 4 ; - lcd128x64setOrigin (32, 32) ; -} - - - - -/* - *********************************************************************** - * The main program - *********************************************************************** - */ - -int main (int argc, char *argv []) -{ - time_t now ; - - wiringPiSetup () ; - - lcd128x64setup () ; - - setup () ; - for (;;) - { - drawClockFace () ; - drawClockHands () ; - lcd128x64update () ; - - now = time (NULL) ; - while (time (NULL) == now) - delay (10) ; - } - - - return 0 ; -} diff --git a/WiringPi/examples/delayTest.c b/WiringPi/examples/delayTest.c deleted file mode 100644 index 4c8b6ca..0000000 --- a/WiringPi/examples/delayTest.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * delayTest.c: - * Just a little test program I'm using to experiment with - * various timings and latency, etc. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include - -#define CYCLES 1000 - -int main() -{ - int x ; - struct timeval t1, t2 ; - int t ; - int max, min ; - int del ; - int underRuns, overRuns, exactRuns, total ; - int descheds ; - - if (wiringPiSetup () == -1) - return 1 ; - - piHiPri (10) ; sleep (1) ; - -// Baseline test - - gettimeofday (&t1, NULL) ; - gettimeofday (&t2, NULL) ; - - t = t2.tv_usec - t1.tv_usec ; - printf ("Baseline test: %d\n", t); - - for (del = 1 ; del < 200 ; ++del) - { - underRuns = overRuns = exactRuns = total = 0 ; - descheds = 0 ; - max = del ; - min = del ; - - for (x = 0 ; x < CYCLES ; ++x) - { - for (;;) // Repeat this if we get a delay over 999uS - { // -> High probability Linux has deschedulled us - gettimeofday (&t1, NULL) ; - delayMicroseconds (del) ; - gettimeofday (&t2, NULL) ; - - if (t2.tv_usec < t1.tv_usec) // Counter wrapped - t = (1000000 + t2.tv_usec) - t1.tv_usec; - else - t = t2.tv_usec - t1.tv_usec ; - if (t > 999) - { - ++descheds ; - continue ; - } - else - break ; - } - - if (t > max) - { - max = t ; - ++overRuns ; - } - else if (t < min) - { - min = t ; - ++underRuns ; - } - else - ++exactRuns ; - - total += t ; - } - printf ("Delay: %3d. Min: %3d, Max: %3d, Unders: %3d, Overs: %3d, Exacts: %3d, Average: %3d, Descheds: %2d\n", - del, min, max, underRuns, overRuns, exactRuns, total / CYCLES, descheds) ; - fflush (stdout) ; - delay (1) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/header.h b/WiringPi/examples/header.h deleted file mode 100644 index 82f723d..0000000 --- a/WiringPi/examples/header.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * file.c: - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - diff --git a/WiringPi/examples/isr-osc.c b/WiringPi/examples/isr-osc.c deleted file mode 100644 index a872ee3..0000000 --- a/WiringPi/examples/isr-osc.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * isr-osc.c: - * Wait for Interrupt test program - ISR method - interrupt oscillator - * - * How to test: - * - * IMPORTANT: To run this test we connect 2 GPIO pins together, but - * before we do that YOU must make sure that they are both setup - * the right way. If they are set to outputs and one is high and one low, - * then you connect the wire, you'll create a short and that won't be good. - * - * Before making the connection, type: - * gpio mode 0 output - * gpio write 0 0 - * gpio mode 1 input - * then you can connect them together. - * - * Run the program, then: - * gpio write 0 1 - * gpio write 0 0 - * - * at which point it will trigger an interrupt and the program will - * then do the up/down toggling for itself and run at full speed, and - * it will report the number of interrupts recieved every second. - * - * Copyright (c) 2013 Gordon Henderson. projects@drogon.net - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include -#include - - -// What GPIO input are we using? -// This is a wiringPi pin number - -#define OUT_PIN 0 -#define IN_PIN 1 - -// globalCounter: -// Global variable to count interrupts -// Should be declared volatile to make sure the compiler doesn't cache it. - -static volatile int globalCounter = 0 ; - -/* - * myInterrupt: - ********************************************************************************* - */ - -void myInterrupt (void) -{ - digitalWrite (OUT_PIN, 1) ; - ++globalCounter ; - digitalWrite (OUT_PIN, 0) ; -} - - -/* - ********************************************************************************* - * main - ********************************************************************************* - */ - -int main (void) -{ - int myCounter = 0 ; - int lastCounter = 0 ; - - if (wiringPiSetup () < 0) - { - fprintf (stderr, "Unable to setup wiringPi: %s\n", strerror (errno)) ; - return 1 ; - } - - pinMode (OUT_PIN, OUTPUT) ; - pinMode (IN_PIN, INPUT) ; - - if (wiringPiISR (IN_PIN, INT_EDGE_FALLING, &myInterrupt) < 0) - { - fprintf (stderr, "Unable to setup ISR: %s\n", strerror (errno)) ; - return 1 ; - } - - for (;;) - { - printf ("Waiting ... ") ; fflush (stdout) ; - - while (myCounter == globalCounter) - delay (1000) ; - - printf (" Done. counter: %6d: %6d\n", - globalCounter, myCounter - lastCounter) ; - lastCounter = myCounter ; - myCounter = globalCounter ; - } - - return 0 ; -} diff --git a/WiringPi/examples/isr.c b/WiringPi/examples/isr.c deleted file mode 100644 index abc6aec..0000000 --- a/WiringPi/examples/isr.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * isr.c: - * Wait for Interrupt test program - ISR method - * - * How to test: - * Use the SoC's pull-up and pull down resistors that are avalable - * on input pins. So compile & run this program (via sudo), then - * in another terminal: - * gpio mode 0 up - * gpio mode 0 down - * at which point it should trigger an interrupt. Toggle the pin - * up/down to generate more interrupts to test. - * - * Copyright (c) 2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include -#include - - -// globalCounter: -// Global variable to count interrupts -// Should be declared volatile to make sure the compiler doesn't cache it. - -static volatile int globalCounter [8] ; - - -/* - * myInterrupt: - ********************************************************************************* - */ - -void myInterrupt0 (void) { ++globalCounter [0] ; } -void myInterrupt1 (void) { ++globalCounter [1] ; } -void myInterrupt2 (void) { ++globalCounter [2] ; } -void myInterrupt3 (void) { ++globalCounter [3] ; } -void myInterrupt4 (void) { ++globalCounter [4] ; } -void myInterrupt5 (void) { ++globalCounter [5] ; } -void myInterrupt6 (void) { ++globalCounter [6] ; } -void myInterrupt7 (void) { ++globalCounter [7] ; } - - -/* - ********************************************************************************* - * main - ********************************************************************************* - */ - -int main (void) -{ - int gotOne, pin ; - int myCounter [8] ; - - for (pin = 0 ; pin < 8 ; ++pin) - globalCounter [pin] = myCounter [pin] = 0 ; - - wiringPiSetup () ; - - wiringPiISR (0, INT_EDGE_FALLING, &myInterrupt0) ; - wiringPiISR (1, INT_EDGE_FALLING, &myInterrupt1) ; - wiringPiISR (2, INT_EDGE_FALLING, &myInterrupt2) ; - wiringPiISR (3, INT_EDGE_FALLING, &myInterrupt3) ; - wiringPiISR (4, INT_EDGE_FALLING, &myInterrupt4) ; - wiringPiISR (5, INT_EDGE_FALLING, &myInterrupt5) ; - wiringPiISR (6, INT_EDGE_FALLING, &myInterrupt6) ; - wiringPiISR (7, INT_EDGE_FALLING, &myInterrupt7) ; - - for (;;) - { - gotOne = 0 ; - printf ("Waiting ... ") ; fflush (stdout) ; - - for (;;) - { - for (pin = 0 ; pin < 8 ; ++pin) - { - if (globalCounter [pin] != myCounter [pin]) - { - printf (" Int on pin %d: Counter: %5d\n", pin, globalCounter [pin]) ; - myCounter [pin] = globalCounter [pin] ; - ++gotOne ; - } - } - if (gotOne != 0) - break ; - } - } - - return 0 ; -} diff --git a/WiringPi/examples/lcd-adafruit.c b/WiringPi/examples/lcd-adafruit.c deleted file mode 100644 index 47c9b9b..0000000 --- a/WiringPi/examples/lcd-adafruit.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * lcd-adafruit.c: - * Text-based LCD driver test code - * This is designed to drive the Adafruit RGB LCD Plate - * with the additional 5 buttons for the Raspberry Pi - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - - -// Defines for the Adafruit Pi LCD interface board - -#define AF_BASE 100 -#define AF_RED (AF_BASE + 6) -#define AF_GREEN (AF_BASE + 7) -#define AF_BLUE (AF_BASE + 8) - -#define AF_E (AF_BASE + 13) -#define AF_RW (AF_BASE + 14) -#define AF_RS (AF_BASE + 15) - -#define AF_DB4 (AF_BASE + 12) -#define AF_DB5 (AF_BASE + 11) -#define AF_DB6 (AF_BASE + 10) -#define AF_DB7 (AF_BASE + 9) - -#define AF_SELECT (AF_BASE + 0) -#define AF_RIGHT (AF_BASE + 1) -#define AF_DOWN (AF_BASE + 2) -#define AF_UP (AF_BASE + 3) -#define AF_LEFT (AF_BASE + 4) - - -// User-Defined character test - -static unsigned char newChar [8] = -{ - 0b00100, - 0b00100, - 0b00000, - 0b00100, - 0b01110, - 0b11011, - 0b11011, - 0b10001, -} ; - -// Global lcd handle: - -static int lcdHandle ; - -/* - * usage: - ********************************************************************************* - */ - -int usage (const char *progName) -{ - fprintf (stderr, "Usage: %s colour\n", progName) ; - return EXIT_FAILURE ; -} - - -/* - * scrollMessage: - ********************************************************************************* - */ - -static const char *message = - " " - "Wiring Pi by Gordon Henderson. HTTP://WIRINGPI.COM/" - " " ; - -void scrollMessage (int line, int width) -{ - char buf [32] ; - static int position = 0 ; - static int timer = 0 ; - - if (millis () < timer) - return ; - - timer = millis () + 200 ; - - strncpy (buf, &message [position], width) ; - buf [width] = 0 ; - lcdPosition (lcdHandle, 0, line) ; - lcdPuts (lcdHandle, buf) ; - - if (++position == (strlen (message) - width)) - position = 0 ; -} - - -/* - * setBacklightColour: - * The colour outputs are inverted. - ********************************************************************************* - */ - -static void setBacklightColour (int colour) -{ - colour &= 7 ; - - digitalWrite (AF_RED, !(colour & 1)) ; - digitalWrite (AF_GREEN, !(colour & 2)) ; - digitalWrite (AF_BLUE, !(colour & 4)) ; -} - - -/* - * adafruitLCDSetup: - * Setup the Adafruit board by making sure the additional pins are - * set to the correct modes, etc. - ********************************************************************************* - */ - -static void adafruitLCDSetup (int colour) -{ - int i ; - -// Backlight LEDs - - pinMode (AF_RED, OUTPUT) ; - pinMode (AF_GREEN, OUTPUT) ; - pinMode (AF_BLUE, OUTPUT) ; - setBacklightColour (colour) ; - -// Input buttons - - for (i = 0 ; i <= 4 ; ++i) - { - pinMode (AF_BASE + i, INPUT) ; - pullUpDnControl (AF_BASE + i, PUD_UP) ; // Enable pull-ups, switches close to 0v - } - -// Control signals - - pinMode (AF_RW, OUTPUT) ; digitalWrite (AF_RW, LOW) ; // Not used with wiringPi - always in write mode - -// The other control pins are initialised with lcdInit () - - lcdHandle = lcdInit (2, 16, 4, AF_RS, AF_E, AF_DB4,AF_DB5,AF_DB6,AF_DB7, 0,0,0,0) ; - - if (lcdHandle < 0) - { - fprintf (stderr, "lcdInit failed\n") ; - exit (EXIT_FAILURE) ; - } -} - - -/* - * waitForEnter: - * On the Adafruit display, wait for the select button - ********************************************************************************* - */ - -static void waitForEnter (void) -{ - printf ("Press SELECT to continue: ") ; fflush (stdout) ; - - while (digitalRead (AF_SELECT) == HIGH) // Wait for push - delay (1) ; - - while (digitalRead (AF_SELECT) == LOW) // Wait for release - delay (1) ; - - printf ("OK\n") ; -} - - -/* - * speedTest: - * Test the update speed of the display - ********************************************************************************* - */ - -static void speedTest (void) -{ - unsigned int start, end, taken ; - int times ; - - lcdClear (lcdHandle) ; - start = millis () ; - for (times = 0 ; times < 10 ; ++times) - { - lcdPuts (lcdHandle, "0123456789ABCDEF") ; - lcdPuts (lcdHandle, "0123456789ABCDEF") ; - } - end = millis () ; - taken = (end - start) / 10; - - lcdClear (lcdHandle) ; - lcdPosition (lcdHandle, 0, 0) ; lcdPrintf (lcdHandle, "Speed: %dmS", taken) ; - lcdPosition (lcdHandle, 0, 1) ; lcdPrintf (lcdHandle, "For full update") ; - - waitForEnter () ; - - lcdClear (lcdHandle) ; - lcdPosition (lcdHandle, 0, 0) ; lcdPrintf (lcdHandle, "Time: %dmS", taken / 32) ; - lcdPosition (lcdHandle, 0, 1) ; lcdPrintf (lcdHandle, "Per character") ; - - waitForEnter () ; - - lcdClear (lcdHandle) ; - lcdPosition (lcdHandle, 0, 0) ; lcdPrintf (lcdHandle, "%d cps...", 32000 / taken) ; - - waitForEnter () ; -} - - -/* - * The works - ********************************************************************************* - */ - -int main (int argc, char *argv[]) -{ - int colour ; - int cols = 16 ; - int waitForRelease = FALSE ; - - struct tm *t ; - time_t tim ; - - char buf [32] ; - - if (argc != 2) - return usage (argv [0]) ; - - printf ("Raspberry Pi Adafruit LCD test\n") ; - printf ("==============================\n") ; - - colour = atoi (argv [1]) ; - - wiringPiSetupSys () ; - mcp23017Setup (AF_BASE, 0x20) ; - - adafruitLCDSetup (colour) ; - - lcdPosition (lcdHandle, 0, 0) ; lcdPuts (lcdHandle, "Gordon Henderson") ; - lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, " wiringpi.com ") ; - - waitForEnter () ; - - lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, "Adafruit RGB LCD") ; - - waitForEnter () ; - - lcdCharDef (lcdHandle, 2, newChar) ; - - lcdClear (lcdHandle) ; - lcdPosition (lcdHandle, 0, 0) ; - lcdPuts (lcdHandle, "User Char: ") ; - lcdPutchar (lcdHandle, 2) ; - - lcdCursor (lcdHandle, TRUE) ; - lcdCursorBlink (lcdHandle, TRUE) ; - - waitForEnter () ; - - lcdCursor (lcdHandle, FALSE) ; - lcdCursorBlink (lcdHandle, FALSE) ; - - speedTest () ; - - lcdClear (lcdHandle) ; - - for (;;) - { - scrollMessage (0, cols) ; - - tim = time (NULL) ; - t = localtime (&tim) ; - - sprintf (buf, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec) ; - - lcdPosition (lcdHandle, (cols - 8) / 2, 1) ; - lcdPuts (lcdHandle, buf) ; - -// Check buttons to cycle colour - -// If Up or Down are still pushed, then skip - - if (waitForRelease) - { - if ((digitalRead (AF_UP) == LOW) || (digitalRead (AF_DOWN) == LOW)) - continue ; - else - waitForRelease = FALSE ; - } - - if (digitalRead (AF_UP) == LOW) // Pushed - { - colour = colour + 1 ; - if (colour == 8) - colour = 0 ; - setBacklightColour (colour) ; - waitForRelease = TRUE ; - } - - if (digitalRead (AF_DOWN) == LOW) // Pushed - { - colour = colour - 1 ; - if (colour == -1) - colour = 7 ; - setBacklightColour (colour) ; - waitForRelease = TRUE ; - } - - } - - return 0 ; -} diff --git a/WiringPi/examples/lcd.c b/WiringPi/examples/lcd.c deleted file mode 100644 index 510f562..0000000 --- a/WiringPi/examples/lcd.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * lcd.c: - * Text-based LCD driver. - * This is designed to drive the parallel interface LCD drivers - * based in the Hitachi HD44780U controller and compatables. - * - * This test program assumes the following: - * - * 8-bit displays: - * GPIO 0-7 is connected to display data pins 0-7. - * GPIO 11 is the RS pin. - * GPIO 10 is the Strobe/E pin. - * - * For 4-bit interface: - * GPIO 4-7 is connected to display data pins 4-7. - * GPIO 11 is the RS pin. - * GPIO 10 is the Strobe/E pin. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - -static unsigned char newChar [8] = -{ - 0b11111, - 0b10001, - 0b10001, - 0b10101, - 0b11111, - 0b10001, - 0b10001, - 0b11111, -} ; - - -// Global lcd handle: - -static int lcdHandle ; - -/* - * usage: - ********************************************************************************* - */ - -int usage (const char *progName) -{ - fprintf (stderr, "Usage: %s bits cols rows\n", progName) ; - return EXIT_FAILURE ; -} - - -/* - * scrollMessage: - ********************************************************************************* - */ - -static const char *message = - " " - "Wiring Pi by Gordon Henderson. HTTP://WIRINGPI.COM/" - " " ; - -void scrollMessage (int line, int width) -{ - char buf [32] ; - static int position = 0 ; - static int timer = 0 ; - - if (millis () < timer) - return ; - - timer = millis () + 200 ; - - strncpy (buf, &message [position], width) ; - buf [width] = 0 ; - lcdPosition (lcdHandle, 0, line) ; - lcdPuts (lcdHandle, buf) ; - - if (++position == (strlen (message) - width)) - position = 0 ; -} - - -/* - * pingPong: - * Bounce a character - only on 4-line displays - ********************************************************************************* - */ - -static void pingPong (int lcd, int cols) -{ - static int position = 0 ; - static int dir = 0 ; - - if (dir == 0) // Setup - { - dir = 1 ; - lcdPosition (lcdHandle, 0, 3) ; - lcdPutchar (lcdHandle, '*') ; - return ; - } - - lcdPosition (lcdHandle, position, 3) ; - lcdPutchar (lcdHandle, ' ') ; - position += dir ; - - if (position == cols) - { - dir = -1 ; - --position ; - } - - if (position < 0) - { - dir = 1 ; - ++position ; - } - - lcdPosition (lcdHandle, position, 3) ; - lcdPutchar (lcdHandle, '#') ; -} - - -/* - * waitForEnter: - ********************************************************************************* - */ - -static void waitForEnter (void) -{ - printf ("Press ENTER to continue: ") ; - (void)fgetc (stdin) ; -} - - -/* - * The works - ********************************************************************************* - */ - -int main (int argc, char *argv[]) -{ - int i ; - int lcd ; - int bits, rows, cols ; - - struct tm *t ; - time_t tim ; - - char buf [32] ; - - if (argc != 4) - return usage (argv [0]) ; - - printf ("Raspberry Pi LCD test\n") ; - printf ("=====================\n") ; - - bits = atoi (argv [1]) ; - cols = atoi (argv [2]) ; - rows = atoi (argv [3]) ; - - if (!((rows == 1) || (rows == 2) || (rows == 4))) - { - fprintf (stderr, "%s: rows must be 1, 2 or 4\n", argv [0]) ; - return EXIT_FAILURE ; - } - - if (!((cols == 16) || (cols == 20))) - { - fprintf (stderr, "%s: cols must be 16 or 20\n", argv [0]) ; - return EXIT_FAILURE ; - } - - wiringPiSetup () ; - - if (bits == 4) - lcdHandle = lcdInit (rows, cols, 4, 11,10, 4,5,6,7,0,0,0,0) ; - else - lcdHandle = lcdInit (rows, cols, 8, 11,10, 0,1,2,3,4,5,6,7) ; - - if (lcdHandle < 0) - { - fprintf (stderr, "%s: lcdInit failed\n", argv [0]) ; - return -1 ; - } - - lcdPosition (lcdHandle, 0, 0) ; lcdPuts (lcdHandle, "Gordon Henderson") ; - lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, " wiringpi.com ") ; - - waitForEnter () ; - - if (rows > 1) - { - lcdPosition (lcdHandle, 0, 1) ; lcdPuts (lcdHandle, " wiringpi.com ") ; - - if (rows == 4) - { - lcdPosition (lcdHandle, 0, 2) ; - for (i = 0 ; i < ((cols - 1) / 2) ; ++i) - lcdPuts (lcdHandle, "=-") ; - lcdPuts (lcdHandle, "=3") ; - - lcdPosition (lcdHandle, 0, 3) ; - for (i = 0 ; i < ((cols - 1) / 2) ; ++i) - lcdPuts (lcdHandle, "-=") ; - lcdPuts (lcdHandle, "-4") ; - } - } - - waitForEnter () ; - - lcdCharDef (lcdHandle, 2, newChar) ; - - lcdClear (lcdHandle) ; - lcdPosition (lcdHandle, 0, 0) ; - lcdPuts (lcdHandle, "User Char: ") ; - lcdPutchar (lcdHandle, 2) ; - - lcdCursor (lcdHandle, TRUE) ; - lcdCursorBlink (lcdHandle, TRUE) ; - - waitForEnter () ; - - lcdCursor (lcdHandle, FALSE) ; - lcdCursorBlink (lcdHandle, FALSE) ; - lcdClear (lcdHandle) ; - - for (;;) - { - scrollMessage (0, cols) ; - - if (rows == 1) - continue ; - - tim = time (NULL) ; - t = localtime (&tim) ; - - sprintf (buf, "%02d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec) ; - - lcdPosition (lcdHandle, (cols - 8) / 2, 1) ; - lcdPuts (lcdHandle, buf) ; - - if (rows == 2) - continue ; - - sprintf (buf, "%02d/%02d/%04d", t->tm_mday, t->tm_mon + 1, t->tm_year+1900) ; - - lcdPosition (lcdHandle, (cols - 10) / 2, 2) ; - lcdPuts (lcdHandle, buf) ; - - pingPong (lcd, cols) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/nes.c b/WiringPi/examples/nes.c deleted file mode 100644 index 31908e8..0000000 --- a/WiringPi/examples/nes.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * nes.c: - * Test program for an old NES controller connected to the Pi. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -#define BLANK "| " - -int main () -{ - int joystick ; - unsigned int buttons ; - - if (wiringPiSetup () == -1) - { - fprintf (stdout, "oops: %s\n", strerror (errno)) ; - return 1 ; - } - - if ((joystick = setupNesJoystick (2, 1, 0)) == -1) - { - fprintf (stdout, "Unable to setup joystick\n") ; - return 1 ; - } - - for (;;) - { - buttons = readNesJoystick (joystick) ; - - if ((buttons & NES_UP) != 0) printf ("| UP " ) ; else printf (BLANK) ; - if ((buttons & NES_DOWN) != 0) printf ("| DOWN " ) ; else printf (BLANK) ; - if ((buttons & NES_LEFT) != 0) printf ("| LEFT " ) ; else printf (BLANK) ; - if ((buttons & NES_RIGHT) != 0) printf ("|RIGHT " ) ; else printf (BLANK) ; - if ((buttons & NES_SELECT) != 0) printf ("|SELECT" ) ; else printf (BLANK) ; - if ((buttons & NES_START) != 0) printf ("|START " ) ; else printf (BLANK) ; - if ((buttons & NES_A) != 0) printf ("| A " ) ; else printf (BLANK) ; - if ((buttons & NES_B) != 0) printf ("| B " ) ; else printf (BLANK) ; - printf ("|\n") ; - } - - return 0 ; -} diff --git a/WiringPi/examples/okLed.c b/WiringPi/examples/okLed.c deleted file mode 100644 index 930f266..0000000 --- a/WiringPi/examples/okLed.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * okLed.c: - * Make the OK LED on the Pi Pulsate... - * - * Originally posted to the Raspberry Pi forums: - * http://www.raspberrypi.org/phpBB3/viewtopic.php?p=162581#p162581 - * - * Compile this and store it somewhere, then kick it off at boot time - * e.g. by putting it in /etc/rc.local and running it in the - * background & - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -// The OK/Act LED is connected to BCM_GPIO pin 16 - -#define OK_LED 16 - -int main () -{ - int fd, i ; - - wiringPiSetupGpio () ; - -// Change the trigger on the OK/Act LED to "none" - - if ((fd = open ("/sys/class/leds/led0/trigger", O_RDWR)) < 0) - { - fprintf (stderr, "Unable to change LED trigger: %s\n", strerror (errno)) ; - return 1 ; - } - write (fd, "none\n", 5) ; - close (fd) ; - - softPwmCreate (OK_LED, 0, 100) ; - - for (;;) - { - for (i = 0 ; i <= 100 ; ++i) - { - softPwmWrite (OK_LED, i) ; - delay (10) ; - } - delay (50) ; - - for (i = 100 ; i >= 0 ; --i) - { - softPwmWrite (OK_LED, i) ; - delay (10) ; - } - delay (10) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/pwm.c b/WiringPi/examples/pwm.c deleted file mode 100644 index 816c832..0000000 --- a/WiringPi/examples/pwm.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * pwm.c: - * This tests the hardware PWM channel. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include -#include - -int main (void) -{ - int bright ; - - printf ("Raspberry Pi wiringPi PWM test program\n") ; - - if (wiringPiSetup () == -1) - exit (1) ; - - pinMode (1, PWM_OUTPUT) ; - - for (;;) - { - for (bright = 0 ; bright < 1024 ; ++bright) - { - pwmWrite (1, bright) ; - delay (1) ; - } - - for (bright = 1023 ; bright >= 0 ; --bright) - { - pwmWrite (1, bright) ; - delay (1) ; - } - } - - return 0 ; -} diff --git a/WiringPi/examples/q2w/Makefile b/WiringPi/examples/q2w/Makefile deleted file mode 100644 index 150c825..0000000 --- a/WiringPi/examples/q2w/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -# -# Makefile: -# wiringPi - Wiring Compatable library for the Raspberry Pi -# https://projects.drogon.net/wiring-pi -# -# Copyright (c) 2012-2013 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# Wiring Compatable library for the Raspberry Pi -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - - -#DEBUG = -g -O0 -DEBUG = -O3 -CC = gcc -INCLUDE = -I/usr/local/include -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe - -LDFLAGS = -L/usr/local/lib -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm - -############################################################################### - -SRC = blink.c button.c blink-io.c volts.c bright.c - -OBJ = $(SRC:.c=.o) - -BINS = $(SRC:.c=) - -all: $(BINS) - -blink: blink.o - @echo [link] - @$(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS) - -blink-io: blink-io.o - @echo [link] - @$(CC) -o $@ blink-io.o $(LDFLAGS) $(LDLIBS) - -button: button.o - @echo [link] - @$(CC) -o $@ button.o $(LDFLAGS) $(LDLIBS) - -volts: volts.o - @echo [link] - @$(CC) -o $@ volts.o $(LDFLAGS) $(LDLIBS) - -bright: bright.o - @echo [link] - @$(CC) -o $@ bright.o $(LDFLAGS) $(LDLIBS) - - -.c.o: - @echo [CC] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -clean: - @echo "[Clean]" - @rm -f $(OBJ) *~ core tags $(BINS) - -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - -depend: - makedepend -Y $(SRC) - -# DO NOT DELETE diff --git a/WiringPi/examples/q2w/binary.c b/WiringPi/examples/q2w/binary.c deleted file mode 100644 index 3c987c6..0000000 --- a/WiringPi/examples/q2w/binary.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * binary.c: - * Using the Quick 2 wire 16-bit GPIO expansion board to output - * a binary counter. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#define Q2W_BASE 100 - -int main (void) -{ - int i, bit ; - -// Enable the on-goard GPIO - - wiringPiSetup () ; - -// Add in the mcp23017 on the q2w board - - mcp23017Setup (Q2W_BASE, 0x20) ; - - printf ("Raspberry Pi - quite2Wire MCP23017 Test\n") ; - -// On-board button Input: - - pinMode (0, INPUT) ; - -// First 10 pins on q2w board as outputs: - - for (i = 0 ; i < 10 ; ++i) - pinMode (Q2W_BASE + i, OUTPUT) ; - -// Last pin as an input with the internal pull-up enabled - - pinMode (Q2W_BASE + 15, INPUT) ; - pullUpDnControl (Q2W_BASE + 15, PUD_UP) ; - -// Loop, outputting a binary number, -// Go faster with the button, or stop if the -// on-board button is pushed - - for (;;) - { - for (i = 0 ; i < 1024 ; ++i) - { - for (bit = 0 ; bit < 10 ; ++bit) - digitalWrite (Q2W_BASE + bit, i & (1 << bit)) ; - - while (digitalRead (0) == HIGH) // While pushed - delay (1) ; - - if (digitalRead (Q2W_BASE + 15) == HIGH) // Not Pushed - delay (100) ; - } - } - return 0 ; -} diff --git a/WiringPi/examples/q2w/blink-io.c b/WiringPi/examples/q2w/blink-io.c deleted file mode 100644 index 4dd4276..0000000 --- a/WiringPi/examples/q2w/blink-io.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * blink-io.c: - * Simple "blink" test for the Quick2Wire 16-pin IO board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#define LED 1 -#define Q2W_BASE 100 - -int main (void) -{ - -// Enable the on-goard GPIO - - wiringPiSetup () ; - -// Add in the mcp23017 on the q2w board - - mcp23017Setup (Q2W_BASE, 0x20) ; - - printf ("Raspberry Pi - Quick2Wire MCP23017 Blink Test\n") ; - -// Blink the on-board LED as well as one on the mcp23017 - - pinMode (LED, OUTPUT) ; - pinMode (Q2W_BASE + 0, OUTPUT) ; - - for (;;) - { - digitalWrite (LED, HIGH) ; - digitalWrite (Q2W_BASE + 0, HIGH) ; - delay (500) ; - digitalWrite (LED, LOW) ; - digitalWrite (Q2W_BASE + 0, LOW) ; - delay (500) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/q2w/blink.c b/WiringPi/examples/q2w/blink.c deleted file mode 100644 index 62b694a..0000000 --- a/WiringPi/examples/q2w/blink.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * blink.c: - * Simple "blink" test for the Quick2Wire interface board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -#define LED 1 - -int main (void) -{ - -// Enable the on-goard GPIO - - wiringPiSetup () ; - - printf ("Raspberry Pi - Quick2Wire Mainboard LED Blink Test\n") ; - - pinMode (LED, OUTPUT) ; - - for (;;) - { - digitalWrite (LED, HIGH) ; - delay (500) ; - digitalWrite (LED, LOW) ; - delay (500) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/q2w/blink.sh b/WiringPi/examples/q2w/blink.sh deleted file mode 100755 index 2dee6c7..0000000 --- a/WiringPi/examples/q2w/blink.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# blink.sh: -# Standard "blink" program in wiringPi. Blinks an LED connected -# to the LED on the Quick2Wire board -# -# Copyright (c) 2012-2013 Gordon Henderson. -####################################################################### -# This file is part of wiringPi: -# https://projects.drogon.net/raspberry-pi/wiringpi/ -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -####################################################################### - -# LED Pin - wiringPi pin 1 is BCM_GPIO 18. - -LED=1 - -gpio mode $LED out - -while true; do - gpio write $LED 1 - sleep 0.5 - gpio write $LED 0 - sleep 0.5 -done diff --git a/WiringPi/examples/q2w/bright.c b/WiringPi/examples/q2w/bright.c deleted file mode 100644 index 2318834..0000000 --- a/WiringPi/examples/q2w/bright.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * bright.c: - * Vary the Q2W LED brightness with the analog card - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#define LED 1 -#define Q2W_ABASE 120 - -int main (void) -{ - int value ; - -// Enable the on-goard GPIO - - wiringPiSetup () ; - -// Add in the pcf8591 on the q2w board - - pcf8591Setup (Q2W_ABASE, 0x48) ; - - printf ("Raspberry Pi - Quick2Wire Analog Test\n") ; - -// Setup the LED - - pinMode (LED, PWM_OUTPUT) ; - pwmWrite (LED, 0) ; - - for (;;) - { - value = analogRead (Q2W_ABASE + 0) ; - pwmWrite (LED, value * 4) ; - delay (10) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/q2w/button.c b/WiringPi/examples/q2w/button.c deleted file mode 100644 index 1781f02..0000000 --- a/WiringPi/examples/q2w/button.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * button.c: - * Simple button test for the Quick2Wire interface board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include - -#define BUTTON 0 -#define LED1 1 -#define LED2 7 - -int main (void) -{ - -// Enable the on-goard GPIO - - wiringPiSetup () ; - - printf ("Raspberry Pi - Quick2Wire Mainboard Button & LED Test\n") ; - - pinMode (BUTTON, INPUT) ; - pinMode (LED1, OUTPUT) ; - pinMode (LED2, OUTPUT) ; - - digitalWrite (LED1, HIGH) ; // On-board LED on - digitalWrite (LED2, LOW) ; // 2nd LED off - - for (;;) - { - if (digitalRead (BUTTON) == HIGH) // Swap LED states - { - digitalWrite (LED1, LOW) ; - digitalWrite (LED2, HIGH) ; - while (digitalRead (BUTTON) == HIGH) - delay (1) ; - digitalWrite (LED1, HIGH) ; - digitalWrite (LED2, LOW) ; - } - delay (1) ; - } - - return 0 ; -} diff --git a/WiringPi/examples/q2w/volts.c b/WiringPi/examples/q2w/volts.c deleted file mode 100644 index e091093..0000000 --- a/WiringPi/examples/q2w/volts.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * volts.c: - * Read in all 4 analogs on the Q2W analog board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#define LED 1 -#define Q2W_ABASE 120 - -int main (void) -{ - int value, pin ; - -// Enable the on-goard GPIO - - wiringPiSetup () ; - - pinMode (LED, OUTPUT) ; // On-board LED - -// Add in the pcf8591 on the q2w board - - pcf8591Setup (Q2W_ABASE, 0x48) ; - - printf ("Raspberry Pi - Quick2Wire Voltmeter\n") ; - - for (;;) - { - for (pin = 0 ; pin < 4 ; ++pin) - { - value = analogRead (Q2W_ABASE + pin) ; - printf (" %5.2f", (double)value * 3.3 / 255.0) ; - } - printf ("\r") ; fflush (stdout) ; - - delay (100) ; - digitalWrite (LED, !digitalRead (LED)) ; // Flicker the LED - } - - return 0 ; -} diff --git a/WiringPi/examples/rht03.c b/WiringPi/examples/rht03.c deleted file mode 100644 index e0cc116..0000000 --- a/WiringPi/examples/rht03.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * rht03.c: - * Driver for the MaxDetect series sensors - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include - -#define RHT03_PIN 0 - -/* - *********************************************************************** - * The main program - *********************************************************************** - */ - -int main (void) -{ - int temp, rh ; - int newTemp, newRh ; - - temp = rh = newTemp = newRh = 0 ; - - wiringPiSetup () ; - piHiPri (55) ; - - for (;;) - { - delay (100) ; - - if (!readRHT03 (RHT03_PIN, &newTemp, &newRh)) - continue ; - - if ((temp != newTemp) || (rh != newRh)) - { - temp = newTemp ; - rh = newRh ; - printf ("Temp: %5.1f, RH: %5.1f%%\n", temp / 10.0, rh / 10.0) ; - } - } - - return 0 ; -} diff --git a/WiringPi/examples/serialRead.c b/WiringPi/examples/serialRead.c deleted file mode 100644 index 9ee11ac..0000000 --- a/WiringPi/examples/serialRead.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * serial.c: - * Example program to read bytes from the Serial line - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include - -int main () -{ - int fd ; - - if ((fd = serialOpen ("/dev/ttyAMA0", 115200)) < 0) - { - fprintf (stderr, "Unable to open serial device: %s\n", strerror (errno)) ; - return 1 ; - } - -// Loop, getting and printing characters - - for (;;) - { - putchar (serialGetchar (fd)) ; - fflush (stdout) ; - } -} diff --git a/WiringPi/examples/serialTest.c b/WiringPi/examples/serialTest.c deleted file mode 100644 index 0d6da5f..0000000 --- a/WiringPi/examples/serialTest.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * serialTest.c: - * Very simple program to test the serial port. Expects - * the port to be looped back to itself - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -int main () -{ - int fd ; - int count ; - unsigned int nextTime ; - - if ((fd = serialOpen ("/dev/ttyAMA0", 115200)) < 0) - { - fprintf (stderr, "Unable to open serial device: %s\n", strerror (errno)) ; - return 1 ; - } - - if (wiringPiSetup () == -1) - { - fprintf (stdout, "Unable to start wiringPi: %s\n", strerror (errno)) ; - return 1 ; - } - - nextTime = millis () + 300 ; - - for (count = 0 ; count < 256 ; ) - { - if (millis () > nextTime) - { - printf ("\nOut: %3d: ", count) ; - fflush (stdout) ; - serialPutchar (fd, count) ; - nextTime += 300 ; - ++count ; - } - - delay (3) ; - - while (serialDataAvail (fd)) - { - printf (" -> %3d", serialGetchar (fd)) ; - fflush (stdout) ; - } - } - - printf ("\n") ; - return 0 ; -} diff --git a/WiringPi/examples/servo.c b/WiringPi/examples/servo.c deleted file mode 100644 index aa1ab05..0000000 --- a/WiringPi/examples/servo.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * servo.c: - * Test of the softServo code. - * Do not use this code - use the servoBlaster kernel module instead - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -int main () -{ - if (wiringPiSetup () == -1) - { - fprintf (stdout, "oops: %s\n", strerror (errno)) ; - return 1 ; - } - - softServoSetup (0, 1, 2, 3, 4, 5, 6, 7) ; - - softServoWrite (0, 0) ; -/* - softServoWrite (1, 1000) ; - softServoWrite (2, 1100) ; - softServoWrite (3, 1200) ; - softServoWrite (4, 1300) ; - softServoWrite (5, 1400) ; - softServoWrite (6, 1500) ; - softServoWrite (7, 2200) ; -*/ - - for (;;) - delay (10) ; - -} diff --git a/WiringPi/examples/softPwm.c b/WiringPi/examples/softPwm.c deleted file mode 100644 index 11f7ad0..0000000 --- a/WiringPi/examples/softPwm.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * softPwm.c: - * Test of the software PWM driver. Needs 8 LEDs connected - * to the Pi - e.g. Ladder board. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -#define RANGE 100 -#define NUM_LEDS 8 - -int ledMap [NUM_LEDS] = { 0, 1, 2, 3, 4, 5, 6, 7 } ; - -int values [NUM_LEDS] = { 0, 25, 50, 75, 100, 75, 50, 25 } ; - -int main () -{ - int i, j ; - char buf [80] ; - - wiringPiSetup () ; - - for (i = 0 ; i < NUM_LEDS ; ++i) - { - softPwmCreate (ledMap [i], 0, RANGE) ; - printf ("%3d, %3d, %3d\n", i, ledMap [i], values [i]) ; - } - - fgets (buf, 80, stdin) ; - -// Bring all up one by one: - - for (i = 0 ; i < NUM_LEDS ; ++i) - for (j = 0 ; j <= 100 ; ++j) - { - softPwmWrite (ledMap [i], j) ; - delay (10) ; - } - - fgets (buf, 80, stdin) ; - -// All Down - - for (i = 100 ; i > 0 ; --i) - { - for (j = 0 ; j < NUM_LEDS ; ++j) - softPwmWrite (ledMap [j], i) ; - delay (10) ; - } - - fgets (buf, 80, stdin) ; - - for (;;) - { - for (i = 0 ; i < NUM_LEDS ; ++i) - softPwmWrite (ledMap [i], values [i]) ; - - delay (50) ; - - i = values [0] ; - for (j = 0 ; j < NUM_LEDS - 1 ; ++j) - values [j] = values [j + 1] ; - values [NUM_LEDS - 1] = i ; - } -} diff --git a/WiringPi/examples/softTone.c b/WiringPi/examples/softTone.c deleted file mode 100644 index 2f46783..0000000 --- a/WiringPi/examples/softTone.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * softTone.c: - * Test of the softTone module in wiringPi - * Plays a scale out on pin 3 - connect pizeo disc to pin 3 & 0v - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -#include -#include - -#define PIN 3 - -int scale [8] = { 262, 294, 330, 349, 392, 440, 494, 525 } ; - -int main () -{ - int i ; - - wiringPiSetup () ; - - softToneCreate (PIN) ; - - for (;;) - { - for (i = 0 ; i < 8 ; ++i) - { - printf ("%3d\n", i) ; - softToneWrite (PIN, scale [i]) ; - delay (500) ; - } - } -} diff --git a/WiringPi/examples/speed.c b/WiringPi/examples/speed.c deleted file mode 100644 index 0a42b36..0000000 --- a/WiringPi/examples/speed.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * speed.c: - * Simple program to measure the speed of the various GPIO - * access mechanisms. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include -#include -#include - -#define FAST_COUNT 10000000 -#define SLOW_COUNT 1000000 -#define PASSES 5 - -void speedTest (int pin, int maxCount) -{ - int count, sum, perSec, i ; - unsigned int start, end ; - - sum = 0 ; - - for (i = 0 ; i < PASSES ; ++i) - { - start = millis () ; - for (count = 0 ; count < maxCount ; ++count) - digitalWrite (pin, 1) ; - end = millis () ; - printf (" %6d", end - start) ; - fflush (stdout) ; - sum += (end - start) ; - } - - digitalWrite (pin, 0) ; - printf (". Av: %6dmS", sum / PASSES) ; - perSec = (int)(double)maxCount / (double)((double)sum / (double)PASSES) * 1000.0 ; - printf (": %7d/sec\n", perSec) ; -} - - -int main (void) -{ - printf ("Raspberry Pi wiringPi GPIO speed test program\n") ; - printf ("=============================================\n") ; - -// Start the standard way - - printf ("\nNative wiringPi method: (%8d iterations)\n", FAST_COUNT) ; - wiringPiSetup () ; - pinMode (0, OUTPUT) ; - speedTest (0, FAST_COUNT) ; - -// GPIO - - printf ("\nNative GPIO method: (%8d iterations)\n", FAST_COUNT) ; - wiringPiSetupGpio () ; - pinMode (17, OUTPUT) ; - speedTest (17, FAST_COUNT) ; - -// Phys - - printf ("\nPhysical pin GPIO method: (%8d iterations)\n", FAST_COUNT) ; - wiringPiSetupPhys () ; - pinMode (11, OUTPUT) ; - speedTest (11, FAST_COUNT) ; - -// Switch to SYS mode: - - system ("/usr/local/bin/gpio export 17 out") ; - printf ("\n/sys/class/gpio method: (%8d iterations)\n", SLOW_COUNT) ; - wiringPiSetupSys () ; - speedTest (17, SLOW_COUNT) ; - - return 0 ; -} diff --git a/WiringPi/examples/wfi.c b/WiringPi/examples/wfi.c deleted file mode 100644 index 6bb6892..0000000 --- a/WiringPi/examples/wfi.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * wfi.c: - * Wait for Interrupt test program - * - * This program demonstrates the use of the waitForInterrupt() - * function in wiringPi. It listens to a button input on - * BCM_GPIO pin 17 (wiringPi pin 0) - * - * The biggest issue with this method is that it really only works - * well in Sys mode. - * - * Jan 2013: This way of doing things is sort of deprecated now, see - * the wiringPiISR() function instead and the isr.c test program here. - * - * Copyright (c) 2012-2013 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include - -// A 'key' which we can lock and unlock - values are 0 through 3 -// This is interpreted internally as a pthread_mutex by wiringPi -// which is hiding some of that to make life simple. - -#define COUNT_KEY 0 - -// What BCM_GPIO input are we using? - -#define BUTTON_PIN 17 - -// Debounce time in mS - -#define DEBOUNCE_TIME 100 - - -// globalCounter: -// Global variable to count interrupts -// Should be declared volatile to make sure the compiler doesn't cache it. - -static volatile int globalCounter = 0 ; - - -/* - * waitForIt: - * This is a thread created using the wiringPi simplified threading - * mechanism. It will wait on an interrupt on the button and increment - * a counter. - ********************************************************************************* - */ - -PI_THREAD (waitForIt) -{ - int state = 0 ; - int debounceTime = 0 ; - - (void)piHiPri (10) ; // Set this thread to be high priority - - for (;;) - { - if (waitForInterrupt (BUTTON_PIN, -1) > 0) // Got it - { -// Bouncing? - - if (millis () < debounceTime) - { - debounceTime = millis () + DEBOUNCE_TIME ; - continue ; - } - -// We have a valid one - - state ^= 1 ; - - piLock (COUNT_KEY) ; - ++globalCounter ; - piUnlock (COUNT_KEY) ; - -// Wait for key to be released - - while (digitalRead (BUTTON_PIN) == LOW) - delay (1) ; - - debounceTime = millis () + DEBOUNCE_TIME ; - } - } -} - - -/* - * setup: - * Demo a crude but effective way to initialise the hardware - ********************************************************************************* - */ - -void setup (void) -{ - -// Use the gpio program to initialise the hardware -// (This is the crude, but effective) - - system ("gpio edge 17 falling") ; - -// Setup wiringPi - - wiringPiSetupSys () ; - -// Fire off our interrupt handler - - piThreadCreate (waitForIt) ; - -} - - -/* - * main - ********************************************************************************* - */ - -int main (void) -{ - int lastCounter = 0 ; - int myCounter = 0 ; - - setup () ; - - for (;;) - { - printf ("Waiting ... ") ; fflush (stdout) ; - - while (myCounter == lastCounter) - { - piLock (COUNT_KEY) ; - myCounter = globalCounter ; - piUnlock (COUNT_KEY) ; - delay (500) ; - } - - printf (" Done. myCounter: %5d\n", myCounter) ; - lastCounter = myCounter ; - } - - return 0 ; -} diff --git a/WiringPi/gpio/COPYING.LESSER b/WiringPi/gpio/COPYING.LESSER deleted file mode 100644 index 65c5ca8..0000000 --- a/WiringPi/gpio/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/WiringPi/gpio/Makefile b/WiringPi/gpio/Makefile deleted file mode 100644 index 52b0150..0000000 --- a/WiringPi/gpio/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# Makefile: -# wiringPi - Wiring Compatable library for the Raspberry Pi -# https://projects.drogon.net/wiring-pi -# -# Copyright (c) 2012 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# Wiring Compatable library for the Raspberry Pi -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - - -#DEBUG = -g -O0 -DEBUG = -O2 -CC = gcc -INCLUDE = -I/usr/local/include -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe - -LDFLAGS = -L/usr/local/lib -LIBS = -lwiringPi -lwiringPiDev -lpthread -lm - -# May not need to alter anything below this line -############################################################################### - -SRC = gpio.c extensions.c - -OBJ = $(SRC:.c=.o) - -all: gpio - -gpio: $(OBJ) - @echo [Link] - @$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS) - -.c.o: - @echo [Compile] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -.PHONEY: clean -clean: - @echo "[Clean]" - @rm -f $(OBJ) gpio *~ core tags *.bak - -.PHONEY: tags -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - -.PHONEY: install -install: - @echo "[Install]" - @cp gpio /usr/local/bin - @chown root.root /usr/local/bin/gpio - @chmod 4755 /usr/local/bin/gpio - @mkdir -p /usr/local/man/man1 - @cp gpio.1 /usr/local/man/man1 - -.PHONEY: uninstall -uninstall: - @echo "[UnInstall]" - @rm -f /usr/local/bin/gpio - @rm -f /usr/local/man/man1/gpio.1 - -.PHONEY: depend -depend: - makedepend -Y $(SRC) - -# DO NOT DELETE - -gpio.o: extensions.h -extensions.o: extensions.h diff --git a/WiringPi/gpio/extensions.c b/WiringPi/gpio/extensions.c deleted file mode 100644 index dae1eac..0000000 --- a/WiringPi/gpio/extensions.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * extensions.c: - * Part of the GPIO program to test, peek, poke and otherwise - * noodle with the GPIO hardware on the Raspberry Pi. - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "extensions.h" - -extern int wiringPiDebug ; - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - -// Local structure to hold details - -struct extensionFunctionStruct -{ - const char *name ; - int (*function)(char *progName, int pinBase, char *params) ; -} ; - - -/* - * extractInt: - * Check & return an integer at the given location (prefixed by a :) - ********************************************************************************* - */ - -static char *extractInt (char *progName, char *p, int *num) -{ - if (*p != ':') - { - fprintf (stderr, "%s: colon expected\n", progName) ; - return NULL ; - } - - ++p ; - - if (!isdigit (*p)) - { - fprintf (stderr, "%s: digit expected\n", progName) ; - return NULL ; - } - - *num = strtol (p, NULL, 0) ; - while (isdigit (*p)) - ++p ; - - return p ; -} - - - -/* - * doExtensionMcp23008: - * MCP23008 - 8-bit I2C GPIO expansion chip - * mcp23002:base:i2cAddr - ********************************************************************************* - */ - -static int doExtensionMcp23008 (char *progName, int pinBase, char *params) -{ - int i2c ; - - if ((params = extractInt (progName, params, &i2c)) == NULL) - return FALSE ; - - if ((i2c < 0x03) || (i2c > 0x77)) - { - fprintf (stderr, "%s: i2c address (0x%X) out of range\n", progName, i2c) ; - return FALSE ; - } - - mcp23008Setup (pinBase, i2c) ; - - return TRUE ; -} - - -/* - * doExtensionMcp23016: - * MCP230016- 16-bit I2C GPIO expansion chip - * mcp23016:base:i2cAddr - ********************************************************************************* - */ - -static int doExtensionMcp23016 (char *progName, int pinBase, char *params) -{ - int i2c ; - - if ((params = extractInt (progName, params, &i2c)) == NULL) - return FALSE ; - - if ((i2c < 0x03) || (i2c > 0x77)) - { - fprintf (stderr, "%s: i2c address (0x%X) out of range\n", progName, i2c) ; - return FALSE ; - } - - mcp23016Setup (pinBase, i2c) ; - - return TRUE ; -} - - -/* - * doExtensionMcp23017: - * MCP230017- 16-bit I2C GPIO expansion chip - * mcp23017:base:i2cAddr - ********************************************************************************* - */ - -static int doExtensionMcp23017 (char *progName, int pinBase, char *params) -{ - int i2c ; - - if ((params = extractInt (progName, params, &i2c)) == NULL) - return FALSE ; - - if ((i2c < 0x03) || (i2c > 0x77)) - { - fprintf (stderr, "%s: i2c address (0x%X) out of range\n", progName, i2c) ; - return FALSE ; - } - - mcp23017Setup (pinBase, i2c) ; - - return TRUE ; -} - - -/* - * doExtensionMcp23s08: - * MCP23s08 - 8-bit SPI GPIO expansion chip - * mcp23s08:base:spi:port - ********************************************************************************* - */ - -static int doExtensionMcp23s08 (char *progName, int pinBase, char *params) -{ - int spi, port ; - - if ((params = extractInt (progName, params, &spi)) == NULL) - return FALSE ; - - if ((spi < 0) || (spi > 1)) - { - fprintf (stderr, "%s: SPI address (%d) out of range\n", progName, spi) ; - return FALSE ; - } - - if ((params = extractInt (progName, params, &port)) == NULL) - return FALSE ; - - if ((port < 0) || (port > 7)) - { - fprintf (stderr, "%s: port address (%d) out of range\n", progName, port) ; - return FALSE ; - } - - mcp23s08Setup (pinBase, spi, port) ; - - return TRUE ; -} - - -/* - * doExtensionMcp23s17: - * MCP23s17 - 16-bit SPI GPIO expansion chip - * mcp23s17:base:spi:port - ********************************************************************************* - */ - -static int doExtensionMcp23s17 (char *progName, int pinBase, char *params) -{ - int spi, port ; - - if ((params = extractInt (progName, params, &spi)) == NULL) - return FALSE ; - - if ((spi < 0) || (spi > 1)) - { - fprintf (stderr, "%s: SPI address (%d) out of range\n", progName, spi) ; - return FALSE ; - } - - if ((params = extractInt (progName, params, &port)) == NULL) - return FALSE ; - - if ((port < 0) || (port > 7)) - { - fprintf (stderr, "%s: port address (%d) out of range\n", progName, port) ; - return FALSE ; - } - - mcp23s17Setup (pinBase, spi, port) ; - - return TRUE ; -} - - -/* - * doExtensionSr595: - * Shift Register 74x595 - * sr595:base:pins:data:clock:latch - ********************************************************************************* - */ - -static int doExtensionSr595 (char *progName, int pinBase, char *params) -{ - int pins, data, clock, latch ; - -// Extract pins - - if ((params = extractInt (progName, params, &pins)) == NULL) - return FALSE ; - - if ((pins < 8) || (pins > 32)) - { - fprintf (stderr, "%s: pin count (%d) out of range - 8-32 expected.\n", progName, pins) ; - return FALSE ; - } - - if ((params = extractInt (progName, params, &data)) == NULL) - return FALSE ; - - if ((params = extractInt (progName, params, &clock)) == NULL) - return FALSE ; - - if ((params = extractInt (progName, params, &latch)) == NULL) - return FALSE ; - - sr595Setup (pinBase, pins, data, clock, latch) ; - - return TRUE ; -} - - -/* - * doExtensionPcf8574: - * Digital IO (Crude!) - * pcf8574:base:i2cAddr - ********************************************************************************* - */ - -static int doExtensionPcf8574 (char *progName, int pinBase, char *params) -{ - int i2c ; - - if ((params = extractInt (progName, params, &i2c)) == NULL) - return FALSE ; - - if ((i2c < 0x03) || (i2c > 0x77)) - { - fprintf (stderr, "%s: i2c address (0x%X) out of range\n", progName, i2c) ; - return FALSE ; - } - - pcf8574Setup (pinBase, i2c) ; - - return TRUE ; -} - - -/* - * doExtensionPcf8591: - * Analog IO - * pcf8591:base:i2cAddr - ********************************************************************************* - */ - -static int doExtensionPcf8591 (char *progName, int pinBase, char *params) -{ - int i2c ; - - if ((params = extractInt (progName, params, &i2c)) == NULL) - return FALSE ; - - if ((i2c < 0x03) || (i2c > 0x77)) - { - fprintf (stderr, "%s: i2c address (0x%X) out of range\n", progName, i2c) ; - return FALSE ; - } - - pcf8591Setup (pinBase, i2c) ; - - return TRUE ; -} - - -/* - * Function list - ********************************************************************************* - */ - -struct extensionFunctionStruct extensionFunctions [] = -{ - { "mcp23008", &doExtensionMcp23008 }, - { "mcp23016", &doExtensionMcp23016 }, - { "mcp23017", &doExtensionMcp23017 }, - { "mcp23s08", &doExtensionMcp23s08 }, - { "mcp23s17", &doExtensionMcp23s17 }, - { "sr595", &doExtensionSr595 }, - { "pcf8574", &doExtensionPcf8574 }, - { "pcf8591", &doExtensionPcf8591 }, - { NULL, NULL }, -} ; - - -/* - * doExtension: - * Load in a wiringPi extension - ********************************************************************************* - */ - -int doExtension (char *progName, char *extensionData) -{ - char *p ; - char *extension = extensionData ; - struct extensionFunctionStruct *extensionFn ; - int pinBase = 0 ; - -// Get the extension extension name by finding the first colon - - p = extension ; - while (*p != ':') - { - if (!*p) // ran out of characters - { - fprintf (stderr, "%s: extension name not terminated by a colon\n", progName) ; - return FALSE ; - } - ++p ; - } - - *p++ = 0 ; - - if (!isdigit (*p)) - { - fprintf (stderr, "%s: pinBase number expected after extension name\n", progName) ; - return FALSE ; - } - - while (isdigit (*p)) - { - if (pinBase > 1000000000) - { - fprintf (stderr, "%s: pinBase too large\n", progName) ; - return FALSE ; - } - - pinBase = pinBase * 10 + (*p - '0') ; - ++p ; - } - - if (pinBase < 64) - { - fprintf (stderr, "%s: pinBase (%d) too small. Minimum is 64.\n", progName, pinBase) ; - return FALSE ; - } - -// Search for extensions: - - for (extensionFn = extensionFunctions ; extensionFn->name != NULL ; ++extensionFn) - { - if (strcmp (extensionFn->name, extension) == 0) - return extensionFn->function (progName, pinBase, p) ; - } - - fprintf (stderr, "%s: extension %s not found\n", progName, extension) ; - return FALSE ; -} diff --git a/WiringPi/gpio/extensions.h b/WiringPi/gpio/extensions.h deleted file mode 100644 index 5d27123..0000000 --- a/WiringPi/gpio/extensions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * extensions.h: - * Part of the GPIO program to test, peek, poke and otherwise - * noodle with the GPIO hardware on the Raspberry Pi. - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - - -extern int doExtension (char *progName, char *extensionData) ; diff --git a/WiringPi/gpio/gpio.1 b/WiringPi/gpio/gpio.1 deleted file mode 100644 index ae4df4e..0000000 --- a/WiringPi/gpio/gpio.1 +++ /dev/null @@ -1,329 +0,0 @@ -.TH "GPIO" "March 2013" "Command-Line access to Raspberry Pi's GPIO" - -.SH NAME -gpio \- Command-line access to Raspberry Pi's GPIO - -.SH SYNOPSIS -.B gpio -.B \-v -.PP -.B gpio -.B [ \-g | \-1 ] -.B mode/read/write/aread/awrite/wb/pwm/clock ... -.PP -.B gpio -.B [ \-x extension:params ] -.B mode/read/write/aread/awrite/pwm ... -.PP -.B gpio -.B [ \-p ] -.B read/write/wb -.B ... -.PP -.B gpio -.B readall/reset -.PP -.B gpio -.B unexportall/exports -.PP -.B gpio -.B export/edge/unexport -.B ... -.PP -.B gpio -.B wfi -.B ... -.PP -.B gpio -.B drive -group value -.PP -.B gpio -.B pwm-bal/pwm-ms -.PP -.B gpio -.B pwmr -range -.PP -.B gpio -.B load \ i2c/spi ... -.PP -.B gpio -.B gbr -channel -.PP -.B gpio -.B gbw -channel value - -.SH DESCRIPTION - -.B GPIO -is a swiss army knife of a command line tool to allow the user easy -access to the GPIO pins on the Raspberry Pi and the SPI A/D and D/A -converters on the Gertboard. It's designed for simple testing and -diagnostic purposes, but can be used in shell scripts for general if -somewhat slow control of the GPIO pins. - -It can also control the IO's on the PiFace IO board and load the SPI and I2C -kernel modules if required. - -Additionally, it can be used to set the exports in the \fI/sys/class/gpio\fR -system directory to allow subsequent programs to use the \fR/sys/class/gpio\fR -interface without needing to be run as root. - -.SH OPTIONS - -.TP -.B \-v -Output the current version including the board revision of the Raspberry Pi. - -.TP -.B \-g -Use the BCM_GPIO pins numbers rather than wiringPi pin numbers. -\fINote:\fR The BCM_GPIO pin numbers are always used with the -export and edge commands. - -.TP -.B \-1 -Use the physical pin numbers rather than wiringPi pin numbers. -\fINote:\fR that this applies to the P1 connector only. It is not possible to -use pins on the Revision 2 P5 connector this way, and as with \-g the -BCM_GPIO pin numbers are always used with the export and edge commands. - -.TP -.B \-x extension -This causes the named extension to be initialised. Extensions -comprise of a name (e.g. mcp23017) followed by a colon, then the -pin-base, then more optional parameters depending on the extension type. -See the web page on http://wiringpi.com/the-gpio-utility/ - -.TP -.B \-p -Use the PiFace interface board and its corresponding pin numbers. The PiFace -will always appear at pin number 200 in the gpio command. You can assign any -pin numbers you like in your own programs though. - -.TP -.B read -Read the digital value of the given pin and print 0 or 1 to represent the -respective logic levels. - -.TP -.B write -Write the given value (0 or 1) to the pin. You need to set the pin -to output mode first. - -.TP -.B wb -Write the given byte to the 8 main GPIO pins. You can prefix it with 0x -to specify a hexadecimal number. You need to set pins to output mode -first. - -.TP -.B readall -Output a table of all GPIO pins values. The values represent the actual values read -if the pin is in input mode, or the last value written if the pin is in output -mode. - -.TP -.B reset -Resets the GPIO - As much as it's possible to do. All pins are set to input -mode and all the internal pull-up/down resistors are disconnected (tristate mode). - -.TP -.B pwm -Write a PWM value (0-1023) to the given pin. The pin needs to be put -into PWM mode first. - -.TP -.B clock -Set the output frequency on the given pin. The pin needs to be put into -clock mode first. - -.TP -.B mode -Set a pin into \fIinput\fR, \fIoutput\fR or \fIpwm\fR mode. Can also -use the literals \fIup\fR, \fIdown\fR or \fItri\fR to set the internal -pull-up, pull-down or tristate (off) controls. - -.TP -.B unexportall -Un-Export all the GPIO pins in the /sys/class/gpio directory. - -.TP -.B exports -Print a list (if any) of all the exported GPIO pins and their current values. - -.TP -.B export -Export a GPIO pin in the \fI/sys/class/gpio\fR directory. Use like the -mode command above however only \fIin\fR and \fIout\fR are supported at -this time. Note that the pin number is the \fBBCM_GPIO\fR number and -not the wiringPi number. - -Once a GPIO pin has been exported, the \fBgpio\fR program changes the -ownership of the \fI/sys/class/gpio/gpioX/value\fR and if present in -later kernels, the \fI/sys/class/gpio/gpioX/edge\fR pseudo files to -that of the user running the \fBgpio\fR program. This means that you -can have a small script of gpio exports to setup the gpio pins as your -program requires without the need to run anything as root, or with the -sudo command. - -.TP -.B edge -This exports a GPIO pin in the \fI/sys/class/gpio\fR directory, set -the direction to input and set the edge interrupt method to \fInone\fR, -\fIrising\fR, \fIfalling\fR or \fIboth\fR. Use like the export command -above and note that \fBBCM_GPIO\fR pin number is used not not wiringPi pin -numbering. - -Like the export commands above, ownership is set to that of the -calling user, allowing subsequent access from user programs without -requiring root/sudo. - -.TP -.B unexport -Un-Export a GPIO pin in the /sys/class/gpio directory. - -.TP -.B wfi -This set the given pin to the supplied interrupt mode: rising, falling -or both then waits for the interrupt to happen. It's a non-busy wait, -so does not consume and CPU while it's waiting. - -.TP -.B drive -group value - -Change the pad driver value for the given pad group to the supplied drive -value. Group is 0, 1 or 2 and value is 0-7. Do not use unless you are -absolutely sure you know what you're doing. - -.TP -.B pwm-bal/pwm-ms -Change the PWM mode to balanced (the default) or mark:space ratio (traditional) - -.TP -.B pwmr -Change the PWM range register. The default is 1024. - -.TP -.B load i2c [baudrate] -This loads the i2c or drivers into the kernel and changes the permissions -on the associated /dev/ entries so that the current user has access to -them. Optionally it will set the I2C baudrate to that supplied (or as -close as the Pi can manage) The default speed is 100Kb/sec. - -.TP -.B load spi [buffer size in KB] -This loads the spi drivers into the kernel and changes the permissions -on the associated /dev/ entries so that the current user has access to -them. Optionally it will set the SPI buffer size to that supplied. The -default is 4KB. - -.TP -.B gbr -channel - -This reads the analog to digital converter on the Gertboard on the given -channel. The board jumpers need to be in-place to do this operation. - -.TP -.B gbw -channel value - -This writes the supplied value to the output channel on the Gertboards -SPI digital to analogue converter. -The board jumpers need to be in-place to do this operation. - - -.SH "WiringPi vs. BCM_GPIO Pin numbering" - -.PP -.TS -c c c c l. -WiringPi GPIO-r1 GPIO-r2 P1-Phys Function -_ - 0 17 17 11 - 1 18 18 12 (PWM) - 2 21 27 13 - 3 22 22 15 - 4 23 23 16 - 5 24 24 18 - 6 25 25 22 - 7 4 4 7 - 8 0 2 3 I2C: SDA0 - 9 1 3 5 I2C: SCL0 -10 8 8 24 SPI: CE0 -11 7 7 26 SPI: CE1 -12 10 10 19 SPI: MOSI -13 9 9 21 SPI: MISO -14 11 11 23 SPI: SCLK -15 14 14 8 TxD -16 15 16 10 RxD -17 - 28 -18 - 29 -19 - 30 -20 - 31 -.TE - -Note that "r1" and "r2" above refers to the board revision. Normally -wiringPi detects the correct board revision with use for it's own -numbering scheme, but if you are using a Revision 2 board with some -of the pins which change numbers between revisions you will need -to alter your software. - -.SH FILES - -.TP 2.2i -.I gpio -executable - -.SH EXAMPLES -.TP 2.2i -gpio mode 4 output # Set pin 4 to output -.PP -gpio -g mode 23 output # Set GPIO pin 23 to output (same as WiringPi pin 4) -.PP -gpio mode 1 pwm # Set pin 1 to PWM mode -.PP -gpio pwm 1 512 # Set pin 1 to PWM value 512 - half brightness -.PP -gpio export 17 out # Set GPIO Pin 17 to output -.PP -gpio export 0 in # Set GPIO Pin 0 (SDA0) to input. -.PP -gpio -g read 0 # Read GPIO Pin 0 (SDA0) - -.SH "NOTES" - -When using the \fIexport\fR, \fIedge\fR or \fIunexport\fR commands, the -pin numbers are \fBalways\fR native BCM_GPIO numbers and never wiringPi -pin numbers. - -.SH "SEE ALSO" - -.LP -WiringPi's home page -.IP -http://wiringpi.com/ - -.SH AUTHOR - -Gordon Henderson - -.SH "REPORTING BUGS" - -Please report bugs to - -.SH COPYRIGHT - -Copyright (c) 2012-2013 Gordon Henderson -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -.SH TRADEMARKS AND ACKNOWLEDGEMENTS - -Raspberry Pi is a trademark of the Raspberry Pi Foundation. See -http://raspberrypi.org/ for full details. diff --git a/WiringPi/gpio/gpio.c b/WiringPi/gpio/gpio.c deleted file mode 100644 index 871548e..0000000 --- a/WiringPi/gpio/gpio.c +++ /dev/null @@ -1,1233 +0,0 @@ -/* - * gpio.c: - * Swiss-Army-Knife, Set-UID command-line interface to the Raspberry - * Pi's GPIO. - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "extensions.h" - -extern int wiringPiDebug ; - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - -#define VERSION "2.05" -#define I2CDETECT "/usr/sbin/i2cdetect" - -static int wpMode ; - -char *usage = "Usage: gpio -v\n" - " gpio -h\n" - " gpio [-g|-1] [-x extension:params] ...\n" - " gpio [-p] ...\n" - " gpio ...\n" - " gpio readall/reset\n" - " gpio unexportall/exports\n" - " gpio export/edge/unexport ...\n" - " gpio wfi \n" - " gpio drive \n" - " gpio pwm-bal/pwm-ms \n" - " gpio pwmr \n" - " gpio pwmc \n" - " gpio load spi/i2c\n" - " gpio i2cd/i2cdetect\n" - " gpio gbr \n" - " gpio gbw " ; // No trailing newline needed here. - - -/* - * changeOwner: - * Change the ownership of the file to the real userId of the calling - * program so we can access it. - ********************************************************************************* - */ - -static void changeOwner (char *cmd, char *file) -{ - uid_t uid = getuid () ; - uid_t gid = getgid () ; - - if (chown (file, uid, gid) != 0) - { - if (errno == ENOENT) // Warn that it's not there - fprintf (stderr, "%s: Warning: File not present: %s\n", cmd, file) ; - else - { - fprintf (stderr, "%s: Unable to change ownership of %s: %s\n", cmd, file, strerror (errno)) ; - exit (1) ; - } - } -} - - -/* - * moduleLoaded: - * Return true/false if the supplied module is loaded - ********************************************************************************* - */ - -static int moduleLoaded (char *modName) -{ - int len = strlen (modName) ; - int found = FALSE ; - FILE *fd = fopen ("/proc/modules", "r") ; - char line [80] ; - - if (fd == NULL) - { - fprintf (stderr, "gpio: Unable to check modules: %s\n", strerror (errno)) ; - exit (1) ; - } - - while (fgets (line, 80, fd) != NULL) - { - if (strncmp (line, modName, len) != 0) - continue ; - - found = TRUE ; - break ; - } - - fclose (fd) ; - - return found ; -} - - -/* - * doLoad: - * Load either the spi or i2c modules and change device ownerships, etc. - ********************************************************************************* - */ - -static void _doLoadUsage (char *argv []) -{ - fprintf (stderr, "Usage: %s load [SPI bufferSize in KB | I2C baudrate in Kb/sec]\n", argv [0]) ; - exit (1) ; -} - -static void doLoad (int argc, char *argv []) -{ - char *module1, *module2 ; - char cmd [80] ; - char *file1, *file2 ; - char args1 [32], args2 [32] ; - - if (argc < 3) - _doLoadUsage (argv) ; - - args1 [0] = args2 [0] = 0 ; - - /**/ if (strcasecmp (argv [2], "spi") == 0) - { - module1 = "spidev" ; - module2 = "spi_bcm2708" ; - file1 = "/dev/spidev0.0" ; - file2 = "/dev/spidev0.1" ; - if (argc == 4) - sprintf (args1, " bufsiz=%d", atoi (argv [3]) * 1024) ; - else if (argc > 4) - _doLoadUsage (argv) ; - } - else if (strcasecmp (argv [2], "i2c") == 0) - { - module1 = "i2c_dev" ; - module2 = "i2c_bcm2708" ; - file1 = "/dev/i2c-0" ; - file2 = "/dev/i2c-1" ; - if (argc == 4) - sprintf (args2, " baudrate=%d", atoi (argv [3]) * 1000) ; - else if (argc > 4) - _doLoadUsage (argv) ; - } - else - _doLoadUsage (argv) ; - - if (!moduleLoaded (module1)) - { - sprintf (cmd, "modprobe %s%s", module1, args1) ; - system (cmd) ; - } - - if (!moduleLoaded (module2)) - { - sprintf (cmd, "modprobe %s%s", module2, args2) ; - system (cmd) ; - } - - if (!moduleLoaded (module2)) - { - fprintf (stderr, "%s: Unable to load %s\n", argv [0], module2) ; - exit (1) ; - } - - sleep (1) ; // To let things get settled - - changeOwner (argv [0], file1) ; - changeOwner (argv [0], file2) ; -} - - -/* - * doI2Cdetect: - * Run the i2cdetect command with the right runes for this Pi revision - ********************************************************************************* - */ - -static void doI2Cdetect (int argc, char *argv []) -{ - int port = piBoardRev () == 1 ? 0 : 1 ; - char command [128] ; - struct stat statBuf ; - - if (stat (I2CDETECT, &statBuf) < 0) - { - fprintf (stderr, "%s: Unable to find i2cdetect command: %s\n", argv [0], strerror (errno)) ; - return ; - } - - if (!moduleLoaded ("i2c_dev")) - { - fprintf (stderr, "%s: The I2C kernel module(s) are not loaded.\n", argv [0]) ; - return ; - } - - sprintf (command, "%s -y %d", I2CDETECT, port) ; - if (system (command) < 0) - fprintf (stderr, "%s: Unable to run i2cdetect: %s\n", argv [0], strerror (errno)) ; - -} - - -/* - * doReadall: - * Read all the GPIO pins - ********************************************************************************* - */ - -static char *pinNames [] = -{ - "GPIO 0", "GPIO 1", "GPIO 2", "GPIO 3", "GPIO 4", "GPIO 5", "GPIO 6", "GPIO 7", - "SDA ", "SCL ", - "CE0 ", "CE1 ", "MOSI ", "MISO ", "SCLK ", - "TxD ", "RxD ", - "GPIO 8", "GPIO 9", "GPIO10", "GPIO11", -} ; - -static char *alts [] = -{ - "IN ", "OUT ", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3" -} ; - -static int wpiToPhys [64] = -{ - 11, 12, 13, 15, 16, 18, 22, 7, // 0...7 - 3, 5, // 8...9 - 24, 26, 19, 21, 23, // 10..14 - 8, 10, // 15..16 - 3, 4, 5, 6, // 17..20 - 0,0,0,0,0,0,0,0,0,0,0, // 20..31 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 32..47 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 47..63 -} ; - -static void doReadall (void) -{ - int pin ; - - printf ("+----------+-Rev%d-+------+--------+------+-------+\n", piBoardRev ()) ; - printf ("| wiringPi | GPIO | Phys | Name | Mode | Value |\n") ; - printf ("+----------+------+------+--------+------+-------+\n") ; - - for (pin = 0 ; pin < 64 ; ++pin) // Crude, but effective - { - if (wpiPinToGpio (pin) == -1) - continue ; - - printf ("| %6d | %3d | %3d | %s | %s | %s |\n", - pin, wpiPinToGpio (pin), wpiToPhys [pin], - pinNames [pin], - alts [getAlt (pin)], - digitalRead (pin) == HIGH ? "High" : "Low ") ; - } - - printf ("+----------+------+------+--------+------+-------+\n") ; -} - - -/* - * doExports: - * List all GPIO exports - ********************************************************************************* - */ - -static void doExports (int argc, char *argv []) -{ - int fd ; - int i, l, first ; - char fName [128] ; - char buf [16] ; - - for (first = 0, i = 0 ; i < 64 ; ++i) // Crude, but effective - { - -// Try to read the direction - - sprintf (fName, "/sys/class/gpio/gpio%d/direction", i) ; - if ((fd = open (fName, O_RDONLY)) == -1) - continue ; - - if (first == 0) - { - ++first ; - printf ("GPIO Pins exported:\n") ; - } - - printf ("%4d: ", i) ; - - if ((l = read (fd, buf, 16)) == 0) - sprintf (buf, "%s", "?") ; - - buf [l] = 0 ; - if ((buf [strlen (buf) - 1]) == '\n') - buf [strlen (buf) - 1] = 0 ; - - printf ("%-3s", buf) ; - - close (fd) ; - -// Try to Read the value - - sprintf (fName, "/sys/class/gpio/gpio%d/value", i) ; - if ((fd = open (fName, O_RDONLY)) == -1) - { - printf ("No Value file (huh?)\n") ; - continue ; - } - - if ((l = read (fd, buf, 16)) == 0) - sprintf (buf, "%s", "?") ; - - buf [l] = 0 ; - if ((buf [strlen (buf) - 1]) == '\n') - buf [strlen (buf) - 1] = 0 ; - - printf (" %s", buf) ; - -// Read any edge trigger file - - sprintf (fName, "/sys/class/gpio/gpio%d/edge", i) ; - if ((fd = open (fName, O_RDONLY)) == -1) - { - printf ("\n") ; - continue ; - } - - if ((l = read (fd, buf, 16)) == 0) - sprintf (buf, "%s", "?") ; - - buf [l] = 0 ; - if ((buf [strlen (buf) - 1]) == '\n') - buf [strlen (buf) - 1] = 0 ; - - printf (" %-8s\n", buf) ; - - close (fd) ; - } -} - - -/* - * doExport: - * gpio export pin mode - * This uses the /sys/class/gpio device interface. - ********************************************************************************* - */ - -void doExport (int argc, char *argv []) -{ - FILE *fd ; - int pin ; - char *mode ; - char fName [128] ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s export pin mode\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - mode = argv [3] ; - - if ((fd = fopen ("/sys/class/gpio/export", "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO export interface: %s\n", argv [0], strerror (errno)) ; - exit (1) ; - } - - fprintf (fd, "%d\n", pin) ; - fclose (fd) ; - - sprintf (fName, "/sys/class/gpio/gpio%d/direction", pin) ; - if ((fd = fopen (fName, "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO direction interface for pin %d: %s\n", argv [0], pin, strerror (errno)) ; - exit (1) ; - } - - /**/ if ((strcasecmp (mode, "in") == 0) || (strcasecmp (mode, "input") == 0)) - fprintf (fd, "in\n") ; - else if ((strcasecmp (mode, "out") == 0) || (strcasecmp (mode, "output") == 0)) - fprintf (fd, "out\n") ; - else - { - fprintf (stderr, "%s: Invalid mode: %s. Should be in or out\n", argv [1], mode) ; - exit (1) ; - } - - fclose (fd) ; - -// Change ownership so the current user can actually use it! - - sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ; - changeOwner (argv [0], fName) ; - - sprintf (fName, "/sys/class/gpio/gpio%d/edge", pin) ; - changeOwner (argv [0], fName) ; - -} - - -/* - * doWfi: - * gpio wfi pin mode - * Wait for Interrupt on a given pin. - * Slight cheat here - it's easier to actually use ISR now (which calls - * gpio to set the pin modes!) then we simply sleep, and expect the thread - * to exit the program. Crude but effective. - ********************************************************************************* - */ - -static void wfi (void) - { exit (0) ; } - -void doWfi (int argc, char *argv []) -{ - int pin, mode ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s wfi pin mode\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - /**/ if (strcasecmp (argv [3], "rising") == 0) mode = INT_EDGE_RISING ; - else if (strcasecmp (argv [3], "falling") == 0) mode = INT_EDGE_FALLING ; - else if (strcasecmp (argv [3], "both") == 0) mode = INT_EDGE_BOTH ; - else - { - fprintf (stderr, "%s: wfi: Invalid mode: %s. Should be rising, falling or both\n", argv [1], argv [3]) ; - exit (1) ; - } - - if (wiringPiISR (pin, mode, &wfi) < 0) - { - fprintf (stderr, "%s: wfi: Unable to setup ISR: %s\n", argv [1], strerror (errno)) ; - exit (1) ; - } - - for (;;) - delay (9999) ; -} - - - -/* - * doEdge: - * gpio edge pin mode - * Easy access to changing the edge trigger on a GPIO pin - * This uses the /sys/class/gpio device interface. - ********************************************************************************* - */ - -void doEdge (int argc, char *argv []) -{ - FILE *fd ; - int pin ; - char *mode ; - char fName [128] ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s edge pin mode\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - mode = argv [3] ; - -// Export the pin and set direction to input - - if ((fd = fopen ("/sys/class/gpio/export", "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO export interface: %s\n", argv [0], strerror (errno)) ; - exit (1) ; - } - - fprintf (fd, "%d\n", pin) ; - fclose (fd) ; - - sprintf (fName, "/sys/class/gpio/gpio%d/direction", pin) ; - if ((fd = fopen (fName, "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO direction interface for pin %d: %s\n", argv [0], pin, strerror (errno)) ; - exit (1) ; - } - - fprintf (fd, "in\n") ; - fclose (fd) ; - - sprintf (fName, "/sys/class/gpio/gpio%d/edge", pin) ; - if ((fd = fopen (fName, "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO edge interface for pin %d: %s\n", argv [0], pin, strerror (errno)) ; - exit (1) ; - } - - /**/ if (strcasecmp (mode, "none") == 0) fprintf (fd, "none\n") ; - else if (strcasecmp (mode, "rising") == 0) fprintf (fd, "rising\n") ; - else if (strcasecmp (mode, "falling") == 0) fprintf (fd, "falling\n") ; - else if (strcasecmp (mode, "both") == 0) fprintf (fd, "both\n") ; - else - { - fprintf (stderr, "%s: Invalid mode: %s. Should be none, rising, falling or both\n", argv [1], mode) ; - exit (1) ; - } - -// Change ownership of the value and edge files, so the current user can actually use it! - - sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ; - changeOwner (argv [0], fName) ; - - sprintf (fName, "/sys/class/gpio/gpio%d/edge", pin) ; - changeOwner (argv [0], fName) ; - - fclose (fd) ; -} - - -/* - * doUnexport: - * gpio unexport pin - * This uses the /sys/class/gpio device interface. - ********************************************************************************* - */ - -void doUnexport (int argc, char *argv []) -{ - FILE *fd ; - int pin ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s unexport pin\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - if ((fd = fopen ("/sys/class/gpio/unexport", "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO export interface\n", argv [0]) ; - exit (1) ; - } - - fprintf (fd, "%d\n", pin) ; - fclose (fd) ; -} - - -/* - * doUnexportAll: - * gpio unexportall - * Un-Export all the GPIO pins. - * This uses the /sys/class/gpio device interface. - ********************************************************************************* - */ - -void doUnexportall (char *progName) -{ - FILE *fd ; - int pin ; - - for (pin = 0 ; pin < 63 ; ++pin) - { - if ((fd = fopen ("/sys/class/gpio/unexport", "w")) == NULL) - { - fprintf (stderr, "%s: Unable to open GPIO export interface\n", progName) ; - exit (1) ; - } - fprintf (fd, "%d\n", pin) ; - fclose (fd) ; - } -} - - -/* - * doReset: - * Reset the GPIO pins - as much as we can do - ********************************************************************************* - */ - -static void doReset (char *progName) -{ - int pin ; - - doUnexportall (progName) ; - - for (pin = 0 ; pin < 64 ; ++pin) - { - if (wpiPinToGpio (pin) == -1) - continue ; - - digitalWrite (pin, LOW) ; - pinMode (pin, INPUT) ; - pullUpDnControl (pin, PUD_OFF) ; - } -} - - -/* - * doMode: - * gpio mode pin mode ... - ********************************************************************************* - */ - -void doMode (int argc, char *argv []) -{ - int pin ; - char *mode ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s mode pin mode\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - mode = argv [3] ; - - /**/ if (strcasecmp (mode, "in") == 0) pinMode (pin, INPUT) ; - else if (strcasecmp (mode, "out") == 0) pinMode (pin, OUTPUT) ; - else if (strcasecmp (mode, "pwm") == 0) pinMode (pin, PWM_OUTPUT) ; - else if (strcasecmp (mode, "clock") == 0) pinMode (pin, GPIO_CLOCK) ; - else if (strcasecmp (mode, "up") == 0) pullUpDnControl (pin, PUD_UP) ; - else if (strcasecmp (mode, "down") == 0) pullUpDnControl (pin, PUD_DOWN) ; - else if (strcasecmp (mode, "tri") == 0) pullUpDnControl (pin, PUD_OFF) ; - else - { - fprintf (stderr, "%s: Invalid mode: %s. Should be in/out/pwm/clock/up/down/tri\n", argv [1], mode) ; - exit (1) ; - } -} - - -/* - * doPadDrive: - * gpio drive group value - ********************************************************************************* - */ - -static void doPadDrive (int argc, char *argv []) -{ - int group, val ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s drive group value\n", argv [0]) ; - exit (1) ; - } - - group = atoi (argv [2]) ; - val = atoi (argv [3]) ; - - if ((group < 0) || (group > 2)) - { - fprintf (stderr, "%s: drive group not 0, 1 or 2: %d\n", argv [0], group) ; - exit (1) ; - } - - if ((val < 0) || (val > 7)) - { - fprintf (stderr, "%s: drive value not 0-7: %d\n", argv [0], val) ; - exit (1) ; - } - - setPadDrive (group, val) ; -} - - -/* - * doGbw: - * gpio gbw channel value - * Gertboard Write - To the Analog output - ********************************************************************************* - */ - -static void doGbw (int argc, char *argv []) -{ - int channel, value ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s gbw \n", argv [0]) ; - exit (1) ; - } - - channel = atoi (argv [2]) ; - value = atoi (argv [3]) ; - - if ((channel < 0) || (channel > 1)) - { - fprintf (stderr, "%s: gbw: Channel number must be 0 or 1\n", argv [0]) ; - exit (1) ; - } - - if ((value < 0) || (value > 1023)) - { - fprintf (stderr, "%s: gbw: Value must be from 0 to 255\n", argv [0]) ; - exit (1) ; - } - - if (gertboardAnalogSetup (64) < 0) - { - fprintf (stderr, "Unable to initialise the Gertboard SPI interface: %s\n", strerror (errno)) ; - exit (1) ; - } - - analogWrite (64 + channel, value) ; -} - - -/* - * doGbr: - * gpio gbr channel - * From the analog input - ********************************************************************************* - */ - -static void doGbr (int argc, char *argv []) -{ - int channel ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s gbr \n", argv [0]) ; - exit (1) ; - } - - channel = atoi (argv [2]) ; - - if ((channel < 0) || (channel > 1)) - { - fprintf (stderr, "%s: gbr: Channel number must be 0 or 1\n", argv [0]) ; - exit (1) ; - } - - if (gertboardAnalogSetup (64) < 0) - { - fprintf (stderr, "Unable to initialise the Gertboard SPI interface: %s\n", strerror (errno)) ; - exit (1) ; - } - - printf ("%d\n", analogRead (64 + channel)) ; -} - - -/* - * doWrite: - * gpio write pin value - ********************************************************************************* - */ - -static void doWrite (int argc, char *argv []) -{ - int pin, val ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s write pin value\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - /**/ if ((strcasecmp (argv [3], "up") == 0) || (strcasecmp (argv [3], "on") == 0)) - val = 1 ; - else if ((strcasecmp (argv [3], "down") == 0) || (strcasecmp (argv [3], "off") == 0)) - val = 0 ; - else - val = atoi (argv [3]) ; - - /**/ if (val == 0) - digitalWrite (pin, LOW) ; - else - digitalWrite (pin, HIGH) ; -} - - -/* - * doAwriterite: - * gpio awrite pin value - ********************************************************************************* - */ - -static void doAwrite (int argc, char *argv []) -{ - int pin, val ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s awrite pin value\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - val = atoi (argv [3]) ; - - analogWrite (pin, val) ; -} - - -/* - * doWriteByte: - * gpio write value - ********************************************************************************* - */ - -static void doWriteByte (int argc, char *argv []) -{ - int val ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s wb value\n", argv [0]) ; - exit (1) ; - } - - val = (int)strtol (argv [2], NULL, 0) ; - - digitalWriteByte (val) ; -} - - -/* - * doRead: - * Read a pin and return the value - ********************************************************************************* - */ - -void doRead (int argc, char *argv []) -{ - int pin, val ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s read pin\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - val = digitalRead (pin) ; - - printf ("%s\n", val == 0 ? "0" : "1") ; -} - - -/* - * doAread: - * Read an analog pin and return the value - ********************************************************************************* - */ - -void doAread (int argc, char *argv []) -{ - if (argc != 3) - { - fprintf (stderr, "Usage: %s aread pin\n", argv [0]) ; - exit (1) ; - } - - printf ("%d\n", analogRead (atoi (argv [2]))) ; -} - - -/* - * doToggle: - * Toggle an IO pin - ********************************************************************************* - */ - -void doToggle (int argc, char *argv []) -{ - int pin ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s toggle pin\n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - digitalWrite (pin, !digitalRead (pin)) ; -} - -/* - * doClock: - * Output a clock on a pin - ********************************************************************************* - */ - -void doClock (int argc, char *argv []) -{ - int pin, freq ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s clock \n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - freq = atoi (argv [3]) ; - - gpioClockSet (pin, freq) ; -} - - -/* - * doPwm: - * Output a PWM value on a pin - ********************************************************************************* - */ - -void doPwm (int argc, char *argv []) -{ - int pin, val ; - - if (argc != 4) - { - fprintf (stderr, "Usage: %s pwm \n", argv [0]) ; - exit (1) ; - } - - pin = atoi (argv [2]) ; - - val = atoi (argv [3]) ; - - pwmWrite (pin, val) ; -} - - -/* - * doPwmMode: doPwmRange: doPwmClock: - * Change the PWM mode, range and clock divider values - ********************************************************************************* - */ - -static void doPwmMode (int mode) -{ - pwmSetMode (mode) ; -} - -static void doPwmRange (int argc, char *argv []) -{ - unsigned int range ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s pwmr \n", argv [0]) ; - exit (1) ; - } - - range = (unsigned int)strtoul (argv [2], NULL, 10) ; - - if (range == 0) - { - fprintf (stderr, "%s: range must be > 0\n", argv [0]) ; - exit (1) ; - } - - pwmSetRange (range) ; -} - -static void doPwmClock (int argc, char *argv []) -{ - unsigned int clock ; - - if (argc != 3) - { - fprintf (stderr, "Usage: %s pwmc \n", argv [0]) ; - exit (1) ; - } - - clock = (unsigned int)strtoul (argv [2], NULL, 10) ; - - if ((clock < 1) || (clock > 4095)) - { - fprintf (stderr, "%s: clock must be between 0 and 4096\n", argv [0]) ; - exit (1) ; - } - - pwmSetClock (clock) ; -} - - -/* - * main: - * Start here - ********************************************************************************* - */ - -int main (int argc, char *argv []) -{ - int i ; - - if (getenv ("WIRINGPI_DEBUG") != NULL) - { - printf ("gpio: wiringPi debug mode enabled\n") ; - wiringPiDebug = TRUE ; - } - - if (argc == 1) - { - fprintf (stderr, "%s\n", usage) ; - return 1 ; - } - -// Help - - if (strcasecmp (argv [1], "-h") == 0) - { - printf ("%s: %s\n", argv [0], usage) ; - return 0 ; - } - -// Sort of a special: - - if (strcmp (argv [1], "-R") == 0) - { - printf ("%d\n", piBoardRev ()) ; - return 0 ; - } - -// Version & Warranty - - if (strcmp (argv [1], "-V") == 0) - { - printf ("%d\n", piBoardRev ()) ; - return 0 ; - } - - if (strcmp (argv [1], "-v") == 0) - { - printf ("gpio version: %s\n", VERSION) ; - printf ("Copyright (c) 2012-2013 Gordon Henderson\n") ; - printf ("This is free software with ABSOLUTELY NO WARRANTY.\n") ; - printf ("For details type: %s -warranty\n", argv [0]) ; - printf ("\n") ; - printf ("This Raspberry Pi is a revision %d board.\n", piBoardRev ()) ; - return 0 ; - } - - if (strcasecmp (argv [1], "-warranty") == 0) - { - printf ("gpio version: %s\n", VERSION) ; - printf ("Copyright (c) 2012-2013 Gordon Henderson\n") ; - printf ("\n") ; - printf (" This program is free software; you can redistribute it and/or modify\n") ; - printf (" it under the terms of the GNU Leser General Public License as published\n") ; - printf (" by the Free Software Foundation, either version 3 of the License, or\n") ; - printf (" (at your option) any later version.\n") ; - printf ("\n") ; - printf (" This program is distributed in the hope that it will be useful,\n") ; - printf (" but WITHOUT ANY WARRANTY; without even the implied warranty of\n") ; - printf (" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n") ; - printf (" GNU Lesser General Public License for more details.\n") ; - printf ("\n") ; - printf (" You should have received a copy of the GNU Lesser General Public License\n") ; - printf (" along with this program. If not, see .\n") ; - printf ("\n") ; - return 0 ; - } - - if (geteuid () != 0) - { - fprintf (stderr, "%s: Must be root to run. Program should be suid root. This is an error.\n", argv [0]) ; - return 1 ; - } - -// Initial test for /sys/class/gpio operations: - - /**/ if (strcasecmp (argv [1], "exports" ) == 0) { doExports (argc, argv) ; return 0 ; } - else if (strcasecmp (argv [1], "export" ) == 0) { doExport (argc, argv) ; return 0 ; } - else if (strcasecmp (argv [1], "edge" ) == 0) { doEdge (argc, argv) ; return 0 ; } - else if (strcasecmp (argv [1], "unexport" ) == 0) { doUnexport (argc, argv) ; return 0 ; } - else if (strcasecmp (argv [1], "unexportall") == 0) { doUnexportall (argv [0]) ; return 0 ; } - -// Check for load command: - - if (strcasecmp (argv [1], "load" ) == 0) { doLoad (argc, argv) ; return 0 ; } - -// Gertboard commands - - if (strcasecmp (argv [1], "gbr" ) == 0) { doGbr (argc, argv) ; return 0 ; } - if (strcasecmp (argv [1], "gbw" ) == 0) { doGbw (argc, argv) ; return 0 ; } - -// Check for -g argument - - /**/ if (strcasecmp (argv [1], "-g") == 0) - { - wiringPiSetupGpio () ; - - for (i = 2 ; i < argc ; ++i) - argv [i - 1] = argv [i] ; - --argc ; - wpMode = WPI_MODE_GPIO ; - } - -// Check for -1 argument - - else if (strcasecmp (argv [1], "-1") == 0) - { - wiringPiSetupPhys () ; - - for (i = 2 ; i < argc ; ++i) - argv [i - 1] = argv [i] ; - --argc ; - wpMode = WPI_MODE_PHYS ; - } - -// Check for -p argument for PiFace - - else if (strcasecmp (argv [1], "-p") == 0) - { - piFaceSetup (200) ; - - for (i = 2 ; i < argc ; ++i) - argv [i - 1] = argv [i] ; - --argc ; - wpMode = WPI_MODE_PIFACE ; - } - -// Default to wiringPi mode - - else - { - wiringPiSetup () ; - wpMode = WPI_MODE_PINS ; - } - -// Check for -x argument to load in a new extension - - if (strcasecmp (argv [1], "-x") == 0) - { - if (argc < 3) - { - fprintf (stderr, "%s: -x missing extension specification.\n", argv [0]) ; - exit (EXIT_FAILURE) ; - } - - if (!doExtension (argv [0], argv [2])) // Prints its own error messages - exit (EXIT_FAILURE) ; - - for (i = 3 ; i < argc ; ++i) - argv [i - 2] = argv [i] ; - argc -= 2 ; - } - - if (argc <= 1) - { - fprintf (stderr, "%s: no command given\n", argv [0]) ; - exit (EXIT_FAILURE) ; - } - -// Core wiringPi functions - - /**/ if (strcasecmp (argv [1], "mode" ) == 0) doMode (argc, argv) ; - else if (strcasecmp (argv [1], "read" ) == 0) doRead (argc, argv) ; - else if (strcasecmp (argv [1], "write" ) == 0) doWrite (argc, argv) ; - else if (strcasecmp (argv [1], "pwm" ) == 0) doPwm (argc, argv) ; - else if (strcasecmp (argv [1], "awrite" ) == 0) doAwrite (argc, argv) ; - else if (strcasecmp (argv [1], "aread" ) == 0) doAread (argc, argv) ; - -// GPIO Nicies - - else if (strcasecmp (argv [1], "toggle" ) == 0) doToggle (argc, argv) ; - -// Pi Specifics - - else if (strcasecmp (argv [1], "pwm-bal" ) == 0) doPwmMode (PWM_MODE_BAL) ; - else if (strcasecmp (argv [1], "pwm-ms" ) == 0) doPwmMode (PWM_MODE_MS) ; - else if (strcasecmp (argv [1], "pwmr" ) == 0) doPwmRange (argc, argv) ; - else if (strcasecmp (argv [1], "pwmc" ) == 0) doPwmClock (argc, argv) ; - else if (strcasecmp (argv [1], "drive" ) == 0) doPadDrive (argc, argv) ; - else if (strcasecmp (argv [1], "readall" ) == 0) doReadall () ; - else if (strcasecmp (argv [1], "i2cdetect") == 0) doI2Cdetect (argc, argv) ; - else if (strcasecmp (argv [1], "i2cd" ) == 0) doI2Cdetect (argc, argv) ; - else if (strcasecmp (argv [1], "reset" ) == 0) doReset (argv [0]) ; - else if (strcasecmp (argv [1], "wb" ) == 0) doWriteByte (argc, argv) ; - else if (strcasecmp (argv [1], "clock" ) == 0) doClock (argc, argv) ; - else if (strcasecmp (argv [1], "wfi" ) == 0) doWfi (argc, argv) ; - else - { - fprintf (stderr, "%s: Unknown command: %s.\n", argv [0], argv [1]) ; - exit (EXIT_FAILURE) ; - } - return 0 ; -} diff --git a/WiringPi/gpio/pintest b/WiringPi/gpio/pintest deleted file mode 100755 index 83ca12a..0000000 --- a/WiringPi/gpio/pintest +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# -# pintest -# Test the Pi's GPIO port -# Copyright (c) 2013 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# Wiring Compatable library for the Raspberry Pi -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - - -# logErr pin, expected got -################################################################################ - -logErr () -{ - if [ $errs = 0 ]; then - echo "" - fi - echo " --> Pin $1 failure. Expected $2, got $3" - let errs+=1 -} - - -# printErrorCount -################################################################################ - -printErrCount() -{ - if [ $errs = 0 ]; then - echo "No faults detected." - elif [ $errs = 1 ]; then - echo "One fault detected." - else - echo "$errs faults detected" - fi -} - - -# testPins start end -################################################################################ - -testPins() -{ - start=$1 - end=$2 - errs=0 - - printf "%30s %2d:%2d: " "$3" $1 $2 - -# Set range to inputs - - for i in `seq $start $end`; do - gpio mode $i in - done - -# Enable internal pull-ups and expect to read high - - for i in `seq $start $end`; do - gpio mode $i up - if [ `gpio read $i` = 0 ]; then - logErr $i 1 0 - fi - done - -# Enable internal pull-downs and expect to read low - - for i in `seq $start $end`; do - gpio mode $i down - if [ `gpio read $i` = 1 ]; then - echo "Pin $i failure - expected 0, got 1" - let errs+=1 - fi - done - -# Remove the internal pull up/downs - - for i in `seq $start $end`; do - gpio mode $i tri - done - - if [ $errs = 0 ]; then - echo " OK" - else - printErrCount - fi - - let totErrs+=errs -} - - -intro() -{ - revision=`gpio -V` - cat <. -################################################################################# - -# Simple test - assumes LEDs on Pins 0-7. - -for i in `seq 0 7`; -do - gpio mode $i out -done - -while true; -do - for i in `seq 0 7`; - do - gpio write $i 1 - sleep 0.1 - done - - for i in `seq 0 7`; - do - gpio write $i 0 - sleep 0.1 - done -done diff --git a/WiringPi/pins/Makefile b/WiringPi/pins/Makefile deleted file mode 100644 index 5e200c2..0000000 --- a/WiringPi/pins/Makefile +++ /dev/null @@ -1,18 +0,0 @@ - -SRC = pins.tex - - -all: ${SRC} - @echo Generating DVI - @latex pins.tex - -pins.dvi: pins.tex - @latex pins.tex - -pdf: pins.dvi - @dvipdf pins.dvi - - -.PHONEY: clean -clean: - @rm -f *.dvi *.aux *.log *.ps *.toc *.bak *~ diff --git a/WiringPi/pins/pins.pdf b/WiringPi/pins/pins.pdf deleted file mode 100644 index bd9629d62044179a5532a68a0eb0dbd7b3ac2dd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9833 zcmb_Cc_378*T_;MLM3a4VkqOzj4_PtJ0YQvbuhy)W|$dkk|% z*#n}Y0vO}TZgh7j285UcdPEW(PlW<{Bpe;DgLk30;?>k3G&&WJ^MV8<*WI#zAX3VE zE{_@*QrC|^a!e(%T5@JylXu>bWHlnu$mZl?UKGQuy>&wk9@W0?VRh*IEt^#Hh&z3U zf+T&_+tNE;I*N`OijJ;5S)Fa^@2y%!i#SwO9PA8NUW+UIPFwD{b$0`4HT#^B(#G*o zGgk(i&E2B@#G=DqQek44`&k~bZ0Yk_Q=fYD>5b)e6{3Rh$+gw*+w7ZJj<3cjpZltvFgXAlYnodLHi&PdDTlBufBm9nlBm)& zSK7-g90+^25%iryXgDIABx-+y9*{QWdQblR7~oES^5V8(PZM(Q6Pto2QgDUb5-_+L zTpqGx?ZcLD{@&}9&nv6F4h3QZtGmCR4t#c+<#x-{@B9THB7H}FRt8r3KFr9Pj0{#( zq>gEuDVsWo_4i_DpI_Z>>+nJK)!to~2L~+Lcd-q3$PSOd9Fq$!QN3h!1xrzrjiu5X z*3Wc0oo>j>`KbxmsG}0BHADh>t^yWYI#zqasZVbc?yfcFDJ25-Qf1|-VxSVJ7 zYd2-SPv(T7L_a&~3@knJq%oqtiNz&3`;y4kLrTY*B=)9|DatW*ttJG^BsN5n+9Rc; zjz&ul^i6buj9LEI@hlBw$Mu9H9yeXVYZb=WJ!uOK&EJ{Q7d;+j^_NH9MmgS%bzccx z?)=CRFm=`B24UCZ+QfVI=4z&xy6VGER=l3wP6_wLjv9S^M8~GyNJ{V!?j7cn#=knA z+4D%|oP)Hp(83_saO10I8lOa9YH5`O-oU^xso6u>9#|jhV0+{A1(de`jr56=t0%{0 z2;xhtb=2wb4%m*2!G`LAWaN+1NG38 zMQoJ{{U0 zvSQnWzimwUFP{s0-YWm~-Lj`0A71NjR-`zq>Gr!-;?FI$x(QK6`7BDMa907Nt}^@Z zD<$yj9$t#9XO4vL+R+M+i%2Wf=gVU?P)K?$=EJ9_0IT0|h&k$5;z-p1@;9M`wAsY}54i-54~7L8(`v?P(P0K0wX(Q>kb^}+|A=Dv*x zo{zs%O~~_FdlP^ANImDZHyf~+haVat%|eH*<=)_zD^Cb#t)QKD%T`+3#9|#$e1=*N zqG(g--N$61T|Y0&dc9E#vj5lt7xvivMD8nJSZ~{L80wCENM6N@FuVqNqU$nz zpmcd9L$&WpkAX$VF1uyAbI^qv!m|)`P^eXD@}djJk^3CPC>X;>UG^Qh@3YqF>ELpC zE0Le4)r`gTGV_qTqU{TUFCcb!Y_hwC+D#3|63VupTX8m$H`FnIKuVzyUP+3FM8Rbv z;Lwcw_%hZMh^;W)7x2UPP5Xx=yQD{2;hw| zPr@+tu>zBj8UV4e{mL%B-ICXwc+oT=`ym&fc2RcxV~jz2=*}_p?!}sS>un$0m4y~r zipsStVrx(JDX&K#C~=?G6?bDzs6U(A8XzSdm?HwwdPA7lDwJ$ro$tbVtTmqd#x7uu?C$*oMx>NV+H6n;|i$TegEai8tnVAfjwvp^LE z{nvt@ZHE;(U$}*YTa|vf)!RUs5^$zXdost>CN>Q=tX1!Koj%0E(<%$im=jLsf8PCd z+VRHZuwxY(#@EdvlyviBhwMOIs0&aQYQ=2l9Rv{_06jDL_Ik0)_E^OuILBV(r&Ik? z*^diT>vLQLnbZ@DimYqvc^y0*r7!V3-4Wd|?G!%0_k5GI1;>5fl`yfy7I$W#zGcSH zt;?wa(eN&DO_y)L&4md;lG|qUjh!iCYlyXh3#XF8YA@QL+`3ZEK<}X27Ve@TXxq%h zn6po;U#2zMvo6hmZ#y|TM2`RH1^a{ik9<-ODmqvjbqqy(cz9e}-+XfXfso-RH?5>u z{`p$YHw_N2MV46P8moHRNMj+gV=qSsZ;~5WM#A<_I6mhJKwjzcR18gZ{8afuWa0d7 z<~ZxOdf)Bd6fG&RjPpQ?qVTT`m6TypcUBZ&<8SNGPU-3^(^boHp{pb_&iEg zu_f6CyWvGOD(@+u5ck(?a9@uMY*Y@-%}ZzU~?tBUS8yO zaC^v$QoSQb;VSr!*G8Y6Q=C66yk!hjEqE4@; zq$>PRdg^lZwSA(e4CMh)vfIX=Un%pN8jpzdD?^%=`)F`SH+V6J7sn!u6NVl<+W}{f z;O(vvNo-PK1_;eFjf5H}H$RcU^qX$}7>16X%i{XiudHi9F1G zbDuNjntM7$lw%FIsFBgv)*{*C)GoG8=HI{VJH}M~ox5~x;cjBDl39WF{vsf>hn zUZ%@<{+9?_)fX4*YiDxb8l30c;vJ32L`vP{7M~!9-qWkdaJkxM{5nfJ^?)+@qFDl| z@N;W__mJ4Tr7xEqvU11q=9etOiSKfQ$7@ZYMaTEd-;}^jbWRYc4y{Fxqg#{(GSkw1 z%ugLKposC}$7hbUS{p?6mQ=pdN%IC0rf5HddE3Yt$LIN(>Q)30Utmm+57P2R`g^=8g-fek3Qo0xvxBn`y;rmqT(HA{Is#|fd zFT@)0((hiMsGmJ&jSN;)&W}tvJ7&#W#ByW(fqgj@)tyf16V}yW3nxsnK5X)~A9|7S zR_fY0US5d|UU5O$;X4x}Tu)nNKjIcMoX3i+mA?dhlK!50BRS_nzgDZC+_}uyNSSrg zn6vja)@0j?_U5|r$Mgys(mMC)$-LGeIXxJC_K|=@Oe1{$dfUhLr@nYy0$Iu`r=7+u5Ji^68O)Vv;tyXFM#U?{49(%SfYh>toIr%+Adb?kw6x zieCtMNkf(&sqvk#z|o@xKOi5Uzzkd?)F0pzd;G$udhe%*^Jp1-<%#I4M!RTtPrMQd zW?s8@-c%R$go!3vJPg+z8KXXLnKjv~`dnXU_pIcz%IKn36&&6x#+Z+Tun%ySgymOA z&$LU0nqU2wiI>`quJL4>$ho;skl**eI(bXF*sGT7l)c!8Tiw^Z15bu52s9O2AZCqc z&6n<+KkDPR)Nm}#rm>9^dPX>88}kOyW@qZ7jO7X zKiQajR)h+)jHZhoJTDh$wnlmk-KZo#<67dl5N24*0qdWA&zTg2Dex^YHR{w&`@}jh z?Fg(~wQ`)mz8Pt2{U!-q@wvYnzwOm(5)6%#>(CbQtg(K)Y;)V|I=abmPXgAFWkh5u zV6PL~l)~QrrMJgtreFHA9hT2}e`MXTfm}Uw&1tWDFx!Z{*6Gd2&i%|E*E{${{@K(X zKG8n2D%&ago}8;5Izf=OjYfF2jhz?AgNKXNQYm9A^ZUbOPw-_e<*F~0j8@&8@L6c= zroZwW343A|J!bd$?OmI^dJcEzMd}scxiiN$Zn5ca+dJB>aG}*^{hg!}2yzlphwoO8 zSDbp2hO)*_R6v)DLg@b z<>Q>?^?_+VsnS`n#1kp{1-nFIZclw15+mOzWxcEWJ@9ISy<_``71up#Dc}5=>cb=2 zb>}c&T|H(6x=MP>u4 z6;X_TVCFS{5dzavEZjdrt18t#)5OA(`~JYJu3n)BcF}yP{qS_s?pyP~sPl(zTR>_A ze<4(`hX0M1tl_qTg}aGORq`vsYgftg34UcORa~qfLyf$g64l-1r*$uO#qE*MBt9Tn z3Hi!t)*GxECSDbK^2j1AV8U{+l-mzwk2QmT9Lzy|QsqCaPgk(;>fyCNbnA3ljHA(| zYi1Ue0{T;uFZc>=lijktQlLUnYy9{EmFDO>`%!{+Z<5$0KYI*>HIvo~UcL@oD49@3 z^a^Lu<>EBiY&GgiJwL@kc6}&S?d9%#D(NNPo8iU2CqSWGlc`kZ!`E=`10yiXx4E8g z;oMR}2lsrsNX@z!fb^-o+!kN8|7=}e#=d9eGwB`^*6{1m%GjWd+18^?BeUr8I)`?V z;FX5U*SM1e$hmxm8e0+URkT&|*?j!hAdZ)ZO6t{i@1_hkK(# z7OByqu>jP0g$p%a2kjAMiWHsd@^(3v8To>V&nuZe%8gO$H93ad62*C`eD0j!7w27l zXpwRFrFm5cVea(XJCob=hquJ|9Vt;j^L6gnncu!I*O7bHNG5jw=l4nz(E$NM-Z8fd z-@cJiW-83z_x!4gR-gAVT#u}%@xsKy3v=qrn0V2f<`Z1O#RQEvrRmN#98ll9XviB= zj0dHlCstA5iHW&$GObe-#@No@}u`5 zn|(wJX7@g&6|M~X_s>OLxiWgoViVpIqA%?XU(7m+8~4k~7#ht9a6M_G?J>Cx;kO*2 zm==wi`N$1O9XQBWOHN*cw41Vr1(%;GWiD-Gsws}FX;T^l2I8_iTIbrwOb6JH&qJnX zot(>yu6;gIDWEzfN#`rXYxt3z?#*6QHhZ0w_wYU@=YrlS_m_;LY?VR*rYDQT<-5WM zTPlT*Tc3;7cO|iMVbs>V{D&@~o5$no1!V_1x@Z+x#r>U=B|go9g84^tB!sY0b(iJs zE0tb#9p*b)Y1AL+=+~y%f9!HVS0JQl!CKayFseO2mm@rFLOOk~xs!*)`DLY|W+0@R zEodg0M^E{oS8(-Y>%Gn~n`{I*uenU+!$fa|3b1;ek`~h~Y05=`nZ8U>%2kzb?HsL0 z`EKC3AZvSHvRKgYV|z|%Da8x_UFyLLC6CnzYum-rvnxk2Q;yg7+}YmLq&4|?EmlW; ze3i;5@Hq4JD=9|*?N zD85t|JPqswno%h(7I?ZX0QL%@fF(YF4$|oc(Df}gNs*`@BzhE(9QlJDYz_k2;62EZ z24yrA%^@J@r+f^QA5BJ(8z>-jQ$iXPI81b_Q!gXJHj$ls(tDYbEQ z9Esxgi^WgrP4IM_D>ws1ZniJ~V4(P~4F1{%1UO=50!6B+{S9|I+b(%&fl5M2vL!!xu67~n~McskJqx49dD0RuHl2HUGd zvKth+sW`yG*O|^RBSTf7e804~Ir~$DO*8+Z19XT40v*)j6`Aq zE21mion{MFK%yDH5C-Yre;9MWVgDB6_be3gAI|^9^XJN&68zxv2L$p1@6W$rBp}fY zZ~m!sa0_HjGL88A{(n(E!?=G}<8NcawJ0RlKQ;EhFxgb?pB7};|1Z^VTEZ0Pg$Mp= zAT2PGZQ)2L9EHL{6%dM03>IzA=+3**pz`t%K$GUe2xbrp#v#tz08eyt|9Q(;fHB7) zg#d^o;0@b-_>yXTG>M@{D6z%<+i@} zBt3BfjVAE1!fjc5CMIl0*4f?pC1=$t`^_&&4BCIwb~v`}tj%6F-lVkd{nsDmEIx+Q zwNKSvCuu)0xoA3+I6iyjLt=jDh34rPe51+C`Z~3F>{LtRvK@=T7A8%e`L5dGVKz>E zwXsVNw)*&meod@BK7UmV|`grW=eXKf8U@@io;lb82+ zo`RiMmniuo>e|_6D{J4%<9FJpI=!(sL@#wn?JKm-#<=ft`Bc;3P$U)JUE`^wn?^i; zPM(D+EK*9o!B!qss{Fk5^H!$La4x5P1}rz99>33*&phV@x8@+6aYF27{U*$A{xrPh zB31`GM+=p7(qPGqpyz$LD63VbN!YW4NR8%sSDT1 z*0-P4#;;VQzU^Y4>~8Tsy;{4iY2V~~C;bMw>n&O70rT&^%kPO$uDbHT?=e4eZYEt&I$-X(zq2LrtS)H}y{fla z>~{5==AAx3aO32n{Z428h`PFac0~(ISOQ6Ho#jl;De1vPR(yIC`UWas(a)EQZYiIT zq(5C6>p^rUsil(*Y|_#DbGzE+n_IP&2{WwUq-Gqy*9?g4+!y$*+km|FNrnDp*?GmQ zaMQG-?K(Wst7q0&%UmbKDK2U0!z-h18HdVmY@cnjulSs^uBb@rbkjV{J!D-dJ1oAa zrt(f1RZuL2mgSK{T1k+XXtt^$If1MPB=xb=A-L1+A-W17dO@-PZ; zS|Qeq4#8+C=1*s(2oIdwG14!DWYT=-bN@O3Gy^WOjbaHi=PWI!I_?06VnwRn_LqF{ ziM`k7I2ejgn79=!WS}7CQ|g$++4gzfHQzci{M_grjW44Y^|{jf?+3p1C>+q8a7g=b z{>rIrz%X{+^RWgSAd;JZms&itRuBvm_w^rG6+J?9Gu`w4_=gh{cXJwNye&2EHV>)z zxl*jIz)S5435#&$>}}?8dCvW%mY&gs;zv>y%={W&>5Vp5N%zTNhjJuicCJa?ocnrH z6U|W=7DPBCF>$p$<<+&5C##iC>t$Mo|Y!}m> zT<2D;?l}dW_9r9>^XR}&lFR%X8+Z|g-LjKpd~HmrxZzTt3K%d&{C$3yvY>lDR;!PV0cLEiJO z22rl8=Hf}L!7$UTir4q*WusrAN~V=NJ9_$`4dk_2&D5hB9#j@et!zm|b1jfRUQyDQ zAPa`vD#*W=f40=p!lAD}`D0}biv9G4TUb@C1IuB;D4M_gMl#p=yrk4HW#kg{goD1b z?LE8eQ#Wgj6MKx$#78{Ua2)VtT4VFt4iquUjDIaPH*2XsA6LJstiO`5wTbZ`8CdCe z23AoI@W#1#;^|Olyc?0M3Y)EX0)rA=Rbf^NCI}O6ZM-|tAc%^$2r{*F3G#Hoy28}e zAS&uOu*Sv1190AO!sZKT8WenZsY+;@8|z6h5CW6~yu7`@VhINXOSS)}*0Vot4#DLQR$#h%*oJ`vXuD2-&(fT(T znI^X>lbj313m{qpNI3-XYoT8cdm@DlWh{(yrufoTVa_hDNCaL%3GVEQz`&76yek|5 zUT~Z<##PY;O~7DX@xNB`{zJllSqhv0*OCWS0FIQw8s62{1y5Cl>6;lt_1!5n`i~M1 zswAg~gaJQy{$CIXw8+2TJ7~tAn^ysGluf`Qmk_7}9zN7i2&6n50e;YyNQ^QXp^QYI zPyzmi1X>%U(gweA0Dc4E|EBr_=?^Lj)e6aw8JJQDqoW0T`g1}Xr2k~X8l)dj$l@C=D)prMhVoUSg)1Pav)2l_P5+Z!x2 zadgnt0ni~~YAWC)ok%C))iz^JlSKb9AQ2fcq)ft*-Be)#a92D5=S!l))VztHdxOUN zp?(rk?Z;q~4)}}LzcJ1x2#jgaPQdSsp$38em#+UFqrcK5n0!@X{){B}k2K6UZU4-| zzk*u&-^H{HSco%%1yndAT%>iB8DWNyN1%}yGy;q;1Of(rKr}EC{~wH>?k~L=J9g5Z zb~4caG=4z-mJBOP|FWOV?;~~q6;A+9ct}MEBfI^$pcn-Oc?Bo|`V*#r0y`C(Q&93R z7#1lHp1&B^UoZufJb2Xq8w{cN4;TW$I5+=~^V8XZTaZyFaXk48WwC3TPJLH-B9#x3Fi diff --git a/WiringPi/pins/pins.tex b/WiringPi/pins/pins.tex deleted file mode 100644 index c3753e9..0000000 --- a/WiringPi/pins/pins.tex +++ /dev/null @@ -1,116 +0,0 @@ -\documentclass[12pt,a4paper]{article} -\parskip 1ex -\parindent 0em -\thispagestyle{empty} -\pagestyle{plain} -\pagenumbering{arabic} -\setlength{\topmargin}{0pt} -\setlength{\headheight}{0pt} -\setlength{\headsep}{0pt} -\setlength{\topskip}{0pt} -\setlength{\textheight}{240mm} -\setlength{\footskip}{5ex} -\setlength{\oddsidemargin}{0pt} -\setlength{\evensidemargin}{0pt} -\setlength{\textwidth}{160mm} -\usepackage[dvips]{graphics,color} -\usepackage{helvet} -\renewcommand{\familydefault}{\sfdefault} -\begin{document} -\begin{sffamily} -\definecolor{rtb-black}{rgb} {0.0, 0.0, 0.0} -\definecolor{rtb-navy}{rgb} {0.0, 0.0, 0.5} -\definecolor{rtb-green}{rgb} {0.0, 0.5, 0.0} -\definecolor{rtb-teal}{rgb} {0.0, 0.5, 0.5} -\definecolor{rtb-maroon}{rgb} {0.5, 0.0, 0.0} -\definecolor{rtb-purple}{rgb} {0.5, 0.0, 0.5} -\definecolor{rtb-olive}{rgb} {0.5, 0.5, 0.0} -\definecolor{rtb-silver}{rgb} {0.7, 0.7, 0.7} -\definecolor{rtb-grey}{rgb} {0.5, 0.5, 0.5} -\definecolor{rtb-blue}{rgb} {0.0, 0.0, 1.0} -\definecolor{rtb-lime}{rgb} {0.0, 1.0, 0.0} -\definecolor{rtb-aqua}{rgb} {0.0, 1.0, 1.0} -\definecolor{rtb-red}{rgb} {1.0, 0.0, 0.0} -\definecolor{rtb-fuchsia}{rgb}{1.0, 0.0, 1.0} -\definecolor{rtb-yellow}{rgb} {1.0, 1.0, 0.0} -\definecolor{rtb-white}{rgb} {1.0, 1.0, 1.0} - -\begin{center} -\bfseries{WiringPi: GPIO Pin Numbering Tables}\\ -\tt{http://wiringpi.com/} -\end{center} - -\begin{center} -\begin{tabular}{|c|c|c||p{8mm}|p{8mm}||c|c|c|c|} -\hline -\multicolumn{8}{|c|}{\bfseries{P1: The Main GPIO connector}}\\ -\hline -\hline -WiringPi Pin & BCM GPIO & Name & \multicolumn{2}{|c||}{Header} & Name & BCM GPIO & WiringPi Pin\\ -\hline -\hline - & & \textcolor{rtb-red}{3.3v} & \raggedleft{1} & 2 & \textcolor{rtb-maroon}{5v} & & \\ -\hline -8 & Rv1:0 - Rv2:2 & \textcolor{rtb-aqua}{SDA} & \raggedleft{3} & 4 & \textcolor{rtb-maroon}{5v} & & \\ -\hline -9 & Rv1:1 - Rv2:3 & \textcolor{rtb-aqua}{SCL} & \raggedleft{5} & 6 & \textcolor{rtb-black}{0v} & & \\ -\hline -7 & 4 & \textcolor{rtb-green}{GPIO7} & \raggedleft{7} & 8 & \textcolor{rtb-yellow}{TxD} & 14 & 15\\ -\hline - & & \textcolor{rtb-black}{0v} & \raggedleft{9} & 10 & \textcolor{rtb-yellow}{RxD} & 15 & 16\\ -\hline -0 & 17 & \textcolor{rtb-green}{GPIO0} & \raggedleft{11} & 12 & \textcolor{rtb-green}{GPIO1} & 18 & 1\\ -\hline -2 & Rv1:21 - Rv2:27 & \textcolor{rtb-green}{GPIO2} & \raggedleft{13} & 14 & \textcolor{rtb-black}{0v} & & \\ -\hline -3 & 22 & \textcolor{rtb-green}{GPIO3} & \raggedleft{15} & 16 & \textcolor{rtb-green}{GPIO4} & 23 & 4\\ -\hline - & & \textcolor{rtb-red}{3.3v} & \raggedleft{17} & 18 & \textcolor{rtb-green}{GPIO5} & 24 & 5\\ -\hline -12 & 10 & \textcolor{rtb-teal}{MOSI} & \raggedleft{19} & 20 & \textcolor{rtb-black}{0v} & & \\ -\hline -13 & 9 & \textcolor{rtb-teal}{MISO} & \raggedleft{21} & 22 & \textcolor{rtb-green}{GPIO6} & 25 & 6\\ -\hline -14 & 11 & \textcolor{rtb-teal}{SCLK} & \raggedleft{23} & 24 & \textcolor{rtb-teal}{CE0} & 8 & 10\\ -\hline - & & \textcolor{rtb-black}{0v} & \raggedleft{25} & 26 & \textcolor{rtb-teal}{CE1} & 7 & 11\\ -\hline -\hline -WiringPi Pin & BCM GPIO & Name & \multicolumn{2}{|c||}{Header} & Name & BCM GPIO & WiringPi Pin\\ -\hline -\end{tabular} -\end{center} - -Note the differences between Revision 1 and Revision 2 Raspberry -Pi's. The Revision 2 is readily identifiable by the presence of the 2 -mounting holes. - -The revision 2 Raspberry Pi has an additional GPIO connector, P5, which is next to the main P1 GPIO -connector: - -\begin{center} -\begin{tabular}{|c|c|c||p{8mm}|p{8mm}||c|c|c|c|} -\hline -\multicolumn{8}{|c|}{\bfseries{P5: Secondary GPIO connector (Rev. 2 Pi only)}}\\ -\hline -\hline -WiringPi Pin & BCM GPIO & Name & \multicolumn{2}{|c||}{Header} & Name & BCM GPIO & WiringPi Pin\\ -\hline -\hline - & & \textcolor{rtb-maroon}{5v} & \raggedleft{1} & 2 & \textcolor{rtb-red}{3.3v} & & \\ -\hline -17 & 28 & \textcolor{rtb-green}{GPIO8} & \raggedleft{3} & 4 & \textcolor{rtb-green}{GPIO9} & 29 & 18 \\ -\hline -19 & 30 & \textcolor{rtb-green}{GPIO10} & \raggedleft{5} & 6 & \textcolor{rtb-green}{GPIO11} & 31 & 20 \\ -\hline - & & \textcolor{rtb-black}{0v} & \raggedleft{7} & 8 & \textcolor{rtb-black}{0v} & & \\ -\hline -\hline -WiringPi Pin & BCM GPIO & Name & \multicolumn{2}{|c||}{Header} & Name & BCM GPIO & WiringPi Pin\\ -\hline -\end{tabular} -\end{center} - - -\end{sffamily} -\end{document} diff --git a/WiringPi/wiringPi/COPYING.LESSER b/WiringPi/wiringPi/COPYING.LESSER deleted file mode 100644 index 65c5ca8..0000000 --- a/WiringPi/wiringPi/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/WiringPi/wiringPi/Makefile b/WiringPi/wiringPi/Makefile deleted file mode 100644 index f0120bb..0000000 --- a/WiringPi/wiringPi/Makefile +++ /dev/null @@ -1,176 +0,0 @@ -# ; -# Makefile: -# wiringPi - Wiring Compatable library for the Raspberry Pi -# -# Copyright (c) 2012 Gordon Henderson -################################################################################# -# This file is part of wiringPi: -# https://projects.drogon.net/raspberry-pi/wiringpi/ -# -# wiringPi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# wiringPi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wiringPi. If not, see . -################################################################################# - -DYN_VERS_MAJ=2 -DYN_VERS_MIN=0 - -VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN) -DESTDIR=/usr -PREFIX=/local - -STATIC=libwiringPi.a -DYNAMIC=libwiringPi.so.$(VERSION) - -#DEBUG = -g -O0 -DEBUG = -O2 -CC = gcc -INCLUDE = -I. -CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC - -LIBS = - -# Should not alter anything below this line -############################################################################### - -SRC = wiringPi.c \ - wiringSerial.c wiringShift.c \ - piHiPri.c piThread.c \ - wiringPiSPI.c wiringPiI2C.c \ - softPwm.c softTone.c \ - mcp23008.c mcp23016.c mcp23017.c \ - mcp23s08.c mcp23s17.c \ - sr595.c \ - pcf8574.c pcf8591.c \ - mcp3002.c mcp4802.c mcp3422.c \ - drc.c - -OBJ = $(SRC:.c=.o) - -all: $(DYNAMIC) - -static: $(STATIC) - -$(STATIC): $(OBJ) - @echo "[Link (Static)]" - @ar rcs $(STATIC) $(OBJ) - @ranlib $(STATIC) -# @size $(STATIC) - -$(DYNAMIC): $(OBJ) - @echo "[Link (Dynamic)]" - @$(CC) -shared -Wl,-soname,libwiringPi.so -o libwiringPi.so.$(VERSION) -lpthread $(OBJ) - -.c.o: - @echo [Compile] $< - @$(CC) -c $(CFLAGS) $< -o $@ - -.PHONEY: clean -clean: - @echo "[Clean]" - @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.* - -.PHONEY: tags -tags: $(SRC) - @echo [ctags] - @ctags $(SRC) - - -.PHONEY: install-headers -install-headers: - @echo "[Install Headers]" - @install -m 0755 -d $(DESTDIR)$(PREFIX)/include - @install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp23008.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp23016.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp23017.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp23s08.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp23s17.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp3002.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp4802.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 mcp3422.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 sr595.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 pcf8574.h $(DESTDIR)$(PREFIX)/include - @install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include - -.PHONEY: install -install: $(DYNAMIC) install-headers - @echo "[Install Dynamic Lib]" - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib - @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) - @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so - @ldconfig - -.PHONEY: install-static -install-static: $(STATIC) install-headers - @echo "[Install Static Lib]" - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib - @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib - -.PHONEY: uninstall -uninstall: - @echo "[UnInstall]" - @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h - @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h - @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h - @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h - @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h - @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h - @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp23008.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp23016.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp23017.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s08.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s17.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp3002.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp4802.h - @rm -f $(DESTDIR)$(PREFIX)/include/mcp3422.h - @rm -f $(DESTDIR)$(PREFIX)/include/sr595.h - @rm -f $(DESTDIR)$(PREFIX)/include/pcf8574.h - @rm -f $(DESTDIR)$(PREFIX)/include/pcf8591.h - @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.* - @ldconfig - - -.PHONEY: depend -depend: - makedepend -Y $(SRC) $(SRC_I2C) - -# DO NOT DELETE - -wiringPi.o: wiringPi.h -wiringSerial.o: wiringSerial.h -wiringShift.o: wiringPi.h wiringShift.h -piHiPri.o: wiringPi.h -piThread.o: wiringPi.h -wiringPiSPI.o: wiringPi.h wiringPiSPI.h -wiringPiI2C.o: wiringPi.h wiringPiI2C.h -softPwm.o: wiringPi.h softPwm.h -softTone.o: wiringPi.h softTone.h -mcp23008.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23008.h -mcp23016.o: wiringPi.h wiringPiI2C.h mcp23016.h mcp23016reg.h -mcp23017.o: wiringPi.h wiringPiI2C.h mcp23x0817.h mcp23017.h -mcp23s08.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s08.h -mcp23s17.o: wiringPi.h wiringPiSPI.h mcp23x0817.h mcp23s17.h -sr595.o: wiringPi.h sr595.h -pcf8574.o: wiringPi.h wiringPiI2C.h pcf8574.h -pcf8591.o: wiringPi.h wiringPiI2C.h pcf8591.h -mcp3002.o: wiringPi.h wiringPiSPI.h mcp3002.h -mcp4802.o: wiringPi.h wiringPiSPI.h mcp4802.h -mcp3422.o: wiringPi.h wiringPiI2C.h mcp3422.h -drc.o: wiringPi.h wiringSerial.h drc.h diff --git a/WiringPi/wiringPi/drc.c b/WiringPi/wiringPi/drc.c deleted file mode 100644 index 07baf17..0000000 --- a/WiringPi/wiringPi/drc.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * drc.c: - * Extend wiringPi with the DRC control protocll to Arduino - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include - -#include "wiringPi.h" -#include "wiringSerial.h" - -#include "drc.h" - -#ifndef TRUE -# define TRUE (1==1) -# define FALSE (1==2) -#endif - - -/* - * myPinMode: - * Change the pin mode on the remote DRC device - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - /**/ if (mode == OUTPUT) - serialPutchar (node->fd, 'o') ; // Input - else if (mode == PWM_OUTPUT) - serialPutchar (node->fd, 'p') ; // PWM - else - serialPutchar (node->fd, 'i') ; // Default to input - - serialPutchar (node->fd, pin - node->pinBase) ; -} - - -/* - * myPullUpDnControl: - * ATmegas only have pull-up's on of off. No pull-downs. - ********************************************************************************* - */ - -static void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int mode) -{ - -// Force pin into input mode - - serialPutchar (node->fd, 'i' ) ; - serialPutchar (node->fd, pin) ; - - /**/ if (mode == PUD_UP) - { - serialPutchar (node->fd, '1') ; - serialPutchar (node->fd, pin - node->pinBase) ; - } - else if (mode == PUD_OFF) - { - serialPutchar (node->fd, '0') ; - serialPutchar (node->fd, pin - node->pinBase) ; - } -} - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - serialPutchar (node->fd, value == 0 ? '0' : '1') ; - serialPutchar (node->fd, pin - node->pinBase) ; -} - - -/* - * myPwmWrite: - ********************************************************************************* - */ - -static void myPwmWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - serialPutchar (node->fd, 'v') ; - serialPutchar (node->fd, pin - node->pinBase) ; - serialPutchar (node->fd, value & 0xFF) ; -} - - -/* - * myAnalogRead: - ********************************************************************************* - */ - -static int myAnalogRead (struct wiringPiNodeStruct *node, int pin) -{ - int vHi, vLo ; - - serialPutchar (node->fd, 'a') ; - serialPutchar (node->fd, pin - node->pinBase) ; - vHi = serialGetchar (node->fd) ; - vLo = serialGetchar (node->fd) ; - - return (vHi << 8) | vLo ; -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - serialPutchar (node->fd, 'r') ; // Send read command - serialPutchar (node->fd, pin - node->pinBase) ; - return (serialGetchar (node->fd) == '0') ? 0 : 1 ; -} - - -/* - * drcSetup: - * Create a new instance of an DRC GPIO interface. - * Could be a variable nunber of pins here - we might not know in advance - * if it's an ATmega with 14 pins, or something with less or more! - ********************************************************************************* - */ - -int drcSetup (const int pinBase, const int numPins, const char *device) -{ - int fd ; - int ok, tries ; - time_t then ; - struct wiringPiNodeStruct *node ; - - if ((fd = serialOpen (device, 115200)) < 0) - return wiringPiFailure (WPI_ALMOST, "Unable to open DRC device (%s): %s", device, strerror (errno)) ; - - delay (10) ; // May need longer if it's an Uno that reboots on the open... - -// Flush any pending input - - while (serialDataAvail (fd)) - (void)serialGetchar (fd) ; - - ok = FALSE ; - for (tries = 1 ; tries < 5 ; ++tries) - { - serialPutchar (fd, '@') ; - then = time (NULL) + 2 ; - while (time (NULL) < then) - if (serialDataAvail (fd)) - { - if (serialGetchar (fd) == '@') - { - ok = TRUE ; - break ; - } - } - if (ok) - break ; - } - - if (!ok) - { - serialClose (fd) ; - return wiringPiFailure (WPI_FATAL, "Unable to communidate with DRC device") ; - } - - node = wiringPiNewNode (pinBase, numPins) ; - - node->fd = fd ; - node->pinMode = myPinMode ; - node->pullUpDnControl = myPullUpDnControl ; - node->analogRead = myAnalogRead ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->pwmWrite = myPwmWrite ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/drc.h b/WiringPi/wiringPi/drc.h deleted file mode 100644 index c2c4ff3..0000000 --- a/WiringPi/wiringPi/drc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * drc.h: - * Extend wiringPi with the DRC control protocll to Arduino - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -int drcSetup (const int pinBase, const int numPins, const char *device) ; - - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/max31855.c b/WiringPi/wiringPi/max31855.c deleted file mode 100644 index 2185839..0000000 --- a/WiringPi/wiringPi/max31855.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * max31855.c: - * Extend wiringPi with the max31855 SPI Analog to Digital convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "max31855.h" - -/* - * myAnalogRead: - * Return the analog value of the given pin - * Note: The chip really only has one read "channel", but we're faking it - * here so we can read the error registers. Channel 0 will be the data - * channel, and 1 is the error register code. - * Note: Temperature returned is temp in C * 4, so divide result by 4 - ********************************************************************************* - */ - -static int myAnalogRead (struct wiringPiNodeStruct *node, int pin) -{ - unsigned int spiData ; - int temp ; - int chan = pin - node->pinBase ; - - wiringPiSPIDataRW (node->fd, (unsigned char *)&spiData, 4) ; - - if (chan == 0) // Read temp in C - { - spiData >>= 18 ; - temp = spiData & 0x3FFF ; // Bottom 13 bits - if ((spiData & 0x2000) != 0) // Negative - temp = -temp ; - return temp ; - } - else // Return error bits - return spiData & 0x7 ; -} - - -/* - * max31855Setup: - * Create a new wiringPi device node for an max31855 on the Pi's - * SPI interface. - ********************************************************************************* - */ - -int max31855Setup (const int pinBase, int spiChannel) -{ - struct wiringPiNodeStruct *node ; - - if (wiringPiSPISetup (spiChannel, 5000000) < 0) // 5MHz - prob 4 on the Pi - return -1 ; - - node = wiringPiNewNode (pinBase, 2) ; - - node->fd = spiChannel ; - node->analogRead = myAnalogRead ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/max31855.h b/WiringPi/wiringPi/max31855.h deleted file mode 100644 index 385c4bd..0000000 --- a/WiringPi/wiringPi/max31855.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * max31855.c: - * Extend wiringPi with the MAX31855 SPI Thermocouple driver - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int max31855Setup (int pinBase, int spiChannel) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/max5322.c b/WiringPi/wiringPi/max5322.c deleted file mode 100644 index b7cd6a9..0000000 --- a/WiringPi/wiringPi/max5322.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * max5322.c: - * Extend wiringPi with the MAX5322 SPI Digital to Analog convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "max5322.h" - -/* - * myAnalogWrite: - * Write analog value on the given pin - ********************************************************************************* - */ - -static void myAnalogWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - unsigned char spiData [2] ; - unsigned char chanBits, dataBits ; - int chan = pin - node->pinBase ; - - if (chan == 0) - chanBits = 0b01000000 ; - else - chanBits = 0b01010000 ; - - chanBits |= ((value >> 12) & 0x0F) ; - dataBits = ((value ) & 0xFF) ; - - spiData [0] = chanBits ; - spiData [1] = dataBits ; - - wiringPiSPIDataRW (node->fd, spiData, 2) ; -} - -/* - * max5322Setup: - * Create a new wiringPi device node for an max5322 on the Pi's - * SPI interface. - ********************************************************************************* - */ - -int max5322Setup (const int pinBase, int spiChannel) -{ - struct wiringPiNodeStruct *node ; - unsigned char spiData [2] ; - - if (wiringPiSPISetup (spiChannel, 8000000) < 0) // 10MHz Max - return -1 ; - - node = wiringPiNewNode (pinBase, 2) ; - - node->fd = spiChannel ; - node->analogWrite = myAnalogWrite ; - -// Enable both DACs - - spiData [0] = 0b11100000 ; - spiData [1] = 0 ; - - wiringPiSPIDataRW (node->fd, spiData, 2) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/max5322.h b/WiringPi/wiringPi/max5322.h deleted file mode 100644 index a217cf8..0000000 --- a/WiringPi/wiringPi/max5322.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * max5322.h: - * Extend wiringPi with the MAX5322 SPI Digital to Analog convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int max5322Setup (int pinBase, int spiChannel) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp23008.c b/WiringPi/wiringPi/mcp23008.c deleted file mode 100644 index d21d237..0000000 --- a/WiringPi/wiringPi/mcp23008.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * mcp23008.c: - * Extend wiringPi with the MCP 23008 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "wiringPiI2C.h" -#include "mcp23x0817.h" - -#include "mcp23008.h" - - -/* - * myPinMode: - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - reg = MCP23x08_IODIR ; - mask = 1 << (pin - node->pinBase) ; - old = wiringPiI2CReadReg8 (node->fd, reg) ; - - if (mode == OUTPUT) - old &= (~mask) ; - else - old |= mask ; - - wiringPiI2CWriteReg8 (node->fd, reg, old) ; -} - - -/* - * myPullUpDnControl: - ********************************************************************************* - */ - -static void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - reg = MCP23x08_GPPU ; - mask = 1 << (pin - node->pinBase) ; - - old = wiringPiI2CReadReg8 (node->fd, reg) ; - - if (mode == PUD_UP) - old |= mask ; - else - old &= (~mask) ; - - wiringPiI2CWriteReg8 (node->fd, reg, old) ; -} - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int bit, old ; - - bit = 1 << ((pin - node->pinBase) & 7) ; - - old = node->data2 ; - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - wiringPiI2CWriteReg8 (node->fd, MCP23x08_GPIO, old) ; - node->data2 = old ; -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - int mask, value ; - - mask = 1 << ((pin - node->pinBase) & 7) ; - value = wiringPiI2CReadReg8 (node->fd, MCP23x08_GPIO) ; - - if ((value & mask) == 0) - return LOW ; - else - return HIGH ; -} - - -/* - * mcp23008Setup: - * Create a new instance of an MCP23008 I2C GPIO interface. We know it - * has 8 pins, so all we need to know here is the I2C address and the - * user-defined pin base. - ********************************************************************************* - */ - -int mcp23008Setup (const int pinBase, const int i2cAddress) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (i2cAddress)) < 0) - return fd ; - - wiringPiI2CWriteReg8 (fd, MCP23x08_IOCON, IOCON_INIT) ; - - node = wiringPiNewNode (pinBase, 8) ; - - node->fd = fd ; - node->pinMode = myPinMode ; - node->pullUpDnControl = myPullUpDnControl ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->data2 = wiringPiI2CReadReg8 (fd, MCP23x08_OLAT) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp23008.h b/WiringPi/wiringPi/mcp23008.h deleted file mode 100644 index e9299a8..0000000 --- a/WiringPi/wiringPi/mcp23008.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 23008.h: - * Extend wiringPi with the MCP 23008 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp23008Setup (const int pinBase, const int i2cAddress) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp23016.c b/WiringPi/wiringPi/mcp23016.c deleted file mode 100644 index e5cc632..0000000 --- a/WiringPi/wiringPi/mcp23016.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * mcp23016.c: - * Extend wiringPi with the MCP 23016 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "wiringPiI2C.h" -#include "mcp23016.h" - -#include "mcp23016reg.h" - - -/* - * myPinMode: - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - reg = MCP23016_IODIR0 ; - else - { - reg = MCP23016_IODIR1 ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - old = wiringPiI2CReadReg8 (node->fd, reg) ; - - if (mode == OUTPUT) - old &= (~mask) ; - else - old |= mask ; - - wiringPiI2CWriteReg8 (node->fd, reg, old) ; -} - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int bit, old ; - - pin -= node->pinBase ; // Pin now 0-15 - - bit = 1 << (pin & 7) ; - - if (pin < 8) // Bank A - { - old = node->data2 ; - - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - wiringPiI2CWriteReg8 (node->fd, MCP23016_GP0, old) ; - node->data2 = old ; - } - else // Bank B - { - old = node->data3 ; - - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - wiringPiI2CWriteReg8 (node->fd, MCP23016_GP1, old) ; - node->data3 = old ; - } -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - int mask, value, gpio ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - gpio = MCP23016_GP0 ; - else - { - gpio = MCP23016_GP1 ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - value = wiringPiI2CReadReg8 (node->fd, gpio) ; - - if ((value & mask) == 0) - return LOW ; - else - return HIGH ; -} - - -/* - * mcp23016Setup: - * Create a new instance of an MCP23016 I2C GPIO interface. We know it - * has 16 pins, so all we need to know here is the I2C address and the - * user-defined pin base. - ********************************************************************************* - */ - -int mcp23016Setup (const int pinBase, const int i2cAddress) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (i2cAddress)) < 0) - return fd ; - - wiringPiI2CWriteReg8 (fd, MCP23016_IOCON0, IOCON_INIT) ; - wiringPiI2CWriteReg8 (fd, MCP23016_IOCON1, IOCON_INIT) ; - - node = wiringPiNewNode (pinBase, 16) ; - - node->fd = fd ; - node->pinMode = myPinMode ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->data2 = wiringPiI2CReadReg8 (fd, MCP23016_OLAT0) ; - node->data3 = wiringPiI2CReadReg8 (fd, MCP23016_OLAT1) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp23016.h b/WiringPi/wiringPi/mcp23016.h deleted file mode 100644 index f9b5cc5..0000000 --- a/WiringPi/wiringPi/mcp23016.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * mcp23016.h: - * Extend wiringPi with the MCP 23016 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp23016Setup (const int pinBase, const int i2cAddress) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp23016reg.h b/WiringPi/wiringPi/mcp23016reg.h deleted file mode 100644 index 9aea92d..0000000 --- a/WiringPi/wiringPi/mcp23016reg.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * mcp23016: - * Copyright (c) 2012-2013 Gordon Henderson - * - * Header file for code using the MCP23016 GPIO expander - * chip. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -// MCP23016 Registers - -#define MCP23016_GP0 0x00 -#define MCP23016_GP1 0x01 -#define MCP23016_OLAT0 0x02 -#define MCP23016_OLAT1 0x03 -#define MCP23016_IPOL0 0x04 -#define MCP23016_IPOL1 0x05 -#define MCP23016_IODIR0 0x06 -#define MCP23016_IODIR1 0x07 -#define MCP23016_INTCAP0 0x08 -#define MCP23016_INTCAP1 0x09 -#define MCP23016_IOCON0 0x0A -#define MCP23016_IOCON1 0x0B - -// Bits in the IOCON register - -#define IOCON_IARES 0x01 - -// Default initialisation mode - -#define IOCON_INIT 0 diff --git a/WiringPi/wiringPi/mcp23017.c b/WiringPi/wiringPi/mcp23017.c deleted file mode 100644 index 5174195..0000000 --- a/WiringPi/wiringPi/mcp23017.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * mcp23017.c: - * Extend wiringPi with the MCP 23017 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "wiringPiI2C.h" -#include "mcp23x0817.h" - -#include "mcp23017.h" - - -/* - * myPinMode: - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - reg = MCP23x17_IODIRA ; - else - { - reg = MCP23x17_IODIRB ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - old = wiringPiI2CReadReg8 (node->fd, reg) ; - - if (mode == OUTPUT) - old &= (~mask) ; - else - old |= mask ; - - wiringPiI2CWriteReg8 (node->fd, reg, old) ; -} - - -/* - * myPullUpDnControl: - ********************************************************************************* - */ - -static void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - reg = MCP23x17_GPPUA ; - else - { - reg = MCP23x17_GPPUB ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - old = wiringPiI2CReadReg8 (node->fd, reg) ; - - if (mode == PUD_UP) - old |= mask ; - else - old &= (~mask) ; - - wiringPiI2CWriteReg8 (node->fd, reg, old) ; -} - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int bit, old ; - - pin -= node->pinBase ; // Pin now 0-15 - - bit = 1 << (pin & 7) ; - - if (pin < 8) // Bank A - { - old = node->data2 ; - - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - wiringPiI2CWriteReg8 (node->fd, MCP23x17_GPIOA, old) ; - node->data2 = old ; - } - else // Bank B - { - old = node->data3 ; - - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - wiringPiI2CWriteReg8 (node->fd, MCP23x17_GPIOB, old) ; - node->data3 = old ; - } -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - int mask, value, gpio ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - gpio = MCP23x17_GPIOA ; - else - { - gpio = MCP23x17_GPIOB ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - value = wiringPiI2CReadReg8 (node->fd, gpio) ; - - if ((value & mask) == 0) - return LOW ; - else - return HIGH ; -} - - -/* - * mcp23017Setup: - * Create a new instance of an MCP23017 I2C GPIO interface. We know it - * has 16 pins, so all we need to know here is the I2C address and the - * user-defined pin base. - ********************************************************************************* - */ - -int mcp23017Setup (const int pinBase, const int i2cAddress) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (i2cAddress)) < 0) - return fd ; - - wiringPiI2CWriteReg8 (fd, MCP23x17_IOCON, IOCON_INIT) ; - - node = wiringPiNewNode (pinBase, 16) ; - - node->fd = fd ; - node->pinMode = myPinMode ; - node->pullUpDnControl = myPullUpDnControl ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->data2 = wiringPiI2CReadReg8 (fd, MCP23x17_OLATA) ; - node->data3 = wiringPiI2CReadReg8 (fd, MCP23x17_OLATB) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp23017.h b/WiringPi/wiringPi/mcp23017.h deleted file mode 100644 index 79b4d7b..0000000 --- a/WiringPi/wiringPi/mcp23017.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 23017.h: - * Extend wiringPi with the MCP 23017 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp23017Setup (const int pinBase, const int i2cAddress) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp23s08.c b/WiringPi/wiringPi/mcp23s08.c deleted file mode 100644 index d0acb5e..0000000 --- a/WiringPi/wiringPi/mcp23s08.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * mcp23s08.c: - * Extend wiringPi with the MCP 23s08 SPI GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "wiringPiSPI.h" -#include "mcp23x0817.h" - -#include "mcp23s08.h" - -#define MCP_SPEED 4000000 - - - -/* - * writeByte: - * Write a byte to a register on the MCP23s08 on the SPI bus. - ********************************************************************************* - */ - -static void writeByte (uint8_t spiPort, uint8_t devId, uint8_t reg, uint8_t data) -{ - uint8_t spiData [4] ; - - spiData [0] = CMD_WRITE | ((devId & 7) << 1) ; - spiData [1] = reg ; - spiData [2] = data ; - - wiringPiSPIDataRW (spiPort, spiData, 3) ; -} - -/* - * readByte: - * Read a byte from a register on the MCP23s08 on the SPI bus. - ********************************************************************************* - */ - -static uint8_t readByte (uint8_t spiPort, uint8_t devId, uint8_t reg) -{ - uint8_t spiData [4] ; - - spiData [0] = CMD_READ | ((devId & 7) << 1) ; - spiData [1] = reg ; - - wiringPiSPIDataRW (spiPort, spiData, 3) ; - - return spiData [2] ; -} - - -/* - * myPinMode: - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - reg = MCP23x08_IODIR ; - mask = 1 << (pin - node->pinBase) ; - old = readByte (node->data0, node->data1, reg) ; - - if (mode == OUTPUT) - old &= (~mask) ; - else - old |= mask ; - - writeByte (node->data0, node->data1, reg, old) ; -} - - -/* - * myPullUpDnControl: - ********************************************************************************* - */ - -static void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - reg = MCP23x08_GPPU ; - mask = 1 << (pin - node->pinBase) ; - - old = readByte (node->data0, node->data1, reg) ; - - if (mode == PUD_UP) - old |= mask ; - else - old &= (~mask) ; - - writeByte (node->data0, node->data1, reg, old) ; -} - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int bit, old ; - - bit = 1 << ((pin - node->pinBase) & 7) ; - - old = node->data2 ; - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - writeByte (node->data0, node->data1, MCP23x08_GPIO, old) ; - node->data2 = old ; -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - int mask, value ; - - mask = 1 << ((pin - node->pinBase) & 7) ; - value = readByte (node->data0, node->data1, MCP23x08_GPIO) ; - - if ((value & mask) == 0) - return LOW ; - else - return HIGH ; -} - - -/* - * mcp23s08Setup: - * Create a new instance of an MCP23s08 SPI GPIO interface. We know it - * has 8 pins, so all we need to know here is the SPI address and the - * user-defined pin base. - ********************************************************************************* - */ - -int mcp23s08Setup (const int pinBase, const int spiPort, const int devId) -{ - int x ; - struct wiringPiNodeStruct *node ; - - if ((x = wiringPiSPISetup (spiPort, MCP_SPEED)) < 0) - return x ; - - writeByte (spiPort, devId, MCP23x08_IOCON, IOCON_INIT) ; - - node = wiringPiNewNode (pinBase, 8) ; - - node->data0 = spiPort ; - node->data1 = devId ; - node->pinMode = myPinMode ; - node->pullUpDnControl = myPullUpDnControl ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->data2 = readByte (spiPort, devId, MCP23x08_OLAT) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp23s08.h b/WiringPi/wiringPi/mcp23s08.h deleted file mode 100644 index ebf93d1..0000000 --- a/WiringPi/wiringPi/mcp23s08.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 23s08.h: - * Extend wiringPi with the MCP 23s08 SPI GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp23s08Setup (const int pinBase, const int spiPort, const int devId) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp23s17.c b/WiringPi/wiringPi/mcp23s17.c deleted file mode 100644 index c2d1be3..0000000 --- a/WiringPi/wiringPi/mcp23s17.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * mcp23s17.c: - * Extend wiringPi with the MCP 23s17 SPI GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "wiringPiSPI.h" -#include "mcp23x0817.h" - -#include "mcp23s17.h" - -#define MCP_SPEED 4000000 - - - -/* - * writeByte: - * Write a byte to a register on the MCP23s17 on the SPI bus. - ********************************************************************************* - */ - -static void writeByte (uint8_t spiPort, uint8_t devId, uint8_t reg, uint8_t data) -{ - uint8_t spiData [4] ; - - spiData [0] = CMD_WRITE | ((devId & 7) << 1) ; - spiData [1] = reg ; - spiData [2] = data ; - - wiringPiSPIDataRW (spiPort, spiData, 3) ; -} - -/* - * readByte: - * Read a byte from a register on the MCP23s17 on the SPI bus. - ********************************************************************************* - */ - -static uint8_t readByte (uint8_t spiPort, uint8_t devId, uint8_t reg) -{ - uint8_t spiData [4] ; - - spiData [0] = CMD_READ | ((devId & 7) << 1) ; - spiData [1] = reg ; - - wiringPiSPIDataRW (spiPort, spiData, 3) ; - - return spiData [2] ; -} - - -/* - * myPinMode: - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - reg = MCP23x17_IODIRA ; - else - { - reg = MCP23x17_IODIRB ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - old = readByte (node->data0, node->data1, reg) ; - - if (mode == OUTPUT) - old &= (~mask) ; - else - old |= mask ; - - writeByte (node->data0, node->data1, reg, old) ; -} - - -/* - * myPullUpDnControl: - ********************************************************************************* - */ - -static void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int mask, old, reg ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - reg = MCP23x17_GPPUA ; - else - { - reg = MCP23x17_GPPUB ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - old = readByte (node->data0, node->data1, reg) ; - - if (mode == PUD_UP) - old |= mask ; - else - old &= (~mask) ; - - writeByte (node->data0, node->data1, reg, old) ; -} - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int bit, old ; - - pin -= node->pinBase ; // Pin now 0-15 - - bit = 1 << (pin & 7) ; - - if (pin < 8) // Bank A - { - old = node->data2 ; - - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - writeByte (node->data0, node->data1, MCP23x17_GPIOA, old) ; - node->data2 = old ; - } - else // Bank B - { - old = node->data3 ; - - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - writeByte (node->data0, node->data1, MCP23x17_GPIOB, old) ; - node->data3 = old ; - } -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - int mask, value, gpio ; - - pin -= node->pinBase ; - - if (pin < 8) // Bank A - gpio = MCP23x17_GPIOA ; - else - { - gpio = MCP23x17_GPIOB ; - pin &= 0x07 ; - } - - mask = 1 << pin ; - value = readByte (node->data0, node->data1, gpio) ; - - if ((value & mask) == 0) - return LOW ; - else - return HIGH ; -} - - -/* - * mcp23s17Setup: - * Create a new instance of an MCP23s17 SPI GPIO interface. We know it - * has 16 pins, so all we need to know here is the SPI address and the - * user-defined pin base. - ********************************************************************************* - */ - -int mcp23s17Setup (const int pinBase, const int spiPort, const int devId) -{ - int x ; - struct wiringPiNodeStruct *node ; - - if ((x = wiringPiSPISetup (spiPort, MCP_SPEED)) < 0) - return x ; - - writeByte (spiPort, devId, MCP23x17_IOCON, IOCON_INIT | IOCON_HAEN) ; - writeByte (spiPort, devId, MCP23x17_IOCONB, IOCON_INIT | IOCON_HAEN) ; - - node = wiringPiNewNode (pinBase, 16) ; - - node->data0 = spiPort ; - node->data1 = devId ; - node->pinMode = myPinMode ; - node->pullUpDnControl = myPullUpDnControl ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->data2 = readByte (spiPort, devId, MCP23x17_OLATA) ; - node->data3 = readByte (spiPort, devId, MCP23x17_OLATB) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp23s17.h b/WiringPi/wiringPi/mcp23s17.h deleted file mode 100644 index 3b2a808..0000000 --- a/WiringPi/wiringPi/mcp23s17.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 23s17.h: - * Extend wiringPi with the MCP 23s17 SPI GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp23s17Setup (int pinBase, int spiPort, int devId) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp23x08.h b/WiringPi/wiringPi/mcp23x08.h deleted file mode 100644 index c4e6b27..0000000 --- a/WiringPi/wiringPi/mcp23x08.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * mcp23x17: - * Copyright (c) 2012-2013 Gordon Henderson - * - * Header file for code using the MCP23x17 GPIO expander chip. - * This comes in 2 flavours: MCP23017 which has an I2C interface, - * an the MXP23S17 which has an SPI interface. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - - -// MCP23x17 Registers - -#define IODIRA 0x00 -#define IPOLA 0x02 -#define GPINTENA 0x04 -#define DEFVALA 0x06 -#define INTCONA 0x08 -#define IOCON 0x0A -#define GPPUA 0x0C -#define INTFA 0x0E -#define INTCAPA 0x10 -#define GPIOA 0x12 -#define OLATA 0x14 - -#define IODIRB 0x01 -#define IPOLB 0x03 -#define GPINTENB 0x05 -#define DEFVALB 0x07 -#define INTCONB 0x09 -#define IOCONB 0x0B -#define GPPUB 0x0D -#define INTFB 0x0F -#define INTCAPB 0x11 -#define GPIOB 0x13 -#define OLATB 0x15 - -// Bits in the IOCON register - -#define IOCON_UNUSED 0x01 -#define IOCON_INTPOL 0x02 -#define IOCON_ODR 0x04 -#define IOCON_HAEN 0x08 -#define IOCON_DISSLW 0x10 -#define IOCON_SEQOP 0x20 -#define IOCON_MIRROR 0x40 -#define IOCON_BANK_MODE 0x80 - -// Default initialisation mode - -#define IOCON_INIT (IOCON_SEQOP) - -// SPI Command codes - -#define CMD_WRITE 0x40 -#define CMD_READ 0x41 diff --git a/WiringPi/wiringPi/mcp23x0817.h b/WiringPi/wiringPi/mcp23x0817.h deleted file mode 100644 index 58bc038..0000000 --- a/WiringPi/wiringPi/mcp23x0817.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * mcp23xxx: - * Copyright (c) 2012-2013 Gordon Henderson - * - * Header file for code using the MCP23x08 and 17 GPIO expander - * chips. - * This comes in 2 flavours: MCP230xx (08/17) which has an I2C - * interface, and the MXP23Sxx (08/17) which has an SPI interface. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -// MCP23x08 Registers - -#define MCP23x08_IODIR 0x00 -#define MCP23x08_IPOL 0x01 -#define MCP23x08_GPINTEN 0x02 -#define MCP23x08_DEFVAL 0x03 -#define MCP23x08_INTCON 0x04 -#define MCP23x08_IOCON 0x05 -#define MCP23x08_GPPU 0x06 -#define MCP23x08_INTF 0x07 -#define MCP23x08_INTCAP 0x08 -#define MCP23x08_GPIO 0x09 -#define MCP23x08_OLAT 0x0A - -// MCP23x17 Registers - -#define MCP23x17_IODIRA 0x00 -#define MCP23x17_IPOLA 0x02 -#define MCP23x17_GPINTENA 0x04 -#define MCP23x17_DEFVALA 0x06 -#define MCP23x17_INTCONA 0x08 -#define MCP23x17_IOCON 0x0A -#define MCP23x17_GPPUA 0x0C -#define MCP23x17_INTFA 0x0E -#define MCP23x17_INTCAPA 0x10 -#define MCP23x17_GPIOA 0x12 -#define MCP23x17_OLATA 0x14 - -#define MCP23x17_IODIRB 0x01 -#define MCP23x17_IPOLB 0x03 -#define MCP23x17_GPINTENB 0x05 -#define MCP23x17_DEFVALB 0x07 -#define MCP23x17_INTCONB 0x09 -#define MCP23x17_IOCONB 0x0B -#define MCP23x17_GPPUB 0x0D -#define MCP23x17_INTFB 0x0F -#define MCP23x17_INTCAPB 0x11 -#define MCP23x17_GPIOB 0x13 -#define MCP23x17_OLATB 0x15 - -// Bits in the IOCON register - -#define IOCON_UNUSED 0x01 -#define IOCON_INTPOL 0x02 -#define IOCON_ODR 0x04 -#define IOCON_HAEN 0x08 -#define IOCON_DISSLW 0x10 -#define IOCON_SEQOP 0x20 -#define IOCON_MIRROR 0x40 -#define IOCON_BANK_MODE 0x80 - -// Default initialisation mode - -#define IOCON_INIT (IOCON_SEQOP) - -// SPI Command codes - -#define CMD_WRITE 0x40 -#define CMD_READ 0x41 diff --git a/WiringPi/wiringPi/mcp3002.c b/WiringPi/wiringPi/mcp3002.c deleted file mode 100644 index 2e7d5cf..0000000 --- a/WiringPi/wiringPi/mcp3002.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * mcp3002.c: - * Extend wiringPi with the MCP3002 SPI Analog to Digital convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "mcp3002.h" - -/* - * myAnalogRead: - * Return the analog value of the given pin - ********************************************************************************* - */ - -static int myAnalogRead (struct wiringPiNodeStruct *node, int pin) -{ - unsigned char spiData [2] ; - unsigned char chanBits ; - int chan = pin - node->pinBase ; - - if (chan == 0) - chanBits = 0b11010000 ; - else - chanBits = 0b11110000 ; - - spiData [0] = chanBits ; - spiData [1] = 0 ; - - wiringPiSPIDataRW (node->fd, spiData, 2) ; - - return ((spiData [0] << 7) | (spiData [1] >> 1)) & 0x3FF ; -} - - -/* - * mcp3002Setup: - * Create a new wiringPi device node for an mcp2003 on the Pi's - * SPI interface. - ********************************************************************************* - */ - -int mcp3002Setup (const int pinBase, int spiChannel) -{ - struct wiringPiNodeStruct *node ; - - if (wiringPiSPISetup (spiChannel, 1000000) < 0) - return -1 ; - - node = wiringPiNewNode (pinBase, 2) ; - - node->fd = spiChannel ; - node->analogRead = myAnalogRead ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp3002.h b/WiringPi/wiringPi/mcp3002.h deleted file mode 100644 index 0cd727f..0000000 --- a/WiringPi/wiringPi/mcp3002.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * mcp3002.c: - * Extend wiringPi with the MCP3002 SPI Analog to Digital convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp3002Setup (int pinBase, int spiChannel) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp3004.c b/WiringPi/wiringPi/mcp3004.c deleted file mode 100644 index 82c73dd..0000000 --- a/WiringPi/wiringPi/mcp3004.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * mcp3004.c: - * Extend wiringPi with the MCP3004 SPI Analog to Digital convertor - * Copyright (c) 2012-2013 Gordon Henderson - * - * Thanks also to "ShorTie" on IRC for some remote debugging help! - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "mcp3004.h" - -/* - * myAnalogRead: - * Return the analog value of the given pin - ********************************************************************************* - */ - -static int myAnalogRead (struct wiringPiNodeStruct *node, int pin) -{ - unsigned char spiData [3] ; - unsigned char chanBits ; - int chan = pin - node->pinBase ; - - chanBits = 0b10000000 | (chan << 4) ; - - spiData [0] = 1 ; // Start bit - spiData [1] = chanBits ; - spiData [2] = 0 ; - - wiringPiSPIDataRW (node->fd, spiData, 3) ; - - return ((spiData [1] << 8) | spiData [2]) & 0x3FF ; -} - - -/* - * mcp3004Setup: - * Create a new wiringPi device node for an mcp3004 on the Pi's - * SPI interface. - ********************************************************************************* - */ - -int mcp3004Setup (const int pinBase, int spiChannel) -{ - struct wiringPiNodeStruct *node ; - - if (wiringPiSPISetup (spiChannel, 1000000) < 0) - return -1 ; - - node = wiringPiNewNode (pinBase, 8) ; - - node->fd = spiChannel ; - node->analogRead = myAnalogRead ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp3004.h b/WiringPi/wiringPi/mcp3004.h deleted file mode 100644 index a07c0bf..0000000 --- a/WiringPi/wiringPi/mcp3004.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * mcp3004.c: - * Extend wiringPi with the MCP3004 SPI Analog to Digital convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp3004Setup (int pinBase, int spiChannel) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp3422.c b/WiringPi/wiringPi/mcp3422.c deleted file mode 100644 index 8e26d76..0000000 --- a/WiringPi/wiringPi/mcp3422.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * mcp3422.c: - * Extend wiringPi with the MCP3422 I2C ADC chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - - -#include -#include -#include -#include -#include - -#include -#include - -#include "mcp3422.h" - - -/* - * myAnalogRead: - * Read a channel from the device - ********************************************************************************* - */ - -int myAnalogRead (struct wiringPiNodeStruct *node, int chan) -{ - unsigned char config, b0, b1, b2, b3 ; - int value = 0 ; - -// One-shot mode, trigger plus the other configs. - - config = 0x80 | ((chan - node->pinBase) << 5) | (node->data0 << 2) | (node->data1) ; - - wiringPiI2CWrite (node->fd, config) ; - - switch (node->data0) // Sample rate - { - case MCP3422_SR_3_75: // 18 bits - delay (270) ; - b0 = wiringPiI2CRead (node->fd) ; - b1 = wiringPiI2CRead (node->fd) ; - b2 = wiringPiI2CRead (node->fd) ; - b3 = wiringPiI2CRead (node->fd) ; - value = ((b0 & 3) << 16) | (b1 << 8) | b2 ; - break ; - - case MCP3422_SR_15: // 16 bits - delay ( 70) ; - b0 = wiringPiI2CRead (node->fd) ; - b1 = wiringPiI2CRead (node->fd) ; - b2 = wiringPiI2CRead (node->fd) ; - value = (b0 << 8) | b1 ; - break ; - - case MCP3422_SR_60: // 14 bits - delay ( 17) ; - b0 = wiringPiI2CRead (node->fd) ; - b1 = wiringPiI2CRead (node->fd) ; - b2 = wiringPiI2CRead (node->fd) ; - value = ((b0 & 0x3F) << 8) | b1 ; - break ; - - case MCP3422_SR_240: // 12 bits - delay ( 5) ; - b0 = wiringPiI2CRead (node->fd) ; - b1 = wiringPiI2CRead (node->fd) ; - b2 = wiringPiI2CRead (node->fd) ; - value = ((b0 & 0x0F) << 8) | b1 ; - break ; - } - - return value ; -} - - -/* - * mcp3422Setup: - * Create a new wiringPi device node for the mcp3422 - ********************************************************************************* - */ - -int mcp3422Setup (int pinBase, int i2cAddress, int channels, int sampleRate, int gain) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (i2cAddress)) < 0) - return fd ; - - node = wiringPiNewNode (pinBase, channels) ; - - node->data0 = sampleRate ; - node->data1 = gain ; - node->analogRead = myAnalogRead ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp3422.h b/WiringPi/wiringPi/mcp3422.h deleted file mode 100644 index 8b4e350..0000000 --- a/WiringPi/wiringPi/mcp3422.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * mcp3422.c: - * Extend wiringPi with the MCP3422 I2C ADC chip - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#define MCP3422_SR_3_75 0 -#define MCP3422_SR_15 1 -#define MCP3422_SR_60 2 -#define MCP3422_SR_240 3 - -#define MCP3422_GAIN_1 0 -#define MCP3422_GAIN_2 1 -#define MCP3422_GAIN_4 2 -#define MCP3422_GAIN_8 3 - - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp3422Setup (int pinBase, int i2cAddress, int channels, int sampleRate, int gain) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/mcp4802.c b/WiringPi/wiringPi/mcp4802.c deleted file mode 100644 index 5c5c17a..0000000 --- a/WiringPi/wiringPi/mcp4802.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * mcp4802.c: - * Extend wiringPi with the MCP4802 SPI Digital to Analog convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "mcp4802.h" - -/* - * myAnalogWrite: - * Write analog value on the given pin - ********************************************************************************* - */ - -static void myAnalogWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - unsigned char spiData [2] ; - unsigned char chanBits, dataBits ; - int chan = pin - node->pinBase ; - - if (chan == 0) - chanBits = 0x30 ; - else - chanBits = 0xB0 ; - - chanBits |= ((value >> 4) & 0x0F) ; - dataBits = ((value << 4) & 0xF0) ; - - spiData [0] = chanBits ; - spiData [1] = dataBits ; - - wiringPiSPIDataRW (node->fd, spiData, 2) ; -} - -/* - * mcp4802Setup: - * Create a new wiringPi device node for an mcp4802 on the Pi's - * SPI interface. - ********************************************************************************* - */ - -int mcp4802Setup (const int pinBase, int spiChannel) -{ - struct wiringPiNodeStruct *node ; - - if (wiringPiSPISetup (spiChannel, 1000000) < 0) - return -1 ; - - node = wiringPiNewNode (pinBase, 2) ; - - node->fd = spiChannel ; - node->analogWrite = myAnalogWrite ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/mcp4802.h b/WiringPi/wiringPi/mcp4802.h deleted file mode 100644 index effa024..0000000 --- a/WiringPi/wiringPi/mcp4802.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * mcp4802.c: - * Extend wiringPi with the MCP4802 SPI Digital to Analog convertor - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int mcp4802Setup (int pinBase, int spiChannel) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/pcf8574.c b/WiringPi/wiringPi/pcf8574.c deleted file mode 100644 index c172d1c..0000000 --- a/WiringPi/wiringPi/pcf8574.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * pcf8574.c: - * Extend wiringPi with the PCF8574 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "wiringPiI2C.h" - -#include "pcf8574.h" - - -/* - * myPinMode: - * The PCF8574 is an odd chip - the pins are effectively bi-directional, - * however the pins should be drven high when used as an input pin... - * So, we're effectively copying digitalWrite... - ********************************************************************************* - */ - -static void myPinMode (struct wiringPiNodeStruct *node, int pin, int mode) -{ - int bit, old ; - - bit = 1 << ((pin - node->pinBase) & 7) ; - - old = node->data2 ; - if (mode == OUTPUT) - old &= (~bit) ; // Write bit to 0 - else - old |= bit ; // Write bit to 1 - - wiringPiI2CWrite (node->fd, old) ; - node->data2 = old ; -} - - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int bit, old ; - - bit = 1 << ((pin - node->pinBase) & 7) ; - - old = node->data2 ; - if (value == LOW) - old &= (~bit) ; - else - old |= bit ; - - wiringPiI2CWrite (node->fd, old) ; - node->data2 = old ; -} - - -/* - * myDigitalRead: - ********************************************************************************* - */ - -static int myDigitalRead (struct wiringPiNodeStruct *node, int pin) -{ - int mask, value ; - - mask = 1 << ((pin - node->pinBase) & 7) ; - value = wiringPiI2CRead (node->fd) ; - - if ((value & mask) == 0) - return LOW ; - else - return HIGH ; -} - - -/* - * pcf8574Setup: - * Create a new instance of a PCF8574 I2C GPIO interface. We know it - * has 8 pins, so all we need to know here is the I2C address and the - * user-defined pin base. - ********************************************************************************* - */ - -int pcf8574Setup (const int pinBase, const int i2cAddress) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (i2cAddress)) < 0) - return fd ; - - node = wiringPiNewNode (pinBase, 8) ; - - node->fd = fd ; - node->pinMode = myPinMode ; - node->digitalRead = myDigitalRead ; - node->digitalWrite = myDigitalWrite ; - node->data2 = wiringPiI2CRead (fd) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/pcf8574.h b/WiringPi/wiringPi/pcf8574.h deleted file mode 100644 index 8e2d818..0000000 --- a/WiringPi/wiringPi/pcf8574.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * pcf8574.h: - * Extend wiringPi with the PCF8574 I2C GPIO expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int pcf8574Setup (const int pinBase, const int i2cAddress) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/pcf8591.c b/WiringPi/wiringPi/pcf8591.c deleted file mode 100644 index 0c86056..0000000 --- a/WiringPi/wiringPi/pcf8591.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * pcf8591.c: - * Extend wiringPi with the PCF8591 I2C GPIO Analog expander chip - * The chip has 1 8-bit DAC and 4 x 8-bit ADCs - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include - -#include "wiringPi.h" -#include "wiringPiI2C.h" - -#include "pcf8591.h" - - -/* - * myAnalogWrite: - ********************************************************************************* - */ - -static void myAnalogWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - unsigned char b [2] ; - b [0] = 0x40 ; - b [1] = value & 0xFF ; - write (node->fd, b, 2) ; -} - - -/* - * myAnalogRead: - ********************************************************************************* - */ - -static int myAnalogRead (struct wiringPiNodeStruct *node, int pin) -{ - int x ; - - wiringPiI2CWrite (node->fd, 0x40 | ((pin - node->pinBase) & 3)) ; - - x = wiringPiI2CRead (node->fd) ; // Throw away the first read - x = wiringPiI2CRead (node->fd) ; - - return x ; -} - - -/* - * pcf8591Setup: - * Create a new instance of a PCF8591 I2C GPIO interface. We know it - * has 4 pins, (4 analog inputs and 1 analog output which we'll shadow - * input 0) so all we need to know here is the I2C address and the - * user-defined pin base. - ********************************************************************************* - */ - -int pcf8591Setup (const int pinBase, const int i2cAddress) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (i2cAddress)) < 0) - return fd ; - - node = wiringPiNewNode (pinBase, 4) ; - - node->fd = fd ; - node->analogRead = myAnalogRead ; - node->analogWrite = myAnalogWrite ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/pcf8591.h b/WiringPi/wiringPi/pcf8591.h deleted file mode 100644 index 6b44ccf..0000000 --- a/WiringPi/wiringPi/pcf8591.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * pcf8591.h: - * Extend wiringPi with the PCF8591 I2C GPIO Analog expander chip - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int pcf8591Setup (const int pinBase, const int i2cAddress) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/piHiPri.c b/WiringPi/wiringPi/piHiPri.c deleted file mode 100644 index d2f3b4e..0000000 --- a/WiringPi/wiringPi/piHiPri.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * piHiPri: - * Simple way to get your program running at high priority - * with realtime schedulling. - * - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" - - -/* - * piHiPri: - * Attempt to set a high priority schedulling for the running program - ********************************************************************************* - */ - -int piHiPri (const int pri) -{ - struct sched_param sched ; - - memset (&sched, 0, sizeof(sched)) ; - - if (pri > sched_get_priority_max (SCHED_RR)) - sched.sched_priority = sched_get_priority_max (SCHED_RR) ; - else - sched.sched_priority = pri ; - - return sched_setscheduler (0, SCHED_RR, &sched) ; -} diff --git a/WiringPi/wiringPi/piThread.c b/WiringPi/wiringPi/piThread.c deleted file mode 100644 index b0499be..0000000 --- a/WiringPi/wiringPi/piThread.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * piThread.c: - * Provide a simplified interface to pthreads - * - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include "wiringPi.h" - -static pthread_mutex_t piMutexes [4] ; - - - -/* - * piThreadCreate: - * Create and start a thread - ********************************************************************************* - */ - -int piThreadCreate (void *(*fn)(void *)) -{ - pthread_t myThread ; - - return pthread_create (&myThread, NULL, fn, NULL) ; -} - -/* - * piLock: piUnlock: - * Activate/Deactivate a mutex. - * We're keeping things simple here and only tracking 4 mutexes which - * is more than enough for out entry-level pthread programming - ********************************************************************************* - */ - -void piLock (int key) -{ - pthread_mutex_lock (&piMutexes [key]) ; -} - -void piUnlock (int key) -{ - pthread_mutex_unlock (&piMutexes [key]) ; -} - diff --git a/WiringPi/wiringPi/sn3218.c b/WiringPi/wiringPi/sn3218.c deleted file mode 100644 index 7ceb156..0000000 --- a/WiringPi/wiringPi/sn3218.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * sn3218.c: - * Extend wiringPi with the SN3218 I2C LEd Driver - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "sn3218.h" - -/* - * myAnalogWrite: - * Write analog value on the given pin - ********************************************************************************* - */ - -static void myAnalogWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - int fd = node->fd ; - int chan = 0x01 + (pin - node->pinBase) ; - - wiringPiI2CWriteReg8 (fd, chan, value & 0xFF) ; // Value - wiringPiI2CWriteReg8 (fd, 0x16, 0x00) ; // Update -} - -/* - * sn3218Setup: - * Create a new wiringPi device node for an sn3218 on the Pi's - * SPI interface. - ********************************************************************************* - */ - -int sn3218Setup (const int pinBase) -{ - int fd ; - struct wiringPiNodeStruct *node ; - - if ((fd = wiringPiI2CSetup (0x54)) < 0) - return fd ; - -// Setup the chip - initialise all 18 LEDs to off - -//wiringPiI2CWriteReg8 (fd, 0x17, 0) ; // Reset - wiringPiI2CWriteReg8 (fd, 0x00, 1) ; // Not Shutdown - wiringPiI2CWriteReg8 (fd, 0x13, 0x3F) ; // Enable LEDs 0- 5 - wiringPiI2CWriteReg8 (fd, 0x14, 0x3F) ; // Enable LEDs 6-11 - wiringPiI2CWriteReg8 (fd, 0x15, 0x3F) ; // Enable LEDs 12-17 - wiringPiI2CWriteReg8 (fd, 0x16, 0x00) ; // Update - - node = wiringPiNewNode (pinBase, 18) ; - - node->fd = fd ; - node->analogWrite = myAnalogWrite ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/sn3218.h b/WiringPi/wiringPi/sn3218.h deleted file mode 100644 index 580d5f9..0000000 --- a/WiringPi/wiringPi/sn3218.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * sn3218.c: - * Extend wiringPi with the SN3218 I2C LED driver board. - * Copyright (c) 2012-2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int sn3218Setup (int pinBase) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/softPwm.c b/WiringPi/wiringPi/softPwm.c deleted file mode 100644 index a4f0fc4..0000000 --- a/WiringPi/wiringPi/softPwm.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * softPwm.c: - * Provide 2 channels of software driven PWM. - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "softPwm.h" - -#define MAX_PINS 1024 - -// The PWM Frequency is derived from the "pulse time" below. Essentially, -// the frequency is a function of the range and this pulse time. -// The total period will be range * pulse time in uS, so a pulse time -// of 100 and a range of 100 gives a period of 100 * 100 = 10,000 uS -// which is a frequency of 100Hz. -// -// It's possible to get a higher frequency by lowering the pulse time, -// however CPU uage will skyrocket as wiringPi uses a hard-loop to time -// periods under 100uS - this is because the Linux timer calls are just -// accurate at all, and have an overhead. -// -// Another way to increase the frequency is to reduce the range - however -// that reduces the overall output accuracy... - -#define PULSE_TIME 100 - -static int marks [MAX_PINS] ; -static int range [MAX_PINS] ; - -int newPin = -1 ; - - -/* - * softPwmThread: - * Thread to do the actual PWM output - ********************************************************************************* - */ - -static PI_THREAD (softPwmThread) -{ - int pin, mark, space ; - - pin = newPin ; - newPin = -1 ; - - piHiPri (50) ; - - for (;;) - { - mark = marks [pin] ; - space = range [pin] - mark ; - - if (mark != 0) - digitalWrite (pin, HIGH) ; - delayMicroseconds (mark * 100) ; - - if (space != 0) - digitalWrite (pin, LOW) ; - delayMicroseconds (space * 100) ; - } - - return NULL ; -} - - -/* - * softPwmWrite: - * Write a PWM value to the given pin - ********************************************************************************* - */ - -void softPwmWrite (int pin, int value) -{ - pin &= (MAX_PINS - 1) ; - - /**/ if (value < 0) - value = 0 ; - else if (value > range [pin]) - value = range [pin] ; - - marks [pin] = value ; -} - - -/* - * softPwmCreate: - * Create a new PWM thread. - ********************************************************************************* - */ - -int softPwmCreate (int pin, int initialValue, int pwmRange) -{ - int res ; - - pinMode (pin, OUTPUT) ; - digitalWrite (pin, LOW) ; - - marks [pin] = initialValue ; - range [pin] = pwmRange ; - - newPin = pin ; - res = piThreadCreate (softPwmThread) ; - - while (newPin != -1) - delay (1) ; - - return res ; -} diff --git a/WiringPi/wiringPi/softPwm.h b/WiringPi/wiringPi/softPwm.h deleted file mode 100644 index 28ad299..0000000 --- a/WiringPi/wiringPi/softPwm.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * softPwm.h: - * Provide 2 channels of software driven PWM. - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int softPwmCreate (int pin, int value, int range) ; -extern void softPwmWrite (int pin, int value) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/softServo.c b/WiringPi/wiringPi/softServo.c deleted file mode 100644 index 9de9f4f..0000000 --- a/WiringPi/wiringPi/softServo.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * softServo.c: - * Provide N channels of software driven PWM suitable for RC - * servo motors. - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -//#include -#include -#include -#include -#include - -#include "wiringPi.h" -#include "softServo.h" - -// RC Servo motors are a bit of an oddity - designed in the days when -// radio control was experimental and people were tryin to make -// things as simple as possible as it was all very expensive... -// -// So... To drive an RC Servo motor, you need to send it a modified PWM -// signal - it needs anything from 1ms to 2ms - with 1ms meaning -// to move the server fully left, and 2ms meaning to move it fully -// right. Then you need a long gap before sending the next pulse. -// The reason for this is that you send a multiplexed stream of these -// pulses up the radio signal into the reciever which de-multiplexes -// them into the signals for each individual servo. Typically there -// might be 8 channels, so you need at least 8 "slots" of 2mS pulses -// meaning the entire frame must fit into a 16mS slot - which would -// then be repeated... -// -// In practice we have a total slot width of about 20mS - so we're sending 50 -// updates per second to each servo. -// -// In this code, we don't need to be too fussy about the gap as we're not doing -// the multipexing, but it does need to be at least 10mS, and preferably 16 -// from what I've been able to determine. - -// WARNING: -// This code is really experimental. It was written in response to some people -// asking for a servo driver, however while it works, there is too much -// jitter to successfully drive a small servo - I have tried it with a micro -// servo and it worked, but the servo ran hot due to the jitter in the signal -// being sent to it. -// -// If you want servo control for the Pi, then use the servoblaster kernel -// module. - -#define MAX_SERVOS 8 - -static int pinMap [MAX_SERVOS] ; // Keep track of our pins -static int pulseWidth [MAX_SERVOS] ; // microseconds - - -/* - * softServoThread: - * Thread to do the actual Servo PWM output - ********************************************************************************* - */ - -static PI_THREAD (softServoThread) -{ - register int i, j, k, m, tmp ; - int lastDelay, pin, servo ; - - int myDelays [MAX_SERVOS] ; - int myPins [MAX_SERVOS] ; - - struct timeval tNow, tStart, tPeriod, tGap, tTotal ; - struct timespec tNs ; - - tTotal.tv_sec = 0 ; - tTotal.tv_usec = 8000 ; - - piHiPri (50) ; - - for (;;) - { - gettimeofday (&tStart, NULL) ; - - memcpy (myDelays, pulseWidth, sizeof (myDelays)) ; - memcpy (myPins, pinMap, sizeof (myPins)) ; - -// Sort the delays (& pins), shortest first - - for (m = MAX_SERVOS / 2 ; m > 0 ; m /= 2 ) - for (j = m ; j < MAX_SERVOS ; ++j) - for (i = j - m ; i >= 0 ; i -= m) - { - k = i + m ; - if (myDelays [k] >= myDelays [i]) - break ; - else // Swap - { - tmp = myDelays [i] ; myDelays [i] = myDelays [k] ; myDelays [k] = tmp ; - tmp = myPins [i] ; myPins [i] = myPins [k] ; myPins [k] = tmp ; - } - } - -// All on - - lastDelay = 0 ; - for (servo = 0 ; servo < MAX_SERVOS ; ++servo) - { - if ((pin = myPins [servo]) == -1) - continue ; - - digitalWrite (pin, HIGH) ; - myDelays [servo] = myDelays [servo] - lastDelay ; - lastDelay += myDelays [servo] ; - } - -// Now loop, turning them all off as required - - for (servo = 0 ; servo < MAX_SERVOS ; ++servo) - { - if ((pin = myPins [servo]) == -1) - continue ; - - delayMicroseconds (myDelays [servo]) ; - digitalWrite (pin, LOW) ; - } - -// Wait until the end of an 8mS time-slot - - gettimeofday (&tNow, NULL) ; - timersub (&tNow, &tStart, &tPeriod) ; - timersub (&tTotal, &tPeriod, &tGap) ; - tNs.tv_sec = tGap.tv_sec ; - tNs.tv_nsec = tGap.tv_usec * 1000 ; - nanosleep (&tNs, NULL) ; - } - - return NULL ; -} - - -/* - * softServoWrite: - * Write a Servo value to the given pin - ********************************************************************************* - */ - -void softServoWrite (int servoPin, int value) -{ - int servo ; - - servoPin &= 63 ; - - /**/ if (value < -250) - value = -250 ; - else if (value > 1250) - value = 1250 ; - - for (servo = 0 ; servo < MAX_SERVOS ; ++servo) - if (pinMap [servo] == servoPin) - pulseWidth [servo] = value + 1000 ; // uS -} - - -/* - * softServoSetup: - * Setup the software servo system - ********************************************************************************* - */ - -int softServoSetup (int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7) -{ - int servo ; - - if (p0 != -1) { pinMode (p0, OUTPUT) ; digitalWrite (p0, LOW) ; } - if (p1 != -1) { pinMode (p1, OUTPUT) ; digitalWrite (p1, LOW) ; } - if (p2 != -1) { pinMode (p2, OUTPUT) ; digitalWrite (p2, LOW) ; } - if (p3 != -1) { pinMode (p3, OUTPUT) ; digitalWrite (p3, LOW) ; } - if (p4 != -1) { pinMode (p4, OUTPUT) ; digitalWrite (p4, LOW) ; } - if (p5 != -1) { pinMode (p5, OUTPUT) ; digitalWrite (p5, LOW) ; } - if (p6 != -1) { pinMode (p6, OUTPUT) ; digitalWrite (p6, LOW) ; } - if (p7 != -1) { pinMode (p7, OUTPUT) ; digitalWrite (p7, LOW) ; } - - pinMap [0] = p0 ; - pinMap [1] = p1 ; - pinMap [2] = p2 ; - pinMap [3] = p3 ; - pinMap [4] = p4 ; - pinMap [5] = p5 ; - pinMap [6] = p6 ; - pinMap [7] = p7 ; - - for (servo = 0 ; servo < MAX_SERVOS ; ++servo) - pulseWidth [servo] = 1500 ; // Mid point - - return piThreadCreate (softServoThread) ; -} diff --git a/WiringPi/wiringPi/softServo.h b/WiringPi/wiringPi/softServo.h deleted file mode 100644 index 794cf55..0000000 --- a/WiringPi/wiringPi/softServo.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * softServo.h: - * Provide N channels of software driven PWM suitable for RC - * servo motors. - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern void softServoWrite (int pin, int value) ; -extern int softServoSetup (int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/softTone.c b/WiringPi/wiringPi/softTone.c deleted file mode 100644 index b4a89f8..0000000 --- a/WiringPi/wiringPi/softTone.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * softTone.c: - * For that authentic retro sound... - * Er... A little experiment to produce tones out of a Pi using - * one (or 2) GPIO pins and a piezeo "speaker" element. - * (Or a high impedance speaker, but don'y blame me if you blow-up - * the GPIO pins!) - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" -#include "softTone.h" - -#define MAX_PINS 64 - -#define PULSE_TIME 100 - -static int freqs [MAX_PINS] ; - -static int newPin = -1 ; - - -/* - * softToneThread: - * Thread to do the actual PWM output - ********************************************************************************* - */ - -static PI_THREAD (softToneThread) -{ - int pin, freq, halfPeriod ; - - pin = newPin ; - newPin = -1 ; - - piHiPri (50) ; - - for (;;) - { - freq = freqs [pin] ; - if (freq == 0) - delay (1) ; - else - { - halfPeriod = 500000 / freq ; - - digitalWrite (pin, HIGH) ; - delayMicroseconds (halfPeriod) ; - - digitalWrite (pin, LOW) ; - delayMicroseconds (halfPeriod) ; - } - } - - return NULL ; -} - - -/* - * softToneWrite: - * Write a frequency value to the given pin - ********************************************************************************* - */ - -void softToneWrite (int pin, int freq) -{ - pin &= 63 ; - - /**/ if (freq < 0) - freq = 0 ; - else if (freq > 5000) // Max 5KHz - freq = 5000 ; - - freqs [pin] = freq ; -} - - -/* - * softToneCreate: - * Create a new tone thread. - ********************************************************************************* - */ - -int softToneCreate (int pin) -{ - int res ; - - pinMode (pin, OUTPUT) ; - digitalWrite (pin, LOW) ; - - freqs [pin] = 0 ; - - newPin = pin ; - res = piThreadCreate (softToneThread) ; - - while (newPin != -1) - delay (1) ; - - return res ; -} diff --git a/WiringPi/wiringPi/softTone.h b/WiringPi/wiringPi/softTone.h deleted file mode 100644 index d8b4e54..0000000 --- a/WiringPi/wiringPi/softTone.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * softTone.c: - * For that authentic retro sound... - * Er... A little experiment to produce tones out of a Pi using - * one (or 2) GPIO pins and a piezeo "speaker" element. - * (Or a high impedance speaker, but don'y blame me if you blow-up - * the GPIO pins!) - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int softToneCreate (int pin) ; -extern void softToneWrite (int pin, int freq) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/sr595.c b/WiringPi/wiringPi/sr595.c deleted file mode 100644 index 87210c2..0000000 --- a/WiringPi/wiringPi/sr595.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * sr595.c: - * Extend wiringPi with the 74x595 shift register as a GPIO - * expander chip. - * Note that the code can cope with a number of 595's - * daisy-chained together - up to 4 for now as we're storing - * the output "register" in a single unsigned int. - * - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#include -#include - -#include "wiringPi.h" - -#include "sr595.h" - - -/* - * myDigitalWrite: - ********************************************************************************* - */ - -static void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value) -{ - unsigned int mask ; - int dataPin, clockPin, latchPin ; - int bit, bits, output ; - - pin -= node->pinBase ; // Normalise pin number - bits = node->pinMax - node->pinBase + 1 ; // ie. number of clock pulses - dataPin = node->data0 ; - clockPin = node->data1 ; - latchPin = node->data2 ; - output = node->data3 ; - - mask = 1 << pin ; - - if (value == LOW) - output &= (~mask) ; - else - output |= mask ; - - node->data3 = output ; - -// A low -> high latch transition copies the latch to the output pins - - digitalWrite (latchPin, LOW) ; delayMicroseconds (1) ; - for (bit = bits - 1 ; bit >= 0 ; --bit) - { - digitalWrite (dataPin, output & (1 << bit)) ; - - digitalWrite (clockPin, HIGH) ; delayMicroseconds (1) ; - digitalWrite (clockPin, LOW) ; delayMicroseconds (1) ; - } - digitalWrite (latchPin, HIGH) ; delayMicroseconds (1) ; -} - - -/* - * sr595Setup: - * Create a new instance of a 74x595 shift register GPIO expander. - ********************************************************************************* - */ - -int sr595Setup (const int pinBase, const int numPins, - const int dataPin, const int clockPin, const int latchPin) -{ - struct wiringPiNodeStruct *node ; - - node = wiringPiNewNode (pinBase, numPins) ; - - node->data0 = dataPin ; - node->data1 = clockPin ; - node->data2 = latchPin ; - node->data3 = 0 ; // Output register - node->digitalWrite = myDigitalWrite ; - -// Initialise the underlying hardware - - digitalWrite (dataPin, LOW) ; - digitalWrite (clockPin, LOW) ; - digitalWrite (latchPin, HIGH) ; - - pinMode (dataPin, OUTPUT) ; - pinMode (clockPin, OUTPUT) ; - pinMode (latchPin, OUTPUT) ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/sr595.h b/WiringPi/wiringPi/sr595.h deleted file mode 100644 index 4a26dc7..0000000 --- a/WiringPi/wiringPi/sr595.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * sr595.h: - * Extend wiringPi with the 74x595 shift registers. - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int sr595Setup (const int pinBase, const int numPins, - const int dataPin, const int clockPin, const int latchPin) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/wiringPi.c b/WiringPi/wiringPi/wiringPi.c deleted file mode 100644 index b54ad29..0000000 --- a/WiringPi/wiringPi/wiringPi.c +++ /dev/null @@ -1,1715 +0,0 @@ -/* - * wiringPi: - * Arduino compatable (ish) Wiring library for the Raspberry Pi - * Copyright (c) 2012 Gordon Henderson - * Additional code for pwmSetClock by Chris Hall - * - * Thanks to code samples from Gert Jan van Loo and the - * BCM2835 ARM Peripherals manual, however it's missing - * the clock section /grr/mutter/ - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -// Revisions: -// 19 Jul 2012: -// Moved to the LGPL -// Added an abstraction layer to the main routines to save a tiny -// bit of run-time and make the clode a little cleaner (if a little -// larger) -// Added waitForInterrupt code -// Added piHiPri code -// -// 9 Jul 2012: -// Added in support to use the /sys/class/gpio interface. -// 2 Jul 2012: -// Fixed a few more bugs to do with range-checking when in GPIO mode. -// 11 Jun 2012: -// Fixed some typos. -// Added c++ support for the .h file -// Added a new function to allow for using my "pin" numbers, or native -// GPIO pin numbers. -// Removed my busy-loop delay and replaced it with a call to delayMicroseconds -// -// 02 May 2012: -// Added in the 2 UART pins -// Change maxPins to numPins to more accurately reflect purpose - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wiringPi.h" - -#ifndef TRUE -#define TRUE (1==1) -#define FALSE (1==2) -#endif - -// Environment Variables - -#define ENV_DEBUG "WIRINGPI_DEBUG" -#define ENV_CODES "WIRINGPI_CODES" - - -// Mask for the bottom 64 pins which belong to the Raspberry Pi -// The others are available for the other devices - -#define PI_GPIO_MASK (0xFFFFFFC0) - -struct wiringPiNodeStruct *wiringPiNodes = NULL ; - -// BCM Magic - -#define BCM_PASSWORD 0x5A000000 - - -// The BCM2835 has 54 GPIO pins. -// BCM2835 data sheet, Page 90 onwards. -// There are 6 control registers, each control the functions of a block -// of 10 pins. -// Each control register has 10 sets of 3 bits per GPIO pin - the ALT values -// -// 000 = GPIO Pin X is an input -// 001 = GPIO Pin X is an output -// 100 = GPIO Pin X takes alternate function 0 -// 101 = GPIO Pin X takes alternate function 1 -// 110 = GPIO Pin X takes alternate function 2 -// 111 = GPIO Pin X takes alternate function 3 -// 011 = GPIO Pin X takes alternate function 4 -// 010 = GPIO Pin X takes alternate function 5 -// -// So the 3 bits for port X are: -// X / 10 + ((X % 10) * 3) - -// Port function select bits - -#define FSEL_INPT 0b000 -#define FSEL_OUTP 0b001 -#define FSEL_ALT0 0b100 -#define FSEL_ALT1 0b101 -#define FSEL_ALT2 0b110 -#define FSEL_ALT3 0b111 -#define FSEL_ALT4 0b011 -#define FSEL_ALT5 0b010 - -// Access from ARM Running Linux -// Taken from Gert/Doms code. Some of this is not in the manual -// that I can find )-: - -#define BCM2708_PERI_BASE 0x20000000 -#define GPIO_PADS (BCM2708_PERI_BASE + 0x00100000) -#define CLOCK_BASE (BCM2708_PERI_BASE + 0x00101000) -#define GPIO_BASE (BCM2708_PERI_BASE + 0x00200000) -#define GPIO_TIMER (BCM2708_PERI_BASE + 0x0000B000) -#define GPIO_PWM (BCM2708_PERI_BASE + 0x0020C000) - -#define PAGE_SIZE (4*1024) -#define BLOCK_SIZE (4*1024) - -// PWM -// Word offsets into the PWM control region - -#define PWM_CONTROL 0 -#define PWM_STATUS 1 -#define PWM0_RANGE 4 -#define PWM0_DATA 5 -#define PWM1_RANGE 8 -#define PWM1_DATA 9 - -// Clock regsiter offsets - -#define PWMCLK_CNTL 40 -#define PWMCLK_DIV 41 - -#define PWM0_MS_MODE 0x0080 // Run in MS mode -#define PWM0_USEFIFO 0x0020 // Data from FIFO -#define PWM0_REVPOLAR 0x0010 // Reverse polarity -#define PWM0_OFFSTATE 0x0008 // Ouput Off state -#define PWM0_REPEATFF 0x0004 // Repeat last value if FIFO empty -#define PWM0_SERIAL 0x0002 // Run in serial mode -#define PWM0_ENABLE 0x0001 // Channel Enable - -#define PWM1_MS_MODE 0x8000 // Run in MS mode -#define PWM1_USEFIFO 0x2000 // Data from FIFO -#define PWM1_REVPOLAR 0x1000 // Reverse polarity -#define PWM1_OFFSTATE 0x0800 // Ouput Off state -#define PWM1_REPEATFF 0x0400 // Repeat last value if FIFO empty -#define PWM1_SERIAL 0x0200 // Run in serial mode -#define PWM1_ENABLE 0x0100 // Channel Enable - -// Timer -// Word offsets - -#define TIMER_LOAD (0x400 >> 2) -#define TIMER_VALUE (0x404 >> 2) -#define TIMER_CONTROL (0x408 >> 2) -#define TIMER_IRQ_CLR (0x40C >> 2) -#define TIMER_IRQ_RAW (0x410 >> 2) -#define TIMER_IRQ_MASK (0x414 >> 2) -#define TIMER_RELOAD (0x418 >> 2) -#define TIMER_PRE_DIV (0x41C >> 2) -#define TIMER_COUNTER (0x420 >> 2) - -// Locals to hold pointers to the hardware - -static volatile uint32_t *gpio ; -static volatile uint32_t *pwm ; -static volatile uint32_t *clk ; -static volatile uint32_t *pads ; - -#ifdef USE_TIMER -static volatile uint32_t *timer ; -static volatile uint32_t *timerIrqRaw ; -#endif - -// Time for easy calculations - -static uint64_t epochMilli, epochMicro ; - -// Misc - -static int wiringPiMode = WPI_MODE_UNINITIALISED ; -static volatile int pinPass = -1 ; -static pthread_mutex_t pinMutex ; - -// Debugging & Return codes - -int wiringPiDebug = FALSE ; -int wiringPiReturnCodes = FALSE ; - -// sysFds: -// Map a file descriptor from the /sys/class/gpio/gpioX/value - -static int sysFds [64] = -{ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -} ; - -// ISR Data - -static void (*isrFunctions [64])(void) ; - - -// Doing it the Arduino way with lookup tables... -// Yes, it's probably more innefficient than all the bit-twidling, but it -// does tend to make it all a bit clearer. At least to me! - -// pinToGpio: -// Take a Wiring pin (0 through X) and re-map it to the BCM_GPIO pin -// Cope for 2 different board revisions here. - -static int *pinToGpio ; - -static int pinToGpioR1 [64] = -{ - 17, 18, 21, 22, 23, 24, 25, 4, // From the Original Wiki - GPIO 0 through 7: wpi 0 - 7 - 0, 1, // I2C - SDA0, SCL0 wpi 8 - 9 - 8, 7, // SPI - CE1, CE0 wpi 10 - 11 - 10, 9, 11, // SPI - MOSI, MISO, SCLK wpi 12 - 14 - 14, 15, // UART - Tx, Rx wpi 15 - 16 - -// Padding: - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 31 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 63 -} ; - -static int pinToGpioR2 [64] = -{ - 17, 18, 27, 22, 23, 24, 25, 4, // From the Original Wiki - GPIO 0 through 7: wpi 0 - 7 - 2, 3, // I2C - SDA0, SCL0 wpi 8 - 9 - 8, 7, // SPI - CE1, CE0 wpi 10 - 11 - 10, 9, 11, // SPI - MOSI, MISO, SCLK wpi 12 - 14 - 14, 15, // UART - Tx, Rx wpi 15 - 16 - 28, 29, 30, 31, // New GPIOs 8 though 11 wpi 17 - 20 - -// Padding: - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 31 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 63 -} ; - - -// physToGpio: -// Take a physical pin (1 through 26) and re-map it to the BCM_GPIO pin -// Cope for 2 different board revisions here. - -static int *physToGpio ; - -static int physToGpioR1 [64] = -{ - -1, // 0 - -1, -1, // 1, 2 - 0, -1, - 1, -1, - 4, 14, - -1, 15, - 17, 18, - 21, -1, - 22, 23, - -1, 24, - 10, -1, - 9, 25, - 11, 8, - -1, 7, // 25, 26 - -// Padding: - - -1, -1, -1, -1, -1, // ... 31 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 63 -} ; - -static int physToGpioR2 [64] = -{ - -1, // 0 - -1, -1, // 1, 2 - 2, -1, - 3, -1, - 4, 14, - -1, 15, - 17, 18, - 27, -1, - 22, 23, - -1, 24, - 10, -1, - 9, 25, - 11, 8, - -1, 7, // 25, 26 - -// Padding: - - -1, -1, -1, -1, -1, // ... 31 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 63 -} ; - - -// gpioToGPFSEL: -// Map a BCM_GPIO pin to it's Function Selection -// control port. (GPFSEL 0-5) -// Groups of 10 - 3 bits per Function - 30 bits per port - -static uint8_t gpioToGPFSEL [] = -{ - 0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2, - 3,3,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5, -} ; - - -// gpioToShift -// Define the shift up for the 3 bits per pin in each GPFSEL port - -static uint8_t gpioToShift [] = -{ - 0,3,6,9,12,15,18,21,24,27, - 0,3,6,9,12,15,18,21,24,27, - 0,3,6,9,12,15,18,21,24,27, - 0,3,6,9,12,15,18,21,24,27, - 0,3,6,9,12,15,18,21,24,27, -} ; - - -// gpioToGPSET: -// (Word) offset to the GPIO Set registers for each GPIO pin - -static uint8_t gpioToGPSET [] = -{ - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -} ; - -// gpioToGPCLR: -// (Word) offset to the GPIO Clear registers for each GPIO pin - -static uint8_t gpioToGPCLR [] = -{ - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, -} ; - - -// gpioToGPLEV: -// (Word) offset to the GPIO Input level registers for each GPIO pin - -static uint8_t gpioToGPLEV [] = -{ - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, -} ; - - -#ifdef notYetReady -// gpioToEDS -// (Word) offset to the Event Detect Status - -static uint8_t gpioToEDS [] = -{ - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, -} ; - -// gpioToREN -// (Word) offset to the Rising edgde ENable register - -static uint8_t gpioToREN [] = -{ - 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, - 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, -} ; - -// gpioToFEN -// (Word) offset to the Falling edgde ENable register - -static uint8_t gpioToFEN [] = -{ - 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22, - 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -} ; -#endif - - -// GPPUD: -// GPIO Pin pull up/down register - -#define GPPUD 37 - -// gpioToPUDCLK -// (Word) offset to the Pull Up Down Clock regsiter - -static uint8_t gpioToPUDCLK [] = -{ - 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, - 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, -} ; - - -// gpioToPwmALT -// the ALT value to put a GPIO pin into PWM mode - -static uint8_t gpioToPwmALT [] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, // 0 -> 7 - 0, 0, 0, 0, FSEL_ALT0, FSEL_ALT0, 0, 0, // 8 -> 15 - 0, 0, FSEL_ALT5, FSEL_ALT5, 0, 0, 0, 0, // 16 -> 23 - 0, 0, 0, 0, 0, 0, 0, 0, // 24 -> 31 - 0, 0, 0, 0, 0, 0, 0, 0, // 32 -> 39 - FSEL_ALT0, FSEL_ALT0, 0, 0, 0, FSEL_ALT0, 0, 0, // 40 -> 47 - 0, 0, 0, 0, 0, 0, 0, 0, // 48 -> 55 - 0, 0, 0, 0, 0, 0, 0, 0, // 56 -> 63 -} ; - - -// gpioToPwmPort -// The port value to put a GPIO pin into PWM mode - -static uint8_t gpioToPwmPort [] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, // 0 -> 7 - 0, 0, 0, 0, PWM0_DATA, PWM1_DATA, 0, 0, // 8 -> 15 - 0, 0, PWM0_DATA, PWM1_DATA, 0, 0, 0, 0, // 16 -> 23 - 0, 0, 0, 0, 0, 0, 0, 0, // 24 -> 31 - 0, 0, 0, 0, 0, 0, 0, 0, // 32 -> 39 - PWM0_DATA, PWM1_DATA, 0, 0, 0, PWM1_DATA, 0, 0, // 40 -> 47 - 0, 0, 0, 0, 0, 0, 0, 0, // 48 -> 55 - 0, 0, 0, 0, 0, 0, 0, 0, // 56 -> 63 - -} ; - -// gpioToGpClkALT: -// ALT value to put a GPIO pin into GP Clock mode. -// On the Pi we can really only use BCM_GPIO_4 and BCM_GPIO_21 -// for clocks 0 and 1 respectively, however I'll include the full -// list for completeness - maybe one day... - -#define GPIO_CLOCK_SOURCE 1 - -// gpioToGpClkALT0: - -static uint8_t gpioToGpClkALT0 [] = -{ - 0, 0, 0, 0, FSEL_ALT0, FSEL_ALT0, FSEL_ALT0, 0, // 0 -> 7 - 0, 0, 0, 0, 0, 0, 0, 0, // 8 -> 15 - 0, 0, 0, 0, FSEL_ALT5, FSEL_ALT5, 0, 0, // 16 -> 23 - 0, 0, 0, 0, 0, 0, 0, 0, // 24 -> 31 - FSEL_ALT0, 0, FSEL_ALT0, 0, 0, 0, 0, 0, // 32 -> 39 - 0, 0, FSEL_ALT0, FSEL_ALT0, FSEL_ALT0, 0, 0, 0, // 40 -> 47 - 0, 0, 0, 0, 0, 0, 0, 0, // 48 -> 55 - 0, 0, 0, 0, 0, 0, 0, 0, // 56 -> 63 -} ; - -// gpioToClk: -// (word) Offsets to the clock Control and Divisor register - -static uint8_t gpioToClkCon [] = -{ - -1, -1, -1, -1, 28, 30, 32, -1, // 0 -> 7 - -1, -1, -1, -1, -1, -1, -1, -1, // 8 -> 15 - -1, -1, -1, -1, 28, 30, -1, -1, // 16 -> 23 - -1, -1, -1, -1, -1, -1, -1, -1, // 24 -> 31 - 28, -1, 28, -1, -1, -1, -1, -1, // 32 -> 39 - -1, -1, 28, 30, 28, -1, -1, -1, // 40 -> 47 - -1, -1, -1, -1, -1, -1, -1, -1, // 48 -> 55 - -1, -1, -1, -1, -1, -1, -1, -1, // 56 -> 63 -} ; - -static uint8_t gpioToClkDiv [] = -{ - -1, -1, -1, -1, 29, 31, 33, -1, // 0 -> 7 - -1, -1, -1, -1, -1, -1, -1, -1, // 8 -> 15 - -1, -1, -1, -1, 29, 31, -1, -1, // 16 -> 23 - -1, -1, -1, -1, -1, -1, -1, -1, // 24 -> 31 - 29, -1, 29, -1, -1, -1, -1, -1, // 32 -> 39 - -1, -1, 29, 31, 29, -1, -1, -1, // 40 -> 47 - -1, -1, -1, -1, -1, -1, -1, -1, // 48 -> 55 - -1, -1, -1, -1, -1, -1, -1, -1, // 56 -> 63 -} ; - - -/* - * Functions - ********************************************************************************* - */ - - -/* - * wiringPiFailure: - * Fail. Or not. - ********************************************************************************* - */ - -int wiringPiFailure (int fatal, const char *message, ...) -{ - va_list argp ; - char buffer [1024] ; - - if (!fatal && wiringPiReturnCodes) - return -1 ; - - va_start (argp, message) ; - vsnprintf (buffer, 1023, message, argp) ; - va_end (argp) ; - - fprintf (stderr, "%s", buffer) ; - exit (EXIT_FAILURE) ; - - return 0 ; -} - - -/* - * piBoardRev: - * Return a number representing the hardware revision of the board. - * Revision is currently 1 or 2. - * - * Much confusion here )-: - * Seems there are some boards with 0000 in them (mistake in manufacture) - * and some board with 0005 in them (another mistake in manufacture?) - * So the distinction between boards that I can see is: - * 0000 - Error - * 0001 - Not used - * 0002 - Rev 1 - * 0003 - Rev 1 - * 0004 - Rev 2 (Early reports? - * 0005 - Rev 2 (but error?) - * 0006 - Rev 2 - * 0008 - Rev 2 - Model A - * 000e - Rev 2 + 512MB - * 000f - Rev 2 + 512MB - * - * A small thorn is the olde style overvolting - that will add in - * 1000000 - * - ********************************************************************************* - */ - -static void piBoardRevOops (const char *why) -{ - fprintf (stderr, "piBoardRev: Unable to determine board revision from /proc/cpuinfo\n") ; - fprintf (stderr, " -> %s\n", why) ; - fprintf (stderr, " -> You may want to check:\n") ; - fprintf (stderr, " -> http://www.raspberrypi.org/phpBB3/viewtopic.php?p=184410#p184410\n") ; - exit (EXIT_FAILURE) ; -} - -int piBoardRev (void) -{ - FILE *cpuFd ; - char line [120] ; - char *c, lastChar ; - static int boardRev = -1 ; - - if (boardRev != -1) // No point checking twice - return boardRev ; - - if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) - piBoardRevOops ("Unable to open /proc/cpuinfo") ; - - while (fgets (line, 120, cpuFd) != NULL) - if (strncmp (line, "Revision", 8) == 0) - break ; - - fclose (cpuFd) ; - - if (strncmp (line, "Revision", 8) != 0) - piBoardRevOops ("No \"Revision\" line") ; - - for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) - *c = 0 ; - - if (wiringPiDebug) - printf ("piboardRev: Revision string: %s\n", line) ; - - for (c = line ; *c ; ++c) - if (isdigit (*c)) - break ; - - if (!isdigit (*c)) - piBoardRevOops ("No numeric revision string") ; - -// If you have overvolted the Pi, then it appears that the revision -// has 100000 added to it! - - if (wiringPiDebug) - if (strlen (c) != 4) - printf ("piboardRev: This Pi has/is overvolted!\n") ; - - lastChar = line [strlen (line) - 1] ; - - if (wiringPiDebug) - printf ("piboardRev: lastChar is: '%c' (%d, 0x%02X)\n", lastChar, lastChar, lastChar) ; - - /**/ if ((lastChar == '2') || (lastChar == '3')) - boardRev = 1 ; - else - boardRev = 2 ; - - if (wiringPiDebug) - printf ("piBoardRev: Returning revision: %d\n", boardRev) ; - - return boardRev ; -} - - -/* - * wpiPinToGpio: - * Translate a wiringPi Pin number to native GPIO pin number. - * Provided for external support. - ********************************************************************************* - */ - -int wpiPinToGpio (int wpiPin) -{ - return pinToGpio [wpiPin & 63] ; -} - - -/* - * physPinToGpio: - * Translate a physical Pin number to native GPIO pin number. - * Provided for external support. - ********************************************************************************* - */ - -int physPinToGpio (int physPin) -{ - return physToGpio [physPin & 63] ; -} - - -/* - * setPadDrive: - * Set the PAD driver value - ********************************************************************************* - */ - -void setPadDrive (int group, int value) -{ - uint32_t wrVal ; - - if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO)) - { - if ((group < 0) || (group > 2)) - return ; - - wrVal = BCM_PASSWORD | 0x18 | (value & 7) ; - *(pads + group + 11) = wrVal ; - - if (wiringPiDebug) - { - printf ("setPadDrive: Group: %d, value: %d (%08X)\n", group, value, wrVal) ; - printf ("Read : %08X\n", *(pads + group + 11)) ; - } - } -} - - -/* - * getAlt: - * Returns the ALT bits for a given port. Only really of-use - * for the gpio readall command (I think) - ********************************************************************************* - */ - -int getAlt (int pin) -{ - int fSel, shift, alt ; - - pin &= 63 ; - - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return 0 ; - - fSel = gpioToGPFSEL [pin] ; - shift = gpioToShift [pin] ; - - alt = (*(gpio + fSel) >> shift) & 7 ; - - return alt ; -} - - -/* - * pwmSetMode: - * Select the native "balanced" mode, or standard mark:space mode - ********************************************************************************* - */ - -void pwmSetMode (int mode) -{ - if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO)) - { - if (mode == PWM_MODE_MS) - *(pwm + PWM_CONTROL) = PWM0_ENABLE | PWM1_ENABLE | PWM0_MS_MODE | PWM1_MS_MODE ; - else - *(pwm + PWM_CONTROL) = PWM0_ENABLE | PWM1_ENABLE ; - } -} - - -/* - * pwmSetRange: - * Set the PWM range register. We set both range registers to the same - * value. If you want different in your own code, then write your own. - ********************************************************************************* - */ - -void pwmSetRange (unsigned int range) -{ - if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO)) - { - *(pwm + PWM0_RANGE) = range ; delayMicroseconds (10) ; - *(pwm + PWM1_RANGE) = range ; delayMicroseconds (10) ; - } -} - - -/* - * pwmSetClock: - * Set/Change the PWM clock. Originally my code, but changed - * (for the better!) by Chris Hall, - * after further study of the manual and testing with a 'scope - ********************************************************************************* - */ - -void pwmSetClock (int divisor) -{ - uint32_t pwm_control ; - divisor &= 4095 ; - - if ((wiringPiMode == WPI_MODE_PINS) || (wiringPiMode == WPI_MODE_PHYS) || (wiringPiMode == WPI_MODE_GPIO)) - { - if (wiringPiDebug) - printf ("Setting to: %d. Current: 0x%08X\n", divisor, *(clk + PWMCLK_DIV)) ; - - pwm_control = *(pwm + PWM_CONTROL) ; // preserve PWM_CONTROL - -// We need to stop PWM prior to stopping PWM clock in MS mode otherwise BUSY -// stays high. - - *(pwm + PWM_CONTROL) = 0 ; // Stop PWM - -// Stop PWM clock before changing divisor. The delay after this does need to -// this big (95uS occasionally fails, 100uS OK), it's almost as though the BUSY -// flag is not working properly in balanced mode. Without the delay when DIV is -// adjusted the clock sometimes switches to very slow, once slow further DIV -// adjustments do nothing and it's difficult to get out of this mode. - - *(clk + PWMCLK_CNTL) = BCM_PASSWORD | 0x01 ; // Stop PWM Clock - delayMicroseconds (110) ; // prevents clock going sloooow - - while ((*(clk + PWMCLK_CNTL) & 0x80) != 0) // Wait for clock to be !BUSY - delayMicroseconds (1) ; - - *(clk + PWMCLK_DIV) = BCM_PASSWORD | (divisor << 12) ; - - *(clk + PWMCLK_CNTL) = BCM_PASSWORD | 0x11 ; // Start PWM clock - *(pwm + PWM_CONTROL) = pwm_control ; // restore PWM_CONTROL - - if (wiringPiDebug) - printf ("Set to: %d. Now : 0x%08X\n", divisor, *(clk + PWMCLK_DIV)) ; - } -} - - -/* - * gpioClockSet: - * Set the freuency on a GPIO clock pin - ********************************************************************************* - */ - -void gpioClockSet (int pin, int freq) -{ - int divi, divr, divf ; - - pin &= 63 ; - - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return ; - - divi = 19200000 / freq ; - divr = 19200000 % freq ; - divf = (int)((double)divr * 4096.0 / 19200000.0) ; - - if (divi > 4095) - divi = 4095 ; - - *(clk + gpioToClkCon [pin]) = BCM_PASSWORD | GPIO_CLOCK_SOURCE ; // Stop GPIO Clock - while ((*(clk + gpioToClkCon [pin]) & 0x80) != 0) // ... and wait - ; - - *(clk + gpioToClkDiv [pin]) = BCM_PASSWORD | (divi << 12) | divf ; // Set dividers - *(clk + gpioToClkCon [pin]) = BCM_PASSWORD | 0x10 | GPIO_CLOCK_SOURCE ; // Start Clock -} - - -/* - * wiringPiFindNode: - * Locate our device node - ********************************************************************************* - */ - -struct wiringPiNodeStruct *wiringPiFindNode (int pin) -{ - struct wiringPiNodeStruct *node = wiringPiNodes ; - - while (node != NULL) - if ((pin >= node->pinBase) && (pin <= node->pinMax)) - return node ; - else - node = node->next ; - - return NULL ; -} - - -/* - * wiringPiNewNode: - * Create a new GPIO node into the wiringPi handling system - ********************************************************************************* - */ - -static void pinModeDummy (struct wiringPiNodeStruct *node, int pin, int mode) { return ; } -static void pullUpDnControlDummy (struct wiringPiNodeStruct *node, int pin, int pud) { return ; } -static int digitalReadDummy (struct wiringPiNodeStruct *node, int pin) { return LOW ; } -static void digitalWriteDummy (struct wiringPiNodeStruct *node, int pin, int value) { return ; } -static void pwmWriteDummy (struct wiringPiNodeStruct *node, int pin, int value) { return ; } -static int analogReadDummy (struct wiringPiNodeStruct *node, int pin) { return 0 ; } -static void analogWriteDummy (struct wiringPiNodeStruct *node, int pin, int value) { return ; } - -struct wiringPiNodeStruct *wiringPiNewNode (int pinBase, int numPins) -{ - int pin ; - struct wiringPiNodeStruct *node ; - -// Minimum pin base is 64 - - if (pinBase < 64) - (void)wiringPiFailure (WPI_FATAL, "wiringPiNewNode: pinBase of %d is < 64\n", pinBase) ; - -// Check all pins in-case there is overlap: - - for (pin = pinBase ; pin < (pinBase + numPins) ; ++pin) - if (wiringPiFindNode (pin) != NULL) - (void)wiringPiFailure (WPI_FATAL, "wiringPiNewNode: Pin %d overlaps with existing definition\n", pin) ; - - node = (struct wiringPiNodeStruct *)calloc (sizeof (struct wiringPiNodeStruct), 1) ; // calloc zeros - if (node == NULL) - (void)wiringPiFailure (WPI_FATAL, "wiringPiNewNode: Unable to allocate memory: %s\n", strerror (errno)) ; - - node->pinBase = pinBase ; - node->pinMax = pinBase + numPins - 1 ; - node->pinMode = pinModeDummy ; - node->pullUpDnControl = pullUpDnControlDummy ; - node->digitalRead = digitalReadDummy ; - node->digitalWrite = digitalWriteDummy ; - node->pwmWrite = pwmWriteDummy ; - node->analogRead = analogReadDummy ; - node->analogWrite = analogWriteDummy ; - node->next = wiringPiNodes ; - wiringPiNodes = node ; - - return node ; -} - - -#ifdef notYetReady -/* - * pinED01: - * pinED10: - * Enables edge-detect mode on a pin - from a 0 to a 1 or 1 to 0 - * Pin must already be in input mode with appropriate pull up/downs set. - ********************************************************************************* - */ - -void pinEnableED01Pi (int pin) -{ - pin = pinToGpio [pin & 63] ; -} -#endif - - -/* - ********************************************************************************* - * Core Functions - ********************************************************************************* - */ - -/* - * pinModeAlt: - * This is an un-documented special to let you set any pin to any mode - ********************************************************************************* - */ - -void pinModeAlt (int pin, int mode) -{ - int fSel, shift ; - - if ((pin & PI_GPIO_MASK) == 0) // On-board pin - { - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return ; - - fSel = gpioToGPFSEL [pin] ; - shift = gpioToShift [pin] ; - - *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | ((mode & 0x7) << shift) ; - } -} - - -/* - * pinMode: - * Sets the mode of a pin to be input, output or PWM output - ********************************************************************************* - */ - -void pinMode (int pin, int mode) -{ - int fSel, shift, alt ; - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((pin & PI_GPIO_MASK) == 0) // On-board pin - { - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return ; - - fSel = gpioToGPFSEL [pin] ; - shift = gpioToShift [pin] ; - - /**/ if (mode == INPUT) - *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) ; // Sets bits to zero = input - else if (mode == OUTPUT) - *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | (1 << shift) ; - else if (mode == PWM_OUTPUT) - { - if ((alt = gpioToPwmALT [pin]) == 0) // Not a PWM pin - return ; - -// Set pin to PWM mode - - *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | (alt << shift) ; - delayMicroseconds (110) ; // See comments in pwmSetClockWPi - - pwmSetMode (PWM_MODE_BAL) ; // Pi default mode - pwmSetRange (1024) ; // Default range of 1024 - pwmSetClock (32) ; // 19.2 / 32 = 600KHz - Also starts the PWM - } - else if (mode == GPIO_CLOCK) - { - if ((alt = gpioToGpClkALT0 [pin]) == 0) // Not a GPIO_CLOCK pin - return ; - -// Set pin to GPIO_CLOCK mode and set the clock frequency to 100KHz - - *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) | (alt << shift) ; - delayMicroseconds (110) ; - gpioClockSet (pin, 100000) ; - } - } - else - { - if ((node = wiringPiFindNode (pin)) != NULL) - node->pinMode (node, pin, mode) ; - return ; - } -} - - -/* - * pullUpDownCtrl: - * Control the internal pull-up/down resistors on a GPIO pin - * The Arduino only has pull-ups and these are enabled by writing 1 - * to a port when in input mode - this paradigm doesn't quite apply - * here though. - ********************************************************************************* - */ - -void pullUpDnControl (int pin, int pud) -{ - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((pin & PI_GPIO_MASK) == 0) // On-Board Pin - { - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return ; - - *(gpio + GPPUD) = pud & 3 ; delayMicroseconds (5) ; - *(gpio + gpioToPUDCLK [pin]) = 1 << (pin & 31) ; delayMicroseconds (5) ; - - *(gpio + GPPUD) = 0 ; delayMicroseconds (5) ; - *(gpio + gpioToPUDCLK [pin]) = 0 ; delayMicroseconds (5) ; - } - else // Extension module - { - if ((node = wiringPiFindNode (pin)) != NULL) - node->pullUpDnControl (node, pin, pud) ; - return ; - } -} - - -/* - * digitalRead: - * Read the value of a given Pin, returning HIGH or LOW - ********************************************************************************* - */ - -int digitalRead (int pin) -{ - char c ; - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((pin & PI_GPIO_MASK) == 0) // On-Board Pin - { - /**/ if (wiringPiMode == WPI_MODE_GPIO_SYS) // Sys mode - { - if (sysFds [pin] == -1) - return LOW ; - - lseek (sysFds [pin], 0L, SEEK_SET) ; - read (sysFds [pin], &c, 1) ; - return (c == '0') ? LOW : HIGH ; - } - else if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return LOW ; - - if ((*(gpio + gpioToGPLEV [pin]) & (1 << (pin & 31))) != 0) - return HIGH ; - else - return LOW ; - } - else - { - if ((node = wiringPiFindNode (pin)) == NULL) - return LOW ; - return node->digitalRead (node, pin) ; - } -} - - -/* - * digitalWrite: - * Set an output bit - ********************************************************************************* - */ - -void digitalWrite (int pin, int value) -{ - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((pin & PI_GPIO_MASK) == 0) // On-Board Pin - { - /**/ if (wiringPiMode == WPI_MODE_GPIO_SYS) // Sys mode - { - if (sysFds [pin] != -1) - { - if (value == LOW) - write (sysFds [pin], "0\n", 2) ; - else - write (sysFds [pin], "1\n", 2) ; - } - return ; - } - else if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return ; - - if (value == LOW) - *(gpio + gpioToGPCLR [pin]) = 1 << (pin & 31) ; - else - *(gpio + gpioToGPSET [pin]) = 1 << (pin & 31) ; - } - else - { - if ((node = wiringPiFindNode (pin)) != NULL) - node->digitalWrite (node, pin, value) ; - } -} - - -/* - * pwmWrite: - * Set an output PWM value - ********************************************************************************* - */ - -void pwmWrite (int pin, int value) -{ - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((pin & PI_GPIO_MASK) == 0) // On-Board Pin - { - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - else if (wiringPiMode != WPI_MODE_GPIO) - return ; - - *(pwm + gpioToPwmPort [pin]) = value ; - } - else - { - if ((node = wiringPiFindNode (pin)) != NULL) - node->pwmWrite (node, pin, value) ; - } -} - - -/* - * analogRead: - * Read the analog value of a given Pin. - * There is no on-board Pi analog hardware, - * so this needs to go to a new node. - ********************************************************************************* - */ - -int analogRead (int pin) -{ - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((node = wiringPiFindNode (pin)) == NULL) - return 0 ; - else - return node->analogRead (node, pin) ; -} - - -/* - * analogWrite: - * Write the analog value to the given Pin. - * There is no on-board Pi analog hardware, - * so this needs to go to a new node. - ********************************************************************************* - */ - -void analogWrite (int pin, int value) -{ - struct wiringPiNodeStruct *node = wiringPiNodes ; - - if ((node = wiringPiFindNode (pin)) == NULL) - return ; - - node->analogWrite (node, pin, value) ; -} - - - -/* - * digitalWriteByte: - * Pi Specific - * Write an 8-bit byte to the first 8 GPIO pins - try to do it as - * fast as possible. - * However it still needs 2 operations to set the bits, so any external - * hardware must not rely on seeing a change as there will be a change - * to set the outputs bits to zero, then another change to set the 1's - ********************************************************************************* - */ - -void digitalWriteByte (int value) -{ - uint32_t pinSet = 0 ; - uint32_t pinClr = 0 ; - int mask = 1 ; - int pin ; - - /**/ if (wiringPiMode == WPI_MODE_GPIO_SYS) - { - for (pin = 0 ; pin < 8 ; ++pin) - { - digitalWrite (pin, value & mask) ; - mask <<= 1 ; - } - return ; - } - else - { - for (pin = 0 ; pin < 8 ; ++pin) - { - if ((value & mask) == 0) - pinClr |= (1 << pinToGpio [pin]) ; - else - pinSet |= (1 << pinToGpio [pin]) ; - - mask <<= 1 ; - } - - *(gpio + gpioToGPCLR [0]) = pinClr ; - *(gpio + gpioToGPSET [0]) = pinSet ; - } -} - - -/* - * waitForInterrupt: - * Pi Specific. - * Wait for Interrupt on a GPIO pin. - * This is actually done via the /sys/class/gpio interface regardless of - * the wiringPi access mode in-use. Maybe sometime it might get a better - * way for a bit more efficiency. - ********************************************************************************* - */ - -int waitForInterrupt (int pin, int mS) -{ - int fd, x ; - uint8_t c ; - struct pollfd polls ; - - /**/ if (wiringPiMode == WPI_MODE_PINS) - pin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - pin = physToGpio [pin] ; - - if ((fd = sysFds [pin]) == -1) - return -2 ; - -// Setup poll structure - - polls.fd = fd ; - polls.events = POLLPRI ; // Urgent data! - -// Wait for it ... - - x = poll (&polls, 1, mS) ; - -// Do a dummy read to clear the interrupt -// A one character read appars to be enough. - - (void)read (fd, &c, 1) ; - - return x ; -} - - -/* - * interruptHandler: - * This is a thread and gets started to wait for the interrupt we're - * hoping to catch. It will call the user-function when the interrupt - * fires. - ********************************************************************************* - */ - -static void *interruptHandler (void *arg) -{ - int myPin ; - - (void)piHiPri (55) ; // Only effective if we run as root - - myPin = pinPass ; - pinPass = -1 ; - - for (;;) - if (waitForInterrupt (myPin, -1) > 0) - isrFunctions [myPin] () ; - - return NULL ; -} - - -/* - * wiringPiISR: - * Pi Specific. - * Take the details and create an interrupt handler that will do a call- - * back to the user supplied function. - ********************************************************************************* - */ - -int wiringPiISR (int pin, int mode, void (*function)(void)) -{ - pthread_t threadId ; - const char *modeS ; - char fName [64] ; - char pinS [8] ; - pid_t pid ; - int count, i ; - char c ; - int bcmGpioPin ; - - if ((pin < 0) || (pin > 63)) - return wiringPiFailure (WPI_FATAL, "wiringPiISR: pin must be 0-63 (%d)\n", pin) ; - - /**/ if (wiringPiMode == WPI_MODE_UNINITIALISED) - return wiringPiFailure (WPI_FATAL, "wiringPiISR: wiringPi has not been initialised. Unable to continue.\n") ; - else if (wiringPiMode == WPI_MODE_PINS) - bcmGpioPin = pinToGpio [pin] ; - else if (wiringPiMode == WPI_MODE_PHYS) - bcmGpioPin = physToGpio [pin] ; - else - bcmGpioPin = pin ; - -// Now export the pin and set the right edge -// We're going to use the gpio program to do this, so it assumes -// a full installation of wiringPi. It's a bit 'clunky', but it -// is a way that will work when we're running in "Sys" mode, as -// a non-root user. (without sudo) - - if (mode != INT_EDGE_SETUP) - { - /**/ if (mode == INT_EDGE_FALLING) - modeS = "falling" ; - else if (mode == INT_EDGE_RISING) - modeS = "rising" ; - else - modeS = "both" ; - - sprintf (pinS, "%d", bcmGpioPin) ; - - if ((pid = fork ()) < 0) // Fail - return wiringPiFailure (WPI_FATAL, "wiringPiISR: fork failed: %s\n", strerror (errno)) ; - - if (pid == 0) // Child, exec - { - execl ("/usr/local/bin/gpio", "gpio", "edge", pinS, modeS, (char *)NULL) ; - return wiringPiFailure (WPI_FATAL, "wiringPiISR: execl failed: %s\n", strerror (errno)) ; - } - else // Parent, wait - wait (NULL) ; - } - -// Now pre-open the /sys/class node - but it may already be open if -// we are in Sys mode... - - if (sysFds [bcmGpioPin] == -1) - { - sprintf (fName, "/sys/class/gpio/gpio%d/value", bcmGpioPin) ; - if ((sysFds [bcmGpioPin] = open (fName, O_RDWR)) < 0) - return wiringPiFailure (WPI_FATAL, "wiringPiISR: unable to open %s: %s\n", fName, strerror (errno)) ; - } - -// Clear any initial pending interrupt - - ioctl (sysFds [bcmGpioPin], FIONREAD, &count) ; - for (i = 0 ; i < count ; ++i) - read (sysFds [bcmGpioPin], &c, 1) ; - - isrFunctions [pin] = function ; - - pthread_mutex_lock (&pinMutex) ; - pinPass = pin ; - pthread_create (&threadId, NULL, interruptHandler, NULL) ; - while (pinPass != -1) - delay (1) ; - pthread_mutex_unlock (&pinMutex) ; - - return 0 ; -} - - -/* - * initialiseEpoch: - * Initialise our start-of-time variable to be the current unix - * time in milliseconds and microseconds. - ********************************************************************************* - */ - -static void initialiseEpoch (void) -{ - struct timeval tv ; - - gettimeofday (&tv, NULL) ; - epochMilli = (uint64_t)tv.tv_sec * (uint64_t)1000 + (uint64_t)(tv.tv_usec / 1000) ; - epochMicro = (uint64_t)tv.tv_sec * (uint64_t)1000000 + (uint64_t)(tv.tv_usec) ; -} - - -/* - * delay: - * Wait for some number of milliseconds - ********************************************************************************* - */ - -void delay (unsigned int howLong) -{ - struct timespec sleeper, dummy ; - - sleeper.tv_sec = (time_t)(howLong / 1000) ; - sleeper.tv_nsec = (long)(howLong % 1000) * 1000000 ; - - nanosleep (&sleeper, &dummy) ; -} - - -/* - * delayMicroseconds: - * This is somewhat intersting. It seems that on the Pi, a single call - * to nanosleep takes some 80 to 130 microseconds anyway, so while - * obeying the standards (may take longer), it's not always what we - * want! - * - * So what I'll do now is if the delay is less than 100uS we'll do it - * in a hard loop, watching a built-in counter on the ARM chip. This is - * somewhat sub-optimal in that it uses 100% CPU, something not an issue - * in a microcontroller, but under a multi-tasking, multi-user OS, it's - * wastefull, however we've no real choice )-: - * - * Plan B: It seems all might not be well with that plan, so changing it - * to use gettimeofday () and poll on that instead... - ********************************************************************************* - */ - -void delayMicrosecondsHard (unsigned int howLong) -{ - struct timeval tNow, tLong, tEnd ; - - gettimeofday (&tNow, NULL) ; - tLong.tv_sec = howLong / 1000000 ; - tLong.tv_usec = howLong % 1000000 ; - timeradd (&tNow, &tLong, &tEnd) ; - - while (timercmp (&tNow, &tEnd, <)) - gettimeofday (&tNow, NULL) ; -} - -void delayMicroseconds (unsigned int howLong) -{ - struct timespec sleeper ; - unsigned int uSecs = howLong % 1000000 ; - unsigned int wSecs = howLong / 1000000 ; - - /**/ if (howLong == 0) - return ; - else if (howLong < 100) - delayMicrosecondsHard (howLong) ; - else - { - sleeper.tv_sec = wSecs ; - sleeper.tv_nsec = (long)(uSecs * 1000L) ; - nanosleep (&sleeper, NULL) ; - } -} - - -/* - * millis: - * Return a number of milliseconds as an unsigned int. - ********************************************************************************* - */ - -unsigned int millis (void) -{ - struct timeval tv ; - uint64_t now ; - - gettimeofday (&tv, NULL) ; - now = (uint64_t)tv.tv_sec * (uint64_t)1000 + (uint64_t)(tv.tv_usec / 1000) ; - - return (uint32_t)(now - epochMilli) ; -} - - -/* - * micros: - * Return a number of microseconds as an unsigned int. - ********************************************************************************* - */ - -unsigned int micros (void) -{ - struct timeval tv ; - uint64_t now ; - - gettimeofday (&tv, NULL) ; - now = (uint64_t)tv.tv_sec * (uint64_t)1000000 + (uint64_t)tv.tv_usec ; - - return (uint32_t)(now - epochMicro) ; -} - - -/* - * wiringPiSetup: - * Must be called once at the start of your program execution. - * - * Default setup: Initialises the system into wiringPi Pin mode and uses the - * memory mapped hardware directly. - ********************************************************************************* - */ - -int wiringPiSetup (void) -{ - int fd ; - int boardRev ; - - if (getenv (ENV_DEBUG) != NULL) - wiringPiDebug = TRUE ; - - if (getenv (ENV_CODES) != NULL) - wiringPiReturnCodes = TRUE ; - - if (geteuid () != 0) - (void)wiringPiFailure (WPI_FATAL, "wiringPiSetup: Must be root. (Did you forget sudo?)\n") ; - - if (wiringPiDebug) - printf ("wiringPi: wiringPiSetup called\n") ; - - boardRev = piBoardRev () ; - - if (boardRev == 1) - { - pinToGpio = pinToGpioR1 ; - physToGpio = physToGpioR1 ; - } - else - { - pinToGpio = pinToGpioR2 ; - physToGpio = physToGpioR2 ; - } - -// Open the master /dev/memory device - - if ((fd = open ("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC) ) < 0) - return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: Unable to open /dev/mem: %s\n", strerror (errno)) ; - -// GPIO: - - gpio = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_BASE) ; - if ((int32_t)gpio == -1) - return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (GPIO) failed: %s\n", strerror (errno)) ; - -// PWM - - pwm = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_PWM) ; - if ((int32_t)pwm == -1) - return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (PWM) failed: %s\n", strerror (errno)) ; - -// Clock control (needed for PWM) - - clk = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, CLOCK_BASE) ; - if ((int32_t)clk == -1) - return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (CLOCK) failed: %s\n", strerror (errno)) ; - -// The drive pads - - pads = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_PADS) ; - if ((int32_t)pads == -1) - return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (PADS) failed: %s\n", strerror (errno)) ; - -#ifdef USE_TIMER -// The system timer - - timer = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_TIMER) ; - if ((int32_t)timer == -1) - return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (TIMER) failed: %s\n", strerror (errno)) ; - -// Set the timer to free-running, 1MHz. -// 0xF9 is 249, the timer divide is base clock / (divide+1) -// so base clock is 250MHz / 250 = 1MHz. - - *(timer + TIMER_CONTROL) = 0x0000280 ; - *(timer + TIMER_PRE_DIV) = 0x00000F9 ; - timerIrqRaw = timer + TIMER_IRQ_RAW ; -#endif - - initialiseEpoch () ; - - wiringPiMode = WPI_MODE_PINS ; - - return 0 ; -} - - -/* - * wiringPiSetupGpio: - * Must be called once at the start of your program execution. - * - * GPIO setup: Initialises the system into GPIO Pin mode and uses the - * memory mapped hardware directly. - ********************************************************************************* - */ - -int wiringPiSetupGpio (void) -{ - (void)wiringPiSetup () ; - - if (wiringPiDebug) - printf ("wiringPi: wiringPiSetupGpio called\n") ; - - wiringPiMode = WPI_MODE_GPIO ; - - return 0 ; -} - - -/* - * wiringPiSetupPhys: - * Must be called once at the start of your program execution. - * - * Phys setup: Initialises the system into Physical Pin mode and uses the - * memory mapped hardware directly. - ********************************************************************************* - */ - -int wiringPiSetupPhys (void) -{ - (void)wiringPiSetup () ; - - if (wiringPiDebug) - printf ("wiringPi: wiringPiSetupPhys called\n") ; - - wiringPiMode = WPI_MODE_PHYS ; - - return 0 ; -} - - -/* - * wiringPiSetupSys: - * Must be called once at the start of your program execution. - * - * Initialisation (again), however this time we are using the /sys/class/gpio - * interface to the GPIO systems - slightly slower, but always usable as - * a non-root user, assuming the devices are already exported and setup correctly. - */ - -int wiringPiSetupSys (void) -{ - int boardRev ; - int pin ; - char fName [128] ; - - if (getenv (ENV_DEBUG) != NULL) - wiringPiDebug = TRUE ; - - if (getenv (ENV_CODES) != NULL) - wiringPiReturnCodes = TRUE ; - - if (wiringPiDebug) - printf ("wiringPi: wiringPiSetupSys called\n") ; - - boardRev = piBoardRev () ; - - if (boardRev == 1) - { - pinToGpio = pinToGpioR1 ; - physToGpio = physToGpioR1 ; - } - else - { - pinToGpio = pinToGpioR2 ; - physToGpio = physToGpioR2 ; - } - -// Open and scan the directory, looking for exported GPIOs, and pre-open -// the 'value' interface to speed things up for later - - for (pin = 0 ; pin < 64 ; ++pin) - { - sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ; - sysFds [pin] = open (fName, O_RDWR) ; - } - - initialiseEpoch () ; - - wiringPiMode = WPI_MODE_GPIO_SYS ; - - return 0 ; -} diff --git a/WiringPi/wiringPi/wiringPi.h b/WiringPi/wiringPi/wiringPi.h deleted file mode 100644 index 7cfd2e5..0000000 --- a/WiringPi/wiringPi/wiringPi.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * wiringPi: - * Arduino compatable (ish) Wiring library for the Raspberry Pi - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#ifndef __WIRING_PI_H__ -#define __WIRING_PI_H__ - -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif -// Handy defines - -// Deprecated -#define NUM_PINS 17 - -#define WPI_MODE_PINS 0 -#define WPI_MODE_GPIO 1 -#define WPI_MODE_GPIO_SYS 2 -#define WPI_MODE_PHYS 3 -#define WPI_MODE_PIFACE 4 -#define WPI_MODE_UNINITIALISED -1 - -// Pin modes - -#define INPUT 0 -#define OUTPUT 1 -#define PWM_OUTPUT 2 -#define GPIO_CLOCK 3 - -#define LOW 0 -#define HIGH 1 - -// Pull up/down/none - -#define PUD_OFF 0 -#define PUD_DOWN 1 -#define PUD_UP 2 - -// PWM - -#define PWM_MODE_MS 0 -#define PWM_MODE_BAL 1 - -// Interrupt levels - -#define INT_EDGE_SETUP 0 -#define INT_EDGE_FALLING 1 -#define INT_EDGE_RISING 2 -#define INT_EDGE_BOTH 3 - -// Threads - -#define PI_THREAD(X) void *X (void *dummy) - -// Failure modes - -#define WPI_FATAL (1==1) -#define WPI_ALMOST (1==2) - - -// wiringPiNodeStruct: -// This describes additional device nodes in the extended wiringPi -// 2.0 scheme of things. -// It's a simple linked list for now, but will hopefully migrate to -// a binary tree for efficiency reasons - but then again, the chances -// of more than 1 or 2 devices being added are fairly slim, so who -// knows.... - -struct wiringPiNodeStruct -{ - int pinBase ; - int pinMax ; - - int fd ; // Node specific - unsigned int data0 ; // ditto - unsigned int data1 ; // ditto - unsigned int data2 ; // ditto - unsigned int data3 ; // ditto - - void (*pinMode) (struct wiringPiNodeStruct *node, int pin, int mode) ; - void (*pullUpDnControl) (struct wiringPiNodeStruct *node, int pin, int mode) ; - int (*digitalRead) (struct wiringPiNodeStruct *node, int pin) ; - void (*digitalWrite) (struct wiringPiNodeStruct *node, int pin, int value) ; - void (*pwmWrite) (struct wiringPiNodeStruct *node, int pin, int value) ; - int (*analogRead) (struct wiringPiNodeStruct *node, int pin) ; - void (*analogWrite) (struct wiringPiNodeStruct *node, int pin, int value) ; - - struct wiringPiNodeStruct *next ; -} ; - -extern struct wiringPiNodeStruct *wiringPiNodes ; - - -// Function prototypes -// c++ wrappers thanks to a comment by Nick Lott -// (and others on the Raspberry Pi forums) - -#ifdef __cplusplus -extern "C" { -#endif - -// Internal - -extern int wiringPiFailure (int fatal, const char *message, ...) ; - -// Core wiringPi functions - -extern struct wiringPiNodeStruct *wiringPiFindNode (int pin) ; -extern struct wiringPiNodeStruct *wiringPiNewNode (int pinBase, int numPins) ; - -extern int wiringPiSetup (void) ; -extern int wiringPiSetupSys (void) ; -extern int wiringPiSetupGpio (void) ; -extern int wiringPiSetupPhys (void) ; - -extern void pinModeAlt (int pin, int mode) ; -extern void pinMode (int pin, int mode) ; -extern void pullUpDnControl (int pin, int pud) ; -extern int digitalRead (int pin) ; -extern void digitalWrite (int pin, int value) ; -extern void pwmWrite (int pin, int value) ; -extern int analogRead (int pin) ; -extern void analogWrite (int pin, int value) ; - -// PiFace specifics -// (Deprecated) - -extern int wiringPiSetupPiFace (void) ; -extern int wiringPiSetupPiFaceForGpioProg (void) ; // Don't use this - for gpio program only - -// On-Board Raspberry Pi hardware specific stuff - -extern int piBoardRev (void) ; -extern int wpiPinToGpio (int wpiPin) ; -extern int physPinToGpio (int physPin) ; -extern void setPadDrive (int group, int value) ; -extern int getAlt (int pin) ; -extern void digitalWriteByte (int value) ; -extern void pwmSetMode (int mode) ; -extern void pwmSetRange (unsigned int range) ; -extern void pwmSetClock (int divisor) ; -extern void gpioClockSet (int pin, int freq) ; - -// Interrupts -// (Also Pi hardware specific) - -extern int waitForInterrupt (int pin, int mS) ; -extern int wiringPiISR (int pin, int mode, void (*function)(void)) ; - -// Threads - -extern int piThreadCreate (void *(*fn)(void *)) ; -extern void piLock (int key) ; -extern void piUnlock (int key) ; - -// Schedulling priority - -extern int piHiPri (const int pri) ; - -// Extras from arduino land - -extern void delay (unsigned int howLong) ; -extern void delayMicroseconds (unsigned int howLong) ; -extern unsigned int millis (void) ; -extern unsigned int micros (void) ; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/WiringPi/wiringPi/wiringPiI2C.c b/WiringPi/wiringPi/wiringPiI2C.c deleted file mode 100644 index c787bce..0000000 --- a/WiringPi/wiringPi/wiringPiI2C.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * wiringPiI2C.c: - * Simplified I2C access routines - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -/* - * Notes: - * The Linux I2C code is actually the same (almost) as the SMBus code. - * SMBus is System Management Bus - and in essentially I2C with some - * additional functionality added, and stricter controls on the electrical - * specifications, etc. however I2C does work well with it and the - * protocols work over both. - * - * I'm directly including the SMBus functions here as some Linux distros - * lack the correct header files, and also some header files are GPLv2 - * rather than the LGPL that wiringPi is released under - presumably because - * originally no-one expected I2C/SMBus to be used outside the kernel - - * however enter the Raspberry Pi with people now taking directly to I2C - * devices without going via the kernel... - * - * This may ultimately reduce the flexibility of this code, but it won't be - * hard to maintain it and keep it current, should things change. - * - * Information here gained from: kernel/Documentation/i2c/dev-interface - * as well as other online resources. - ********************************************************************************* - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "wiringPi.h" -#include "wiringPiI2C.h" - -// I2C definitions - -#define I2C_SLAVE 0x0703 -#define I2C_SMBUS 0x0720 /* SMBus-level access */ - -#define I2C_SMBUS_READ 1 -#define I2C_SMBUS_WRITE 0 - -// SMBus transaction types - -#define I2C_SMBUS_QUICK 0 -#define I2C_SMBUS_BYTE 1 -#define I2C_SMBUS_BYTE_DATA 2 -#define I2C_SMBUS_WORD_DATA 3 -#define I2C_SMBUS_PROC_CALL 4 -#define I2C_SMBUS_BLOCK_DATA 5 -#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 -#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ -#define I2C_SMBUS_I2C_BLOCK_DATA 8 - -// SMBus messages - -#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ -#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */ - -// Structures used in the ioctl() calls - -union i2c_smbus_data -{ - uint8_t byte ; - uint16_t word ; - uint8_t block [I2C_SMBUS_BLOCK_MAX + 2] ; // block [0] is used for length + one more for PEC -} ; - -struct i2c_smbus_ioctl_data -{ - char read_write ; - uint8_t command ; - int size ; - union i2c_smbus_data *data ; -} ; - -static inline int i2c_smbus_access (int fd, char rw, uint8_t command, int size, union i2c_smbus_data *data) -{ - struct i2c_smbus_ioctl_data args ; - - args.read_write = rw ; - args.command = command ; - args.size = size ; - args.data = data ; - return ioctl (fd, I2C_SMBUS, &args) ; -} - - -/* - * wiringPiI2CRead: - * Simple device read - ********************************************************************************* - */ - -int wiringPiI2CRead (int fd) -{ - union i2c_smbus_data data ; - - if (i2c_smbus_access (fd, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data)) - return -1 ; - else - return data.byte & 0xFF ; -} - - -/* - * wiringPiI2CReadReg8: wiringPiI2CReadReg16: - * Read an 8 or 16-bit value from a regsiter on the device - ********************************************************************************* - */ - -int wiringPiI2CReadReg8 (int fd, int reg) -{ - union i2c_smbus_data data; - - if (i2c_smbus_access (fd, I2C_SMBUS_READ, reg, I2C_SMBUS_BYTE_DATA, &data)) - return -1 ; - else - return data.byte & 0xFF ; -} - -int wiringPiI2CReadReg16 (int fd, int reg) -{ - union i2c_smbus_data data; - - if (i2c_smbus_access (fd, I2C_SMBUS_READ, reg, I2C_SMBUS_WORD_DATA, &data)) - return -1 ; - else - return data.word & 0xFFFF ; -} - - -/* - * wiringPiI2CWrite: - * Simple device write - ********************************************************************************* - */ - -int wiringPiI2CWrite (int fd, int data) -{ - return i2c_smbus_access (fd, I2C_SMBUS_WRITE, data, I2C_SMBUS_BYTE, NULL) ; -} - - -/* - * wiringPiI2CWriteReg8: wiringPiI2CWriteReg16: - * Write an 8 or 16-bit value to the given register - ********************************************************************************* - */ - -int wiringPiI2CWriteReg8 (int fd, int reg, int value) -{ - union i2c_smbus_data data ; - - data.byte = value ; - return i2c_smbus_access (fd, I2C_SMBUS_WRITE, reg, I2C_SMBUS_BYTE_DATA, &data) ; -} - -int wiringPiI2CWriteReg16 (int fd, int reg, int value) -{ - union i2c_smbus_data data ; - - data.word = value ; - return i2c_smbus_access (fd, I2C_SMBUS_WRITE, reg, I2C_SMBUS_WORD_DATA, &data) ; -} - - -/* - * wiringPiI2CSetupInterface: - * Undocumented access to set the interface explicitly - might be used - * for the Pi's 2nd I2C interface... - ********************************************************************************* - */ - -int wiringPiI2CSetupInterface (const char *device, int devId) -{ - int fd ; - - if ((fd = open (device, O_RDWR)) < 0) - return wiringPiFailure (WPI_ALMOST, "Unable to open I2C device: %s\n", strerror (errno)) ; - - if (ioctl (fd, I2C_SLAVE, devId) < 0) - return wiringPiFailure (WPI_ALMOST, "Unable to select I2C device: %s\n", strerror (errno)) ; - - return fd ; -} - - -/* - * wiringPiI2CSetup: - * Open the I2C device, and regsiter the target device - ********************************************************************************* - */ - -int wiringPiI2CSetup (const int devId) -{ - int rev ; - const char *device ; - - rev = piBoardRev () ; - - if (rev == 1) - device = "/dev/i2c-0" ; - else - device = "/dev/i2c-1" ; - - return wiringPiI2CSetupInterface (device, devId) ; -} diff --git a/WiringPi/wiringPi/wiringPiI2C.h b/WiringPi/wiringPi/wiringPiI2C.h deleted file mode 100644 index 6db8c68..0000000 --- a/WiringPi/wiringPi/wiringPiI2C.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * wiringPiI2C.h: - * Simplified I2C access routines - * Copyright (c) 2013 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int wiringPiI2CRead (int fd) ; -extern int wiringPiI2CReadReg8 (int fd, int reg) ; -extern int wiringPiI2CReadReg16 (int fd, int reg) ; - -extern int wiringPiI2CWrite (int fd, int data) ; -extern int wiringPiI2CWriteReg8 (int fd, int reg, int data) ; -extern int wiringPiI2CWriteReg16 (int fd, int reg, int data) ; - -extern int wiringPiI2CSetupInterface (const char *device, int devId) ; -extern int wiringPiI2CSetup (const int devId) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/wiringPiSPI.c b/WiringPi/wiringPi/wiringPiSPI.c deleted file mode 100644 index 215a027..0000000 --- a/WiringPi/wiringPi/wiringPiSPI.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * wiringPiSPI.c: - * Simplified SPI access routines - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - - -#include -#include -#include -#include -#include -#include - -#include "wiringPi.h" - -#include "wiringPiSPI.h" - - -// The SPI bus parameters -// Variables as they need to be passed as pointers later on - -const static char *spiDev0 = "/dev/spidev0.0" ; -const static char *spiDev1 = "/dev/spidev0.1" ; -const static uint8_t spiMode = 0 ; -const static uint8_t spiBPW = 8 ; -const static uint16_t spiDelay = 0 ; - -static uint32_t spiSpeeds [2] ; -static int spiFds [2] ; - - -/* - * wiringPiSPIGetFd: - * Return the file-descriptor for the given channel - ********************************************************************************* - */ - -int wiringPiSPIGetFd (int channel) -{ - return spiFds [channel & 1] ; -} - - -/* - * wiringPiSPIDataRW: - * Write and Read a block of data over the SPI bus. - * Note the data ia being read into the transmit buffer, so will - * overwrite it! - * This is also a full-duplex operation. - ********************************************************************************* - */ - -int wiringPiSPIDataRW (int channel, unsigned char *data, int len) -{ - struct spi_ioc_transfer spi ; - - channel &= 1 ; - - spi.tx_buf = (unsigned long)data ; - spi.rx_buf = (unsigned long)data ; - spi.len = len ; - spi.delay_usecs = spiDelay ; - spi.speed_hz = spiSpeeds [channel] ; - spi.bits_per_word = spiBPW ; - - return ioctl (spiFds [channel], SPI_IOC_MESSAGE(1), &spi) ; -} - - -/* - * wiringPiSPISetup: - * Open the SPI device, and set it up, etc. - ********************************************************************************* - */ - -int wiringPiSPISetup (int channel, int speed) -{ - int fd ; - - channel &= 1 ; - - if ((fd = open (channel == 0 ? spiDev0 : spiDev1, O_RDWR)) < 0) - return wiringPiFailure (WPI_ALMOST, "Unable to open SPI device: %s\n", strerror (errno)) ; - - spiSpeeds [channel] = speed ; - spiFds [channel] = fd ; - -// Set SPI parameters. -// Why are we reading it afterwriting it? I've no idea, but for now I'm blindly -// copying example code I've seen online... - - if (ioctl (fd, SPI_IOC_WR_MODE, &spiMode) < 0) - return wiringPiFailure (WPI_ALMOST, "SPI Mode Change failure: %s\n", strerror (errno)) ; - - if (ioctl (fd, SPI_IOC_WR_BITS_PER_WORD, &spiBPW) < 0) - return wiringPiFailure (WPI_ALMOST, "SPI BPW Change failure: %s\n", strerror (errno)) ; - - if (ioctl (fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed) < 0) - return wiringPiFailure (WPI_ALMOST, "SPI Speed Change failure: %s\n", strerror (errno)) ; - - return fd ; -} diff --git a/WiringPi/wiringPi/wiringPiSPI.h b/WiringPi/wiringPi/wiringPiSPI.h deleted file mode 100644 index f53697d..0000000 --- a/WiringPi/wiringPi/wiringPiSPI.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * wiringPiSPI.h: - * Simplified SPI access routines - * Copyright (c) 2012 Gordon Henderson - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with wiringPi. - * If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -int wiringPiSPIGetFd (int channel) ; -int wiringPiSPIDataRW (int channel, unsigned char *data, int len) ; -int wiringPiSPISetup (int channel, int speed) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/wiringSerial.c b/WiringPi/wiringPi/wiringSerial.c deleted file mode 100644 index ca976a9..0000000 --- a/WiringPi/wiringPi/wiringSerial.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * wiringSerial.c: - * Handle a serial port - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wiringSerial.h" - -/* - * serialOpen: - * Open and initialise the serial port, setting all the right - * port parameters - or as many as are required - hopefully! - ********************************************************************************* - */ - -int serialOpen (const char *device, const int baud) -{ - struct termios options ; - speed_t myBaud ; - int status, fd ; - - switch (baud) - { - case 50: myBaud = B50 ; break ; - case 75: myBaud = B75 ; break ; - case 110: myBaud = B110 ; break ; - case 134: myBaud = B134 ; break ; - case 150: myBaud = B150 ; break ; - case 200: myBaud = B200 ; break ; - case 300: myBaud = B300 ; break ; - case 600: myBaud = B600 ; break ; - case 1200: myBaud = B1200 ; break ; - case 1800: myBaud = B1800 ; break ; - case 2400: myBaud = B2400 ; break ; - case 4800: myBaud = B4800 ; break ; - case 9600: myBaud = B9600 ; break ; - case 19200: myBaud = B19200 ; break ; - case 38400: myBaud = B38400 ; break ; - case 57600: myBaud = B57600 ; break ; - case 115200: myBaud = B115200 ; break ; - case 230400: myBaud = B230400 ; break ; - - default: - return -2 ; - } - - if ((fd = open (device, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK)) == -1) - return -1 ; - - fcntl (fd, F_SETFL, O_RDWR) ; - -// Get and modify current options: - - tcgetattr (fd, &options) ; - - cfmakeraw (&options) ; - cfsetispeed (&options, myBaud) ; - cfsetospeed (&options, myBaud) ; - - options.c_cflag |= (CLOCAL | CREAD) ; - options.c_cflag &= ~PARENB ; - options.c_cflag &= ~CSTOPB ; - options.c_cflag &= ~CSIZE ; - options.c_cflag |= CS8 ; - options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG) ; - options.c_oflag &= ~OPOST ; - - options.c_cc [VMIN] = 0 ; - options.c_cc [VTIME] = 100 ; // Ten seconds (100 deciseconds) - - tcsetattr (fd, TCSANOW | TCSAFLUSH, &options) ; - - ioctl (fd, TIOCMGET, &status); - - status |= TIOCM_DTR ; - status |= TIOCM_RTS ; - - ioctl (fd, TIOCMSET, &status); - - usleep (10000) ; // 10mS - - return fd ; -} - - -/* - * serialFlush: - * Flush the serial buffers (both tx & rx) - ********************************************************************************* - */ - -void serialFlush (const int fd) -{ - tcflush (fd, TCIOFLUSH) ; -} - - -/* - * serialClose: - * Release the serial port - ********************************************************************************* - */ - -void serialClose (const int fd) -{ - close (fd) ; -} - - -/* - * serialPutchar: - * Send a single character to the serial port - ********************************************************************************* - */ - -void serialPutchar (const int fd, const unsigned char c) -{ - write (fd, &c, 1) ; -} - - -/* - * serialPuts: - * Send a string to the serial port - ********************************************************************************* - */ - -void serialPuts (const int fd, const char *s) -{ - write (fd, s, strlen (s)) ; -} - -/* - * serialPrintf: - * Printf over Serial - ********************************************************************************* - */ - -void serialPrintf (const int fd, const char *message, ...) -{ - va_list argp ; - char buffer [1024] ; - - va_start (argp, message) ; - vsnprintf (buffer, 1023, message, argp) ; - va_end (argp) ; - - serialPuts (fd, buffer) ; -} - - -/* - * serialDataAvail: - * Return the number of bytes of data avalable to be read in the serial port - ********************************************************************************* - */ - -int serialDataAvail (const int fd) -{ - int result ; - - if (ioctl (fd, FIONREAD, &result) == -1) - return -1 ; - - return result ; -} - - -/* - * serialGetchar: - * Get a single character from the serial device. - * Note: Zero is a valid character and this function will time-out after - * 10 seconds. - ********************************************************************************* - */ - -int serialGetchar (const int fd) -{ - uint8_t x ; - - if (read (fd, &x, 1) != 1) - return -1 ; - - return ((int)x) & 0xFF ; -} diff --git a/WiringPi/wiringPi/wiringSerial.h b/WiringPi/wiringPi/wiringSerial.h deleted file mode 100644 index 430dc73..0000000 --- a/WiringPi/wiringPi/wiringSerial.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * wiringSerial.h: - * Handle a serial port - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int serialOpen (const char *device, const int baud) ; -extern void serialClose (const int fd) ; -extern void serialFlush (const int fd) ; -extern void serialPutchar (const int fd, const unsigned char c) ; -extern void serialPuts (const int fd, const char *s) ; -extern void serialPrintf (const int fd, const char *message, ...) ; -extern int serialDataAvail (const int fd) ; -extern int serialGetchar (const int fd) ; - -#ifdef __cplusplus -} -#endif diff --git a/WiringPi/wiringPi/wiringShift.c b/WiringPi/wiringPi/wiringShift.c deleted file mode 100644 index 3df94e8..0000000 --- a/WiringPi/wiringPi/wiringShift.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * wiringShift.c: - * Emulate some of the Arduino wiring functionality. - * - * Copyright (c) 2009-2012 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#include - -#include "wiringPi.h" -#include "wiringShift.h" - -/* - * shiftIn: - * Shift data in from a clocked source - ********************************************************************************* - */ - -uint8_t shiftIn (uint8_t dPin, uint8_t cPin, uint8_t order) -{ - uint8_t value = 0 ; - int8_t i ; - - if (order == MSBFIRST) - for (i = 7 ; i >= 0 ; --i) - { - digitalWrite (cPin, HIGH) ; - value |= digitalRead (dPin) << i ; - digitalWrite (cPin, LOW) ; - } - else - for (i = 0 ; i < 8 ; ++i) - { - digitalWrite (cPin, HIGH) ; - value |= digitalRead (dPin) << i ; - digitalWrite (cPin, LOW) ; - } - - return value; -} - -/* - * shiftOut: - * Shift data out to a clocked source - ********************************************************************************* - */ - -void shiftOut (uint8_t dPin, uint8_t cPin, uint8_t order, uint8_t val) -{ - int8_t i; - - if (order == MSBFIRST) - for (i = 7 ; i >= 0 ; --i) - { - digitalWrite (dPin, val & (1 << i)) ; - digitalWrite (cPin, HIGH) ; - digitalWrite (cPin, LOW) ; - } - else - for (i = 0 ; i < 8 ; ++i) - { - digitalWrite (dPin, val & (1 << i)) ; - digitalWrite (cPin, HIGH) ; - digitalWrite (cPin, LOW) ; - } -} diff --git a/WiringPi/wiringPi/wiringShift.h b/WiringPi/wiringPi/wiringShift.h deleted file mode 100644 index 419ade4..0000000 --- a/WiringPi/wiringPi/wiringShift.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * wiringShift.h: - * Emulate some of the Arduino wiring functionality. - * - * Copyright (c) 2009-2012 Gordon Henderson. - *********************************************************************** - * This file is part of wiringPi: - * https://projects.drogon.net/raspberry-pi/wiringpi/ - * - * wiringPi is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * wiringPi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with wiringPi. If not, see . - *********************************************************************** - */ - -#define LSBFIRST 0 -#define MSBFIRST 1 - -#ifndef _STDINT_H -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -extern uint8_t shiftIn (uint8_t dPin, uint8_t cPin, uint8_t order) ; -extern void shiftOut (uint8_t dPin, uint8_t cPin, uint8_t order, uint8_t val) ; - -#ifdef __cplusplus -} -#endif From fd2b55c2b9585f7e4fbdeb0144fa01cef8280fcc Mon Sep 17 00:00:00 2001 From: YANG HONGBO Date: Mon, 17 Nov 2014 15:58:57 +0000 Subject: [PATCH 2/2] replace code copy of WiringPi2 with git clone repo. remove swig generated files. change function definition with new from wiring pi 2 --- .gitignore | 2 + .gitmodules | 3 + WiringPi | 1 + setup.py | 2 +- wiringpi.i | 4 +- wiringpi2.py | 712 ----- wiringpi2.pyc | Bin 34416 -> 0 bytes wiringpi_wrap.c | 7746 ----------------------------------------------- 8 files changed, 9 insertions(+), 8461 deletions(-) create mode 100644 .gitmodules create mode 160000 WiringPi delete mode 100644 wiringpi2.py delete mode 100644 wiringpi2.pyc delete mode 100644 wiringpi_wrap.c diff --git a/.gitignore b/.gitignore index 718abe0..35d7e42 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ wiringpi2.egg-info/ dist/ __pycache__ *.pyc +wiringpi2.py +wiringpi_wrap.c diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8257e67 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "WiringPi"] + path = WiringPi + url = git://git.drogon.net/wiringPi diff --git a/WiringPi b/WiringPi new file mode 160000 index 0000000..0a9fdeb --- /dev/null +++ b/WiringPi @@ -0,0 +1 @@ +Subproject commit 0a9fdeb29d31609ef834f050bdb8a7a65cd35e2b diff --git a/setup.py b/setup.py index ac52a91..e2b0025 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ 'WiringPi/wiringPi/wiringPiSPI.c', 'WiringPi/wiringPi/max31855.c', 'WiringPi/wiringPi/max5322.c', - 'WiringPi/wiringPi/drc.c', + 'WiringPi/wiringPi/drcSerial.c', 'WiringPi/wiringPi/sn3218.c', 'WiringPi/wiringPi/mcp23s17.c', 'WiringPi/wiringPi/pcf8591.c', diff --git a/wiringpi.i b/wiringpi.i index 6132a36..4d04ba0 100644 --- a/wiringpi.i +++ b/wiringpi.i @@ -23,7 +23,7 @@ #include "WiringPi/wiringPi/mcp23s17.h" #include "WiringPi/wiringPi/pcf8574.h" #include "WiringPi/wiringPi/pcf8591.h" -#include "WiringPi/wiringPi/drc.h" +#include "WiringPi/wiringPi/drcSerial.h" #include "WiringPi/wiringPi/softPwm.h" #include "WiringPi/wiringPi/softServo.h" #include "WiringPi/wiringPi/softTone.h" @@ -155,7 +155,7 @@ extern int mcp23017Setup (const int pinBase, const int i2cAddress) ; extern int mcp23s08Setup (const int pinBase, const int spiPort, const int devId) ; extern int mcp23s17Setup (int pinBase, int spiPort, int devId) ; extern int mcp3002Setup (int pinBase, int spiChannel) ; -extern int mcp3422Setup (int pinBase, int i2cAddress, int channels, int sampleRate, int gain) ; +extern int mcp3422Setup (int pinBase, int i2cAddress, int sampleRate, int gain) ; extern int mcp4802Setup (int pinBase, int spiChannel) ; extern int pcf8574Setup (const int pinBase, const int i2cAddress) ; extern int pcf8591Setup (const int pinBase, const int i2cAddress) ; diff --git a/wiringpi2.py b/wiringpi2.py deleted file mode 100644 index b01b882..0000000 --- a/wiringpi2.py +++ /dev/null @@ -1,712 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 2.0.7 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - - - -from sys import version_info -if version_info >= (2,6,0): - def swig_import_helper(): - from os.path import dirname - import imp - fp = None - try: - fp, pathname, description = imp.find_module('_wiringpi2', [dirname(__file__)]) - except ImportError: - import _wiringpi2 - return _wiringpi2 - if fp is not None: - try: - _mod = imp.load_module('_wiringpi2', fp, pathname, description) - finally: - fp.close() - return _mod - _wiringpi2 = swig_import_helper() - del swig_import_helper -else: - import _wiringpi2 -del version_info -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. -def _swig_setattr_nondynamic(self,class_type,name,value,static=1): - if (name == "thisown"): return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name,None) - if method: return method(self,value) - if (not static): - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - -def _swig_setattr(self,class_type,name,value): - return _swig_setattr_nondynamic(self,class_type,name,value,0) - -def _swig_getattr(self,class_type,name): - if (name == "thisown"): return self.this.own() - method = class_type.__swig_getmethods__.get(name,None) - if method: return method(self) - raise AttributeError(name) - -def _swig_repr(self): - try: strthis = "proxy of " + self.this.__repr__() - except: strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -try: - _object = object - _newclass = 1 -except AttributeError: - class _object : pass - _newclass = 0 - - - -def wiringPiSetup(): - return _wiringpi2.wiringPiSetup() -wiringPiSetup = _wiringpi2.wiringPiSetup - -def wiringPiSetupSys(): - return _wiringpi2.wiringPiSetupSys() -wiringPiSetupSys = _wiringpi2.wiringPiSetupSys - -def wiringPiSetupGpio(): - return _wiringpi2.wiringPiSetupGpio() -wiringPiSetupGpio = _wiringpi2.wiringPiSetupGpio - -def wiringPiSetupPhys(): - return _wiringpi2.wiringPiSetupPhys() -wiringPiSetupPhys = _wiringpi2.wiringPiSetupPhys - -def piFaceSetup(*args): - return _wiringpi2.piFaceSetup(*args) -piFaceSetup = _wiringpi2.piFaceSetup - -def pinMode(*args): - return _wiringpi2.pinMode(*args) -pinMode = _wiringpi2.pinMode - -def pullUpDnControl(*args): - return _wiringpi2.pullUpDnControl(*args) -pullUpDnControl = _wiringpi2.pullUpDnControl - -def digitalRead(*args): - return _wiringpi2.digitalRead(*args) -digitalRead = _wiringpi2.digitalRead - -def digitalWrite(*args): - return _wiringpi2.digitalWrite(*args) -digitalWrite = _wiringpi2.digitalWrite - -def pwmWrite(*args): - return _wiringpi2.pwmWrite(*args) -pwmWrite = _wiringpi2.pwmWrite - -def analogRead(*args): - return _wiringpi2.analogRead(*args) -analogRead = _wiringpi2.analogRead - -def analogWrite(*args): - return _wiringpi2.analogWrite(*args) -analogWrite = _wiringpi2.analogWrite - -def piBoardRev(): - return _wiringpi2.piBoardRev() -piBoardRev = _wiringpi2.piBoardRev - -def wpiPinToGpio(*args): - return _wiringpi2.wpiPinToGpio(*args) -wpiPinToGpio = _wiringpi2.wpiPinToGpio - -def setPadDrive(*args): - return _wiringpi2.setPadDrive(*args) -setPadDrive = _wiringpi2.setPadDrive - -def getAlt(*args): - return _wiringpi2.getAlt(*args) -getAlt = _wiringpi2.getAlt - -def digitalWriteByte(*args): - return _wiringpi2.digitalWriteByte(*args) -digitalWriteByte = _wiringpi2.digitalWriteByte - -def pwmSetMode(*args): - return _wiringpi2.pwmSetMode(*args) -pwmSetMode = _wiringpi2.pwmSetMode - -def pwmSetRange(*args): - return _wiringpi2.pwmSetRange(*args) -pwmSetRange = _wiringpi2.pwmSetRange - -def pwmSetClock(*args): - return _wiringpi2.pwmSetClock(*args) -pwmSetClock = _wiringpi2.pwmSetClock - -def gpioClockSet(*args): - return _wiringpi2.gpioClockSet(*args) -gpioClockSet = _wiringpi2.gpioClockSet - -def wiringPiISR(*args): - return _wiringpi2.wiringPiISR(*args) -wiringPiISR = _wiringpi2.wiringPiISR - -def piThreadCreate(*args): - return _wiringpi2.piThreadCreate(*args) -piThreadCreate = _wiringpi2.piThreadCreate - -def piLock(*args): - return _wiringpi2.piLock(*args) -piLock = _wiringpi2.piLock - -def piUnlock(*args): - return _wiringpi2.piUnlock(*args) -piUnlock = _wiringpi2.piUnlock - -def piHiPri(*args): - return _wiringpi2.piHiPri(*args) -piHiPri = _wiringpi2.piHiPri - -def delay(*args): - return _wiringpi2.delay(*args) -delay = _wiringpi2.delay - -def delayMicroseconds(*args): - return _wiringpi2.delayMicroseconds(*args) -delayMicroseconds = _wiringpi2.delayMicroseconds - -def millis(): - return _wiringpi2.millis() -millis = _wiringpi2.millis - -def micros(): - return _wiringpi2.micros() -micros = _wiringpi2.micros - -def serialOpen(*args): - return _wiringpi2.serialOpen(*args) -serialOpen = _wiringpi2.serialOpen - -def serialClose(*args): - return _wiringpi2.serialClose(*args) -serialClose = _wiringpi2.serialClose - -def serialFlush(*args): - return _wiringpi2.serialFlush(*args) -serialFlush = _wiringpi2.serialFlush - -def serialPutchar(*args): - return _wiringpi2.serialPutchar(*args) -serialPutchar = _wiringpi2.serialPutchar - -def serialPuts(*args): - return _wiringpi2.serialPuts(*args) -serialPuts = _wiringpi2.serialPuts - -def serialPrintf(*args): - return _wiringpi2.serialPrintf(*args) -serialPrintf = _wiringpi2.serialPrintf - -def serialDataAvail(*args): - return _wiringpi2.serialDataAvail(*args) -serialDataAvail = _wiringpi2.serialDataAvail - -def serialGetchar(*args): - return _wiringpi2.serialGetchar(*args) -serialGetchar = _wiringpi2.serialGetchar - -def shiftOut(*args): - return _wiringpi2.shiftOut(*args) -shiftOut = _wiringpi2.shiftOut - -def shiftIn(*args): - return _wiringpi2.shiftIn(*args) -shiftIn = _wiringpi2.shiftIn - -def wiringPiSPIGetFd(*args): - return _wiringpi2.wiringPiSPIGetFd(*args) -wiringPiSPIGetFd = _wiringpi2.wiringPiSPIGetFd - -def wiringPiSPIDataRW(*args): - return _wiringpi2.wiringPiSPIDataRW(*args) -wiringPiSPIDataRW = _wiringpi2.wiringPiSPIDataRW - -def wiringPiSPISetup(*args): - return _wiringpi2.wiringPiSPISetup(*args) -wiringPiSPISetup = _wiringpi2.wiringPiSPISetup - -def wiringPiI2CSetupInterface(*args): - return _wiringpi2.wiringPiI2CSetupInterface(*args) -wiringPiI2CSetupInterface = _wiringpi2.wiringPiI2CSetupInterface - -def wiringPiI2CSetup(*args): - return _wiringpi2.wiringPiI2CSetup(*args) -wiringPiI2CSetup = _wiringpi2.wiringPiI2CSetup - -def wiringPiI2CRead(*args): - return _wiringpi2.wiringPiI2CRead(*args) -wiringPiI2CRead = _wiringpi2.wiringPiI2CRead - -def wiringPiI2CReadReg8(*args): - return _wiringpi2.wiringPiI2CReadReg8(*args) -wiringPiI2CReadReg8 = _wiringpi2.wiringPiI2CReadReg8 - -def wiringPiI2CReadReg16(*args): - return _wiringpi2.wiringPiI2CReadReg16(*args) -wiringPiI2CReadReg16 = _wiringpi2.wiringPiI2CReadReg16 - -def wiringPiI2CWrite(*args): - return _wiringpi2.wiringPiI2CWrite(*args) -wiringPiI2CWrite = _wiringpi2.wiringPiI2CWrite - -def wiringPiI2CWriteReg8(*args): - return _wiringpi2.wiringPiI2CWriteReg8(*args) -wiringPiI2CWriteReg8 = _wiringpi2.wiringPiI2CWriteReg8 - -def wiringPiI2CWriteReg16(*args): - return _wiringpi2.wiringPiI2CWriteReg16(*args) -wiringPiI2CWriteReg16 = _wiringpi2.wiringPiI2CWriteReg16 - -def softToneCreate(*args): - return _wiringpi2.softToneCreate(*args) -softToneCreate = _wiringpi2.softToneCreate - -def softToneWrite(*args): - return _wiringpi2.softToneWrite(*args) -softToneWrite = _wiringpi2.softToneWrite - -def softServoWrite(*args): - return _wiringpi2.softServoWrite(*args) -softServoWrite = _wiringpi2.softServoWrite - -def softServoSetup(*args): - return _wiringpi2.softServoSetup(*args) -softServoSetup = _wiringpi2.softServoSetup - -def softPwmCreate(*args): - return _wiringpi2.softPwmCreate(*args) -softPwmCreate = _wiringpi2.softPwmCreate - -def softPwmWrite(*args): - return _wiringpi2.softPwmWrite(*args) -softPwmWrite = _wiringpi2.softPwmWrite - -def mcp23008Setup(*args): - return _wiringpi2.mcp23008Setup(*args) -mcp23008Setup = _wiringpi2.mcp23008Setup - -def mcp23016Setup(*args): - return _wiringpi2.mcp23016Setup(*args) -mcp23016Setup = _wiringpi2.mcp23016Setup - -def mcp23017Setup(*args): - return _wiringpi2.mcp23017Setup(*args) -mcp23017Setup = _wiringpi2.mcp23017Setup - -def mcp23s08Setup(*args): - return _wiringpi2.mcp23s08Setup(*args) -mcp23s08Setup = _wiringpi2.mcp23s08Setup - -def mcp23s17Setup(*args): - return _wiringpi2.mcp23s17Setup(*args) -mcp23s17Setup = _wiringpi2.mcp23s17Setup - -def mcp3002Setup(*args): - return _wiringpi2.mcp3002Setup(*args) -mcp3002Setup = _wiringpi2.mcp3002Setup - -def mcp3422Setup(*args): - return _wiringpi2.mcp3422Setup(*args) -mcp3422Setup = _wiringpi2.mcp3422Setup - -def mcp4802Setup(*args): - return _wiringpi2.mcp4802Setup(*args) -mcp4802Setup = _wiringpi2.mcp4802Setup - -def pcf8574Setup(*args): - return _wiringpi2.pcf8574Setup(*args) -pcf8574Setup = _wiringpi2.pcf8574Setup - -def pcf8591Setup(*args): - return _wiringpi2.pcf8591Setup(*args) -pcf8591Setup = _wiringpi2.pcf8591Setup - -def sr595Setup(*args): - return _wiringpi2.sr595Setup(*args) -sr595Setup = _wiringpi2.sr595Setup - -def lcdHome(*args): - return _wiringpi2.lcdHome(*args) -lcdHome = _wiringpi2.lcdHome - -def lcdClear(*args): - return _wiringpi2.lcdClear(*args) -lcdClear = _wiringpi2.lcdClear - -def lcdDisplay(*args): - return _wiringpi2.lcdDisplay(*args) -lcdDisplay = _wiringpi2.lcdDisplay - -def lcdCursor(*args): - return _wiringpi2.lcdCursor(*args) -lcdCursor = _wiringpi2.lcdCursor - -def lcdCursorBlink(*args): - return _wiringpi2.lcdCursorBlink(*args) -lcdCursorBlink = _wiringpi2.lcdCursorBlink - -def lcdSendCommand(*args): - return _wiringpi2.lcdSendCommand(*args) -lcdSendCommand = _wiringpi2.lcdSendCommand - -def lcdPosition(*args): - return _wiringpi2.lcdPosition(*args) -lcdPosition = _wiringpi2.lcdPosition - -def lcdCharDef(*args): - return _wiringpi2.lcdCharDef(*args) -lcdCharDef = _wiringpi2.lcdCharDef - -def lcdPutchar(*args): - return _wiringpi2.lcdPutchar(*args) -lcdPutchar = _wiringpi2.lcdPutchar - -def lcdPuts(*args): - return _wiringpi2.lcdPuts(*args) -lcdPuts = _wiringpi2.lcdPuts - -def lcdPrintf(*args): - return _wiringpi2.lcdPrintf(*args) -lcdPrintf = _wiringpi2.lcdPrintf - -def lcdInit(*args): - return _wiringpi2.lcdInit(*args) -lcdInit = _wiringpi2.lcdInit - -def ds1302rtcRead(*args): - return _wiringpi2.ds1302rtcRead(*args) -ds1302rtcRead = _wiringpi2.ds1302rtcRead - -def ds1302rtcWrite(*args): - return _wiringpi2.ds1302rtcWrite(*args) -ds1302rtcWrite = _wiringpi2.ds1302rtcWrite - -def ds1302ramRead(*args): - return _wiringpi2.ds1302ramRead(*args) -ds1302ramRead = _wiringpi2.ds1302ramRead - -def ds1302ramWrite(*args): - return _wiringpi2.ds1302ramWrite(*args) -ds1302ramWrite = _wiringpi2.ds1302ramWrite - -def ds1302clockRead(*args): - return _wiringpi2.ds1302clockRead(*args) -ds1302clockRead = _wiringpi2.ds1302clockRead - -def ds1302clockWrite(*args): - return _wiringpi2.ds1302clockWrite(*args) -ds1302clockWrite = _wiringpi2.ds1302clockWrite - -def ds1302trickleCharge(*args): - return _wiringpi2.ds1302trickleCharge(*args) -ds1302trickleCharge = _wiringpi2.ds1302trickleCharge - -def ds1302setup(*args): - return _wiringpi2.ds1302setup(*args) -ds1302setup = _wiringpi2.ds1302setup - -def gertboardAnalogWrite(*args): - return _wiringpi2.gertboardAnalogWrite(*args) -gertboardAnalogWrite = _wiringpi2.gertboardAnalogWrite - -def gertboardAnalogRead(*args): - return _wiringpi2.gertboardAnalogRead(*args) -gertboardAnalogRead = _wiringpi2.gertboardAnalogRead - -def gertboardSPISetup(): - return _wiringpi2.gertboardSPISetup() -gertboardSPISetup = _wiringpi2.gertboardSPISetup - -def gertboardAnalogSetup(*args): - return _wiringpi2.gertboardAnalogSetup(*args) -gertboardAnalogSetup = _wiringpi2.gertboardAnalogSetup - -def lcd128x64setOrigin(*args): - return _wiringpi2.lcd128x64setOrigin(*args) -lcd128x64setOrigin = _wiringpi2.lcd128x64setOrigin - -def lcd128x64setOrientation(*args): - return _wiringpi2.lcd128x64setOrientation(*args) -lcd128x64setOrientation = _wiringpi2.lcd128x64setOrientation - -def lcd128x64orientCoordinates(*args): - return _wiringpi2.lcd128x64orientCoordinates(*args) -lcd128x64orientCoordinates = _wiringpi2.lcd128x64orientCoordinates - -def lcd128x64getScreenSize(*args): - return _wiringpi2.lcd128x64getScreenSize(*args) -lcd128x64getScreenSize = _wiringpi2.lcd128x64getScreenSize - -def lcd128x64point(*args): - return _wiringpi2.lcd128x64point(*args) -lcd128x64point = _wiringpi2.lcd128x64point - -def lcd128x64line(*args): - return _wiringpi2.lcd128x64line(*args) -lcd128x64line = _wiringpi2.lcd128x64line - -def lcd128x64lineTo(*args): - return _wiringpi2.lcd128x64lineTo(*args) -lcd128x64lineTo = _wiringpi2.lcd128x64lineTo - -def lcd128x64rectangle(*args): - return _wiringpi2.lcd128x64rectangle(*args) -lcd128x64rectangle = _wiringpi2.lcd128x64rectangle - -def lcd128x64circle(*args): - return _wiringpi2.lcd128x64circle(*args) -lcd128x64circle = _wiringpi2.lcd128x64circle - -def lcd128x64ellipse(*args): - return _wiringpi2.lcd128x64ellipse(*args) -lcd128x64ellipse = _wiringpi2.lcd128x64ellipse - -def lcd128x64putchar(*args): - return _wiringpi2.lcd128x64putchar(*args) -lcd128x64putchar = _wiringpi2.lcd128x64putchar - -def lcd128x64puts(*args): - return _wiringpi2.lcd128x64puts(*args) -lcd128x64puts = _wiringpi2.lcd128x64puts - -def lcd128x64update(): - return _wiringpi2.lcd128x64update() -lcd128x64update = _wiringpi2.lcd128x64update - -def lcd128x64clear(*args): - return _wiringpi2.lcd128x64clear(*args) -lcd128x64clear = _wiringpi2.lcd128x64clear - -def lcd128x64setup(): - return _wiringpi2.lcd128x64setup() -lcd128x64setup = _wiringpi2.lcd128x64setup - -def setupNesJoystick(*args): - return _wiringpi2.setupNesJoystick(*args) -setupNesJoystick = _wiringpi2.setupNesJoystick - -def readNesJoystick(*args): - return _wiringpi2.readNesJoystick(*args) -readNesJoystick = _wiringpi2.readNesJoystick - -def piGlow1(*args): - return _wiringpi2.piGlow1(*args) -piGlow1 = _wiringpi2.piGlow1 - -def piGlowLeg(*args): - return _wiringpi2.piGlowLeg(*args) -piGlowLeg = _wiringpi2.piGlowLeg - -def piGlowRing(*args): - return _wiringpi2.piGlowRing(*args) -piGlowRing = _wiringpi2.piGlowRing - -def piGlowSetup(*args): - return _wiringpi2.piGlowSetup(*args) -piGlowSetup = _wiringpi2.piGlowSetup -class nes(object): - def setupNesJoystick(self,*args): - return setupNesJoystick(*args) - def readNesJoystick(self,*args): - return readNesJoystick(*args) - -class Serial(object): - device = '/dev/ttyAMA0' - baud = 9600 - serial_id = 0 - def printf(self,*args): - return serialPrintf(self.serial_id,*args) - def dataAvail(self,*args): - return serialDataAvail(self.serial_id,*args) - def getchar(self,*args): - return serialGetchar(self.serial_id,*args) - def putchar(self,*args): - return serialPutchar(self.serial_id,*args) - def puts(self,*args): - return serialPuts(self.serial_id,*args) - def __init__(self,device,baud): - self.device = device - self.baud = baud - self.serial_id = serialOpen(self.device,self.baud) - def __del__(self): - serialClose(self.serial_id) - -class I2C(object): - def setupInterface(self,*args): - return wiringPiI2CSetupInterface(*args) - def setup(self,*args): - return wiringPiI2CSetup(*args) - def read(self,*args): - return wiringPiI2CRead(*args) - def readReg8(self,*args): - return wiringPiI2CReadReg8(*args) - def readReg16(self,*args): - return wiringPiI2CReadReg16(*args) - def write(self,*args): - return wiringPiI2CWrite(*args) - def writeReg8(self,*args): - return wiringPiI2CWriteReg8(*args) - def writeReg16(self,*args): - return wiringPiI2CWriteReg16(*args) - -class GPIO(object): - WPI_MODE_PINS = 0 - WPI_MODE_GPIO = 1 - WPI_MODE_GPIO_SYS = 2 - WPI_MODE_PHYS = 3 - WPI_MODE_PIFACE = 4 - WPI_MODE_UNINITIALISED = -1 - - INPUT = 0 - OUTPUT = 1 - PWM_OUTPUT = 2 - GPIO_CLOCK = 3 - - LOW = 0 - HIGH = 1 - - PUD_OFF = 0 - PUD_DOWN = 1 - PUD_UP = 2 - - PWM_MODE_MS = 0 - PWM_MODE_BAL = 1 - - INT_EDGE_SETUP = 0 - INT_EDGE_FALLING = 1 - INT_EDGE_RISING = 2 - INT_EDGE_BOTH = 3 - - LSBFIRST = 0 - MSBFIRST = 1 - - MODE = 0 - def __init__(self,pinmode=0): - self.MODE=pinmode - if pinmode==self.WPI_MODE_PINS: - wiringPiSetup() - if pinmode==self.WPI_MODE_GPIO: - wiringPiSetupGpio() - if pinmode==self.WPI_MODE_GPIO_SYS: - wiringPiSetupSys() - if pinmode==self.WPI_MODE_PHYS: - wiringPiSetupPhys() - if pinmode==self.WPI_MODE_PIFACE: - wiringPiSetupPiFace() - - def delay(self,*args): - delay(*args) - def delayMicroseconds(self,*args): - delayMicroseconds(*args) - def millis(self): - return millis() - def micros(self): - return micros() - - def piHiPri(self,*args): - return piHiPri(*args) - - def piBoardRev(self): - return piBoardRev() - def wpiPinToGpio(self,*args): - return wpiPinToGpio(*args) - def setPadDrive(self,*args): - return setPadDrive(*args) - def getAlt(self,*args): - return getAlt(*args) - def digitalWriteByte(self,*args): - return digitalWriteByte(*args) - - def pwmSetMode(self,*args): - pwmSetMode(*args) - def pwmSetRange(self,*args): - pwmSetRange(*args) - def pwmSetClock(self,*args): - pwmSetClock(*args) - def gpioClockSet(self,*args): - gpioClockSet(*args) - def pwmWrite(self,*args): - pwmWrite(*args) - - def pinMode(self,*args): - pinMode(*args) - - def digitalWrite(self,*args): - digitalWrite(*args) - def digitalRead(self,*args): - return digitalRead(*args) - def digitalWriteByte(self,*args): - digitalWriteByte(*args) - - def analogWrite(self,*args): - analogWrite(*args) - def analogRead(self,*args): - return analogRead(*args) - - def shiftOut(self,*args): - shiftOut(*args) - def shiftIn(self,*args): - return shiftIn(*args) - - def pullUpDnControl(self,*args): - return pullUpDnControl(*args) - - def waitForInterrupt(self,*args): - return waitForInterrupt(*args) - def wiringPiISR(self,*args): - return wiringPiISR(*args) - - def softPwmCreate(self,*args): - return softPwmCreate(*args) - def softPwmWrite(self,*args): - return softPwmWrite(*args) - - def softToneCreate(self,*args): - return softToneCreate(*args) - def softToneWrite(self,*args): - return softToneWrite(*args) - - def lcdHome(self,*args): - return lcdHome(self,*args) - def lcdCLear(self,*args): - return lcdClear(self,*args) - def lcdSendCommand(self,*args): - return lcdSendCommand(self,*args) - def lcdPosition(self,*args): - return lcdPosition(self,*args) - def lcdPutchar(self,*args): - return lcdPutchar(self,*args) - def lcdPuts(self,*args): - return lcdPuts(self,*args) - def lcdPrintf(self,*args): - return lcdPrintf(self,*args) - def lcdInit(self,*args): - return lcdInit(self,*args) - def piGlowSetup(self,*args): - return piGlowSetup(self,*args) - def piGlow1(self,*args): - return piGlow1(self,*args) - def piGlowLeg(self,*args): - return piGlowLeg(self,*args) - def piGlowRing(self,*args): - return piGlowRing(self,*args) - -# This file is compatible with both classic and new-style classes. - -cvar = _wiringpi2.cvar - diff --git a/wiringpi2.pyc b/wiringpi2.pyc deleted file mode 100644 index ce0c5ccbf96903e38b86febc2e827825dd2ca4f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34416 zcmeHQTW}QDnf^x-7lFBB@ZG`~Bik4u?idUR2?>Fa#y!G<1NJb?8A%PJnej|ZLR^e( zd`s-aNu0z`ImJ_P-z5^>WvS{}CYeU@mx);>c9|kj3uL*N!^mDp8^tX5>TnAKueD{`kIcZ#`F?463NQDlvnHDcE& zvR09`V%CaXtH@o7+$H8Nv3DtQw<33oxm)brirk~fJ!0+=dygXbDsr!wd&S}EaqXc4=b`kkqu%th~1#bBZ@pC<`J=vD6&zJ zjbb*6-Ka>bBCTRt#kMN)s3MPwc~tD9iae&sV`3f?`?Vh<|Pp-6|A4zV4I98%cB0Y-qi0KjAqsS3Oj)*xT_J|_A ziu8)<72B)GQALi5IV$$3BF7XtCgzyfV~X@C(kG@*Y@Z^>6*(^ExY*;0^efUYreAEo zA_IyHh#3$&ph#SixR|)uxFSz0^0b(z#XhZwr-&!U6YD9GP$VHHAvU4Npdy1}2E`64 zazc?4Vor!Xp~y3eJR{~AvCk+nq{xt%A+bY>oK)nbn3G~pDsoDZQ({huJ*9|I#E3Cs zjUuNNIW6Y2*wc!fQRIx6Gh)vu@~k4yig{M-vx+>Y$a7+z6Z@PZNkx)kl46sJoK@tk zn6qNfDw0wpB_<^{rN}u&&WSlE_M9SVMbcu@V$+IPMXVSr)+&-wBqJsxHlxU}BEw>a z#SSYnqR5Dt5wRnRj4CoJW>oB`BEBNN7+F|lKc?>vT)e4Fe;T&8SbDb_tqV)}U zM*iRM*BV1AxC3G$Q!M%UT++`C=lupApHG2J(i97@Ey31_t@JGjcvQAw+NruKaF?(z za-l)4YT{~xOts3DnD|X%8|4aaGf%F^WF#in8{|x*;DoD?O>lu)q$vpfsnwwi6slSv zSLexQBm58RNH8NEYnu-+qyCnnQXo=mdOQe zL;3^b{?;erQ^9CH*H-z(n+sFHN?cZ&^hc8TjbNP|&14IiB5zu{2SQ@YV|T>n#~Nd; zv89??g7ke2i(~yhvnS2pLW5y8RZN7X7L)T0l3yV)SOBaEXQRAe2ZF~eAm6f~)QW+Jcq9We;O%H8YDBzxB9$G_ zpt_-CgH(XKG8x_|x*6RCT^07skz_8Pvs1XapI*;f@&t)3krlBeu{GG5V|T_D$kNz? z*ouZUd2%BoHKH|01Sn4Y54%wlfk9nIlhDdK(yz^vwqafi_O+IKv{&z5iu)+;=K*Zd z>Ia*?SwCzGfD%baEX~3pZ~m*iJtSzHq4Co!%f^45Moa@nBc-jE4GkFSM#(QO+p1O& zG?-8_!$S2pd&{9*%Ug}hqs7cL8(2xjY&>SS+KhKMuOi90`9o87nLoHc3w|5ame{ed zw3lirFOH?zR`6G_!PA`TLShPoMilRiELw{`WQb$%SPV@Bc2Mn4hP}vi#^Ge-AnI^T zh8tzgbOT>vohuac7pGeC!!59!X%71~ls0cD?M1C@*{}6Hte0WUD`pBs)G%I}Oop{4 z8TJX&O?xuw-HC&0a+-VENR)yi+lJ^_r`?a%crw{T&V(e^C~L7Tis|i=d2M;pJi>#|ypi1vY?ejyQ04e36C8^z}Ht@7@t(5&? zmhp;!6)5a+;(j6%j29g7dK`Ltu$Ai~lKRK|xfNclO|y66Bq%7M6)yJ^aN{xNT zENVRkKkq2po`CKFm)zo`&hl+DcqQg=D>ock)U+j3Zu$};Z{5h+=(rU8?o>Jx+8Qs{ zZZK6GnNhs8R)#jH8^SiTWN(upTfl;!JD#_humfX1fQBk=b}Qd!o>l z>&)kZVm|AVAsy6YG=?l)>yP+BD(huZ)+IZ3TWn(^lq@^FX?85?jQYFj?^9er_Y3jZuhsnTPb*}ff`a@)r3gZ|f}QPc`CIflO9b^rPlh`kw& z9L)|5FvxkS+=x@N+Yi-myJFXw&8IK8w7mmh_D(c*>{~HOmsf7cL6`InLifAT=&@+a z9(!-XbIGm)s^5#oj?+d3e{i%2pQ#hVZMEg#@JrDMvdJs>eU8nJqrms05mTSZKaq1? zBRKo<)o9ehal{cnUi4j>+hMT!Ml@!eY_yqdYRVoN1^$r(a5nM2+5(N!t))6e(y1;{+TOw-P!Tds7rQzVD|H9 z>^Qj-=3RU|NROt9F8LjY@?S*bS2aBFbJ}k7gV-;lk)wY!oq2ei84SD3y8-C_RWy3b zD)hQiL8@aS(J0QE>yP)cdU!)FYwrp0`$II2bFvY` zFFeI@*tIYkxx0xCEdHVQz`c5f=qE3j{;nB9m0+N9F6PD>@0J2N%17;{UsVj zw%0SV)Ag+EDX9NzG={4_$k5A->~@)t2DkWIG?uGx$g+K>OPZ%~k4DtSnNI#~`qXnQ z()m318BkmhjpCe~REn+({8`Xk9E~R57no6T$~4`U_;a|)vS>UxB~;1}2ZMN{&Ha>6 z653ZqBdGq^G(qR~cozKDM&nn`z(l4vk#|lo1%mfFBEiqzOi&+>$WXhb~`U#yjLWTyW-cr(>cFk@N09%ZU=bI(-or=kCVDGPM?ZQf?UZ7xjH=Vx(ITU(a24=!>*roO@Z0v zXw0VD6TJA~_(9htaJv?b+jOq==6t75X)c4=^=QmEUbLn5ZCkb$gS6`jUA&GjuSes@ zmbk*t`G6ZAs>++u2+qjB)R^lGd;$F4j>d0B2BzH4SX=|accKyGLxr$}@$qZ=g6k}N z5$fNK#*p*iGZ;Fz!k3``y=WBq+#{rjuTIk!vKe-5ZeJ#S8MpXSG?sJeg*gVYBZWG>NzxB*O^ywi*L+f3Fwwz5aZM93Pn6& z4+oUg5dB@T*P!J)bGTtwKO^nIza=)v@UU<4HP{Ub+WC<8b+GtBG@2`+0)vqDt-CMo z+>Qz}P{cP*PCe;2aEBj9Bf0j2B(b^xJ|uVR^M44p`AIaU{0_X5o%x~O z`Rw$?tq{x9s=KGQ#nKcL;jP{^7}c=uzNdR&#aaj)x+&<^`}7Q4|50t zy5+2!#V#Bj@bc(6_i1SP;~ZkQnRBeUN~u3nI+~vz|DU5#q~#Uy9ao(g zeg^9Q5{)6JzzTj(Hb2?!vVZ$5)c!RZGfo_a%=$7TF1dXUivJdk8z-tmZXT8+b4l(! zXl}$(EYnX(bVaEg78C=lf8ZT1@It>CFMeP_8N8l?@hg_b#qvB%G;)a9J0e;uo&F5!Laze0Ul=^4L@W_`qp)EX>Jwtxxw;kp;e6NmYK#$ z_lpqD3G(N|n+QLVSs8`n({1|B0-exkKH3d7@dWjO8Cu8G31zitehpqWnXT{Gy> z{K{J=(xuH1T>nnj&EYC|`Y4_&CTblED-zZ_B#wGrZGWjqtT}|O#5SqY*uR3-dPeV! zCZEV{w)$w}7eZ;Jc?7Tjsm~w6DbCwOju_M{uYAz+5VMGMq`I=;EwDRT4|em)>>jR- z6gz3>S=I!l93?#RzlalUiJbJSjoNteQy1rX#V&W6SNqP#Y9n^09>i!_lUzt_Q*EU9 zIZIt~OG&X9H`hjt->*0)Mt8JKtbON}Dl>IdXSD7Af)l;3Q+$Ksn-t%o_%_9ND838f zs73!8RIMW!dcU*UaVIfTi><;W!ntq}$+K}3x(PRYh{c#_s~RFX%_!AKq}#~?wFj4<>FVq=66 zN1!kaG=kU|VSEvU#0bNRAQDCxO#}fj!XP4udlAMCLAZ-BWC)^MtW)v`ZV?6uK}?JF ziXfCl7!G7tISL2@S3IJJ5U*mRCJ?5gRTGF#5k~kxP>L|H2Vzl#@jMWMA`IhkfP0FQZM@FqH>_hW(9c~_)Kljjr%AtjG4>eZ~Evg)Xv6RPnd?!E+{`f%GVODBhdoPBPxx zpYR^%anAZyVAc$eIT6rToCPNnrxM<#4_pyH0+?=dzd~U7I9G$}iN~pwVeDs2s#}?1oKImJ~*`Zgg^C>f3V%mY% z4N;}*XikMn&ypvt=|&#a%{g&w@0=5ro}0soIlxVgoqjy>35Hv?FU_DMfWzr0&Sq8H z@LJ1|`p_KC%9~r^(d(E8^$pMA!Q$e^ywa7UD|Rz0OAh0(^YWomwn{T?=2r4$H_2#8 zxhWs&%g*6(i}|vr9{ED0h}ShMUv81lll9<3rG?t~?5zhMDlOK=XJ0+|P${~`zh7QA zZ~LCA2PZ0>tew;TdT^rBsoFUms0Sx1y<9t|gZ1DVo4(3W#T>~_Ohk?KnWI*csfpz|!E(y!G_ z>G?WP(nqU!skE~Xuk(GqW@_VgpypBOH*2OeQ4dN~`t6!2U91NsD*bNFl&0!IiAuj; zGo?%QphTrVteMi~dQhU$A5|%}9>o5P$4Nin?hh&cmEuPfKZXd_KvZU+PxSZp_YU@U z^z|kVcOkx?NN<1q#Gt;UF>qp#NqS)Mq2tLJyPN<|cJ>W)9@FRkeFH-}fqta7=ZH>K z$4_)62fDkpabUV@V5nbJa_2-`yEdxSN%rFj4QE-|Kh)8u0VR9;2a|`pdJZQOhX-*D z-I)s1-O<(RsX=+=4kozx5R=p}gUkF{s@&N9We-urh7wqqV!4v%%!W9{&0kDi(p5)Pb! z??KBp8q*6%lwa`Be;cOv_-~l5ra}b!cPyEH6{NAbvGP*L%v6}B47X}3M5?cnG_3O=s)o}-|L78+-YsdE%n)6H;qm|}!tl!Arlou{}!k);@;$Wi1e)Xtx0sz_0y z2q>y%Kgr!2*uDqXOT4QTG+XZ)#fua#QM^oXoq~qry-M*K#p@JrP<)8u!xV2)yhZU5 zijPvfP4O{`k5hbt;vI@lQhbWy(-iMge1_t)6rZDbkK*$bU!eFJ#rGhzp-fNU+Xw7K zuejQr?Zb0HM10;)8!!DSCbFD?Y?n317Bt*}sK|}6MTn6+kCn8sd4BV}M!dU4WL0c& bQ>C)bsDS^E{h!H!*qZrk?p(8S%^Uv>w{NX2 diff --git a/wiringpi_wrap.c b/wiringpi_wrap.c deleted file mode 100644 index 0eb71f3..0000000 --- a/wiringpi_wrap.c +++ /dev/null @@ -1,7746 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.7 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - - -/* Python.h has to appear first */ -#include - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if () { - if () { - *ptr = ; - return SWIG_NEWOBJ; - } else { - *ptr = ; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class" == "Class", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCompare(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; -} - - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - register int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - register size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - -/* Compatibility macros for Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - -#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) -#define PyInt_Check(x) PyLong_Check(x) -#define PyInt_AsLong(x) PyLong_AsLong(x) -#define PyInt_FromLong(x) PyLong_FromLong(x) -#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) -#define PyString_Check(name) PyBytes_Check(name) -#define PyString_FromString(x) PyUnicode_FromString(x) -#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) -#define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) -#define PyString_InternFromString(key) PyUnicode_InternFromString(key) -#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE -#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) -#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) - -#endif - -#ifndef Py_TYPE -# define Py_TYPE(op) ((op)->ob_type) -#endif - -/* SWIG APIs for compatibility of both Python 2 & 3 */ - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_FromFormat PyUnicode_FromFormat -#else -# define SWIG_Python_str_FromFormat PyString_FromFormat -#endif - - -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ -SWIGINTERN char* -SWIG_Python_str_AsChar(PyObject *str) -{ -#if PY_VERSION_HEX >= 0x03000000 - char *cstr; - char *newstr; - Py_ssize_t len; - str = PyUnicode_AsUTF8String(str); - PyBytes_AsStringAndSize(str, &cstr, &len); - newstr = (char *) malloc(len+1); - memcpy(newstr, cstr, len+1); - Py_XDECREF(str); - return newstr; -#else - return PyString_AsString(str); -#endif -} - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#else -# define SWIG_Python_str_DelForPy3(x) -#endif - - -SWIGINTERN PyObject* -SWIG_Python_str_FromChar(const char *c) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); -#else - return PyString_FromString(c); -#endif -} - -/* Add PyOS_snprintf for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) -# define PyOS_snprintf _snprintf -# else -# define PyOS_snprintf snprintf -# endif -#endif - -/* A crude PyString_FromFormat implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 - -#ifndef SWIG_PYBUFFER_SIZE -# define SWIG_PYBUFFER_SIZE 1024 -#endif - -static PyObject * -PyString_FromFormat(const char *fmt, ...) { - va_list ap; - char buf[SWIG_PYBUFFER_SIZE * 2]; - int res; - va_start(ap, fmt); - res = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); -} -#endif - -/* Add PyObject_Del for old Pythons */ -#if PY_VERSION_HEX < 0x01060000 -# define PyObject_Del(op) PyMem_DEL((op)) -#endif -#ifndef PyObject_DEL -# define PyObject_DEL PyObject_Del -#endif - -/* A crude PyExc_StopIteration exception for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -# ifndef PyExc_StopIteration -# define PyExc_StopIteration PyExc_RuntimeError -# endif -# ifndef PyObject_GenericGetAttr -# define PyObject_GenericGetAttr 0 -# endif -#endif - -/* Py_NotImplemented is defined in 2.1 and up. */ -#if PY_VERSION_HEX < 0x02010000 -# ifndef Py_NotImplemented -# define Py_NotImplemented PyExc_RuntimeError -# endif -#endif - -/* A crude PyString_AsStringAndSize implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02010000 -# ifndef PyString_AsStringAndSize -# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} -# endif -#endif - -/* PySequence_Size for old Pythons */ -#if PY_VERSION_HEX < 0x02000000 -# ifndef PySequence_Size -# define PySequence_Size PySequence_Length -# endif -#endif - -/* PyBool_FromLong for old Pythons */ -#if PY_VERSION_HEX < 0x02030000 -static -PyObject *PyBool_FromLong(long ok) -{ - PyObject *result = ok ? Py_True : Py_False; - Py_INCREF(result); - return result; -} -#endif - -/* Py_ssize_t for old Pythons */ -/* This code is as recommended by: */ -/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -# define PY_SSIZE_T_MAX INT_MAX -# define PY_SSIZE_T_MIN INT_MIN -typedef inquiry lenfunc; -typedef intargfunc ssizeargfunc; -typedef intintargfunc ssizessizeargfunc; -typedef intobjargproc ssizeobjargproc; -typedef intintobjargproc ssizessizeobjargproc; -typedef getreadbufferproc readbufferproc; -typedef getwritebufferproc writebufferproc; -typedef getsegcountproc segcountproc; -typedef getcharbufferproc charbufferproc; -static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) -{ - long result = 0; - PyObject *i = PyNumber_Int(x); - if (i) { - result = PyInt_AsLong(i); - Py_DECREF(i); - } - return result; -} -#endif - -#if PY_VERSION_HEX < 0x02040000 -#define Py_VISIT(op) \ - do { \ - if (op) { \ - int vret = visit((op), arg); \ - if (vret) \ - return vret; \ - } \ - } while (0) -#endif - -#if PY_VERSION_HEX < 0x02030000 -typedef struct { - PyTypeObject type; - PyNumberMethods as_number; - PyMappingMethods as_mapping; - PySequenceMethods as_sequence; - PyBufferProcs as_buffer; - PyObject *name, *slots; -} PyHeapTypeObject; -#endif - -#if PY_VERSION_HEX < 0x02030000 -typedef destructor freefunc; -#endif - -#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ - (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ - (PY_MAJOR_VERSION > 3)) -# define SWIGPY_USE_CAPSULE -# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) -#endif - -#if PY_VERSION_HEX < 0x03020000 -#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) -#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) -#endif - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIME PyObject* -SWIG_Python_ErrorType(int code) { - PyObject* type = 0; - switch(code) { - case SWIG_MemoryError: - type = PyExc_MemoryError; - break; - case SWIG_IOError: - type = PyExc_IOError; - break; - case SWIG_RuntimeError: - type = PyExc_RuntimeError; - break; - case SWIG_IndexError: - type = PyExc_IndexError; - break; - case SWIG_TypeError: - type = PyExc_TypeError; - break; - case SWIG_DivisionByZero: - type = PyExc_ZeroDivisionError; - break; - case SWIG_OverflowError: - type = PyExc_OverflowError; - break; - case SWIG_SyntaxError: - type = PyExc_SyntaxError; - break; - case SWIG_ValueError: - type = PyExc_ValueError; - break; - case SWIG_SystemError: - type = PyExc_SystemError; - break; - case SWIG_AttributeError: - type = PyExc_AttributeError; - break; - default: - type = PyExc_RuntimeError; - } - return type; -} - - -SWIGRUNTIME void -SWIG_Python_AddErrorMsg(const char* mesg) -{ - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - - if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); - if (value) { - char *tmp; - PyObject *old_str = PyObject_Str(value); - PyErr_Clear(); - Py_XINCREF(type); - - PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - Py_DECREF(value); - } else { - PyErr_SetString(PyExc_RuntimeError, mesg); - } -} - -#if defined(SWIG_PYTHON_NO_THREADS) -# if defined(SWIG_PYTHON_THREADS) -# undef SWIG_PYTHON_THREADS -# endif -#endif -#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ -# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) -# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ -# define SWIG_PYTHON_USE_GIL -# endif -# endif -# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() -# endif -# ifdef __cplusplus /* C++ code */ - class SWIG_Python_Thread_Block { - bool status; - PyGILState_STATE state; - public: - void end() { if (status) { PyGILState_Release(state); status = false;} } - SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} - ~SWIG_Python_Thread_Block() { end(); } - }; - class SWIG_Python_Thread_Allow { - bool status; - PyThreadState *save; - public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} - SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} - ~SWIG_Python_Thread_Allow() { end(); } - }; -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block -# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow -# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() -# else /* C code */ -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() -# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() -# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) -# endif -# else /* Old thread way, not implemented, user must provide it */ -# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) -# define SWIG_PYTHON_INITIALIZE_THREADS -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) -# define SWIG_PYTHON_THREAD_END_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# endif -# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) -# define SWIG_PYTHON_THREAD_END_ALLOW -# endif -# endif -#else /* No thread support */ -# define SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# define SWIG_PYTHON_THREAD_END_BLOCK -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# define SWIG_PYTHON_THREAD_END_ALLOW -#endif - -/* ----------------------------------------------------------------------------- - * Python API portion that goes into the runtime - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ----------------------------------------------------------------------------- - * Constant declarations - * ----------------------------------------------------------------------------- */ - -/* Constant Types */ -#define SWIG_PY_POINTER 4 -#define SWIG_PY_BINARY 5 - -/* Constant information structure */ -typedef struct swig_const_info { - int type; - char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_const_info; - - -/* ----------------------------------------------------------------------------- - * Wrapper of PyInstanceMethod_New() used in Python 3 - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ -#if PY_VERSION_HEX >= 0x03000000 -SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) -{ - return PyInstanceMethod_New(func); -} -#else -SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) -{ - return NULL; -} -#endif - -#ifdef __cplusplus -} -#endif - - -/* ----------------------------------------------------------------------------- - * pyrun.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * ----------------------------------------------------------------------------- */ - -/* Common SWIG API */ - -/* for raw pointers */ -#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) - -#ifdef SWIGPYTHON_BUILTIN -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) -#else -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) -#endif - -#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) - -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) -#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) -#define swig_owntype int - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() -#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) -#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) - -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail - - -/* Runtime API implementation */ - -/* Error manipulation */ - -SWIGINTERN void -SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetObject(errtype, obj); - Py_DECREF(obj); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -SWIGINTERN void -SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(errtype, msg); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) - -/* Set a constant value */ - -#if defined(SWIGPYTHON_BUILTIN) - -SWIGINTERN void -SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { - PyObject *s = PyString_InternFromString(key); - PyList_Append(seq, s); - Py_DECREF(s); -} - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { -#if PY_VERSION_HEX < 0x02030000 - PyDict_SetItemString(d, (char *)name, obj); -#else - PyDict_SetItemString(d, name, obj); -#endif - Py_DECREF(obj); - if (public_interface) - SwigPyBuiltin_AddPublicSymbol(public_interface, name); -} - -#else - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { -#if PY_VERSION_HEX < 0x02030000 - PyDict_SetItemString(d, (char *)name, obj); -#else - PyDict_SetItemString(d, name, obj); -#endif - Py_DECREF(obj); -} - -#endif - -/* Append a value to the result obj */ - -SWIGINTERN PyObject* -SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { -#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyList_Check(result)) { - PyObject *o2 = result; - result = PyList_New(1); - PyList_SetItem(result, 0, o2); - } - PyList_Append(result,obj); - Py_DECREF(obj); - } - return result; -#else - PyObject* o2; - PyObject* o3; - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyTuple_Check(result)) { - o2 = result; - result = PyTuple_New(1); - PyTuple_SET_ITEM(result, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SET_ITEM(o3, 0, obj); - o2 = result; - result = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return result; -#endif -} - -/* Unpack the argument tuple */ - -SWIGINTERN int -SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) -{ - if (!args) { - if (!min && !max) { - return 1; - } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", - name, (min == max ? "" : "at least "), (int)min); - return 0; - } - } - if (!PyTuple_Check(args)) { - if (min <= 1 && max >= 1) { - register int i; - objs[0] = args; - for (i = 1; i < max; ++i) { - objs[i] = 0; - } - return 2; - } - PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); - return 0; - } else { - register Py_ssize_t l = PyTuple_GET_SIZE(args); - if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at least "), (int)min, (int)l); - return 0; - } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at most "), (int)max, (int)l); - return 0; - } else { - register int i; - for (i = 0; i < l; ++i) { - objs[i] = PyTuple_GET_ITEM(args, i); - } - for (; l < max; ++l) { - objs[l] = 0; - } - return i + 1; - } - } -} - -/* A functor is a function object with one single object argument */ -#if PY_VERSION_HEX >= 0x02020000 -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); -#else -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); -#endif - -/* - Helper for static pointer initialization for both C and C++ code, for example - static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); -*/ -#ifdef __cplusplus -#define SWIG_STATIC_POINTER(var) var -#else -#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var -#endif - -/* ----------------------------------------------------------------------------- - * Pointer declarations - * ----------------------------------------------------------------------------- */ - -/* Flags for new pointer objects */ -#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) -#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) - -#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) - -#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) -#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) - -#ifdef __cplusplus -extern "C" { -#endif - -/* How to access Py_None */ -#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# ifndef SWIG_PYTHON_NO_BUILD_NONE -# ifndef SWIG_PYTHON_BUILD_NONE -# define SWIG_PYTHON_BUILD_NONE -# endif -# endif -#endif - -#ifdef SWIG_PYTHON_BUILD_NONE -# ifdef Py_None -# undef Py_None -# define Py_None SWIG_Py_None() -# endif -SWIGRUNTIMEINLINE PyObject * -_SWIG_Py_None(void) -{ - PyObject *none = Py_BuildValue((char*)""); - Py_DECREF(none); - return none; -} -SWIGRUNTIME PyObject * -SWIG_Py_None(void) -{ - static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); - return none; -} -#endif - -/* The python void return value */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Py_Void(void) -{ - PyObject *none = Py_None; - Py_INCREF(none); - return none; -} - -/* SwigPyClientData */ - -typedef struct { - PyObject *klass; - PyObject *newraw; - PyObject *newargs; - PyObject *destroy; - int delargs; - int implicitconv; - PyTypeObject *pytype; -} SwigPyClientData; - -SWIGRUNTIMEINLINE int -SWIG_Python_CheckImplicit(swig_type_info *ty) -{ - SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; - return data ? data->implicitconv : 0; -} - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_ExceptionType(swig_type_info *desc) { - SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; - PyObject *klass = data ? data->klass : 0; - return (klass ? klass : PyExc_RuntimeError); -} - - -SWIGRUNTIME SwigPyClientData * -SwigPyClientData_New(PyObject* obj) -{ - if (!obj) { - return 0; - } else { - SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); - /* the klass element */ - data->klass = obj; - Py_INCREF(data->klass); - /* the newraw method and newargs arguments used to create a new raw instance */ - if (PyClass_Check(obj)) { - data->newraw = 0; - data->newargs = obj; - Py_INCREF(obj); - } else { -#if (PY_VERSION_HEX < 0x02020000) - data->newraw = 0; -#else - data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); -#endif - if (data->newraw) { - Py_INCREF(data->newraw); - data->newargs = PyTuple_New(1); - PyTuple_SetItem(data->newargs, 0, obj); - } else { - data->newargs = obj; - } - Py_INCREF(data->newargs); - } - /* the destroy method, aka as the C++ delete method */ - data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); - if (PyErr_Occurred()) { - PyErr_Clear(); - data->destroy = 0; - } - if (data->destroy) { - int flags; - Py_INCREF(data->destroy); - flags = PyCFunction_GET_FLAGS(data->destroy); -#ifdef METH_O - data->delargs = !(flags & (METH_O)); -#else - data->delargs = 0; -#endif - } else { - data->delargs = 0; - } - data->implicitconv = 0; - data->pytype = 0; - return data; - } -} - -SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData *data) { - Py_XDECREF(data->newraw); - Py_XDECREF(data->newargs); - Py_XDECREF(data->destroy); -} - -/* =============== SwigPyObject =====================*/ - -typedef struct { - PyObject_HEAD - void *ptr; - swig_type_info *ty; - int own; - PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif -} SwigPyObject; - -SWIGRUNTIME PyObject * -SwigPyObject_long(SwigPyObject *v) -{ - return PyLong_FromVoidPtr(v->ptr); -} - -SWIGRUNTIME PyObject * -SwigPyObject_format(const char* fmt, SwigPyObject *v) -{ - PyObject *res = NULL; - PyObject *args = PyTuple_New(1); - if (args) { - if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { - PyObject *ofmt = SWIG_Python_str_FromChar(fmt); - if (ofmt) { -#if PY_VERSION_HEX >= 0x03000000 - res = PyUnicode_Format(ofmt,args); -#else - res = PyString_Format(ofmt,args); -#endif - Py_DECREF(ofmt); - } - Py_DECREF(args); - } - } - return res; -} - -SWIGRUNTIME PyObject * -SwigPyObject_oct(SwigPyObject *v) -{ - return SwigPyObject_format("%o",v); -} - -SWIGRUNTIME PyObject * -SwigPyObject_hex(SwigPyObject *v) -{ - return SwigPyObject_format("%x",v); -} - -SWIGRUNTIME PyObject * -#ifdef METH_NOARGS -SwigPyObject_repr(SwigPyObject *v) -#else -SwigPyObject_repr(SwigPyObject *v, PyObject *args) -#endif -{ - const char *name = SWIG_TypePrettyName(v->ty); - PyObject *repr = SWIG_Python_str_FromFormat("", (name ? name : "unknown"), (void *)v); - if (v->next) { -# ifdef METH_NOARGS - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); -# else - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); -# endif -# if PY_VERSION_HEX >= 0x03000000 - PyObject *joined = PyUnicode_Concat(repr, nrep); - Py_DecRef(repr); - Py_DecRef(nrep); - repr = joined; -# else - PyString_ConcatAndDel(&repr,nrep); -# endif - } - return repr; -} - -SWIGRUNTIME int -SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) -{ - char *str; -#ifdef METH_NOARGS - PyObject *repr = SwigPyObject_repr(v); -#else - PyObject *repr = SwigPyObject_repr(v, NULL); -#endif - if (repr) { - str = SWIG_Python_str_AsChar(repr); - fputs(str, fp); - SWIG_Python_str_DelForPy3(str); - Py_DECREF(repr); - return 0; - } else { - return 1; - } -} - -SWIGRUNTIME PyObject * -SwigPyObject_str(SwigPyObject *v) -{ - char result[SWIG_BUFFER_SIZE]; - return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? - SWIG_Python_str_FromChar(result) : 0; -} - -SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) -{ - void *i = v->ptr; - void *j = w->ptr; - return (i < j) ? -1 : ((i > j) ? 1 : 0); -} - -/* Added for Python 3.x, would it also be useful for Python 2.x? */ -SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) -{ - PyObject* res; - if( op != Py_EQ && op != Py_NE ) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); - return res; -} - - -SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); - -#ifdef SWIGPYTHON_BUILTIN -static swig_type_info *SwigPyObject_stype = 0; -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - SwigPyClientData *cd; - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - assert(cd); - assert(cd->pytype); - return cd->pytype; -} -#else -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); - return type; -} -#endif - -SWIGRUNTIMEINLINE int -SwigPyObject_Check(PyObject *op) { -#ifdef SWIGPYTHON_BUILTIN - PyTypeObject *target_tp = SwigPyObject_type(); - if (PyType_IsSubtype(op->ob_type, target_tp)) - return 1; - return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); -#else - return (Py_TYPE(op) == SwigPyObject_type()) - || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); -#endif -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own); - -SWIGRUNTIME void -SwigPyObject_dealloc(PyObject *v) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - PyObject *next = sobj->next; - if (sobj->own == SWIG_POINTER_OWN) { - swig_type_info *ty = sobj->ty; - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - PyObject *destroy = data ? data->destroy : 0; - if (destroy) { - /* destroy is always a VARARGS method */ - PyObject *res; - if (data->delargs) { - /* we need to create a temporary object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); - } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - res = ((*meth)(mself, v)); - } - Py_XDECREF(res); - } -#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - else { - const char *name = SWIG_TypePrettyName(ty); - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); - } -#endif - } - Py_XDECREF(next); - PyObject_DEL(v); -} - -SWIGRUNTIME PyObject* -SwigPyObject_append(PyObject* v, PyObject* next) -{ - SwigPyObject *sobj = (SwigPyObject *) v; -#ifndef METH_O - PyObject *tmp = 0; - if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; - next = tmp; -#endif - if (!SwigPyObject_Check(next)) { - return NULL; - } - sobj->next = next; - Py_INCREF(next); - return SWIG_Py_Void(); -} - -SWIGRUNTIME PyObject* -#ifdef METH_NOARGS -SwigPyObject_next(PyObject* v) -#else -SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - SwigPyObject *sobj = (SwigPyObject *) v; - if (sobj->next) { - Py_INCREF(sobj->next); - return sobj->next; - } else { - return SWIG_Py_Void(); - } -} - -SWIGINTERN PyObject* -#ifdef METH_NOARGS -SwigPyObject_disown(PyObject *v) -#else -SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = 0; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -#ifdef METH_NOARGS -SwigPyObject_acquire(PyObject *v) -#else -SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = SWIG_POINTER_OWN; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -SwigPyObject_own(PyObject *v, PyObject *args) -{ - PyObject *val = 0; -#if (PY_VERSION_HEX < 0x02020000) - if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) -#elif (PY_VERSION_HEX < 0x02050000) - if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) -#else - if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) -#endif - { - return NULL; - } - else - { - SwigPyObject *sobj = (SwigPyObject *)v; - PyObject *obj = PyBool_FromLong(sobj->own); - if (val) { -#ifdef METH_NOARGS - if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v); - } else { - SwigPyObject_disown(v); - } -#else - if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v,args); - } else { - SwigPyObject_disown(v,args); - } -#endif - } - return obj; - } -} - -#ifdef METH_O -static PyMethodDef -swigobject_methods[] = { - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} -}; -#else -static PyMethodDef -swigobject_methods[] = { - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} -}; -#endif - -#if PY_VERSION_HEX < 0x02020000 -SWIGINTERN PyObject * -SwigPyObject_getattr(SwigPyObject *sobj,char *name) -{ - return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); -} -#endif - -SWIGRUNTIME PyTypeObject* -SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - - static PyNumberMethods SwigPyObject_as_number = { - (binaryfunc)0, /*nb_add*/ - (binaryfunc)0, /*nb_subtract*/ - (binaryfunc)0, /*nb_multiply*/ - /* nb_divide removed in Python 3 */ -#if PY_VERSION_HEX < 0x03000000 - (binaryfunc)0, /*nb_divide*/ -#endif - (binaryfunc)0, /*nb_remainder*/ - (binaryfunc)0, /*nb_divmod*/ - (ternaryfunc)0,/*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*nb_positive*/ - (unaryfunc)0, /*nb_absolute*/ - (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ -#if PY_VERSION_HEX < 0x03000000 - 0, /*nb_coerce*/ -#endif - (unaryfunc)SwigPyObject_long, /*nb_int*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_long, /*nb_long*/ -#else - 0, /*nb_reserved*/ -#endif - (unaryfunc)0, /*nb_float*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_oct, /*nb_oct*/ - (unaryfunc)SwigPyObject_hex, /*nb_hex*/ -#endif -#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ -#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ -#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ -#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ - 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ -#endif - }; - - static PyTypeObject swigpyobject_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"SwigPyObject", /* tp_name */ - sizeof(SwigPyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - (printfunc)SwigPyObject_print, /* tp_print */ -#if PY_VERSION_HEX < 0x02020000 - (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ -#else - (getattrfunc)0, /* tp_getattr */ -#endif - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ -#else - (cmpfunc)SwigPyObject_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyObject_repr, /* tp_repr */ - &SwigPyObject_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyObject_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0, /* tp_iter */ - 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - swigpyobject_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - swigpyobject_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&swigpyobject_type) < 0) - return NULL; -#endif - } - return &swigpyobject_type; -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own) -{ - SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); - if (sobj) { - sobj->ptr = ptr; - sobj->ty = ty; - sobj->own = own; - sobj->next = 0; - } - return (PyObject *)sobj; -} - -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Packed type, and use it instead of string - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *pack; - swig_type_info *ty; - size_t size; -} SwigPyPacked; - -SWIGRUNTIME int -SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) -{ - char result[SWIG_BUFFER_SIZE]; - fputs("pack, v->size, 0, sizeof(result))) { - fputs("at ", fp); - fputs(result, fp); - } - fputs(v->ty->name,fp); - fputs(">", fp); - return 0; -} - -SWIGRUNTIME PyObject * -SwigPyPacked_repr(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return SWIG_Python_str_FromFormat("", result, v->ty->name); - } else { - return SWIG_Python_str_FromFormat("", v->ty->name); - } -} - -SWIGRUNTIME PyObject * -SwigPyPacked_str(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); - } else { - return SWIG_Python_str_FromChar(v->ty->name); - } -} - -SWIGRUNTIME int -SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) -{ - size_t i = v->size; - size_t j = w->size; - int s = (i < j) ? -1 : ((i > j) ? 1 : 0); - return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); -} - -SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); - return type; -} - -SWIGRUNTIMEINLINE int -SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) - || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); -} - -SWIGRUNTIME void -SwigPyPacked_dealloc(PyObject *v) -{ - if (SwigPyPacked_Check(v)) { - SwigPyPacked *sobj = (SwigPyPacked *) v; - free(sobj->pack); - } - PyObject_DEL(v); -} - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyTypeObject swigpypacked_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX>=0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"SwigPyPacked", /* tp_name */ - sizeof(SwigPyPacked), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - (printfunc)SwigPyPacked_print, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 - 0, /* tp_reserved in 3.0.1 */ -#else - (cmpfunc)SwigPyPacked_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyPacked_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyPacked_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - swigpypacked_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - swigpypacked_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&swigpypacked_type) < 0) - return NULL; -#endif - } - return &swigpypacked_type; -} - -SWIGRUNTIME PyObject * -SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) -{ - SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); - if (sobj) { - void *pack = malloc(size); - if (pack) { - memcpy(pack, ptr, size); - sobj->pack = pack; - sobj->ty = ty; - sobj->size = size; - } else { - PyObject_DEL((PyObject *) sobj); - sobj = 0; - } - } - return (PyObject *) sobj; -} - -SWIGRUNTIME swig_type_info * -SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) -{ - if (SwigPyPacked_Check(obj)) { - SwigPyPacked *sobj = (SwigPyPacked *)obj; - if (sobj->size != size) return 0; - memcpy(ptr, sobj->pack, size); - return sobj->ty; - } else { - return 0; - } -} - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIMEINLINE PyObject * -_SWIG_This(void) -{ - return SWIG_Python_str_FromChar("this"); -} - -static PyObject *swig_this = NULL; - -SWIGRUNTIME PyObject * -SWIG_This(void) -{ - if (swig_this == NULL) - swig_this = _SWIG_This(); - return swig_this; -} - -/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ - -/* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS -#endif - -SWIGRUNTIME SwigPyObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) -{ - PyObject *obj; - - if (SwigPyObject_Check(pyobj)) - return (SwigPyObject *) pyobj; - -#ifdef SWIGPYTHON_BUILTIN - (void)obj; -# ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - pyobj = PyWeakref_GET_OBJECT(pyobj); - if (pyobj && SwigPyObject_Check(pyobj)) - return (SwigPyObject*) pyobj; - } -# endif - return NULL; -#else - - obj = 0; - -#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) - if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); - } else { - PyObject **dictptr = _PyObject_GetDictPtr(pyobj); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; - } else { -#ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); - return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; - } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } - } - } -#else - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } -#endif - if (obj && !SwigPyObject_Check(obj)) { - /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ - return SWIG_Python_GetSwigThis(obj); - } - return (SwigPyObject *)obj; -#endif -} - -/* Acquire a pointer value */ - -SWIGRUNTIME int -SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own == SWIG_POINTER_OWN) { - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); - if (sobj) { - int oldown = sobj->own; - sobj->own = own; - return oldown; - } - } - return 0; -} - -/* Convert a pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { - int res; - SwigPyObject *sobj; - - if (!obj) - return SWIG_ERROR; - if (obj == Py_None) { - if (ptr) - *ptr = 0; - return SWIG_OK; - } - - res = SWIG_ERROR; - - sobj = SWIG_Python_GetSwigThis(obj); - if (own) - *own = 0; - while (sobj) { - void *vptr = sobj->ptr; - if (ty) { - swig_type_info *to = sobj->ty; - if (to == ty) { - /* no type cast needed */ - if (ptr) *ptr = vptr; - break; - } else { - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) { - sobj = (SwigPyObject *)sobj->next; - } else { - if (ptr) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } - break; - } - } - } else { - if (ptr) *ptr = vptr; - break; - } - } - if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; - } - res = SWIG_OK; - } else { - if (flags & SWIG_POINTER_IMPLICIT_CONV) { - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - if (data && !data->implicitconv) { - PyObject *klass = data->klass; - if (klass) { - PyObject *impconv; - data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ - impconv = SWIG_Python_CallFunctor(klass, obj); - data->implicitconv = 0; - if (PyErr_Occurred()) { - PyErr_Clear(); - impconv = 0; - } - if (impconv) { - SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); - if (iobj) { - void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); - if (SWIG_IsOK(res)) { - if (ptr) { - *ptr = vptr; - /* transfer the ownership to 'ptr' */ - iobj->own = 0; - res = SWIG_AddCast(res); - res = SWIG_AddNewMask(res); - } else { - res = SWIG_AddCast(res); - } - } - } - Py_DECREF(impconv); - } - } - } - } - } - return res; -} - -/* Convert a function ptr value */ - -SWIGRUNTIME int -SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { - if (!PyCFunction_Check(obj)) { - return SWIG_ConvertPtr(obj, ptr, ty, 0); - } else { - void *vptr = 0; - - /* here we get the method pointer for callbacks */ - const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); - const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; - if (desc) - desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; - if (!desc) - return SWIG_ERROR; - if (ty) { - swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (tc) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } else { - return SWIG_ERROR; - } - } else { - *ptr = vptr; - } - return SWIG_OK; - } -} - -/* Convert a packed value value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); - if (!to) return SWIG_ERROR; - if (ty) { - if (to != ty) { - /* check type cast? */ - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) return SWIG_ERROR; - } - } - return SWIG_OK; -} - -/* ----------------------------------------------------------------------------- - * Create a new pointer object - * ----------------------------------------------------------------------------- */ - -/* - Create a new instance object, without calling __init__, and set the - 'this' attribute. -*/ - -SWIGRUNTIME PyObject* -SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) -{ -#if (PY_VERSION_HEX >= 0x02020000) - PyObject *inst = 0; - PyObject *newraw = data->newraw; - if (newraw) { - inst = PyObject_Call(newraw, data->newargs, NULL); - if (inst) { -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - PyDict_SetItem(dict, SWIG_This(), swig_this); - } - } -#else - PyObject *key = SWIG_This(); - PyObject_SetAttr(inst, key, swig_this); -#endif - } - } else { -#if PY_VERSION_HEX >= 0x03000000 - inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); - PyObject_SetAttr(inst, SWIG_This(), swig_this); - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; -#else - PyObject *dict = PyDict_New(); - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); -#endif - } - return inst; -#else -#if (PY_VERSION_HEX >= 0x02010000) - PyObject *inst; - PyObject *dict = PyDict_New(); - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - return (PyObject *) inst; -#else - PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); - if (inst == NULL) { - return NULL; - } - inst->in_class = (PyClassObject *)data->newargs; - Py_INCREF(inst->in_class); - inst->in_dict = PyDict_New(); - if (inst->in_dict == NULL) { - Py_DECREF(inst); - return NULL; - } -#ifdef Py_TPFLAGS_HAVE_WEAKREFS - inst->in_weakreflist = NULL; -#endif -#ifdef Py_TPFLAGS_GC - PyObject_GC_Init(inst); -#endif - PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); - return (PyObject *) inst; -#endif -#endif -} - -SWIGRUNTIME void -SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) -{ - PyObject *dict; -#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - } - PyDict_SetItem(dict, SWIG_This(), swig_this); - return; - } -#endif - dict = PyObject_GetAttrString(inst, (char*)"__dict__"); - PyDict_SetItem(dict, SWIG_This(), swig_this); - Py_DECREF(dict); -} - - -SWIGINTERN PyObject * -SWIG_Python_InitShadowInstance(PyObject *args) { - PyObject *obj[2]; - if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { - return NULL; - } else { - SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); - if (sthis) { - SwigPyObject_append((PyObject*) sthis, obj[1]); - } else { - SWIG_Python_SetSwigThis(obj[0], obj[1]); - } - return SWIG_Py_Void(); - } -} - -/* Create a new pointer object */ - -SWIGRUNTIME PyObject * -SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { - SwigPyClientData *clientdata; - PyObject * robj; - int own; - - if (!ptr) - return SWIG_Py_Void(); - - clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; - own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - if (clientdata && clientdata->pytype) { - SwigPyObject *newobj; - if (flags & SWIG_BUILTIN_TP_INIT) { - newobj = (SwigPyObject*) self; - if (newobj->ptr) { - PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); - while (newobj->next) - newobj = (SwigPyObject *) newobj->next; - newobj->next = next_self; - newobj = (SwigPyObject *)next_self; - } - } else { - newobj = PyObject_New(SwigPyObject, clientdata->pytype); - } - if (newobj) { - newobj->ptr = ptr; - newobj->ty = type; - newobj->own = own; - newobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif - return (PyObject*) newobj; - } - return SWIG_Py_Void(); - } - - assert(!(flags & SWIG_BUILTIN_TP_INIT)); - - robj = SwigPyObject_New(ptr, type, own); - if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { - PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - if (inst) { - Py_DECREF(robj); - robj = inst; - } - } - return robj; -} - -/* Create a new packed object */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); -} - -/* -----------------------------------------------------------------------------* - * Get type list - * -----------------------------------------------------------------------------*/ - -#ifdef SWIG_LINK_RUNTIME -void *SWIG_ReturnGlobalTypeList(void *); -#endif - -SWIGRUNTIME swig_module_info * -SWIG_Python_GetModule(void) { - static void *type_pointer = (void *)0; - /* first check if module already created */ - if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME - type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else -# ifdef SWIGPY_USE_CAPSULE - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); -# else - type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, - (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); -# endif - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif - } - return (swig_module_info *) type_pointer; -} - -#if PY_MAJOR_VERSION < 2 -/* PyModule_AddObject function was introduced in Python 2.0. The following function - is copied out of Python/modsupport.c in python version 2.3.4 */ -SWIGINTERN int -PyModule_AddObject(PyObject *m, char *name, PyObject *o) -{ - PyObject *dict; - if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); - return SWIG_ERROR; - } - if (!o) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); - return SWIG_ERROR; - } - - dict = PyModule_GetDict(m); - if (dict == NULL) { - /* Internal error -- modules must have a dict! */ - PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", - PyModule_GetName(m)); - return SWIG_ERROR; - } - if (PyDict_SetItemString(dict, name, o)) - return SWIG_ERROR; - Py_DECREF(o); - return SWIG_OK; -} -#endif - -SWIGRUNTIME void -#ifdef SWIGPY_USE_CAPSULE -SWIG_Python_DestroyModule(PyObject *obj) -#else -SWIG_Python_DestroyModule(void *vptr) -#endif -{ -#ifdef SWIGPY_USE_CAPSULE - swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); -#else - swig_module_info *swig_module = (swig_module_info *) vptr; -#endif - swig_type_info **types = swig_module->types; - size_t i; - for (i =0; i < swig_module->size; ++i) { - swig_type_info *ty = types[i]; - if (ty->owndata) { - SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; - if (data) SwigPyClientData_Del(data); - } - } - Py_DECREF(SWIG_This()); - swig_this = NULL; -} - -SWIGRUNTIME void -SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif -#ifdef SWIGPY_USE_CAPSULE - PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -#else - PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -#endif -} - -/* The python cached type query */ -SWIGRUNTIME PyObject * -SWIG_Python_TypeCache(void) { - static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); - return cache; -} - -SWIGRUNTIME swig_type_info * -SWIG_Python_TypeQuery(const char *type) -{ - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); - swig_type_info *descriptor; - if (obj) { -#ifdef SWIGPY_USE_CAPSULE - descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); -#else - descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); -#endif - } else { - swig_module_info *swig_module = SWIG_Python_GetModule(); - descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); - if (descriptor) { -#ifdef SWIGPY_USE_CAPSULE - obj = PyCapsule_New((void*) descriptor, NULL, NULL); -#else - obj = PyCObject_FromVoidPtr(descriptor, NULL); -#endif - PyDict_SetItem(cache, key, obj); - Py_DECREF(obj); - } - } - Py_DECREF(key); - return descriptor; -} - -/* - For backward compatibility only -*/ -#define SWIG_POINTER_EXCEPTION 0 -#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) -#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) - -SWIGRUNTIME int -SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ - if (PyErr_Occurred()) { - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - PyErr_Fetch(&type, &value, &traceback); - if (value) { - char *tmp; - PyObject *old_str = PyObject_Str(value); - Py_XINCREF(type); - PyErr_Clear(); - if (infront) { - PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); - } else { - PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); - } - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - } - return 1; - } else { - return 0; - } -} - -SWIGRUNTIME int -SWIG_Python_ArgFail(int argnum) -{ - if (PyErr_Occurred()) { - /* add information about failing argument */ - char mesg[256]; - PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); - return SWIG_Python_AddErrMesg(mesg, 1); - } else { - return 0; - } -} - -SWIGRUNTIMEINLINE const char * -SwigPyObject_GetDesc(PyObject *self) -{ - SwigPyObject *v = (SwigPyObject *)self; - swig_type_info *ty = v ? v->ty : 0; - return ty ? ty->str : ""; -} - -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - Py_XDECREF(str); - return; - } - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - -/* Convert a pointer value, signal an exception on a type mismatch */ -SWIGRUNTIME void * -SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { - void *result; - if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { - PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif - } - return result; -} - -#ifdef SWIGPYTHON_BUILTIN -SWIGRUNTIME int -SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; - PyObject *descr; - PyObject *encoded_name; - descrsetfunc f; - int res; - -# ifdef Py_USING_UNICODE - if (PyString_Check(name)) { - name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); - if (!name) - return -1; - } else if (!PyUnicode_Check(name)) -# else - if (!PyString_Check(name)) -# endif - { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); - return -1; - } else { - Py_INCREF(name); - } - - if (!tp->tp_dict) { - if (PyType_Ready(tp) < 0) - goto done; - } - - res = -1; - descr = _PyType_Lookup(tp, name); - f = NULL; - if (descr != NULL) - f = descr->ob_type->tp_descr_set; - if (!f) { - if (PyString_Check(name)) { - encoded_name = name; - Py_INCREF(name); - } else { - encoded_name = PyUnicode_AsUTF8String(name); - } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); - Py_DECREF(encoded_name); - } else { - res = f(descr, obj, value); - } - - done: - Py_DECREF(name); - return res; -} -#endif - - -#ifdef __cplusplus -} -#endif - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_char swig_types[0] -#define SWIGTYPE_p_f_int_int__int swig_types[1] -#define SWIGTYPE_p_f_p_void__p_void swig_types[2] -#define SWIGTYPE_p_f_void__void swig_types[3] -#define SWIGTYPE_p_int swig_types[4] -#define SWIGTYPE_p_unsigned_char swig_types[5] -static swig_type_info *swig_types[7]; -static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#if (PY_VERSION_HEX <= 0x02000000) -# if !defined(SWIG_PYTHON_CLASSIC) -# error "This python version requires swig to be run with the '-classic' option" -# endif -#endif - -/*----------------------------------------------- - @(target):= _wiringpi2.so - ------------------------------------------------*/ -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__wiringpi2 - -#else -# define SWIG_init init_wiringpi2 - -#endif -#define SWIG_name "_wiringpi2" - -#define SWIGVERSION 0x020007 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) (void *)((const void *)(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) - - -#include "WiringPi/wiringPi/wiringPi.h" -#include "WiringPi/wiringPi/wiringPiSPI.h" -#include "WiringPi/wiringPi/wiringPiI2C.h" -#include "WiringPi/wiringPi/wiringSerial.h" -#include "WiringPi/wiringPi/wiringShift.h" -#include "WiringPi/wiringPi/max31855.h" -#include "WiringPi/wiringPi/max5322.h" -#include "WiringPi/wiringPi/mcp23017.h" -#include "WiringPi/wiringPi/mcp4802.h" -#include "WiringPi/wiringPi/mcp3422.h" -#include "WiringPi/wiringPi/mcp23s08.h" -#include "WiringPi/wiringPi/mcp23008.h" -#include "WiringPi/wiringPi/mcp23x08.h" -#include "WiringPi/wiringPi/mcp23016.h" -#include "WiringPi/wiringPi/mcp3002.h" -#include "WiringPi/wiringPi/mcp3004.h" -#include "WiringPi/wiringPi/mcp23016reg.h" -#include "WiringPi/wiringPi/sn3218.h" -#include "WiringPi/wiringPi/mcp23x0817.h" -#include "WiringPi/wiringPi/mcp23s17.h" -#include "WiringPi/wiringPi/pcf8574.h" -#include "WiringPi/wiringPi/pcf8591.h" -#include "WiringPi/wiringPi/drc.h" -#include "WiringPi/wiringPi/softPwm.h" -#include "WiringPi/wiringPi/softServo.h" -#include "WiringPi/wiringPi/softTone.h" -#include "WiringPi/wiringPi/sr595.h" -#include "WiringPi/devLib/gertboard.h" -#include "WiringPi/devLib/lcd128x64.h" -#include "WiringPi/devLib/font.h" -#include "WiringPi/devLib/lcd.h" -#include "WiringPi/devLib/maxdetect.h" -#include "WiringPi/devLib/piFace.h" -#include "WiringPi/devLib/ds1302.h" -#include "WiringPi/devLib/piNes.h" -#include "WiringPi/devLib/piGlow.h" - - -SWIGINTERNINLINE PyObject* - SWIG_From_int (int value) -{ - return PyInt_FromLong((long) value); -} - - -#include -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; - } else if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include - - -#include - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (int)(v); - } - } - return res; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) -{ - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { - if (val) *val = v; - return SWIG_OK; - } else { - return SWIG_OverflowError; - } - } else if (PyLong_Check(obj)) { - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { - if (val) *val = (unsigned long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v > UINT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (unsigned int)(v); - } - } - return res; -} - - -SWIGINTERNINLINE PyObject* - SWIG_From_unsigned_SS_int (unsigned int value) -{ - return PyInt_FromSize_t((size_t) value); -} - - -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - -SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) -{ -#if PY_VERSION_HEX>=0x03000000 - if (PyUnicode_Check(obj)) -#else - if (PyString_Check(obj)) -#endif - { - char *cstr; Py_ssize_t len; -#if PY_VERSION_HEX>=0x03000000 - if (!alloc && cptr) { - /* We can't allow converting without allocation, since the internal - representation of string in Python 3 is UCS-2/UCS-4 but we require - a UTF-8 representation. - TODO(bhy) More detailed explanation */ - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - PyBytes_AsStringAndSize(obj, &cstr, &len); - if(alloc) *alloc = SWIG_NEWOBJ; -#else - PyString_AsStringAndSize(obj, &cstr, &len); -#endif - if (cptr) { - if (alloc) { - /* - In python the user should not be able to modify the inner - string representation. To warranty that, if you define - SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string - buffer is always returned. - - The default behavior is just to return the pointer value, - so, be careful. - */ -#if defined(SWIG_PYTHON_SAFE_CSTRINGS) - if (*alloc != SWIG_OLDOBJ) -#else - if (*alloc == SWIG_NEWOBJ) -#endif - { - *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); - *alloc = SWIG_NEWOBJ; - } - else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } else { - #if PY_VERSION_HEX>=0x03000000 - assert(0); /* Should never reach here in Python 3 */ - #endif - *cptr = SWIG_Python_str_AsChar(obj); - } - } - if (psize) *psize = len + 1; -#if PY_VERSION_HEX>=0x03000000 - Py_XDECREF(obj); -#endif - return SWIG_OK; - } else { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *) vptr; - if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - - - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_char (PyObject * obj, unsigned char *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v > UCHAR_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (unsigned char)(v); - } - } - return res; -} - - - #define SWIG_From_long PyLong_FromLong - - -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long (unsigned long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLong(value) : PyLong_FromLong((long)(value)); -} - - -SWIGINTERNINLINE PyObject * -SWIG_From_unsigned_SS_char (unsigned char value) -{ - return SWIG_From_unsigned_SS_long (value); -} - -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_wiringPiSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":wiringPiSetup")) SWIG_fail; - result = (int)wiringPiSetup(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiSetupSys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":wiringPiSetupSys")) SWIG_fail; - result = (int)wiringPiSetupSys(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiSetupGpio(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":wiringPiSetupGpio")) SWIG_fail; - result = (int)wiringPiSetupGpio(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiSetupPhys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":wiringPiSetupPhys")) SWIG_fail; - result = (int)wiringPiSetupPhys(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piFaceSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:piFaceSetup",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piFaceSetup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)piFaceSetup(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pinMode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:pinMode",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pinMode" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pinMode" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - pinMode(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pullUpDnControl(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:pullUpDnControl",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pullUpDnControl" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pullUpDnControl" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - pullUpDnControl(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_digitalRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:digitalRead",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "digitalRead" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)digitalRead(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_digitalWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:digitalWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "digitalWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "digitalWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - digitalWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pwmWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:pwmWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pwmWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pwmWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - pwmWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_analogRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:analogRead",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "analogRead" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)analogRead(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_analogWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:analogWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "analogWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "analogWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - analogWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piBoardRev(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":piBoardRev")) SWIG_fail; - result = (int)piBoardRev(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wpiPinToGpio(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:wpiPinToGpio",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wpiPinToGpio" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)wpiPinToGpio(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_setPadDrive(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:setPadDrive",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "setPadDrive" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setPadDrive" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - setPadDrive(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_getAlt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:getAlt",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getAlt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)getAlt(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_digitalWriteByte(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:digitalWriteByte",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "digitalWriteByte" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - digitalWriteByte(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pwmSetMode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:pwmSetMode",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pwmSetMode" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - pwmSetMode(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pwmSetRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int arg1 ; - unsigned int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:pwmSetRange",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pwmSetRange" "', argument " "1"" of type '" "unsigned int""'"); - } - arg1 = (unsigned int)(val1); - pwmSetRange(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pwmSetClock(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:pwmSetClock",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pwmSetClock" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - pwmSetClock(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gpioClockSet(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:gpioClockSet",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gpioClockSet" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gpioClockSet" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gpioClockSet(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN int Swig_var_waitForInterrupt_set(PyObject *_val) { - { - int res = SWIG_ConvertFunctionPtr(_val, (void**)(&waitForInterrupt), SWIGTYPE_p_f_int_int__int); - if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in variable '""waitForInterrupt""' of type '""int (*)(int,int)""'"); - } - } - return 0; -fail: - return 1; -} - - -SWIGINTERN PyObject *Swig_var_waitForInterrupt_get(void) { - PyObject *pyobj = 0; - - pyobj = SWIG_NewFunctionPtrObj((void *)(waitForInterrupt), SWIGTYPE_p_f_int_int__int); - return pyobj; -} - - -SWIGINTERN PyObject *_wrap_wiringPiISR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - void (*arg3)(void) = (void (*)(void)) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:wiringPiISR",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiISR" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiISR" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - { - int res = SWIG_ConvertFunctionPtr(obj2, (void**)(&arg3), SWIGTYPE_p_f_void__void); - if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in method '" "wiringPiISR" "', argument " "3"" of type '" "void (*)(void)""'"); - } - } - result = (int)wiringPiISR(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piThreadCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - void *(*arg1)(void *) = (void *(*)(void *)) 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:piThreadCreate",&obj0)) SWIG_fail; - { - int res = SWIG_ConvertFunctionPtr(obj0, (void**)(&arg1), SWIGTYPE_p_f_p_void__p_void); - if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in method '" "piThreadCreate" "', argument " "1"" of type '" "void *(*)(void *)""'"); - } - } - result = (int)piThreadCreate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piLock(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:piLock",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piLock" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - piLock(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piUnlock(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:piUnlock",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piUnlock" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - piUnlock(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piHiPri(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:piHiPri",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piHiPri" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)piHiPri(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delay(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int arg1 ; - unsigned int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delay",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "delay" "', argument " "1"" of type '" "unsigned int""'"); - } - arg1 = (unsigned int)(val1); - delay(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delayMicroseconds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int arg1 ; - unsigned int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:delayMicroseconds",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "delayMicroseconds" "', argument " "1"" of type '" "unsigned int""'"); - } - arg1 = (unsigned int)(val1); - delayMicroseconds(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_millis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)":millis")) SWIG_fail; - result = (unsigned int)millis(); - resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_micros(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)":micros")) SWIG_fail; - result = (unsigned int)micros(); - resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialOpen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:serialOpen",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "serialOpen" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "serialOpen" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)serialOpen((char const *)arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialClose(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:serialClose",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialClose" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - serialClose(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialFlush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:serialFlush",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialFlush" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - serialFlush(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialPutchar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char arg2 ; - int val1 ; - int ecode1 = 0 ; - unsigned char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:serialPutchar",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialPutchar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "serialPutchar" "', argument " "2"" of type '" "unsigned char""'"); - } - arg2 = (unsigned char)(val2); - serialPutchar(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialPuts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:serialPuts",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialPuts" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "serialPuts" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - serialPuts(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialPrintf__varargs__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *varargs) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - void *arg3 = 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:serialPrintf",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialPrintf" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "serialPrintf" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - serialPrintf(arg1,(char const *)arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialPrintf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj; - PyObject *varargs; - PyObject *newargs; - - newargs = PyTuple_GetSlice(args,0,2); - varargs = PyTuple_GetSlice(args,2,PyTuple_Size(args)+1); - resultobj = _wrap_serialPrintf__varargs__(NULL,newargs,varargs); - Py_XDECREF(newargs); - Py_XDECREF(varargs); - return resultobj; -} - - -SWIGINTERN PyObject *_wrap_serialDataAvail(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:serialDataAvail",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialDataAvail" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)serialDataAvail(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_serialGetchar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:serialGetchar",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "serialGetchar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)serialGetchar(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_shiftOut(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - uint8_t arg1 ; - uint8_t arg2 ; - uint8_t arg3 ; - uint8_t arg4 ; - unsigned char val1 ; - int ecode1 = 0 ; - unsigned char val2 ; - int ecode2 = 0 ; - unsigned char val3 ; - int ecode3 = 0 ; - unsigned char val4 ; - int ecode4 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOO:shiftOut",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; - ecode1 = SWIG_AsVal_unsigned_SS_char(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "shiftOut" "', argument " "1"" of type '" "uint8_t""'"); - } - arg1 = (uint8_t)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "shiftOut" "', argument " "2"" of type '" "uint8_t""'"); - } - arg2 = (uint8_t)(val2); - ecode3 = SWIG_AsVal_unsigned_SS_char(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "shiftOut" "', argument " "3"" of type '" "uint8_t""'"); - } - arg3 = (uint8_t)(val3); - ecode4 = SWIG_AsVal_unsigned_SS_char(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "shiftOut" "', argument " "4"" of type '" "uint8_t""'"); - } - arg4 = (uint8_t)(val4); - shiftOut(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_shiftIn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - uint8_t arg1 ; - uint8_t arg2 ; - uint8_t arg3 ; - unsigned char val1 ; - int ecode1 = 0 ; - unsigned char val2 ; - int ecode2 = 0 ; - unsigned char val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - uint8_t result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:shiftIn",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_unsigned_SS_char(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "shiftIn" "', argument " "1"" of type '" "uint8_t""'"); - } - arg1 = (uint8_t)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "shiftIn" "', argument " "2"" of type '" "uint8_t""'"); - } - arg2 = (uint8_t)(val2); - ecode3 = SWIG_AsVal_unsigned_SS_char(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "shiftIn" "', argument " "3"" of type '" "uint8_t""'"); - } - arg3 = (uint8_t)(val3); - result = shiftIn(arg1,arg2,arg3); - resultobj = SWIG_From_unsigned_SS_char((unsigned char)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiSPIGetFd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:wiringPiSPIGetFd",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiSPIGetFd" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)wiringPiSPIGetFd(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiSPIDataRW(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char *arg2 = (unsigned char *) 0 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiSPIDataRW",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiSPIDataRW" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - { - arg2 = (unsigned char *) PyString_AsString(obj1); - arg3 = PyString_Size(obj1); - } - result = (int)wiringPiSPIDataRW(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiSPISetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiSPISetup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiSPISetup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiSPISetup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)wiringPiSPISetup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CSetupInterface(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiI2CSetupInterface",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wiringPiI2CSetupInterface" "', argument " "1"" of type '" "char *""'"); - } - arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CSetupInterface" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)wiringPiI2CSetupInterface(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:wiringPiI2CSetup",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CSetup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)wiringPiI2CSetup(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:wiringPiI2CRead",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CRead" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)wiringPiI2CRead(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CReadReg8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiI2CReadReg8",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CReadReg8" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CReadReg8" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)wiringPiI2CReadReg8(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CReadReg16(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiI2CReadReg16",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CReadReg16" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CReadReg16" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)wiringPiI2CReadReg16(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:wiringPiI2CWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)wiringPiI2CWrite(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CWriteReg8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:wiringPiI2CWriteReg8",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CWriteReg8" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CWriteReg8" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "wiringPiI2CWriteReg8" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)wiringPiI2CWriteReg8(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_wiringPiI2CWriteReg16(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:wiringPiI2CWriteReg16",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wiringPiI2CWriteReg16" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wiringPiI2CWriteReg16" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "wiringPiI2CWriteReg16" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)wiringPiI2CWriteReg16(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_softToneCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:softToneCreate",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "softToneCreate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)softToneCreate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_softToneWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:softToneWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "softToneWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "softToneWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - softToneWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_softServoWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:softServoWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "softServoWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "softServoWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - softServoWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_softServoSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int arg6 ; - int arg7 ; - int arg8 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - int val6 ; - int ecode6 = 0 ; - int val7 ; - int ecode7 = 0 ; - int val8 ; - int ecode8 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:softServoSetup",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "softServoSetup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "softServoSetup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "softServoSetup" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "softServoSetup" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "softServoSetup" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - ecode6 = SWIG_AsVal_int(obj5, &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "softServoSetup" "', argument " "6"" of type '" "int""'"); - } - arg6 = (int)(val6); - ecode7 = SWIG_AsVal_int(obj6, &val7); - if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "softServoSetup" "', argument " "7"" of type '" "int""'"); - } - arg7 = (int)(val7); - ecode8 = SWIG_AsVal_int(obj7, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "softServoSetup" "', argument " "8"" of type '" "int""'"); - } - arg8 = (int)(val8); - result = (int)softServoSetup(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_softPwmCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:softPwmCreate",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "softPwmCreate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "softPwmCreate" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "softPwmCreate" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)softPwmCreate(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_softPwmWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:softPwmWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "softPwmWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "softPwmWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - softPwmWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp23008Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:mcp23008Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp23008Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp23008Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)mcp23008Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp23016Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:mcp23016Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp23016Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp23016Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)mcp23016Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp23017Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:mcp23017Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp23017Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp23017Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)mcp23017Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp23s08Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:mcp23s08Setup",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp23s08Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp23s08Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "mcp23s08Setup" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)mcp23s08Setup(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp23s17Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:mcp23s17Setup",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp23s17Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp23s17Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "mcp23s17Setup" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)mcp23s17Setup(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp3002Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:mcp3002Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp3002Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp3002Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)mcp3002Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp3422Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:mcp3422Setup",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp3422Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp3422Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "mcp3422Setup" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "mcp3422Setup" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "mcp3422Setup" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - result = (int)mcp3422Setup(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_mcp4802Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:mcp4802Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "mcp4802Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "mcp4802Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)mcp4802Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pcf8574Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:pcf8574Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pcf8574Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pcf8574Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)pcf8574Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_pcf8591Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OO:pcf8591Setup",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "pcf8591Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pcf8591Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)pcf8591Setup(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_sr595Setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:sr595Setup",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sr595Setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sr595Setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "sr595Setup" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "sr595Setup" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "sr595Setup" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - result = (int)sr595Setup(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdHome(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:lcdHome",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdHome" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - lcdHome(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdClear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:lcdClear",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdClear" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - lcdClear(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdDisplay(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdDisplay",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdDisplay" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdDisplay" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - lcdDisplay(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdCursor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdCursor",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdCursor" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdCursor" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - lcdCursor(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdCursorBlink(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdCursorBlink",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdCursorBlink" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdCursorBlink" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - lcdCursorBlink(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdSendCommand(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char arg2 ; - int val1 ; - int ecode1 = 0 ; - unsigned char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdSendCommand",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdSendCommand" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdSendCommand" "', argument " "2"" of type '" "unsigned char""'"); - } - arg2 = (unsigned char)(val2); - lcdSendCommand(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdPosition(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:lcdPosition",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdPosition" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdPosition" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcdPosition" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - lcdPosition(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdCharDef(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - unsigned char *arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:lcdCharDef",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdCharDef" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdCharDef" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "lcdCharDef" "', argument " "3"" of type '" "unsigned char [8]""'"); - } - arg3 = (unsigned char *)(argp3); - lcdCharDef(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdPutchar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char arg2 ; - int val1 ; - int ecode1 = 0 ; - unsigned char val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdPutchar",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdPutchar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdPutchar" "', argument " "2"" of type '" "unsigned char""'"); - } - arg2 = (unsigned char)(val2); - lcdPutchar(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdPuts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdPuts",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdPuts" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lcdPuts" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - lcdPuts(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdPrintf__varargs__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *varargs) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - void *arg3 = 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcdPrintf",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdPrintf" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lcdPrintf" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - lcdPrintf(arg1,(char const *)arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcdPrintf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj; - PyObject *varargs; - PyObject *newargs; - - newargs = PyTuple_GetSlice(args,0,2); - varargs = PyTuple_GetSlice(args,2,PyTuple_Size(args)+1); - resultobj = _wrap_lcdPrintf__varargs__(NULL,newargs,varargs); - Py_XDECREF(newargs); - Py_XDECREF(varargs); - return resultobj; -} - - -SWIGINTERN PyObject *_wrap_lcdInit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int arg6 ; - int arg7 ; - int arg8 ; - int arg9 ; - int arg10 ; - int arg11 ; - int arg12 ; - int arg13 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - int val6 ; - int ecode6 = 0 ; - int val7 ; - int ecode7 = 0 ; - int val8 ; - int ecode8 = 0 ; - int val9 ; - int ecode9 = 0 ; - int val10 ; - int ecode10 = 0 ; - int val11 ; - int ecode11 = 0 ; - int val12 ; - int ecode12 = 0 ; - int val13 ; - int ecode13 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - PyObject * obj8 = 0 ; - PyObject * obj9 = 0 ; - PyObject * obj10 = 0 ; - PyObject * obj11 = 0 ; - PyObject * obj12 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:lcdInit",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcdInit" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcdInit" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcdInit" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcdInit" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcdInit" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - ecode6 = SWIG_AsVal_int(obj5, &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "lcdInit" "', argument " "6"" of type '" "int""'"); - } - arg6 = (int)(val6); - ecode7 = SWIG_AsVal_int(obj6, &val7); - if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "lcdInit" "', argument " "7"" of type '" "int""'"); - } - arg7 = (int)(val7); - ecode8 = SWIG_AsVal_int(obj7, &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "lcdInit" "', argument " "8"" of type '" "int""'"); - } - arg8 = (int)(val8); - ecode9 = SWIG_AsVal_int(obj8, &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "lcdInit" "', argument " "9"" of type '" "int""'"); - } - arg9 = (int)(val9); - ecode10 = SWIG_AsVal_int(obj9, &val10); - if (!SWIG_IsOK(ecode10)) { - SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "lcdInit" "', argument " "10"" of type '" "int""'"); - } - arg10 = (int)(val10); - ecode11 = SWIG_AsVal_int(obj10, &val11); - if (!SWIG_IsOK(ecode11)) { - SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "lcdInit" "', argument " "11"" of type '" "int""'"); - } - arg11 = (int)(val11); - ecode12 = SWIG_AsVal_int(obj11, &val12); - if (!SWIG_IsOK(ecode12)) { - SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "lcdInit" "', argument " "12"" of type '" "int""'"); - } - arg12 = (int)(val12); - ecode13 = SWIG_AsVal_int(obj12, &val13); - if (!SWIG_IsOK(ecode13)) { - SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "lcdInit" "', argument " "13"" of type '" "int""'"); - } - arg13 = (int)(val13); - result = (int)lcdInit(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302rtcRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)"O:ds1302rtcRead",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ds1302rtcRead" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (unsigned int)ds1302rtcRead(arg1); - resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302rtcWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned int arg2 ; - int val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:ds1302rtcWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ds1302rtcWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ds1302rtcWrite" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = (unsigned int)(val2); - ds1302rtcWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302ramRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)"O:ds1302ramRead",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ds1302ramRead" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (unsigned int)ds1302ramRead(arg1); - resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302ramWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned int arg2 ; - int val1 ; - int ecode1 = 0 ; - unsigned int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:ds1302ramWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ds1302ramWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ds1302ramWrite" "', argument " "2"" of type '" "unsigned int""'"); - } - arg2 = (unsigned int)(val2); - ds1302ramWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302clockRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int *arg1 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:ds1302clockRead",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ds1302clockRead" "', argument " "1"" of type '" "int [8]""'"); - } - arg1 = (int *)(argp1); - ds1302clockRead(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302clockWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int *arg1 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:ds1302clockWrite",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ds1302clockWrite" "', argument " "1"" of type '" "int const [8]""'"); - } - arg1 = (int *)(argp1); - ds1302clockWrite((int const (*))arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302trickleCharge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:ds1302trickleCharge",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ds1302trickleCharge" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ds1302trickleCharge" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ds1302trickleCharge(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ds1302setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:ds1302setup",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ds1302setup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ds1302setup" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ds1302setup" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ds1302setup(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gertboardAnalogWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:gertboardAnalogWrite",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gertboardAnalogWrite" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gertboardAnalogWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gertboardAnalogWrite(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gertboardAnalogRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:gertboardAnalogRead",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gertboardAnalogRead" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gertboardAnalogRead(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gertboardSPISetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":gertboardSPISetup")) SWIG_fail; - result = (int)gertboardSPISetup(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gertboardAnalogSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"O:gertboardAnalogSetup",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gertboardAnalogSetup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gertboardAnalogSetup(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64setOrigin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcd128x64setOrigin",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64setOrigin" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64setOrigin" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - lcd128x64setOrigin(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64setOrientation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:lcd128x64setOrientation",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64setOrientation" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - lcd128x64setOrientation(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64orientCoordinates(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int *arg1 = (int *) 0 ; - int *arg2 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcd128x64orientCoordinates",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lcd128x64orientCoordinates" "', argument " "1"" of type '" "int *""'"); - } - arg1 = (int *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lcd128x64orientCoordinates" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - lcd128x64orientCoordinates(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64getScreenSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int *arg1 = (int *) 0 ; - int *arg2 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:lcd128x64getScreenSize",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lcd128x64getScreenSize" "', argument " "1"" of type '" "int *""'"); - } - arg1 = (int *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "lcd128x64getScreenSize" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - lcd128x64getScreenSize(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64point(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:lcd128x64point",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64point" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64point" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64point" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - lcd128x64point(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64line(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:lcd128x64line",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64line" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64line" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64line" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcd128x64line" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcd128x64line" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - lcd128x64line(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64lineTo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:lcd128x64lineTo",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64lineTo" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64lineTo" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64lineTo" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - lcd128x64lineTo(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64rectangle(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - int val6 ; - int ecode6 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:lcd128x64rectangle",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64rectangle" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64rectangle" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64rectangle" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcd128x64rectangle" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcd128x64rectangle" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - ecode6 = SWIG_AsVal_int(obj5, &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "lcd128x64rectangle" "', argument " "6"" of type '" "int""'"); - } - arg6 = (int)(val6); - lcd128x64rectangle(arg1,arg2,arg3,arg4,arg5,arg6); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64circle(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:lcd128x64circle",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64circle" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64circle" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64circle" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcd128x64circle" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcd128x64circle" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - lcd128x64circle(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64ellipse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - int val6 ; - int ecode6 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:lcd128x64ellipse",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64ellipse" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64ellipse" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64ellipse" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcd128x64ellipse" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcd128x64ellipse" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - ecode6 = SWIG_AsVal_int(obj5, &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "lcd128x64ellipse" "', argument " "6"" of type '" "int""'"); - } - arg6 = (int)(val6); - lcd128x64ellipse(arg1,arg2,arg3,arg4,arg5,arg6); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64putchar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:lcd128x64putchar",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64putchar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64putchar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "lcd128x64putchar" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcd128x64putchar" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcd128x64putchar" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - lcd128x64putchar(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64puts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOOOO:lcd128x64puts",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64puts" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "lcd128x64puts" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "lcd128x64puts" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(obj3, &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "lcd128x64puts" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(obj4, &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "lcd128x64puts" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - lcd128x64puts(arg1,arg2,(char const *)arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64update(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - - if (!PyArg_ParseTuple(args,(char *)":lcd128x64update")) SWIG_fail; - lcd128x64update(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:lcd128x64clear",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "lcd128x64clear" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - lcd128x64clear(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_lcd128x64setup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!PyArg_ParseTuple(args,(char *)":lcd128x64setup")) SWIG_fail; - result = (int)lcd128x64setup(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_setupNesJoystick(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; - - if (!PyArg_ParseTuple(args,(char *)"OOO:setupNesJoystick",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "setupNesJoystick" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setupNesJoystick" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setupNesJoystick" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)setupNesJoystick(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_readNesJoystick(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - unsigned int result; - - if (!PyArg_ParseTuple(args,(char *)"O:readNesJoystick",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "readNesJoystick" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (unsigned int)readNesJoystick(arg1); - resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piGlow1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OOO:piGlow1",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piGlow1" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "piGlow1" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "piGlow1" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - piGlow1(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piGlowLeg(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:piGlowLeg",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piGlowLeg" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "piGlowLeg" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - piGlowLeg(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piGlowRing(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:piGlowRing",&obj0,&obj1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piGlowRing" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "piGlowRing" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - piGlowRing(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_piGlowSetup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject * obj0 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:piGlowSetup",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "piGlowSetup" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - piGlowSetup(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -static PyMethodDef SwigMethods[] = { - { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, - { (char *)"wiringPiSetup", _wrap_wiringPiSetup, METH_VARARGS, NULL}, - { (char *)"wiringPiSetupSys", _wrap_wiringPiSetupSys, METH_VARARGS, NULL}, - { (char *)"wiringPiSetupGpio", _wrap_wiringPiSetupGpio, METH_VARARGS, NULL}, - { (char *)"wiringPiSetupPhys", _wrap_wiringPiSetupPhys, METH_VARARGS, NULL}, - { (char *)"piFaceSetup", _wrap_piFaceSetup, METH_VARARGS, NULL}, - { (char *)"pinMode", _wrap_pinMode, METH_VARARGS, NULL}, - { (char *)"pullUpDnControl", _wrap_pullUpDnControl, METH_VARARGS, NULL}, - { (char *)"digitalRead", _wrap_digitalRead, METH_VARARGS, NULL}, - { (char *)"digitalWrite", _wrap_digitalWrite, METH_VARARGS, NULL}, - { (char *)"pwmWrite", _wrap_pwmWrite, METH_VARARGS, NULL}, - { (char *)"analogRead", _wrap_analogRead, METH_VARARGS, NULL}, - { (char *)"analogWrite", _wrap_analogWrite, METH_VARARGS, NULL}, - { (char *)"piBoardRev", _wrap_piBoardRev, METH_VARARGS, NULL}, - { (char *)"wpiPinToGpio", _wrap_wpiPinToGpio, METH_VARARGS, NULL}, - { (char *)"setPadDrive", _wrap_setPadDrive, METH_VARARGS, NULL}, - { (char *)"getAlt", _wrap_getAlt, METH_VARARGS, NULL}, - { (char *)"digitalWriteByte", _wrap_digitalWriteByte, METH_VARARGS, NULL}, - { (char *)"pwmSetMode", _wrap_pwmSetMode, METH_VARARGS, NULL}, - { (char *)"pwmSetRange", _wrap_pwmSetRange, METH_VARARGS, NULL}, - { (char *)"pwmSetClock", _wrap_pwmSetClock, METH_VARARGS, NULL}, - { (char *)"gpioClockSet", _wrap_gpioClockSet, METH_VARARGS, NULL}, - { (char *)"wiringPiISR", _wrap_wiringPiISR, METH_VARARGS, NULL}, - { (char *)"piThreadCreate", _wrap_piThreadCreate, METH_VARARGS, NULL}, - { (char *)"piLock", _wrap_piLock, METH_VARARGS, NULL}, - { (char *)"piUnlock", _wrap_piUnlock, METH_VARARGS, NULL}, - { (char *)"piHiPri", _wrap_piHiPri, METH_VARARGS, NULL}, - { (char *)"delay", _wrap_delay, METH_VARARGS, NULL}, - { (char *)"delayMicroseconds", _wrap_delayMicroseconds, METH_VARARGS, NULL}, - { (char *)"millis", _wrap_millis, METH_VARARGS, NULL}, - { (char *)"micros", _wrap_micros, METH_VARARGS, NULL}, - { (char *)"serialOpen", _wrap_serialOpen, METH_VARARGS, NULL}, - { (char *)"serialClose", _wrap_serialClose, METH_VARARGS, NULL}, - { (char *)"serialFlush", _wrap_serialFlush, METH_VARARGS, NULL}, - { (char *)"serialPutchar", _wrap_serialPutchar, METH_VARARGS, NULL}, - { (char *)"serialPuts", _wrap_serialPuts, METH_VARARGS, NULL}, - { (char *)"serialPrintf", _wrap_serialPrintf, METH_VARARGS, NULL}, - { (char *)"serialDataAvail", _wrap_serialDataAvail, METH_VARARGS, NULL}, - { (char *)"serialGetchar", _wrap_serialGetchar, METH_VARARGS, NULL}, - { (char *)"shiftOut", _wrap_shiftOut, METH_VARARGS, NULL}, - { (char *)"shiftIn", _wrap_shiftIn, METH_VARARGS, NULL}, - { (char *)"wiringPiSPIGetFd", _wrap_wiringPiSPIGetFd, METH_VARARGS, NULL}, - { (char *)"wiringPiSPIDataRW", _wrap_wiringPiSPIDataRW, METH_VARARGS, NULL}, - { (char *)"wiringPiSPISetup", _wrap_wiringPiSPISetup, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CSetupInterface", _wrap_wiringPiI2CSetupInterface, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CSetup", _wrap_wiringPiI2CSetup, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CRead", _wrap_wiringPiI2CRead, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CReadReg8", _wrap_wiringPiI2CReadReg8, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CReadReg16", _wrap_wiringPiI2CReadReg16, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CWrite", _wrap_wiringPiI2CWrite, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CWriteReg8", _wrap_wiringPiI2CWriteReg8, METH_VARARGS, NULL}, - { (char *)"wiringPiI2CWriteReg16", _wrap_wiringPiI2CWriteReg16, METH_VARARGS, NULL}, - { (char *)"softToneCreate", _wrap_softToneCreate, METH_VARARGS, NULL}, - { (char *)"softToneWrite", _wrap_softToneWrite, METH_VARARGS, NULL}, - { (char *)"softServoWrite", _wrap_softServoWrite, METH_VARARGS, NULL}, - { (char *)"softServoSetup", _wrap_softServoSetup, METH_VARARGS, NULL}, - { (char *)"softPwmCreate", _wrap_softPwmCreate, METH_VARARGS, NULL}, - { (char *)"softPwmWrite", _wrap_softPwmWrite, METH_VARARGS, NULL}, - { (char *)"mcp23008Setup", _wrap_mcp23008Setup, METH_VARARGS, NULL}, - { (char *)"mcp23016Setup", _wrap_mcp23016Setup, METH_VARARGS, NULL}, - { (char *)"mcp23017Setup", _wrap_mcp23017Setup, METH_VARARGS, NULL}, - { (char *)"mcp23s08Setup", _wrap_mcp23s08Setup, METH_VARARGS, NULL}, - { (char *)"mcp23s17Setup", _wrap_mcp23s17Setup, METH_VARARGS, NULL}, - { (char *)"mcp3002Setup", _wrap_mcp3002Setup, METH_VARARGS, NULL}, - { (char *)"mcp3422Setup", _wrap_mcp3422Setup, METH_VARARGS, NULL}, - { (char *)"mcp4802Setup", _wrap_mcp4802Setup, METH_VARARGS, NULL}, - { (char *)"pcf8574Setup", _wrap_pcf8574Setup, METH_VARARGS, NULL}, - { (char *)"pcf8591Setup", _wrap_pcf8591Setup, METH_VARARGS, NULL}, - { (char *)"sr595Setup", _wrap_sr595Setup, METH_VARARGS, NULL}, - { (char *)"lcdHome", _wrap_lcdHome, METH_VARARGS, NULL}, - { (char *)"lcdClear", _wrap_lcdClear, METH_VARARGS, NULL}, - { (char *)"lcdDisplay", _wrap_lcdDisplay, METH_VARARGS, NULL}, - { (char *)"lcdCursor", _wrap_lcdCursor, METH_VARARGS, NULL}, - { (char *)"lcdCursorBlink", _wrap_lcdCursorBlink, METH_VARARGS, NULL}, - { (char *)"lcdSendCommand", _wrap_lcdSendCommand, METH_VARARGS, NULL}, - { (char *)"lcdPosition", _wrap_lcdPosition, METH_VARARGS, NULL}, - { (char *)"lcdCharDef", _wrap_lcdCharDef, METH_VARARGS, NULL}, - { (char *)"lcdPutchar", _wrap_lcdPutchar, METH_VARARGS, NULL}, - { (char *)"lcdPuts", _wrap_lcdPuts, METH_VARARGS, NULL}, - { (char *)"lcdPrintf", _wrap_lcdPrintf, METH_VARARGS, NULL}, - { (char *)"lcdInit", _wrap_lcdInit, METH_VARARGS, NULL}, - { (char *)"ds1302rtcRead", _wrap_ds1302rtcRead, METH_VARARGS, NULL}, - { (char *)"ds1302rtcWrite", _wrap_ds1302rtcWrite, METH_VARARGS, NULL}, - { (char *)"ds1302ramRead", _wrap_ds1302ramRead, METH_VARARGS, NULL}, - { (char *)"ds1302ramWrite", _wrap_ds1302ramWrite, METH_VARARGS, NULL}, - { (char *)"ds1302clockRead", _wrap_ds1302clockRead, METH_VARARGS, NULL}, - { (char *)"ds1302clockWrite", _wrap_ds1302clockWrite, METH_VARARGS, NULL}, - { (char *)"ds1302trickleCharge", _wrap_ds1302trickleCharge, METH_VARARGS, NULL}, - { (char *)"ds1302setup", _wrap_ds1302setup, METH_VARARGS, NULL}, - { (char *)"gertboardAnalogWrite", _wrap_gertboardAnalogWrite, METH_VARARGS, NULL}, - { (char *)"gertboardAnalogRead", _wrap_gertboardAnalogRead, METH_VARARGS, NULL}, - { (char *)"gertboardSPISetup", _wrap_gertboardSPISetup, METH_VARARGS, NULL}, - { (char *)"gertboardAnalogSetup", _wrap_gertboardAnalogSetup, METH_VARARGS, NULL}, - { (char *)"lcd128x64setOrigin", _wrap_lcd128x64setOrigin, METH_VARARGS, NULL}, - { (char *)"lcd128x64setOrientation", _wrap_lcd128x64setOrientation, METH_VARARGS, NULL}, - { (char *)"lcd128x64orientCoordinates", _wrap_lcd128x64orientCoordinates, METH_VARARGS, NULL}, - { (char *)"lcd128x64getScreenSize", _wrap_lcd128x64getScreenSize, METH_VARARGS, NULL}, - { (char *)"lcd128x64point", _wrap_lcd128x64point, METH_VARARGS, NULL}, - { (char *)"lcd128x64line", _wrap_lcd128x64line, METH_VARARGS, NULL}, - { (char *)"lcd128x64lineTo", _wrap_lcd128x64lineTo, METH_VARARGS, NULL}, - { (char *)"lcd128x64rectangle", _wrap_lcd128x64rectangle, METH_VARARGS, NULL}, - { (char *)"lcd128x64circle", _wrap_lcd128x64circle, METH_VARARGS, NULL}, - { (char *)"lcd128x64ellipse", _wrap_lcd128x64ellipse, METH_VARARGS, NULL}, - { (char *)"lcd128x64putchar", _wrap_lcd128x64putchar, METH_VARARGS, NULL}, - { (char *)"lcd128x64puts", _wrap_lcd128x64puts, METH_VARARGS, NULL}, - { (char *)"lcd128x64update", _wrap_lcd128x64update, METH_VARARGS, NULL}, - { (char *)"lcd128x64clear", _wrap_lcd128x64clear, METH_VARARGS, NULL}, - { (char *)"lcd128x64setup", _wrap_lcd128x64setup, METH_VARARGS, NULL}, - { (char *)"setupNesJoystick", _wrap_setupNesJoystick, METH_VARARGS, NULL}, - { (char *)"readNesJoystick", _wrap_readNesJoystick, METH_VARARGS, NULL}, - { (char *)"piGlow1", _wrap_piGlow1, METH_VARARGS, NULL}, - { (char *)"piGlowLeg", _wrap_piGlowLeg, METH_VARARGS, NULL}, - { (char *)"piGlowRing", _wrap_piGlowRing, METH_VARARGS, NULL}, - { (char *)"piGlowSetup", _wrap_piGlowSetup, METH_VARARGS, NULL}, - { NULL, NULL, 0, NULL } -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_f_int_int__int = {"_p_f_int_int__int", "int (*)(int,int)", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_f_p_void__p_void = {"_p_f_p_void__p_void", "void *(*)(void *)", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_f_void__void = {"_p_f_void__void", "void (*)(void)", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_char, - &_swigt__p_f_int_int__int, - &_swigt__p_f_p_void__p_void, - &_swigt__p_f_void__void, - &_swigt__p_int, - &_swigt__p_unsigned_char, -}; - -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_f_int_int__int[] = { {&_swigt__p_f_int_int__int, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_f_p_void__p_void[] = { {&_swigt__p_f_p_void__p_void, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_f_void__void[] = { {&_swigt__p_f_void__void, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_char, - _swigc__p_f_int_int__int, - _swigc__p_f_p_void__p_void, - _swigc__p_f_void__void, - _swigc__p_int, - _swigc__p_unsigned_char, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_const_info swig_const_table[] = { -{0, 0, 0, 0.0, 0, 0}}; - -#ifdef __cplusplus -} -#endif -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int found, init; - - clientdata = clientdata; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpeters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ - /* c-mode */ -#endif -} -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - - /* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - - typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; - } swig_globalvar; - - typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; - } swig_varlinkobject; - - SWIGINTERN PyObject * - swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString(""); -#else - return PyString_FromString(""); -#endif - } - - SWIGINTERN PyObject * - swig_varlink_str(swig_varlinkobject *v) { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); - PyObject *tail; - PyObject *joined; - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - tail = PyUnicode_FromString(var->name); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - if (var->next) { - tail = PyUnicode_InternFromString(", "); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - } - } - tail = PyUnicode_InternFromString(")"); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; -#else - PyObject *str = PyString_FromString("("); - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - PyString_ConcatAndDel(&str,PyString_FromString(var->name)); - if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); - } - PyString_ConcatAndDel(&str,PyString_FromString(")")); -#endif - return str; - } - - SWIGINTERN int - swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { - char *tmp; - PyObject *str = swig_varlink_str(v); - fprintf(fp,"Swig global variables "); - fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(str); - return 0; - } - - SWIGINTERN void - swig_varlink_dealloc(swig_varlinkobject *v) { - swig_globalvar *var = v->vars; - while (var) { - swig_globalvar *n = var->next; - free(var->name); - free(var); - var = n; - } - } - - SWIGINTERN PyObject * - swig_varlink_getattr(swig_varlinkobject *v, char *n) { - PyObject *res = NULL; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->get_attr)(); - break; - } - var = var->next; - } - if (res == NULL && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - } - return res; - } - - SWIGINTERN int - swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - int res = 1; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->set_attr)(p); - break; - } - var = var->next; - } - if (res == 1 && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - } - return res; - } - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - (char *)"swigvarlink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ - (printfunc) swig_varlink_print, /* tp_print */ - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - varlink_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - varlink_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&varlink_type) < 0) - return NULL; -#endif - } - return &varlink_type; - } - - /* Create a variable linking object for use later */ - SWIGINTERN PyObject * - SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); - } - - SWIGINTERN void - SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - strncpy(gv->name,name,size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; - } - - SWIGINTERN PyObject * - SWIG_globals(void) { - static PyObject *_SWIG_globals = 0; - if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); - return _SWIG_globals; - } - - /* ----------------------------------------------------------------------------- - * constants/methods manipulation - * ----------------------------------------------------------------------------- */ - - /* Install Constants */ - SWIGINTERN void - SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { - PyObject *obj = 0; - size_t i; - for (i = 0; constants[i].type; ++i) { - switch(constants[i].type) { - case SWIG_PY_POINTER: - obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; - } - if (obj) { - PyDict_SetItemString(d, constants[i].name, obj); - Py_DECREF(obj); - } - } - } - - /* -----------------------------------------------------------------------------*/ - /* Fix SwigMethods to carry the callback ptrs when needed */ - /* -----------------------------------------------------------------------------*/ - - SWIGINTERN void - SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { - size_t i; - for (i = 0; methods[i].ml_name; ++i) { - const char *c = methods[i].ml_doc; - if (c && (c = strstr(c, "swig_ptr: "))) { - int j; - swig_const_info *ci = 0; - const char *name = c + 10; - for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, - strlen(const_table[j].name)) == 0) { - ci = &(const_table[j]); - break; - } - } - if (ci) { - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - strncpy(buff, methods[i].ml_doc, ldoc); - buff += ldoc; - strncpy(buff, "swig_ptr: ", 10); - buff += 10; - SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); - methods[i].ml_doc = ndoc; - } - } - } - } - } - } - -#ifdef __cplusplus -} -#endif - -/* -----------------------------------------------------------------------------* - * Partial Init method - * -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" -#endif - -SWIGEXPORT -#if PY_VERSION_HEX >= 0x03000000 -PyObject* -#else -void -#endif -SWIG_init(void) { - PyObject *m, *d, *md; -#if PY_VERSION_HEX >= 0x03000000 - static struct PyModuleDef SWIG_module = { -# if PY_VERSION_HEX >= 0x03020000 - PyModuleDef_HEAD_INIT, -# else - { - PyObject_HEAD_INIT(NULL) - NULL, /* m_init */ - 0, /* m_index */ - NULL, /* m_copy */ - }, -# endif - (char *) SWIG_name, - NULL, - -1, - SwigMethods, - NULL, - NULL, - NULL, - NULL - }; -#endif - -#if defined(SWIGPYTHON_BUILTIN) - static SwigPyClientData SwigPyObject_clientdata = { - 0, 0, 0, 0, 0, 0, 0 - }; - static PyGetSetDef this_getset_def = { - (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL - }; - static SwigPyGetSet thisown_getset_closure = { - (PyCFunction) SwigPyObject_own, - (PyCFunction) SwigPyObject_own - }; - static PyGetSetDef thisown_getset_def = { - (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure - }; - PyObject *metatype_args; - PyTypeObject *builtin_pytype; - int builtin_base_count; - swig_type_info *builtin_basetype; - PyObject *tuple; - PyGetSetDescrObject *static_getset; - PyTypeObject *metatype; - SwigPyClientData *cd; - PyObject *public_interface, *public_symbol; - PyObject *this_descr; - PyObject *thisown_descr; - int i; - - (void)builtin_pytype; - (void)builtin_base_count; - (void)builtin_basetype; - (void)tuple; - (void)static_getset; - - /* metatype is used to implement static member variables. */ - metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); - assert(metatype_args); - metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); - assert(metatype); - Py_DECREF(metatype_args); - metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; - assert(PyType_Ready(metatype) >= 0); -#endif - - /* Fix SwigMethods to carry the callback ptrs when needed */ - SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule((char *) SWIG_name, SwigMethods); -#endif - md = d = PyModule_GetDict(m); - - SWIG_InitializeModule(0); - -#ifdef SWIGPYTHON_BUILTIN - SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - if (!cd) { - SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); - } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { - PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif - } - - /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); - (void)this_descr; - - /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); - (void)thisown_descr; - - public_interface = PyList_New(0); - public_symbol = 0; - (void)public_symbol; - - PyDict_SetItemString(md, "__all__", public_interface); - Py_DECREF(public_interface); - for (i = 0; SwigMethods[i].ml_name != NULL; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); - for (i = 0; swig_const_table[i].name != 0; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); -#endif - - SWIG_InstallConstants(d,swig_const_table); - - PyDict_SetItemString(md,(char*)"cvar", SWIG_globals()); - SWIG_addvarlink(SWIG_globals(),(char*)"waitForInterrupt",Swig_var_waitForInterrupt_get, Swig_var_waitForInterrupt_set); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif -} -