]> git.basschouten.com Git - openhab-addons.git/blob
b90cff85604ed3224d85062ce52d61660801adf5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mcp23017.internal;
14
15 import static com.pi4j.gpio.extension.mcp.MCP23017Pin.*;
16 import static org.openhab.binding.mcp23017.internal.Mcp23017BindingConstants.*;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import com.pi4j.io.gpio.Pin;
22
23 /**
24  * @author Anatol Ogorek - Initial contribution
25  */
26 public class PinMapper {
27
28     private static final Map<String, Pin> PIN_MAP = new HashMap<>();
29
30     static {
31         PIN_MAP.put(CHANNEL_A0, GPIO_A0);
32         PIN_MAP.put(CHANNEL_A1, GPIO_A1);
33         PIN_MAP.put(CHANNEL_A2, GPIO_A2);
34         PIN_MAP.put(CHANNEL_A3, GPIO_A3);
35         PIN_MAP.put(CHANNEL_A4, GPIO_A4);
36         PIN_MAP.put(CHANNEL_A5, GPIO_A5);
37         PIN_MAP.put(CHANNEL_A6, GPIO_A6);
38         PIN_MAP.put(CHANNEL_A7, GPIO_A7);
39         PIN_MAP.put(CHANNEL_B0, GPIO_B0);
40         PIN_MAP.put(CHANNEL_B1, GPIO_B1);
41         PIN_MAP.put(CHANNEL_B2, GPIO_B2);
42         PIN_MAP.put(CHANNEL_B3, GPIO_B3);
43         PIN_MAP.put(CHANNEL_B4, GPIO_B4);
44         PIN_MAP.put(CHANNEL_B5, GPIO_B5);
45         PIN_MAP.put(CHANNEL_B6, GPIO_B6);
46         PIN_MAP.put(CHANNEL_B7, GPIO_B7);
47     }
48
49     public static Pin get(String pinCode) {
50         return PIN_MAP.get(pinCode);
51     }
52 }