001package com.pi4j.io.gpio;
002
003/*
004 * #%L
005 * **********************************************************************
006 * ORGANIZATION  :  Pi4J
007 * PROJECT       :  Pi4J :: Java Library (Core)
008 * FILENAME      :  OdroidC1Pin.java
009 *
010 * This file is part of the Pi4J project. More information about
011 * this project can be found here:  https://www.pi4j.com/
012 * **********************************************************************
013 * %%
014 * Copyright (C) 2012 - 2019 Pi4J
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Lesser General Public License as
018 * published by the Free Software Foundation, either version 3 of the
019 * License, or (at your option) any later version.
020 *
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Lesser Public License for more details.
025 *
026 * You should have received a copy of the GNU General Lesser Public
027 * License along with this program.  If not, see
028 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
029 * #L%
030 */
031
032
033
034
035/**
036 * Odroid-C1/C1+ pin definitions for (default) WiringPi pin numbering scheme.
037 *
038 * @link http://odroid.com/dokuwiki/doku.php?id=en:c1_hardware#expansion_connectors
039 *
040 * @author Robert Savage (<a
041 *         href="http://www.savagehomeautomation.com">http://www.savagehomeautomation.com</a>)
042 *
043 */
044public class OdroidC1Pin extends PinProvider {
045
046    // 11       GPIOY.BIT8      Export GPIO#88, Wiring Pi GPIO#0
047    public static final Pin GPIO_00 = createDigitalPin(0, "GPIO 0");
048
049    // 12       GPIOY.BIT7      Export GPIO#87, Wiring Pi GPIO#1
050    public static final Pin GPIO_01 = createDigitalPin(1, "GPIO 1");
051
052    // 13       GPIOX.BIT19     Export GPIO#116, Wiring Pi GPIO#2
053    public static final Pin GPIO_02 = createDigitalPin(2, "GPIO 2");
054
055    // 15       GPIOX.BIT18     Export GPIO#115, Wiring PI GPIO#3
056    public static final Pin GPIO_03 = createDigitalPin(3, "GPIO 3");
057
058    // 16       GPIOX.BIT7      Export GPIO#104, Wiring Pi GPIO#4
059    public static final Pin GPIO_04 = createDigitalPin(4, "GPIO 4");
060
061    // 18       GPIOX.BIT5      Export GPIO#102, Wiring Pi GPIO#5
062    public static final Pin GPIO_05 = createDigitalPin(5, "GPIO 5");
063
064    // 22       GPIOX.BIT6      Export GPIO#103, Wiring Pi GPIO#6
065    public static final Pin GPIO_06 = createDigitalPin(6, "GPIO 6");
066
067    // 7        GPIOY.BIT3      Export GPIO#83, Wiring Pi GPIO#7
068    public static final Pin GPIO_07 = createDigitalPin(7, "GPIO 7");
069
070    // 24       GPIOX.BIT20     Export GPIO#117, Wiring Pi GPIO#10
071    public static final Pin GPIO_10 = createDigitalPin(10, "GPIO 10");
072
073    // 26       GPIOX.BIT21     Export GPIO#118, Wiring Pi GPIO#11
074    public static final Pin GPIO_11 = createDigitalPin(11, "GPIO 11");
075
076    // 19   GPIOX.BIT10(MOSI)   Export GPIO#107, Wiring Pi GPIO#12, PWM1
077    // PWM not currently supported, see known issues: https://github.com/Pi4J/pi4j-v1/issues/229
078    public static final Pin GPIO_12 = createDigitalPin(12, "GPIO 12");
079
080    // 21       GPIOX.BIT9(MISO)        Export GPIO#106, Wiring Pi GPIO#13
081    public static final Pin GPIO_13 = createDigitalPin(13, "GPIO 13");
082
083    // 23       GPIOX.BIT8(SPI_SCLK)    Export GPIO#105, Wiring Pi GPIO#14
084    public static final Pin GPIO_14 = createDigitalPin(14, "GPIO 14");
085
086    // 29       GPIOX.BIT4      Export GPIO#101, Wiring Pi GPIO#21
087    public static final Pin GPIO_21 = createDigitalPin(21, "GPIO 21");
088
089    // 31       GPIOX.BIT3      Export GPIO#100, Wiring Pi GPIO#22
090    public static final Pin GPIO_22 = createDigitalPin(22, "GPIO 22");
091
092    // 33       GPIOX.BIT11     Export GPIO#108, Wiring Pi GPIO#23, PWM0
093    // PWM not currently supported, see known issues: https://github.com/Pi4J/pi4j-v1/issues/229
094    public static final Pin GPIO_23 = createDigitalPin(23, "GPIO 23");
095
096    // 35       GPIOX.BIT0      Export GPIO#97, Wiring Pi GPIO#24
097    public static final Pin GPIO_24 = createDigitalPin(24, "GPIO 24");
098
099    // 32       GPIOX.BIT2      Export GPIO#99, Wiring Pi#26
100    public static final Pin GPIO_26 = createDigitalPin(26, "GPIO 26");
101
102    // 36       GPIOX.BIT1      Wiring Pi GPIO#27
103    public static final Pin GPIO_27 = createDigitalPin(27, "GPIO 27");
104
105    // 40       ADC.AIN0  (!! 1.8 VDC MAX !!)
106    public static final Pin AIN0 = createAnalogInputPin(0 + OdroidGpioProvider.AIN_ADDRESS_OFFSET, "AIN0");
107
108    // 37       ADC.AIN1  (!! 1.8 VDC MAX !!)
109    public static final Pin AIN1 = createAnalogInputPin(1 + OdroidGpioProvider.AIN_ADDRESS_OFFSET, "AIN1");
110
111    private static Pin createAnalogInputPin(int address, String name) {
112        return createAnalogInputPin(OdroidGpioProvider.NAME, address, name);
113    }
114
115    protected static Pin createDigitalPin(int address, String name) {
116        return createDigitalPin(OdroidGpioProvider.NAME, address, name);
117    }
118
119    protected static Pin createDigitalAndPwmPin(int address, String name) {
120        return createDigitalAndPwmPin(OdroidGpioProvider.NAME, address, name);
121    }
122
123    // *override* static method from subclass
124    // (overriding a static method is not supported in Java
125    //  so this method definition will hide the subclass static method)
126    public static Pin getPinByName(String name) {
127        return PinProvider.getPinByName(name);
128    }
129
130    // *override* static method from subclass
131    // (overriding a static method is not supported in Java
132    //  so this method definition will hide the subclass static method)
133    public static Pin getPinByAddress(int address) {
134        return PinProvider.getPinByAddress(address);
135    }
136
137    // *override* static method from subclass
138    // (overriding a static method is not supported in Java
139    //  so this method definition will hide the subclass static method)
140    public static Pin[] allPins() { return PinProvider.allPins(); }
141
142    // *override* static method from subclass
143    // (overriding a static method is not supported in Java
144    //  so this method definition will hide the subclass static method)
145    public static Pin[] allPins(PinMode ... mode) { return PinProvider.allPins(mode); }
146}