Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

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?

UserRevisionLine numberNew 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 typedef enum {
sahilmgandhi 18:6a4db94011d3 31 // LPC Pin Names
sahilmgandhi 18:6a4db94011d3 32 P0_0 = 0,
sahilmgandhi 18:6a4db94011d3 33 P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
sahilmgandhi 18:6a4db94011d3 34 P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
sahilmgandhi 18:6a4db94011d3 35 P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12,
sahilmgandhi 18:6a4db94011d3 36
sahilmgandhi 18:6a4db94011d3 37 LED_RED = P0_25,
sahilmgandhi 18:6a4db94011d3 38 LED_GREEN = P0_3,
sahilmgandhi 18:6a4db94011d3 39 LED_BLUE = P1_1,
sahilmgandhi 18:6a4db94011d3 40
sahilmgandhi 18:6a4db94011d3 41 // mbed original LED naming
sahilmgandhi 18:6a4db94011d3 42 LED1 = LED_RED,
sahilmgandhi 18:6a4db94011d3 43 LED2 = LED_GREEN,
sahilmgandhi 18:6a4db94011d3 44 LED3 = LED_BLUE,
sahilmgandhi 18:6a4db94011d3 45 LED4 = LED_BLUE,
sahilmgandhi 18:6a4db94011d3 46
sahilmgandhi 18:6a4db94011d3 47 // Serial to USB pins
sahilmgandhi 18:6a4db94011d3 48 USBTX = P0_18,
sahilmgandhi 18:6a4db94011d3 49 USBRX = P0_13,
sahilmgandhi 18:6a4db94011d3 50
sahilmgandhi 18:6a4db94011d3 51 // Arduino Shield Receptacles Names
sahilmgandhi 18:6a4db94011d3 52 D0 = P0_13,
sahilmgandhi 18:6a4db94011d3 53 D1 = P0_18,
sahilmgandhi 18:6a4db94011d3 54 D2 = P0_29,
sahilmgandhi 18:6a4db94011d3 55 D3 = P0_9,
sahilmgandhi 18:6a4db94011d3 56 D4 = P0_10,
sahilmgandhi 18:6a4db94011d3 57 D5 = P0_16, // same port as D13
sahilmgandhi 18:6a4db94011d3 58 D6 = P1_3,
sahilmgandhi 18:6a4db94011d3 59 D7 = P0_0,
sahilmgandhi 18:6a4db94011d3 60 D8 = P0_24,
sahilmgandhi 18:6a4db94011d3 61 D9 = P1_0,
sahilmgandhi 18:6a4db94011d3 62 D10= P0_27,
sahilmgandhi 18:6a4db94011d3 63 D11= P0_28,
sahilmgandhi 18:6a4db94011d3 64 D12= P0_12,
sahilmgandhi 18:6a4db94011d3 65 D13= P0_16, // same port as D5
sahilmgandhi 18:6a4db94011d3 66 D14= P0_23,
sahilmgandhi 18:6a4db94011d3 67 D15= P0_22,
sahilmgandhi 18:6a4db94011d3 68
sahilmgandhi 18:6a4db94011d3 69 A0 = P0_8,
sahilmgandhi 18:6a4db94011d3 70 A1 = P0_7,
sahilmgandhi 18:6a4db94011d3 71 A2 = P0_6,
sahilmgandhi 18:6a4db94011d3 72 A3 = P0_5,
sahilmgandhi 18:6a4db94011d3 73 A4 = P0_23, // same port as SDA
sahilmgandhi 18:6a4db94011d3 74 A5 = P0_22, // same port as SCL
sahilmgandhi 18:6a4db94011d3 75 SDA= P0_23, // same port as A4
sahilmgandhi 18:6a4db94011d3 76 SCL= P0_22, // same port as A5
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78 // Not connected
sahilmgandhi 18:6a4db94011d3 79 NC = (int)0xFFFFFFFF,
sahilmgandhi 18:6a4db94011d3 80 } PinName;
sahilmgandhi 18:6a4db94011d3 81
sahilmgandhi 18:6a4db94011d3 82 typedef enum {
sahilmgandhi 18:6a4db94011d3 83 PullUp = 2,
sahilmgandhi 18:6a4db94011d3 84 PullDown = 1,
sahilmgandhi 18:6a4db94011d3 85 PullNone = 0,
sahilmgandhi 18:6a4db94011d3 86 Repeater = 3,
sahilmgandhi 18:6a4db94011d3 87 OpenDrain = 4,
sahilmgandhi 18:6a4db94011d3 88 PullDefault = PullDown
sahilmgandhi 18:6a4db94011d3 89 } PinMode;
sahilmgandhi 18:6a4db94011d3 90
sahilmgandhi 18:6a4db94011d3 91 #define STDIO_UART_TX USBTX
sahilmgandhi 18:6a4db94011d3 92 #define STDIO_UART_RX USBRX
sahilmgandhi 18:6a4db94011d3 93
sahilmgandhi 18:6a4db94011d3 94 typedef struct {
sahilmgandhi 18:6a4db94011d3 95 unsigned char n;
sahilmgandhi 18:6a4db94011d3 96 unsigned char offset;
sahilmgandhi 18:6a4db94011d3 97 } SWM_Map;
sahilmgandhi 18:6a4db94011d3 98
sahilmgandhi 18:6a4db94011d3 99 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 100 }
sahilmgandhi 18:6a4db94011d3 101 #endif
sahilmgandhi 18:6a4db94011d3 102
sahilmgandhi 18:6a4db94011d3 103 #endif