2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mcp23017.internal;
15 import static com.pi4j.gpio.extension.mcp.MCP23017Pin.*;
16 import static org.openhab.binding.mcp23017.internal.Mcp23017BindingConstants.*;
18 import java.util.HashMap;
21 import com.pi4j.io.gpio.Pin;
24 * @author Anatol Ogorek - Initial contribution
26 public class PinMapper {
28 private static final Map<String, Pin> PIN_MAP = new HashMap<>();
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);
49 public static Pin get(String pinCode) {
50 return PIN_MAP.get(pinCode);