|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | + * copy of this software and associated documentation files (the "Software"), |
| 6 | + * to deal in the Software without restriction, including without limitation |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | + * Software is furnished to do so, subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included |
| 12 | + * in all copies or substantial portions of the Software. |
| 13 | + * |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 16 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 17 | + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
| 18 | + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | + * |
| 22 | + * Except as contained in this notice, the name of Maxim Integrated |
| 23 | + * Products, Inc. shall not be used except as stated in the Maxim Integrated |
| 24 | + * Products, Inc. Branding Policy. |
| 25 | + * |
| 26 | + * The mere transfer of this software does not imply any licenses |
| 27 | + * of trade secrets, proprietary technology, copyrights, patents, |
| 28 | + * trademarks, maskwork rights, or any other form of intellectual |
| 29 | + * property whatsoever. Maxim Integrated Products, Inc. retains all |
| 30 | + * ownership rights. |
| 31 | + ******************************************************************************* |
| 32 | + */ |
| 33 | + |
| 34 | +#ifndef MBED_PINNAMES_H |
| 35 | +#define MBED_PINNAMES_H |
| 36 | + |
| 37 | +#include "cmsis.h" |
| 38 | +#include "gpio_regs.h" |
| 39 | + |
| 40 | +#ifdef __cplusplus |
| 41 | +extern "C" { |
| 42 | +#endif |
| 43 | + |
| 44 | +typedef enum { |
| 45 | + PIN_INPUT = 0, /* MXC_V_GPIO_OUT_MODE_HIGH_Z,*/ |
| 46 | + PIN_OUTPUT = 1 /* MXC_V_GPIO_OUT_MODE_NORMAL_DRIVE */ |
| 47 | +} PinDirection; |
| 48 | + |
| 49 | +#define PORT_SHIFT 12 |
| 50 | +#define PINNAME_TO_PORT(name) ((unsigned int)(name) >> PORT_SHIFT) |
| 51 | +#define PINNAME_TO_PIN(name) ((unsigned int)(name) & ~(0xFFFFFFFF << PORT_SHIFT)) |
| 52 | + |
| 53 | +#define NOT_CONNECTED (int)0xFFFFFFFF |
| 54 | + |
| 55 | +typedef enum { |
| 56 | + P0_0 = (0 << PORT_SHIFT), P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, |
| 57 | + P1_0 = (1 << PORT_SHIFT), P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, |
| 58 | + P2_0 = (2 << PORT_SHIFT), P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, |
| 59 | + P3_0 = (3 << PORT_SHIFT), P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, |
| 60 | + P4_0 = (4 << PORT_SHIFT), P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, |
| 61 | + |
| 62 | + // Analog input pins |
| 63 | + AIN_0 = (0xA << PORT_SHIFT), AIN_1, AIN_2, AIN_3, AIN_4, AIN_5, |
| 64 | + |
| 65 | + LED_GREEN = P3_1, |
| 66 | + LED_RED = P3_0, |
| 67 | + LED_YELLOW = P3_3, |
| 68 | + LED_BLUE = P3_2, |
| 69 | + |
| 70 | + // mbed original LED naming |
| 71 | + LED1 = LED_RED, |
| 72 | + LED2 = LED_GREEN, |
| 73 | + LED3 = LED_BLUE, |
| 74 | + LED4 = LED_YELLOW, |
| 75 | + |
| 76 | + // Push button |
| 77 | + SW2 = P2_2, |
| 78 | + SW3 = P2_3, |
| 79 | + |
| 80 | + // USB bridge connected UART pins |
| 81 | + USBTX = P2_1, |
| 82 | + USBRX = P2_0, |
| 83 | + STDIO_UART_TX = USBTX, |
| 84 | + STDIO_UART_RX = USBRX, |
| 85 | + |
| 86 | + // I2C pins |
| 87 | + I2C0_SCL = P1_7, |
| 88 | + I2C0_SDA = P1_6, |
| 89 | + |
| 90 | + I2C1_SCL = P3_5, |
| 91 | + I2C1_SDA = P3_4, |
| 92 | + |
| 93 | + // UART pins |
| 94 | + UART0_RX = P0_0, |
| 95 | + UART0_TX = P0_1, |
| 96 | + UART0_CTS = P0_2, |
| 97 | + UART0_RTS = P0_3, |
| 98 | + |
| 99 | + UART1_RX = P2_0, |
| 100 | + UART1_TX = P2_1, |
| 101 | + UART1_CTS = P2_2, |
| 102 | + UART1_RTS = P2_3, |
| 103 | + |
| 104 | + UART2_RX = P3_0, |
| 105 | + UART2_TX = P3_1, |
| 106 | + UART2_CTS = P3_2, |
| 107 | + UART2_RTS = P3_3, |
| 108 | + |
| 109 | + // SPI pins |
| 110 | + SPI0_SCK = P0_4, |
| 111 | + SPI0_MOSI = P0_5, |
| 112 | + SPI0_MISO = P0_6, |
| 113 | + SPI0_SS = P0_7, |
| 114 | + |
| 115 | + SPI1_SCK = P1_0, |
| 116 | + SPI1_MOSI = P1_1, |
| 117 | + SPI1_MISO = P1_2, |
| 118 | + SPI1_SS = P1_3, |
| 119 | + |
| 120 | + SPI2_SCK = P2_4, |
| 121 | + SPI2_MOSI = P2_5, |
| 122 | + SPI2_MISO = P2_6, |
| 123 | + SPI2_SS = P2_7, |
| 124 | + |
| 125 | + // Not connected |
| 126 | + NC = NOT_CONNECTED |
| 127 | +} PinName; |
| 128 | + |
| 129 | +typedef enum { |
| 130 | + PullUp, |
| 131 | + PullDown, |
| 132 | + OpenDrain, |
| 133 | + PullNone, |
| 134 | + PullDefault = PullUp |
| 135 | +} PinMode; |
| 136 | + |
| 137 | +typedef enum { |
| 138 | + LED_ON = 0, |
| 139 | + LED_OFF = 1 |
| 140 | +} LedStates; |
| 141 | + |
| 142 | +#ifdef __cplusplus |
| 143 | +} |
| 144 | +#endif |
| 145 | + |
| 146 | +#endif |
0 commit comments