Mouse code for the MacroRat
mbed-dev/targets/TARGET_NXP/TARGET_LPC11U6X/PinNames.h@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /* mbed Microcontroller Library |
sahilmgandhi | 18:6a4db94011d3 | 2 | * Copyright (c) 2006-2014 ARM Limited |
sahilmgandhi | 18:6a4db94011d3 | 3 | * |
sahilmgandhi | 18:6a4db94011d3 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
sahilmgandhi | 18:6a4db94011d3 | 5 | * you may not use this file except in compliance with the License. |
sahilmgandhi | 18:6a4db94011d3 | 6 | * You may obtain a copy of the License at |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
sahilmgandhi | 18:6a4db94011d3 | 9 | * |
sahilmgandhi | 18:6a4db94011d3 | 10 | * Unless required by applicable law or agreed to in writing, software |
sahilmgandhi | 18:6a4db94011d3 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
sahilmgandhi | 18:6a4db94011d3 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
sahilmgandhi | 18:6a4db94011d3 | 13 | * See the License for the specific language governing permissions and |
sahilmgandhi | 18:6a4db94011d3 | 14 | * limitations under the License. |
sahilmgandhi | 18:6a4db94011d3 | 15 | */ |
sahilmgandhi | 18:6a4db94011d3 | 16 | #ifndef MBED_PINNAMES_H |
sahilmgandhi | 18:6a4db94011d3 | 17 | #define MBED_PINNAMES_H |
sahilmgandhi | 18:6a4db94011d3 | 18 | |
sahilmgandhi | 18:6a4db94011d3 | 19 | #include "cmsis.h" |
sahilmgandhi | 18:6a4db94011d3 | 20 | |
sahilmgandhi | 18:6a4db94011d3 | 21 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 22 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 23 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 24 | |
sahilmgandhi | 18:6a4db94011d3 | 25 | typedef enum { |
sahilmgandhi | 18:6a4db94011d3 | 26 | PIN_INPUT, |
sahilmgandhi | 18:6a4db94011d3 | 27 | PIN_OUTPUT |
sahilmgandhi | 18:6a4db94011d3 | 28 | } PinDirection; |
sahilmgandhi | 18:6a4db94011d3 | 29 | |
sahilmgandhi | 18:6a4db94011d3 | 30 | #define PORT_SHIFT 16 |
sahilmgandhi | 18:6a4db94011d3 | 31 | #define PIN_SHIFT 9 |
sahilmgandhi | 18:6a4db94011d3 | 32 | |
sahilmgandhi | 18:6a4db94011d3 | 33 | typedef enum { |
sahilmgandhi | 18:6a4db94011d3 | 34 | // LPC11U68 Pin Names (PORT[19:16] + PIN[15:9] + IOCON offset[8:0]) |
sahilmgandhi | 18:6a4db94011d3 | 35 | |
sahilmgandhi | 18:6a4db94011d3 | 36 | P0_0 = (0 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x000, |
sahilmgandhi | 18:6a4db94011d3 | 37 | P0_1 = (0 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x004, |
sahilmgandhi | 18:6a4db94011d3 | 38 | P0_2 = (0 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x008, |
sahilmgandhi | 18:6a4db94011d3 | 39 | P0_3 = (0 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x00C, |
sahilmgandhi | 18:6a4db94011d3 | 40 | P0_4 = (0 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x010, |
sahilmgandhi | 18:6a4db94011d3 | 41 | P0_5 = (0 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x014, |
sahilmgandhi | 18:6a4db94011d3 | 42 | P0_6 = (0 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x018, |
sahilmgandhi | 18:6a4db94011d3 | 43 | P0_7 = (0 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x01C, |
sahilmgandhi | 18:6a4db94011d3 | 44 | P0_8 = (0 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x020, |
sahilmgandhi | 18:6a4db94011d3 | 45 | P0_9 = (0 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x024, |
sahilmgandhi | 18:6a4db94011d3 | 46 | P0_10= (0 << PORT_SHIFT) | (10<< PIN_SHIFT) | 0x028, |
sahilmgandhi | 18:6a4db94011d3 | 47 | P0_11= (0 << PORT_SHIFT) | (11<< PIN_SHIFT) | 0x02C, |
sahilmgandhi | 18:6a4db94011d3 | 48 | P0_12= (0 << PORT_SHIFT) | (12<< PIN_SHIFT) | 0x030, |
sahilmgandhi | 18:6a4db94011d3 | 49 | P0_13= (0 << PORT_SHIFT) | (13<< PIN_SHIFT) | 0x034, |
sahilmgandhi | 18:6a4db94011d3 | 50 | P0_14= (0 << PORT_SHIFT) | (14<< PIN_SHIFT) | 0x038, |
sahilmgandhi | 18:6a4db94011d3 | 51 | P0_15= (0 << PORT_SHIFT) | (15<< PIN_SHIFT) | 0x03C, |
sahilmgandhi | 18:6a4db94011d3 | 52 | P0_16= (0 << PORT_SHIFT) | (16<< PIN_SHIFT) | 0x040, |
sahilmgandhi | 18:6a4db94011d3 | 53 | P0_17= (0 << PORT_SHIFT) | (17<< PIN_SHIFT) | 0x044, |
sahilmgandhi | 18:6a4db94011d3 | 54 | P0_18= (0 << PORT_SHIFT) | (18<< PIN_SHIFT) | 0x048, |
sahilmgandhi | 18:6a4db94011d3 | 55 | P0_19= (0 << PORT_SHIFT) | (19<< PIN_SHIFT) | 0x04C, |
sahilmgandhi | 18:6a4db94011d3 | 56 | P0_20= (0 << PORT_SHIFT) | (20<< PIN_SHIFT) | 0x050, |
sahilmgandhi | 18:6a4db94011d3 | 57 | P0_21= (0 << PORT_SHIFT) | (21<< PIN_SHIFT) | 0x054, |
sahilmgandhi | 18:6a4db94011d3 | 58 | P0_22= (0 << PORT_SHIFT) | (22<< PIN_SHIFT) | 0x058, |
sahilmgandhi | 18:6a4db94011d3 | 59 | P0_23= (0 << PORT_SHIFT) | (23<< PIN_SHIFT) | 0x05C, |
sahilmgandhi | 18:6a4db94011d3 | 60 | |
sahilmgandhi | 18:6a4db94011d3 | 61 | P1_0 = (1 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x060, |
sahilmgandhi | 18:6a4db94011d3 | 62 | P1_1 = (1 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x064, |
sahilmgandhi | 18:6a4db94011d3 | 63 | P1_2 = (1 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x068, |
sahilmgandhi | 18:6a4db94011d3 | 64 | P1_3 = (1 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x06C, |
sahilmgandhi | 18:6a4db94011d3 | 65 | P1_4 = (1 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x070, |
sahilmgandhi | 18:6a4db94011d3 | 66 | P1_5 = (1 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x074, |
sahilmgandhi | 18:6a4db94011d3 | 67 | P1_6 = (1 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x078, |
sahilmgandhi | 18:6a4db94011d3 | 68 | P1_7 = (1 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x07C, |
sahilmgandhi | 18:6a4db94011d3 | 69 | P1_8 = (1 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x080, |
sahilmgandhi | 18:6a4db94011d3 | 70 | P1_9 = (1 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x084, |
sahilmgandhi | 18:6a4db94011d3 | 71 | P1_10= (1 << PORT_SHIFT) | (10<< PIN_SHIFT) | 0x088, |
sahilmgandhi | 18:6a4db94011d3 | 72 | P1_11= (1 << PORT_SHIFT) | (11<< PIN_SHIFT) | 0x08C, |
sahilmgandhi | 18:6a4db94011d3 | 73 | P1_12= (1 << PORT_SHIFT) | (12<< PIN_SHIFT) | 0x090, |
sahilmgandhi | 18:6a4db94011d3 | 74 | P1_13= (1 << PORT_SHIFT) | (13<< PIN_SHIFT) | 0x094, |
sahilmgandhi | 18:6a4db94011d3 | 75 | P1_14= (1 << PORT_SHIFT) | (14<< PIN_SHIFT) | 0x098, |
sahilmgandhi | 18:6a4db94011d3 | 76 | P1_15= (1 << PORT_SHIFT) | (15<< PIN_SHIFT) | 0x09C, |
sahilmgandhi | 18:6a4db94011d3 | 77 | P1_16= (1 << PORT_SHIFT) | (16<< PIN_SHIFT) | 0x0A0, |
sahilmgandhi | 18:6a4db94011d3 | 78 | P1_17= (1 << PORT_SHIFT) | (17<< PIN_SHIFT) | 0x0A4, |
sahilmgandhi | 18:6a4db94011d3 | 79 | P1_18= (1 << PORT_SHIFT) | (18<< PIN_SHIFT) | 0x0A8, |
sahilmgandhi | 18:6a4db94011d3 | 80 | P1_19= (1 << PORT_SHIFT) | (19<< PIN_SHIFT) | 0x0AC, |
sahilmgandhi | 18:6a4db94011d3 | 81 | P1_20= (1 << PORT_SHIFT) | (20<< PIN_SHIFT) | 0x0B0, |
sahilmgandhi | 18:6a4db94011d3 | 82 | P1_21= (1 << PORT_SHIFT) | (21<< PIN_SHIFT) | 0x0B4, |
sahilmgandhi | 18:6a4db94011d3 | 83 | P1_22= (1 << PORT_SHIFT) | (22<< PIN_SHIFT) | 0x0B8, |
sahilmgandhi | 18:6a4db94011d3 | 84 | P1_23= (1 << PORT_SHIFT) | (23<< PIN_SHIFT) | 0x0BC, |
sahilmgandhi | 18:6a4db94011d3 | 85 | P1_24= (1 << PORT_SHIFT) | (24<< PIN_SHIFT) | 0x0C0, |
sahilmgandhi | 18:6a4db94011d3 | 86 | P1_25= (1 << PORT_SHIFT) | (25<< PIN_SHIFT) | 0x0C4, |
sahilmgandhi | 18:6a4db94011d3 | 87 | P1_26= (1 << PORT_SHIFT) | (26<< PIN_SHIFT) | 0x0C8, |
sahilmgandhi | 18:6a4db94011d3 | 88 | P1_27= (1 << PORT_SHIFT) | (27<< PIN_SHIFT) | 0x0CC, |
sahilmgandhi | 18:6a4db94011d3 | 89 | P1_28= (1 << PORT_SHIFT) | (28<< PIN_SHIFT) | 0x0D0, |
sahilmgandhi | 18:6a4db94011d3 | 90 | P1_29= (1 << PORT_SHIFT) | (29<< PIN_SHIFT) | 0x0D4, |
sahilmgandhi | 18:6a4db94011d3 | 91 | P1_30= (1 << PORT_SHIFT) | (30<< PIN_SHIFT) | 0x0D8, |
sahilmgandhi | 18:6a4db94011d3 | 92 | P1_31= (1 << PORT_SHIFT) | (31<< PIN_SHIFT) | 0x0DC, |
sahilmgandhi | 18:6a4db94011d3 | 93 | |
sahilmgandhi | 18:6a4db94011d3 | 94 | P2_0 = (2 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x0F0, |
sahilmgandhi | 18:6a4db94011d3 | 95 | P2_1 = (2 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x0F4, |
sahilmgandhi | 18:6a4db94011d3 | 96 | P2_2 = (2 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x0FC, |
sahilmgandhi | 18:6a4db94011d3 | 97 | P2_3 = (2 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x100, |
sahilmgandhi | 18:6a4db94011d3 | 98 | P2_4 = (2 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x104, |
sahilmgandhi | 18:6a4db94011d3 | 99 | P2_5 = (2 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x108, |
sahilmgandhi | 18:6a4db94011d3 | 100 | P2_6 = (2 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x10C, |
sahilmgandhi | 18:6a4db94011d3 | 101 | P2_7 = (2 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x110, |
sahilmgandhi | 18:6a4db94011d3 | 102 | P2_8 = (2 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x114, |
sahilmgandhi | 18:6a4db94011d3 | 103 | P2_9 = (2 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x118, |
sahilmgandhi | 18:6a4db94011d3 | 104 | P2_10= (2 << PORT_SHIFT) | (10<< PIN_SHIFT) | 0x11C, |
sahilmgandhi | 18:6a4db94011d3 | 105 | P2_11= (2 << PORT_SHIFT) | (11<< PIN_SHIFT) | 0x120, |
sahilmgandhi | 18:6a4db94011d3 | 106 | P2_12= (2 << PORT_SHIFT) | (12<< PIN_SHIFT) | 0x124, |
sahilmgandhi | 18:6a4db94011d3 | 107 | P2_13= (2 << PORT_SHIFT) | (13<< PIN_SHIFT) | 0x128, |
sahilmgandhi | 18:6a4db94011d3 | 108 | P2_14= (2 << PORT_SHIFT) | (14<< PIN_SHIFT) | 0x12C, |
sahilmgandhi | 18:6a4db94011d3 | 109 | P2_15= (2 << PORT_SHIFT) | (15<< PIN_SHIFT) | 0x130, |
sahilmgandhi | 18:6a4db94011d3 | 110 | P2_16= (2 << PORT_SHIFT) | (16<< PIN_SHIFT) | 0x134, |
sahilmgandhi | 18:6a4db94011d3 | 111 | P2_17= (2 << PORT_SHIFT) | (17<< PIN_SHIFT) | 0x138, |
sahilmgandhi | 18:6a4db94011d3 | 112 | P2_18= (2 << PORT_SHIFT) | (18<< PIN_SHIFT) | 0x13C, |
sahilmgandhi | 18:6a4db94011d3 | 113 | P2_19= (2 << PORT_SHIFT) | (19<< PIN_SHIFT) | 0x140, |
sahilmgandhi | 18:6a4db94011d3 | 114 | P2_20= (2 << PORT_SHIFT) | (20<< PIN_SHIFT) | 0x144, |
sahilmgandhi | 18:6a4db94011d3 | 115 | P2_21= (2 << PORT_SHIFT) | (21<< PIN_SHIFT) | 0x148, |
sahilmgandhi | 18:6a4db94011d3 | 116 | P2_22= (2 << PORT_SHIFT) | (22<< PIN_SHIFT) | 0x14C, |
sahilmgandhi | 18:6a4db94011d3 | 117 | P2_23= (2 << PORT_SHIFT) | (23<< PIN_SHIFT) | 0x150, |
sahilmgandhi | 18:6a4db94011d3 | 118 | |
sahilmgandhi | 18:6a4db94011d3 | 119 | LED_RED = P2_17, |
sahilmgandhi | 18:6a4db94011d3 | 120 | LED_GREEN = P2_16, |
sahilmgandhi | 18:6a4db94011d3 | 121 | LED_BLUE = P2_18, |
sahilmgandhi | 18:6a4db94011d3 | 122 | |
sahilmgandhi | 18:6a4db94011d3 | 123 | // mbed original LED naming |
sahilmgandhi | 18:6a4db94011d3 | 124 | LED1 = LED_RED, |
sahilmgandhi | 18:6a4db94011d3 | 125 | LED2 = LED_GREEN, |
sahilmgandhi | 18:6a4db94011d3 | 126 | LED3 = LED_BLUE, |
sahilmgandhi | 18:6a4db94011d3 | 127 | LED4 = LED_BLUE, |
sahilmgandhi | 18:6a4db94011d3 | 128 | |
sahilmgandhi | 18:6a4db94011d3 | 129 | // Serial to USB pins |
sahilmgandhi | 18:6a4db94011d3 | 130 | USBTX = P0_19, |
sahilmgandhi | 18:6a4db94011d3 | 131 | USBRX = P0_18, |
sahilmgandhi | 18:6a4db94011d3 | 132 | |
sahilmgandhi | 18:6a4db94011d3 | 133 | // Arduino Shield Receptacles Names |
sahilmgandhi | 18:6a4db94011d3 | 134 | D0 = P0_18, |
sahilmgandhi | 18:6a4db94011d3 | 135 | D1 = P0_19, |
sahilmgandhi | 18:6a4db94011d3 | 136 | D2 = P1_18, |
sahilmgandhi | 18:6a4db94011d3 | 137 | D3 = P1_24, |
sahilmgandhi | 18:6a4db94011d3 | 138 | D4 = P1_19, |
sahilmgandhi | 18:6a4db94011d3 | 139 | D5 = P1_26, |
sahilmgandhi | 18:6a4db94011d3 | 140 | D6 = P1_27, |
sahilmgandhi | 18:6a4db94011d3 | 141 | D7 = P1_25, |
sahilmgandhi | 18:6a4db94011d3 | 142 | D8 = P1_28, |
sahilmgandhi | 18:6a4db94011d3 | 143 | D9 = P2_3, |
sahilmgandhi | 18:6a4db94011d3 | 144 | D10= P0_2, |
sahilmgandhi | 18:6a4db94011d3 | 145 | D11= P0_9, |
sahilmgandhi | 18:6a4db94011d3 | 146 | D12= P0_8, |
sahilmgandhi | 18:6a4db94011d3 | 147 | D13= P1_29, |
sahilmgandhi | 18:6a4db94011d3 | 148 | D14= P0_5, |
sahilmgandhi | 18:6a4db94011d3 | 149 | D15= P0_4, |
sahilmgandhi | 18:6a4db94011d3 | 150 | |
sahilmgandhi | 18:6a4db94011d3 | 151 | A0 = P1_9, |
sahilmgandhi | 18:6a4db94011d3 | 152 | A1 = P0_14, |
sahilmgandhi | 18:6a4db94011d3 | 153 | A2 = P0_13, |
sahilmgandhi | 18:6a4db94011d3 | 154 | A3 = P0_12, |
sahilmgandhi | 18:6a4db94011d3 | 155 | A4 = P0_5, // same port as SDA |
sahilmgandhi | 18:6a4db94011d3 | 156 | A5 = P0_4, // same port as SCL |
sahilmgandhi | 18:6a4db94011d3 | 157 | SDA= P0_5, // same port as A4 |
sahilmgandhi | 18:6a4db94011d3 | 158 | SCL= P0_4, // same port as A5 |
sahilmgandhi | 18:6a4db94011d3 | 159 | |
sahilmgandhi | 18:6a4db94011d3 | 160 | // Not connected |
sahilmgandhi | 18:6a4db94011d3 | 161 | NC = (int)0xFFFFFFFF, |
sahilmgandhi | 18:6a4db94011d3 | 162 | } PinName; |
sahilmgandhi | 18:6a4db94011d3 | 163 | |
sahilmgandhi | 18:6a4db94011d3 | 164 | typedef enum { |
sahilmgandhi | 18:6a4db94011d3 | 165 | PullUp = 2, |
sahilmgandhi | 18:6a4db94011d3 | 166 | PullDown = 1, |
sahilmgandhi | 18:6a4db94011d3 | 167 | PullNone = 0, |
sahilmgandhi | 18:6a4db94011d3 | 168 | Repeater = 3, |
sahilmgandhi | 18:6a4db94011d3 | 169 | OpenDrain = 4, |
sahilmgandhi | 18:6a4db94011d3 | 170 | PullDefault = PullDown |
sahilmgandhi | 18:6a4db94011d3 | 171 | } PinMode; |
sahilmgandhi | 18:6a4db94011d3 | 172 | |
sahilmgandhi | 18:6a4db94011d3 | 173 | #define STDIO_UART_TX USBTX |
sahilmgandhi | 18:6a4db94011d3 | 174 | #define STDIO_UART_RX USBRX |
sahilmgandhi | 18:6a4db94011d3 | 175 | #define STDIO_UART UART_0 |
sahilmgandhi | 18:6a4db94011d3 | 176 | |
sahilmgandhi | 18:6a4db94011d3 | 177 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 178 | } |
sahilmgandhi | 18:6a4db94011d3 | 179 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 180 | |
sahilmgandhi | 18:6a4db94011d3 | 181 | #endif |