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 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file pad_map.h
sahilmgandhi 18:6a4db94011d3 4 * @brief PAD hw module register map
sahilmgandhi 18:6a4db94011d3 5 * @internal
sahilmgandhi 18:6a4db94011d3 6 * @author ON Semiconductor
sahilmgandhi 18:6a4db94011d3 7 * $Rev: 3166 $
sahilmgandhi 18:6a4db94011d3 8 * $Date: 2015-01-19 11:28:08 +0530 (Mon, 19 Jan 2015) $
sahilmgandhi 18:6a4db94011d3 9 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 10 * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”).
sahilmgandhi 18:6a4db94011d3 11 * All rights reserved. This software and/or documentation is licensed by ON Semiconductor
sahilmgandhi 18:6a4db94011d3 12 * under limited terms and conditions. The terms and conditions pertaining to the software
sahilmgandhi 18:6a4db94011d3 13 * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf
sahilmgandhi 18:6a4db94011d3 14 * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and
sahilmgandhi 18:6a4db94011d3 15 * if applicable the software license agreement. Do not use this software and/or
sahilmgandhi 18:6a4db94011d3 16 * documentation unless you have carefully read and you agree to the limited terms and
sahilmgandhi 18:6a4db94011d3 17 * conditions. By using this software and/or documentation, you agree to the limited
sahilmgandhi 18:6a4db94011d3 18 * terms and conditions.
sahilmgandhi 18:6a4db94011d3 19 *
sahilmgandhi 18:6a4db94011d3 20 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
sahilmgandhi 18:6a4db94011d3 21 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
sahilmgandhi 18:6a4db94011d3 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
sahilmgandhi 18:6a4db94011d3 23 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
sahilmgandhi 18:6a4db94011d3 24 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
sahilmgandhi 18:6a4db94011d3 25 * @endinternal
sahilmgandhi 18:6a4db94011d3 26 *
sahilmgandhi 18:6a4db94011d3 27 * @ingroup pad
sahilmgandhi 18:6a4db94011d3 28 *
sahilmgandhi 18:6a4db94011d3 29 * @details
sahilmgandhi 18:6a4db94011d3 30 */
sahilmgandhi 18:6a4db94011d3 31
sahilmgandhi 18:6a4db94011d3 32 #ifndef PAD_MAP_H_
sahilmgandhi 18:6a4db94011d3 33 #define PAD_MAP_H_
sahilmgandhi 18:6a4db94011d3 34
sahilmgandhi 18:6a4db94011d3 35 /*************************************************************************************************
sahilmgandhi 18:6a4db94011d3 36 * *
sahilmgandhi 18:6a4db94011d3 37 * Header files *
sahilmgandhi 18:6a4db94011d3 38 * *
sahilmgandhi 18:6a4db94011d3 39 *************************************************************************************************/
sahilmgandhi 18:6a4db94011d3 40
sahilmgandhi 18:6a4db94011d3 41 #include "architecture.h"
sahilmgandhi 18:6a4db94011d3 42
sahilmgandhi 18:6a4db94011d3 43 /*************************************************************************************************
sahilmgandhi 18:6a4db94011d3 44 * *
sahilmgandhi 18:6a4db94011d3 45 * Symbolic Constants *
sahilmgandhi 18:6a4db94011d3 46 * *
sahilmgandhi 18:6a4db94011d3 47 *************************************************************************************************/
sahilmgandhi 18:6a4db94011d3 48
sahilmgandhi 18:6a4db94011d3 49 /** no pull up nor pull down */
sahilmgandhi 18:6a4db94011d3 50 #define PAD_PULL_NONE (uint8_t)0x01
sahilmgandhi 18:6a4db94011d3 51 /** pull down */
sahilmgandhi 18:6a4db94011d3 52 #define PAD_PULL_DOWN (uint8_t)0x00
sahilmgandhi 18:6a4db94011d3 53 /** pull up */
sahilmgandhi 18:6a4db94011d3 54 #define PAD_PULL_UP (uint8_t)0x03
sahilmgandhi 18:6a4db94011d3 55
sahilmgandhi 18:6a4db94011d3 56 /** Drive strength */
sahilmgandhi 18:6a4db94011d3 57 #define PAD_DRIVE_L0 (uint8_t)0x00
sahilmgandhi 18:6a4db94011d3 58 #define PAD_DRIVE_L1 (uint8_t)0x01
sahilmgandhi 18:6a4db94011d3 59 #define PAD_DRIVE_L2 (uint8_t)0x02
sahilmgandhi 18:6a4db94011d3 60 #define PAD_DRIVE_L3 (uint8_t)0x03
sahilmgandhi 18:6a4db94011d3 61 #define PAD_DRIVE_L4 (uint8_t)0x04
sahilmgandhi 18:6a4db94011d3 62 #define PAD_DRIVE_L5 (uint8_t)0x05
sahilmgandhi 18:6a4db94011d3 63 #define PAD_DRIVE_L6 (uint8_t)0x06
sahilmgandhi 18:6a4db94011d3 64
sahilmgandhi 18:6a4db94011d3 65 /** output configuration push/pull */
sahilmgandhi 18:6a4db94011d3 66 #define PAD_OUTCFG_PUSHPULL (uint8_t)0x00
sahilmgandhi 18:6a4db94011d3 67 /** output configuration open drain */
sahilmgandhi 18:6a4db94011d3 68 #define PAD_OOUTCFG_OPENDRAIN (uint8_t)0x01
sahilmgandhi 18:6a4db94011d3 69
sahilmgandhi 18:6a4db94011d3 70 /** lowest power PAD configuration, shall be the default */
sahilmgandhi 18:6a4db94011d3 71 #define PAD_LOW_POWER (PAD_PULL_NONE | (PAD_DRIVE_L0<<2) | (PAD_OOUTCFG_OPENDRAIN<<5))
sahilmgandhi 18:6a4db94011d3 72
sahilmgandhi 18:6a4db94011d3 73 /** custom Power PAD configuration */
sahilmgandhi 18:6a4db94011d3 74 #define PAD_OUTPUT_PN_L1_OD (PAD_PULL_NONE | (PAD_DRIVE_L1<<2) | (PAD_OOUTCFG_OPENDRAIN<<5))
sahilmgandhi 18:6a4db94011d3 75 #define PAD_INPUT_PD_L1_PP (PAD_PULL_DOWN | (PAD_DRIVE_L1<<2) | (PAD_OUTCFG_PUSHPULL<<5))
sahilmgandhi 18:6a4db94011d3 76 #define PAD_UNUSED_PD_L1_PP (PAD_PULL_DOWN | (PAD_DRIVE_L1<<2) | (PAD_OUTCFG_PUSHPULL<<5))
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78 #define PAD_UART_TX (PAD_PULL_UP | (PAD_DRIVE_L1<<2) | (PAD_OUTCFG_PUSHPULL<<5))
sahilmgandhi 18:6a4db94011d3 79 #define PAD_UART_RX (PAD_PULL_UP | (PAD_DRIVE_L1<<2) | (PAD_OOUTCFG_OPENDRAIN<<5))
sahilmgandhi 18:6a4db94011d3 80
sahilmgandhi 18:6a4db94011d3 81 /**************************************************************************************************
sahilmgandhi 18:6a4db94011d3 82 * *
sahilmgandhi 18:6a4db94011d3 83 * Type definitions *
sahilmgandhi 18:6a4db94011d3 84 * *
sahilmgandhi 18:6a4db94011d3 85 **************************************************************************************************/
sahilmgandhi 18:6a4db94011d3 86
sahilmgandhi 18:6a4db94011d3 87 /** Pad control
sahilmgandhi 18:6a4db94011d3 88 * The pad control peripheral is used to setup any necessary pad parameters
sahilmgandhi 18:6a4db94011d3 89 * not controlled directly via the cross-bar: output drive strength,
sahilmgandhi 18:6a4db94011d3 90 * push/pull control and output drive type.
sahilmgandhi 18:6a4db94011d3 91 */
sahilmgandhi 18:6a4db94011d3 92 typedef struct {
sahilmgandhi 18:6a4db94011d3 93 union {
sahilmgandhi 18:6a4db94011d3 94 struct {
sahilmgandhi 18:6a4db94011d3 95 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 96 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 97 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 98 } BITS;
sahilmgandhi 18:6a4db94011d3 99 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 100 } PADIO0;
sahilmgandhi 18:6a4db94011d3 101 union {
sahilmgandhi 18:6a4db94011d3 102 struct {
sahilmgandhi 18:6a4db94011d3 103 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 104 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 105 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 106 } BITS;
sahilmgandhi 18:6a4db94011d3 107 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 108 } PADIO1;
sahilmgandhi 18:6a4db94011d3 109 union {
sahilmgandhi 18:6a4db94011d3 110 struct {
sahilmgandhi 18:6a4db94011d3 111 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 112 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 113 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 114 } BITS;
sahilmgandhi 18:6a4db94011d3 115 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 116 } PADIO2;
sahilmgandhi 18:6a4db94011d3 117 union {
sahilmgandhi 18:6a4db94011d3 118 struct {
sahilmgandhi 18:6a4db94011d3 119 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 120 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 121 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 122 } BITS;
sahilmgandhi 18:6a4db94011d3 123 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 124 } PADIO3;
sahilmgandhi 18:6a4db94011d3 125 union {
sahilmgandhi 18:6a4db94011d3 126 struct {
sahilmgandhi 18:6a4db94011d3 127 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 128 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 129 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 130 } BITS;
sahilmgandhi 18:6a4db94011d3 131 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 132 } PADIO4;
sahilmgandhi 18:6a4db94011d3 133 union {
sahilmgandhi 18:6a4db94011d3 134 struct {
sahilmgandhi 18:6a4db94011d3 135 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 136 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 137 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 138 } BITS;
sahilmgandhi 18:6a4db94011d3 139 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 140 } PADIO5;
sahilmgandhi 18:6a4db94011d3 141 union {
sahilmgandhi 18:6a4db94011d3 142 struct {
sahilmgandhi 18:6a4db94011d3 143 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 144 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 145 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 146 } BITS;
sahilmgandhi 18:6a4db94011d3 147 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 148 } PADIO6;
sahilmgandhi 18:6a4db94011d3 149 union {
sahilmgandhi 18:6a4db94011d3 150 struct {
sahilmgandhi 18:6a4db94011d3 151 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 152 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 153 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 154 } BITS;
sahilmgandhi 18:6a4db94011d3 155 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 156 } PADIO7;
sahilmgandhi 18:6a4db94011d3 157 union {
sahilmgandhi 18:6a4db94011d3 158 struct {
sahilmgandhi 18:6a4db94011d3 159 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 160 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 161 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 162 } BITS;
sahilmgandhi 18:6a4db94011d3 163 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 164 } PADIO8;
sahilmgandhi 18:6a4db94011d3 165 union {
sahilmgandhi 18:6a4db94011d3 166 struct {
sahilmgandhi 18:6a4db94011d3 167 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 168 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 169 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 170 } BITS;
sahilmgandhi 18:6a4db94011d3 171 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 172 } PADIO9;
sahilmgandhi 18:6a4db94011d3 173 union {
sahilmgandhi 18:6a4db94011d3 174 struct {
sahilmgandhi 18:6a4db94011d3 175 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 176 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 177 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 178 } BITS;
sahilmgandhi 18:6a4db94011d3 179 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 180 } PADIO10;
sahilmgandhi 18:6a4db94011d3 181 union {
sahilmgandhi 18:6a4db94011d3 182 struct {
sahilmgandhi 18:6a4db94011d3 183 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 184 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 185 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 186 } BITS;
sahilmgandhi 18:6a4db94011d3 187 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 188 } PADIO11;
sahilmgandhi 18:6a4db94011d3 189 union {
sahilmgandhi 18:6a4db94011d3 190 struct {
sahilmgandhi 18:6a4db94011d3 191 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 192 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 193 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 194 } BITS;
sahilmgandhi 18:6a4db94011d3 195 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 196 } PADIO12;
sahilmgandhi 18:6a4db94011d3 197 union {
sahilmgandhi 18:6a4db94011d3 198 struct {
sahilmgandhi 18:6a4db94011d3 199 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 200 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 201 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 202 } BITS;
sahilmgandhi 18:6a4db94011d3 203 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 204 } PADIO13;
sahilmgandhi 18:6a4db94011d3 205 union {
sahilmgandhi 18:6a4db94011d3 206 struct {
sahilmgandhi 18:6a4db94011d3 207 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 208 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 209 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 210 } BITS;
sahilmgandhi 18:6a4db94011d3 211 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 212 } PADIO14;
sahilmgandhi 18:6a4db94011d3 213 union {
sahilmgandhi 18:6a4db94011d3 214 struct {
sahilmgandhi 18:6a4db94011d3 215 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 216 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 217 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 218 } BITS;
sahilmgandhi 18:6a4db94011d3 219 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 220 } PADIO15;
sahilmgandhi 18:6a4db94011d3 221 union {
sahilmgandhi 18:6a4db94011d3 222 struct {
sahilmgandhi 18:6a4db94011d3 223 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 224 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 225 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 226 } BITS;
sahilmgandhi 18:6a4db94011d3 227 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 228 } PADIO16;
sahilmgandhi 18:6a4db94011d3 229 union {
sahilmgandhi 18:6a4db94011d3 230 struct {
sahilmgandhi 18:6a4db94011d3 231 __IO uint32_t PULL :2; /**< 00 – Pull-down active, 01 – No pull active, 10 – No pull active, 11 – Pull-up active*/
sahilmgandhi 18:6a4db94011d3 232 __IO uint32_t POWER :3; /**< Output Drive Strength*/
sahilmgandhi 18:6a4db94011d3 233 __IO uint32_t TYPE :1; /**< Output Type: 0 – Push/Pull, 1 – Open Drain*/
sahilmgandhi 18:6a4db94011d3 234 } BITS;
sahilmgandhi 18:6a4db94011d3 235 __IO uint32_t WORD;
sahilmgandhi 18:6a4db94011d3 236 } PADIO17;
sahilmgandhi 18:6a4db94011d3 237 } PadReg_t, *PadReg_pt;
sahilmgandhi 18:6a4db94011d3 238
sahilmgandhi 18:6a4db94011d3 239 #endif /* PAD_MAP_H_ */