Simple to use macros to manipulate GPIOs quickly.

Dependents:   revcounter FastStepDriver

Committer:
AjK
Date:
Thu May 26 08:36:56 2011 +0000
Revision:
1:cb1f38aaae0a
Parent:
0:a3a04e1ce9c2
Add TOGGLE to pins

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 0:a3a04e1ce9c2 1 /*
AjK 0:a3a04e1ce9c2 2 Copyright (c) 2010 Andy Kirkham
AjK 0:a3a04e1ce9c2 3
AjK 0:a3a04e1ce9c2 4 Permission is hereby granted, free of charge, to any person obtaining a copy
AjK 0:a3a04e1ce9c2 5 of this software and associated documentation files (the "Software"), to deal
AjK 0:a3a04e1ce9c2 6 in the Software without restriction, including without limitation the rights
AjK 0:a3a04e1ce9c2 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
AjK 0:a3a04e1ce9c2 8 copies of the Software, and to permit persons to whom the Software is
AjK 0:a3a04e1ce9c2 9 furnished to do so, subject to the following conditions:
AjK 0:a3a04e1ce9c2 10
AjK 0:a3a04e1ce9c2 11 The above copyright notice and this permission notice shall be included in
AjK 0:a3a04e1ce9c2 12 all copies or substantial portions of the Software.
AjK 0:a3a04e1ce9c2 13
AjK 0:a3a04e1ce9c2 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
AjK 0:a3a04e1ce9c2 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
AjK 0:a3a04e1ce9c2 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AjK 0:a3a04e1ce9c2 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AjK 0:a3a04e1ce9c2 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AjK 0:a3a04e1ce9c2 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
AjK 0:a3a04e1ce9c2 20 THE SOFTWARE.
AjK 0:a3a04e1ce9c2 21 */
AjK 0:a3a04e1ce9c2 22
AjK 0:a3a04e1ce9c2 23 #ifndef IOMACROS_H
AjK 0:a3a04e1ce9c2 24 #define IOMACROS_H
AjK 0:a3a04e1ce9c2 25
AjK 0:a3a04e1ce9c2 26 #ifndef __LPC17xx_H__
AjK 0:a3a04e1ce9c2 27 #include "LPC17xx.h"
AjK 0:a3a04e1ce9c2 28 #endif
AjK 0:a3a04e1ce9c2 29
AjK 0:a3a04e1ce9c2 30 #define PIN_PULLUP 0UL
AjK 0:a3a04e1ce9c2 31 #define PIN_REPEAT 1UL
AjK 0:a3a04e1ce9c2 32 #define PIN_NONE 2UL
AjK 0:a3a04e1ce9c2 33 #define PIN_PULLDOWN 3UL
AjK 0:a3a04e1ce9c2 34
AjK 0:a3a04e1ce9c2 35 /* p5 is P0.9 */
AjK 0:a3a04e1ce9c2 36 #define p5_SEL_MASK ~(3UL << 18)
AjK 0:a3a04e1ce9c2 37 #define p5_SET_MASK (1UL << 9)
AjK 0:a3a04e1ce9c2 38 #define p5_CLR_MASK ~(p5_SET_MASK)
AjK 0:a3a04e1ce9c2 39 #define p5_AS_OUTPUT LPC_PINCON->PINSEL0&=p5_SEL_MASK;LPC_GPIO0->FIODIR|=p5_SET_MASK
AjK 0:a3a04e1ce9c2 40 #define p5_AS_INPUT LPC_GPIO0->FIOMASK &= p5_CLR_MASK;
AjK 0:a3a04e1ce9c2 41 #define p5_SET LPC_GPIO0->FIOSET = p5_SET_MASK
AjK 0:a3a04e1ce9c2 42 #define p5_CLR LPC_GPIO0->FIOCLR = p5_SET_MASK
AjK 0:a3a04e1ce9c2 43 #define p5_IS_SET (bool)(LPC_GPIO0->FIOPIN & p5_SET_MASK)
AjK 0:a3a04e1ce9c2 44 #define p5_IS_CLR !(p5_IS_SET)
AjK 0:a3a04e1ce9c2 45 #define p5_MODE(x) LPC_PINCON->PINMODE0&=p5_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<18)
AjK 1:cb1f38aaae0a 46 #define p5_TOGGLE p5_IS_SET?p5_CLR:p5_SET
AjK 0:a3a04e1ce9c2 47
AjK 0:a3a04e1ce9c2 48 /* p6 is P0.8 */
AjK 0:a3a04e1ce9c2 49 #define p6_SEL_MASK ~(3UL << 16)
AjK 0:a3a04e1ce9c2 50 #define p6_SET_MASK (1UL << 8)
AjK 0:a3a04e1ce9c2 51 #define p6_CLR_MASK ~(p6_SET_MASK)
AjK 1:cb1f38aaae0a 52 #define p6_AS_OUTPUT LPC_PINCON->PINSEL0&=p6_SEL_MASK;LPC_GPIO0->FIODIR|=p6_SET_MASK
AjK 0:a3a04e1ce9c2 53 #define p6_AS_INPUT LPC_GPIO0->FIOMASK &= p6_CLR_MASK;
AjK 0:a3a04e1ce9c2 54 #define p6_SET LPC_GPIO0->FIOSET = p6_SET_MASK
AjK 0:a3a04e1ce9c2 55 #define p6_CLR LPC_GPIO0->FIOCLR = p6_SET_MASK
AjK 0:a3a04e1ce9c2 56 #define p6_IS_SET (bool)(LPC_GPIO0->FIOPIN & p6_SET_MASK)
AjK 0:a3a04e1ce9c2 57 #define p6_IS_CLR !(p6_IS_SET)
AjK 0:a3a04e1ce9c2 58 #define p6_MODE(x) LPC_PINCON->PINMODE0&=p6_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<16)
AjK 1:cb1f38aaae0a 59 #define p6_TOGGLE p6_IS_SET?p6_CLR:p6_SET
AjK 0:a3a04e1ce9c2 60
AjK 0:a3a04e1ce9c2 61 /* p7 is P0.7 */
AjK 0:a3a04e1ce9c2 62 #define p7_SEL_MASK ~(3UL << 14)
AjK 0:a3a04e1ce9c2 63 #define p7_SET_MASK (1UL << 7)
AjK 0:a3a04e1ce9c2 64 #define p7_CLR_MASK ~(p7_SET_MASK)
AjK 0:a3a04e1ce9c2 65 #define p7_AS_OUTPUT LPC_PINCON->PINSEL0&=p7_SEL_MASK;LPC_GPIO0->FIODIR|=p7_SET_MASK
AjK 0:a3a04e1ce9c2 66 #define p7_AS_INPUT LPC_GPIO0->FIOMASK &= p7_CLR_MASK;
AjK 0:a3a04e1ce9c2 67 #define p7_SET LPC_GPIO0->FIOSET = p7_SET_MASK
AjK 0:a3a04e1ce9c2 68 #define p7_CLR LPC_GPIO0->FIOCLR = p7_SET_MASK
AjK 0:a3a04e1ce9c2 69 #define p7_IS_SET (bool)(LPC_GPIO0->FIOPIN & p7_SET_MASK)
AjK 0:a3a04e1ce9c2 70 #define p7_IS_CLR !(p7_IS_SET)
AjK 1:cb1f38aaae0a 71 #define p7_MODE(x) LPC_PINCON->PINMODE0&=p7_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<14)
AjK 1:cb1f38aaae0a 72 #define p7_TOGGLE p7_IS_SET?p7_CLR:p7_SET
AjK 0:a3a04e1ce9c2 73
AjK 0:a3a04e1ce9c2 74 /* p8 is P0.6 */
AjK 0:a3a04e1ce9c2 75 #define p8_SEL_MASK ~(3UL << 12)
AjK 0:a3a04e1ce9c2 76 #define p8_SET_MASK (1UL << 6)
AjK 0:a3a04e1ce9c2 77 #define p8_AS_OUTPUT LPC_PINCON->PINSEL0&=p8_SEL_MASK;LPC_GPIO0->FIODIR|=p8_SET_MASK
AjK 0:a3a04e1ce9c2 78 #define p8_AS_INPUT LPC_GPIO0->FIOMASK &= p8_CLR_MASK;
AjK 0:a3a04e1ce9c2 79 #define p8_SET LPC_GPIO0->FIOSET = p8_SET_MASK
AjK 0:a3a04e1ce9c2 80 #define p8_CLR LPC_GPIO0->FIOCLR = p8_SET_MASK
AjK 0:a3a04e1ce9c2 81 #define p8_IS_SET (bool)(LPC_GPIO0->FIOPIN & p8_SET_MASK)
AjK 0:a3a04e1ce9c2 82 #define p8_IS_CLR !(p8_IS_SET)
AjK 0:a3a04e1ce9c2 83 #define p8_MODE(x) LPC_PINCON->PINMODE0&=p8_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<12)
AjK 1:cb1f38aaae0a 84 #define p8_TOGGLE p8_IS_SET?p8_CLR:p8_SET
AjK 0:a3a04e1ce9c2 85
AjK 0:a3a04e1ce9c2 86 /* p9 is P0.0 */
AjK 0:a3a04e1ce9c2 87 #define p9_SEL_MASK ~(3UL << 0)
AjK 0:a3a04e1ce9c2 88 #define p9_SET_MASK (1UL << 0)
AjK 0:a3a04e1ce9c2 89 #define p9_CLR_MASK ~(p9_SET_MASK)
AjK 0:a3a04e1ce9c2 90 #define p9_AS_OUTPUT LPC_PINCON->PINSEL0&=p9_SEL_MASK;LPC_GPIO0->FIODIR|=p9_SET_MASK
AjK 0:a3a04e1ce9c2 91 #define p9_AS_INPUT LPC_GPIO0->FIOMASK &= p9_CLR_MASK;
AjK 0:a3a04e1ce9c2 92 #define p9_SET LPC_GPIO0->FIOSET = p9_SET_MASK
AjK 0:a3a04e1ce9c2 93 #define p9_CLR LPC_GPIO0->FIOCLR = p9_SET_MASK
AjK 0:a3a04e1ce9c2 94 #define p9_IS_SET (bool)(LPC_GPIO0->FIOPIN & p9_SET_MASK)
AjK 0:a3a04e1ce9c2 95 #define p9_IS_CLR !(p9_IS_SET)
AjK 0:a3a04e1ce9c2 96 #define p9_MODE(x) LPC_PINCON->PINMODE0&=p9_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<0)
AjK 1:cb1f38aaae0a 97 #define p9_TOGGLE p9_IS_SET?p9_CLR:p9_SET
AjK 0:a3a04e1ce9c2 98
AjK 0:a3a04e1ce9c2 99 /* p10 is P0.1 */
AjK 0:a3a04e1ce9c2 100 #define p10_SEL_MASK ~(3UL << 2)
AjK 0:a3a04e1ce9c2 101 #define p10_SET_MASK (1UL << 1)
AjK 0:a3a04e1ce9c2 102 #define p10_CLR_MASK ~(p10_SET_MASK)
AjK 0:a3a04e1ce9c2 103 #define p10_AS_OUTPUT LPC_PINCON->PINSEL0&=p10_SEL_MASK;LPC_GPIO0->FIODIR|=p10_SET_MASK
AjK 0:a3a04e1ce9c2 104 #define p10_AS_INPUT LPC_GPIO0->FIOMASK &= p10_CLR_MASK;
AjK 0:a3a04e1ce9c2 105 #define p10_SET LPC_GPIO0->FIOSET = p10_SET_MASK
AjK 0:a3a04e1ce9c2 106 #define p10_CLR LPC_GPIO0->FIOCLR = p10_SET_MASK
AjK 0:a3a04e1ce9c2 107 #define p10_IS_SET (bool)(LPC_GPIO0->FIOPIN & p10_SET_MASK)
AjK 0:a3a04e1ce9c2 108 #define p10_IS_CLR !(p10_IS_SET)
AjK 0:a3a04e1ce9c2 109 #define p10_MODE(x) LPC_PINCON->PINMODE0&=p10_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<2)
AjK 1:cb1f38aaae0a 110 #define p10_TOGGLE p10_IS_SET?p10_CLR:p10_SET
AjK 0:a3a04e1ce9c2 111
AjK 0:a3a04e1ce9c2 112 /* p11 is P0.18 */
AjK 0:a3a04e1ce9c2 113 #define p11_SEL_MASK ~(3UL << 4)
AjK 0:a3a04e1ce9c2 114 #define p11_SET_MASK (1UL << 18)
AjK 0:a3a04e1ce9c2 115 #define p11_CLR_MASK ~(p11_SET_MASK)
AjK 0:a3a04e1ce9c2 116 #define p11_AS_OUTPUT LPC_PINCON->PINSEL1&=p11_SEL_MASK;LPC_GPIO0->FIODIR|=p11_SET_MASK
AjK 0:a3a04e1ce9c2 117 #define p11_AS_INPUT LPC_GPIO0->FIOMASK &= p11_CLR_MASK;
AjK 0:a3a04e1ce9c2 118 #define p11_SET LPC_GPIO0->FIOSET = p11_SET_MASK
AjK 0:a3a04e1ce9c2 119 #define p11_CLR LPC_GPIO0->FIOCLR = p11_SET_MASK
AjK 0:a3a04e1ce9c2 120 #define p11_IS_SET (bool)(LPC_GPIO0->FIOPIN & p11_SET_MASK)
AjK 0:a3a04e1ce9c2 121 #define p11_IS_CLR !(p11_IS_SET)
AjK 0:a3a04e1ce9c2 122 #define p11_MODE(x) LPC_PINCON->PINMODE1&=p11_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<4)
AjK 1:cb1f38aaae0a 123 #define p11_TOGGLE p11_IS_SET?p11_CLR:p11_SET
AjK 0:a3a04e1ce9c2 124
AjK 0:a3a04e1ce9c2 125 /* p12 is P0.17 */
AjK 0:a3a04e1ce9c2 126 #define p12_SEL_MASK ~(3UL << 2)
AjK 0:a3a04e1ce9c2 127 #define p12_SET_MASK (1UL << 17)
AjK 0:a3a04e1ce9c2 128 #define p12_CLR_MASK ~(p12_SET_MASK)
AjK 0:a3a04e1ce9c2 129 #define p12_AS_OUTPUT LPC_PINCON->PINSEL1&=p12_SEL_MASK;LPC_GPIO0->FIODIR|=p12_SET_MASK
AjK 0:a3a04e1ce9c2 130 #define p12_AS_INPUT LPC_GPIO0->FIOMASK &= p12_CLR_MASK;
AjK 0:a3a04e1ce9c2 131 #define p12_SET LPC_GPIO0->FIOSET = p12_SET_MASK
AjK 0:a3a04e1ce9c2 132 #define p12_CLR LPC_GPIO0->FIOCLR = p12_SET_MASK
AjK 0:a3a04e1ce9c2 133 #define p12_IS_SET (bool)(LPC_GPIO0->FIOPIN & p12_SET_MASK)
AjK 0:a3a04e1ce9c2 134 #define p12_IS_CLR !(p12_IS_SET)
AjK 0:a3a04e1ce9c2 135 #define p12_MODE(x) LPC_PINCON->PINMODE1&=p12_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<2)
AjK 1:cb1f38aaae0a 136 #define p12_TOGGLE p12_IS_SET?p12_CLR:p12_SET
AjK 0:a3a04e1ce9c2 137
AjK 0:a3a04e1ce9c2 138 /* p13 is P0.15 */
AjK 0:a3a04e1ce9c2 139 #define p13_SEL_MASK ~(3UL << 30)
AjK 0:a3a04e1ce9c2 140 #define p13_SET_MASK (1UL << 15)
AjK 0:a3a04e1ce9c2 141 #define p13_CLR_MASK ~(p13_SET_MASK)
AjK 0:a3a04e1ce9c2 142 #define p13_AS_OUTPUT LPC_PINCON->PINSEL0&=p13_SEL_MASK;LPC_GPIO0->FIODIR|=p13_SET_MASK
AjK 0:a3a04e1ce9c2 143 #define p13_AS_INPUT LPC_GPIO0->FIOMASK &= p13_CLR_MASK;
AjK 0:a3a04e1ce9c2 144 #define p13_SET LPC_GPIO0->FIOSET = p13_SET_MASK
AjK 0:a3a04e1ce9c2 145 #define p13_CLR LPC_GPIO0->FIOCLR = p13_SET_MASK
AjK 0:a3a04e1ce9c2 146 #define p13_IS_SET (bool)(LPC_GPIO0->FIOPIN & p13_SET_MASK)
AjK 0:a3a04e1ce9c2 147 #define p13_IS_CLR !(p13_IS_SET)
AjK 0:a3a04e1ce9c2 148 #define p13_MODE(x) LPC_PINCON->PINMODE0&=p13_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<30)
AjK 1:cb1f38aaae0a 149 #define p13_TOGGLE p13_IS_SET?p13_CLR:p13_SET
AjK 0:a3a04e1ce9c2 150
AjK 0:a3a04e1ce9c2 151 /* p14 is P0.16 */
AjK 0:a3a04e1ce9c2 152 #define p14_SEL_MASK ~(3UL << 0)
AjK 0:a3a04e1ce9c2 153 #define p14_SET_MASK (1UL << 16)
AjK 0:a3a04e1ce9c2 154 #define p14_CLR_MASK ~(p14_SET_MASK)
AjK 0:a3a04e1ce9c2 155 #define p14_AS_OUTPUT LPC_PINCON->PINSEL1&=p14_SEL_MASK;LPC_GPIO0->FIODIR|=p14_SET_MASK
AjK 0:a3a04e1ce9c2 156 #define p14_AS_INPUT LPC_GPIO0->FIOMASK &= p14_CLR_MASK;
AjK 0:a3a04e1ce9c2 157 #define p14_SET LPC_GPIO0->FIOSET = p14_SET_MASK
AjK 0:a3a04e1ce9c2 158 #define p14_CLR LPC_GPIO0->FIOCLR = p14_SET_MASK
AjK 0:a3a04e1ce9c2 159 #define p14_IS_SET (bool)(LPC_GPIO0->FIOPIN & p14_SET_MASK)
AjK 0:a3a04e1ce9c2 160 #define p14_IS_CLR !(p14_IS_SET)
AjK 0:a3a04e1ce9c2 161 #define p14_MODE(x) LPC_PINCON->PINMODE1&=p14_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<0)
AjK 1:cb1f38aaae0a 162 #define p14_TOGGLE p14_IS_SET?p14_CLR:p14_SET
AjK 0:a3a04e1ce9c2 163
AjK 0:a3a04e1ce9c2 164 /* p15 is P0.23 */
AjK 0:a3a04e1ce9c2 165 #define p15_SEL_MASK ~(3UL << 14)
AjK 0:a3a04e1ce9c2 166 #define p15_SET_MASK (1UL << 23)
AjK 0:a3a04e1ce9c2 167 #define p15_CLR_MASK ~(p15_SET_MASK)
AjK 0:a3a04e1ce9c2 168 #define p15_AS_OUTPUT LPC_PINCON->PINSEL1&=p15_SEL_MASK;LPC_GPIO0->FIODIR|=p15_SET_MASK
AjK 0:a3a04e1ce9c2 169 #define p15_AS_INPUT LPC_GPIO0->FIOMASK &= p15_CLR_MASK;
AjK 0:a3a04e1ce9c2 170 #define p15_SET LPC_GPIO0->FIOSET = p15_SET_MASK
AjK 0:a3a04e1ce9c2 171 #define p15_CLR LPC_GPIO0->FIOCLR = p15_SET_MASK
AjK 0:a3a04e1ce9c2 172 #define p15_IS_SET (bool)(LPC_GPIO0->FIOPIN & p15_SET_MASK)
AjK 0:a3a04e1ce9c2 173 #define p15_IS_CLR !(p15_IS_SET)
AjK 0:a3a04e1ce9c2 174 #define p15_MODE(x) LPC_PINCON->PINMODE1&=p15_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<14)
AjK 1:cb1f38aaae0a 175 #define p15_TOGGLE p15_IS_SET?p15_CLR:p15_SET
AjK 0:a3a04e1ce9c2 176
AjK 0:a3a04e1ce9c2 177 /* p16 is P0.24 */
AjK 0:a3a04e1ce9c2 178 #define p16_SEL_MASK ~(3UL << 16)
AjK 0:a3a04e1ce9c2 179 #define p16_SET_MASK (1UL << 24)
AjK 0:a3a04e1ce9c2 180 #define p16_CLR_MASK ~(p16_SET_MASK)
AjK 0:a3a04e1ce9c2 181 #define p16_AS_OUTPUT LPC_PINCON->PINSEL1&=p16_SEL_MASK;LPC_GPIO0->FIODIR|=p16_SET_MASK
AjK 0:a3a04e1ce9c2 182 #define p16_AS_INPUT LPC_GPIO0->FIOMASK &= p16_CLR_MASK;
AjK 0:a3a04e1ce9c2 183 #define p16_SET LPC_GPIO0->FIOSET = p16_SET_MASK
AjK 0:a3a04e1ce9c2 184 #define p16_CLR LPC_GPIO0->FIOCLR = p16_SET_MASK
AjK 0:a3a04e1ce9c2 185 #define p16_IS_SET (bool)(LPC_GPIO0->FIOPIN & p16_SET_MASK)
AjK 0:a3a04e1ce9c2 186 #define p16_IS_CLR !(p16_IS_SET)
AjK 0:a3a04e1ce9c2 187 #define p16_MODE(x) LPC_PINCON->PINMODE1&=p16_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<16)
AjK 1:cb1f38aaae0a 188 #define p16_TOGGLE p16_IS_SET?p16_CLR:p16_SET
AjK 0:a3a04e1ce9c2 189
AjK 0:a3a04e1ce9c2 190 /* p17 is P0.25 */
AjK 0:a3a04e1ce9c2 191 #define p17_SEL_MASK ~(3UL << 18)
AjK 0:a3a04e1ce9c2 192 #define p17_SET_MASK (1UL << 25)
AjK 0:a3a04e1ce9c2 193 #define p17_CLR_MASK ~(p17_SET_MASK)
AjK 0:a3a04e1ce9c2 194 #define p17_AS_OUTPUT LPC_PINCON->PINSEL1&=p17_SEL_MASK;LPC_GPIO0->FIODIR|=p17_SET_MASK
AjK 0:a3a04e1ce9c2 195 #define p17_AS_INPUT LPC_GPIO0->FIOMASK &= p17_CLR_MASK;
AjK 0:a3a04e1ce9c2 196 #define p17_SET LPC_GPIO0->FIOSET = p17_SET_MASK
AjK 0:a3a04e1ce9c2 197 #define p17_CLR LPC_GPIO0->FIOCLR = p17_SET_MASK
AjK 0:a3a04e1ce9c2 198 #define p17_IS_SET (bool)(LPC_GPIO0->FIOPIN & p17_SET_MASK)
AjK 0:a3a04e1ce9c2 199 #define p17_IS_CLR !(p17_IS_SET)
AjK 0:a3a04e1ce9c2 200 #define p17_MODE(x) LPC_PINCON->PINMODE1&=p17_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<18)
AjK 1:cb1f38aaae0a 201 #define p17_TOGGLE p17_IS_SET?p17_CLR:p17_SET
AjK 0:a3a04e1ce9c2 202
AjK 0:a3a04e1ce9c2 203 /* p18 is P0.26 */
AjK 0:a3a04e1ce9c2 204 #define p18_SEL_MASK ~(3UL << 20)
AjK 0:a3a04e1ce9c2 205 #define p18_SET_MASK (1UL << 26)
AjK 0:a3a04e1ce9c2 206 #define p18_CLR_MASK ~(p18_SET_MASK)
AjK 0:a3a04e1ce9c2 207 #define p18_AS_OUTPUT LPC_PINCON->PINSEL1&=p18_SEL_MASK;LPC_GPIO0->FIODIR|=p18_SET_MASK
AjK 0:a3a04e1ce9c2 208 #define p18_AS_INPUT LPC_GPIO0->FIOMASK &= p18_CLR_MASK;
AjK 0:a3a04e1ce9c2 209 #define p18_SET LPC_GPIO0->FIOSET = p18_SET_MASK
AjK 0:a3a04e1ce9c2 210 #define p18_CLR LPC_GPIO0->FIOCLR = p18_SET_MASK
AjK 0:a3a04e1ce9c2 211 #define p18_IS_SET (bool)(LPC_GPIO0->FIOPIN & p18_SET_MASK)
AjK 0:a3a04e1ce9c2 212 #define p18_IS_CLR !(p18_IS_SET)
AjK 0:a3a04e1ce9c2 213 #define p18_MODE(x) LPC_PINCON->PINMODE1&=p18_SEL_MASK;LPC_PINCON->PINMODE1|=((x&0x3)<<20)
AjK 1:cb1f38aaae0a 214 #define p18_TOGGLE p18_IS_SET?p18_CLR:p18_SET
AjK 0:a3a04e1ce9c2 215
AjK 0:a3a04e1ce9c2 216 /* p19 is P1.30 */
AjK 0:a3a04e1ce9c2 217 #define p19_SEL_MASK ~(3UL << 28)
AjK 0:a3a04e1ce9c2 218 #define p19_SET_MASK (1UL << 30)
AjK 0:a3a04e1ce9c2 219 #define p19_AS_OUTPUT LPC_PINCON->PINSEL3&=p19_SEL_MASK;LPC_GPIO1->FIODIR|=p19_SET_MASK
AjK 0:a3a04e1ce9c2 220 #define p19_AS_INPUT LPC_GPIO1->FIOMASK &= p19_CLR_MASK;
AjK 0:a3a04e1ce9c2 221 #define p19_SET LPC_GPIO1->FIOSET = p19_SET_MASK
AjK 0:a3a04e1ce9c2 222 #define p19_CLR LPC_GPIO1->FIOCLR = p19_SET_MASK
AjK 0:a3a04e1ce9c2 223 #define p19_IS_SET (bool)(LPC_GPIO1->FIOPIN & p19_SET_MASK)
AjK 0:a3a04e1ce9c2 224 #define p19_IS_CLR !(p19_IS_SET)
AjK 0:a3a04e1ce9c2 225 #define p19_MODE(x) LPC_PINCON->PINMODE3&=p19_SEL_MASK;LPC_PINCON->PINMODE3|=((x&0x3)<<28)
AjK 1:cb1f38aaae0a 226 #define p19_TOGGLE p19_IS_SET?p19_CLR:p19_SET
AjK 0:a3a04e1ce9c2 227
AjK 0:a3a04e1ce9c2 228 /* p20 is P1.31 */
AjK 0:a3a04e1ce9c2 229 #define p20_SEL_MASK ~(3UL << 30)
AjK 0:a3a04e1ce9c2 230 #define p20_SET_MASK (1UL << 31)
AjK 0:a3a04e1ce9c2 231 #define p20_CLR_MASK ~(p20_SET_MASK)
AjK 0:a3a04e1ce9c2 232 #define p20_AS_OUTPUT LPC_PINCON->PINSEL3&=p20_SEL_MASK;LPC_GPIO1->FIODIR|=p20_SET_MASK
AjK 0:a3a04e1ce9c2 233 #define p20_AS_INPUT LPC_GPIO1->FIOMASK &= p20_CLR_MASK;
AjK 0:a3a04e1ce9c2 234 #define p20_SET LPC_GPIO1->FIOSET = p20_SET_MASK
AjK 0:a3a04e1ce9c2 235 #define p20_CLR LPC_GPIO1->FIOCLR = p20_SET_MASK
AjK 0:a3a04e1ce9c2 236 #define p20_IS_SET (bool)(LPC_GPIO1->FIOPIN & p20_SET_MASK)
AjK 0:a3a04e1ce9c2 237 #define p20_IS_CLR !(p20_IS_SET)
AjK 0:a3a04e1ce9c2 238 #define p20_MODE(x) LPC_PINCON->PINMODE3&=p20_SEL_MASK;LPC_PINCON->PINMODE3|=((x&0x3)<<30)
AjK 1:cb1f38aaae0a 239 #define p20_TOGGLE p20_IS_SET?p20_CLR:p20_SET
AjK 0:a3a04e1ce9c2 240
AjK 0:a3a04e1ce9c2 241 /* p21 is P2.5 */
AjK 0:a3a04e1ce9c2 242 #define p21_SEL_MASK ~(3UL << 10)
AjK 0:a3a04e1ce9c2 243 #define p21_SET_MASK (1UL << 5)
AjK 0:a3a04e1ce9c2 244 #define p21_CLR_MASK ~(p21_SET_MASK)
AjK 0:a3a04e1ce9c2 245 #define p21_AS_OUTPUT LPC_PINCON->PINSEL4&=p21_SEL_MASK;LPC_GPIO2->FIODIR|=p21_SET_MASK
AjK 0:a3a04e1ce9c2 246 #define p21_AS_INPUT LPC_GPIO2->FIOMASK &= p21_CLR_MASK;
AjK 0:a3a04e1ce9c2 247 #define p21_SET LPC_GPIO2->FIOSET = p21_SET_MASK
AjK 0:a3a04e1ce9c2 248 #define p21_CLR LPC_GPIO2->FIOCLR = p21_SET_MASK
AjK 0:a3a04e1ce9c2 249 #define p21_IS_SET (bool)(LPC_GPIO2->FIOPIN & p21_SET_MASK)
AjK 0:a3a04e1ce9c2 250 #define p21_IS_CLR !(p21_IS_SET)
AjK 0:a3a04e1ce9c2 251 #define p21_MODE(x) LPC_PINCON->PINMODE4&=p21_SEL_MASK;LPC_PINCON->PINMODE4|=((x&0x3)<<10)
AjK 1:cb1f38aaae0a 252 #define p22_TOGGLE p22_IS_SET?p22_CLR:p22_SET
AjK 0:a3a04e1ce9c2 253
AjK 0:a3a04e1ce9c2 254 /* p22 is P2.4 */
AjK 0:a3a04e1ce9c2 255 #define p22_SEL_MASK ~(3UL << 8)
AjK 0:a3a04e1ce9c2 256 #define p22_SET_MASK (1UL << 4)
AjK 0:a3a04e1ce9c2 257 #define p22_CLR_MASK ~(p22_SET_MASK)
AjK 0:a3a04e1ce9c2 258 #define p22_AS_OUTPUT LPC_PINCON->PINSEL4&=p22_SEL_MASK;LPC_GPIO2->FIODIR|=p22_SET_MASK
AjK 0:a3a04e1ce9c2 259 #define p22_AS_INPUT LPC_GPIO2->FIOMASK &= p22_CLR_MASK;
AjK 0:a3a04e1ce9c2 260 #define p22_SET LPC_GPIO2->FIOSET = p22_SET_MASK
AjK 0:a3a04e1ce9c2 261 #define p22_CLR LPC_GPIO2->FIOCLR = p22_SET_MASK
AjK 0:a3a04e1ce9c2 262 #define p22_IS_SET (bool)(LPC_GPIO2->FIOPIN & p22_SET_MASK)
AjK 0:a3a04e1ce9c2 263 #define p22_IS_CLR !(p22_IS_SET)
AjK 0:a3a04e1ce9c2 264 #define p22_MODE(x) LPC_PINCON->PINMODE4&=p22_SEL_MASK;LPC_PINCON->PINMODE4|=((x&0x3)<<8)
AjK 1:cb1f38aaae0a 265 #define p22_TOGGLE p22_IS_SET?p22_CLR:p22_SET
AjK 0:a3a04e1ce9c2 266
AjK 0:a3a04e1ce9c2 267 /* p23 is P2.3 */
AjK 0:a3a04e1ce9c2 268 #define p23_SEL_MASK ~(3UL << 6)
AjK 0:a3a04e1ce9c2 269 #define p23_SET_MASK (1UL << 3)
AjK 0:a3a04e1ce9c2 270 #define p23_CLR_MASK ~(p23_SET_MASK)
AjK 0:a3a04e1ce9c2 271 #define p23_AS_OUTPUT LPC_PINCON->PINSEL4&=p23_SEL_MASK;LPC_GPIO2->FIODIR|=p23_SET_MASK
AjK 0:a3a04e1ce9c2 272 #define p23_AS_INPUT LPC_GPIO2->FIOMASK &= p23_CLR_MASK;
AjK 0:a3a04e1ce9c2 273 #define p23_SET LPC_GPIO2->FIOSET = p23_SET_MASK
AjK 0:a3a04e1ce9c2 274 #define p23_CLR LPC_GPIO2->FIOCLR = p23_SET_MASK
AjK 0:a3a04e1ce9c2 275 #define p23_IS_SET (bool)(LPC_GPIO2->FIOPIN & p23_SET_MASK)
AjK 0:a3a04e1ce9c2 276 #define p23_IS_CLR !(p23_IS_SET)
AjK 0:a3a04e1ce9c2 277 #define p23_MODE(x) LPC_PINCON->PINMODE4&=p23_SEL_MASK;LPC_PINCON->PINMODE4|=((x&0x3)<<6)
AjK 1:cb1f38aaae0a 278 #define p23_TOGGLE p23_IS_SET?p23_CLR:p23_SET
AjK 0:a3a04e1ce9c2 279
AjK 0:a3a04e1ce9c2 280 /* p24 is P2.2 */
AjK 0:a3a04e1ce9c2 281 #define p24_SEL_MASK ~(3UL << 4)
AjK 0:a3a04e1ce9c2 282 #define p24_SET_MASK (1UL << 2)
AjK 0:a3a04e1ce9c2 283 #define p24_CLR_MASK ~(p24_SET_MASK)
AjK 0:a3a04e1ce9c2 284 #define p24_AS_OUTPUT LPC_PINCON->PINSEL4&=p24_SEL_MASK;LPC_GPIO2->FIODIR|=p24_SET_MASK
AjK 0:a3a04e1ce9c2 285 #define p24_AS_INPUT LPC_GPIO2->FIOMASK &= p24_CLR_MASK;
AjK 0:a3a04e1ce9c2 286 #define p24_SET LPC_GPIO2->FIOSET = p24_SET_MASK
AjK 0:a3a04e1ce9c2 287 #define p24_CLR LPC_GPIO2->FIOCLR = p24_SET_MASK
AjK 0:a3a04e1ce9c2 288 #define p24_IS_SET (bool)(LPC_GPIO2->FIOPIN & p24_SET_MASK)
AjK 0:a3a04e1ce9c2 289 #define p24_IS_CLR !(p24_IS_SET)
AjK 0:a3a04e1ce9c2 290 #define p24_MODE(x) LPC_PINCON->PINMODE4&=p24_SEL_MASK;LPC_PINCON->PINMODE4|=((x&0x3)<<4)
AjK 1:cb1f38aaae0a 291 #define p24_TOGGLE p24_IS_SET?p24_CLR:p24_SET
AjK 0:a3a04e1ce9c2 292
AjK 0:a3a04e1ce9c2 293 /* p25 is P2.1 */
AjK 0:a3a04e1ce9c2 294 #define p25_SEL_MASK ~(3UL << 2)
AjK 0:a3a04e1ce9c2 295 #define p25_SET_MASK (1UL << 1)
AjK 0:a3a04e1ce9c2 296 #define p25_CLR_MASK ~(p25_SET_MASK)
AjK 0:a3a04e1ce9c2 297 #define p25_AS_OUTPUT LPC_PINCON->PINSEL4&=p25_SEL_MASK;LPC_GPIO2->FIODIR|=p25_SET_MASK
AjK 0:a3a04e1ce9c2 298 #define p25_AS_INPUT LPC_GPIO2->FIOMASK &= p25_CLR_MASK;
AjK 0:a3a04e1ce9c2 299 #define p25_SET LPC_GPIO2->FIOSET = p25_SET_MASK
AjK 0:a3a04e1ce9c2 300 #define p25_CLR LPC_GPIO2->FIOCLR = p25_SET_MASK
AjK 0:a3a04e1ce9c2 301 #define p25_IS_SET (bool)(LPC_GPIO2->FIOPIN & p25_SET_MASK)
AjK 0:a3a04e1ce9c2 302 #define p25_IS_CLR !(p25_IS_SET)
AjK 0:a3a04e1ce9c2 303 #define p25_MODE(x) LPC_PINCON->PINMODE4&=p25_SEL_MASK;LPC_PINCON->PINMODE4|=((x&0x3)<<2)
AjK 1:cb1f38aaae0a 304 #define p25_TOGGLE p25_IS_SET?p25_CLR:p25_SET
AjK 0:a3a04e1ce9c2 305
AjK 0:a3a04e1ce9c2 306 /* p26 is P2.0 */
AjK 0:a3a04e1ce9c2 307 #define p26_SEL_MASK ~(3UL << 0)
AjK 0:a3a04e1ce9c2 308 #define p26_SET_MASK (1UL << 0)
AjK 0:a3a04e1ce9c2 309 #define p26_CLR_MASK ~(p26_SET_MASK)
AjK 0:a3a04e1ce9c2 310 #define p26_AS_OUTPUT LPC_PINCON->PINSEL4&=p26_SEL_MASK;LPC_GPIO2->FIODIR|=p26_SET_MASK
AjK 0:a3a04e1ce9c2 311 #define p26_AS_INPUT LPC_GPIO2->FIOMASK &= p26_CLR_MASK;
AjK 0:a3a04e1ce9c2 312 #define p26_SET LPC_GPIO2->FIOSET = p26_SET_MASK
AjK 0:a3a04e1ce9c2 313 #define p26_CLR LPC_GPIO2->FIOCLR = p26_SET_MASK
AjK 0:a3a04e1ce9c2 314 #define p26_IS_SET (bool)(LPC_GPIO2->FIOPIN & p26_SET_MASK)
AjK 0:a3a04e1ce9c2 315 #define p26_IS_CLR !(p26_IS_SET)
AjK 0:a3a04e1ce9c2 316 #define p26_MODE(x) LPC_PINCON->PINMODE4&=p26_SEL_MASK;LPC_PINCON->PINMODE4|=((x&0x3)<<0)
AjK 1:cb1f38aaae0a 317 #define p26_TOGGLE p26_IS_SET?p26_CLR:p26_SET
AjK 0:a3a04e1ce9c2 318
AjK 0:a3a04e1ce9c2 319 /* p27 is P0.11 */
AjK 0:a3a04e1ce9c2 320 #define p27_SEL_MASK ~(3UL << 22)
AjK 0:a3a04e1ce9c2 321 #define p27_SET_MASK (1UL << 11)
AjK 0:a3a04e1ce9c2 322 #define p27_CLR_MASK ~(p27_SET_MASK)
AjK 0:a3a04e1ce9c2 323 #define p27_AS_OUTPUT LPC_PINCON->PINSEL0&=p27_SEL_MASK;LPC_GPIO0->FIODIR|=p27_SET_MASK
AjK 0:a3a04e1ce9c2 324 #define p27_AS_INPUT LPC_GPIO0->FIOMASK &= p27_CLR_MASK;
AjK 0:a3a04e1ce9c2 325 #define p27_SET LPC_GPIO0->FIOSET = p27_SET_MASK
AjK 0:a3a04e1ce9c2 326 #define p27_CLR LPC_GPIO0->FIOCLR = p27_SET_MASK
AjK 0:a3a04e1ce9c2 327 #define p27_IS_SET (bool)(LPC_GPIO0->FIOPIN & p27_SET_MASK)
AjK 0:a3a04e1ce9c2 328 #define p27_IS_CLR !(p27_IS_SET)
AjK 0:a3a04e1ce9c2 329 #define p27_MODE(x) LPC_PINCON->PINMODE0&=p27_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<22)
AjK 1:cb1f38aaae0a 330 #define p27_TOGGLE p27_IS_SET?p27_CLR:p27_SET
AjK 0:a3a04e1ce9c2 331
AjK 0:a3a04e1ce9c2 332 /* p28 is P0.10 */
AjK 0:a3a04e1ce9c2 333 #define p28_SEL_MASK ~(3UL << 20)
AjK 0:a3a04e1ce9c2 334 #define p28_SET_MASK (1UL << 10)
AjK 0:a3a04e1ce9c2 335 #define p28_CLR_MASK ~(p28_SET_MASK)
AjK 0:a3a04e1ce9c2 336 #define p28_AS_OUTPUT LPC_PINCON->PINSEL0&=p28_SEL_MASK;LPC_GPIO0->FIODIR|=p28_SET_MASK
AjK 0:a3a04e1ce9c2 337 #define p28_AS_INPUT LPC_GPIO0->FIOMASK &= p28_CLR_MASK;
AjK 0:a3a04e1ce9c2 338 #define p28_SET LPC_GPIO0->FIOSET = p28_SET_MASK
AjK 0:a3a04e1ce9c2 339 #define p28_CLR LPC_GPIO0->FIOCLR = p28_SET_MASK
AjK 0:a3a04e1ce9c2 340 #define p28_IS_SET (bool)(LPC_GPIO0->FIOPIN & p28_SET_MASK)
AjK 0:a3a04e1ce9c2 341 #define p28_IS_CLR !(p28_IS_SET)
AjK 0:a3a04e1ce9c2 342 #define p28_MODE(x) LPC_PINCON->PINMODE0&=p28_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<20)
AjK 1:cb1f38aaae0a 343 #define p28_TOGGLE p28_IS_SET?p28_CLR:p28_SET
AjK 0:a3a04e1ce9c2 344
AjK 0:a3a04e1ce9c2 345 /* p29 is P0.5 */
AjK 0:a3a04e1ce9c2 346 #define p29_SEL_MASK ~(3UL << 10)
AjK 0:a3a04e1ce9c2 347 #define p29_SET_MASK (1UL << 5)
AjK 0:a3a04e1ce9c2 348 #define p29_CLR_MASK ~(p29_SET_MASK)
AjK 0:a3a04e1ce9c2 349 #define p29_AS_OUTPUT LPC_PINCON->PINSEL0&=p29_SEL_MASK;LPC_GPIO0->FIODIR|=p29_SET_MASK
AjK 0:a3a04e1ce9c2 350 #define p29_AS_INPUT LPC_GPIO0->FIOMASK &= p29_CLR_MASK;
AjK 0:a3a04e1ce9c2 351 #define p29_SET LPC_GPIO0->FIOSET = p29_SET_MASK
AjK 0:a3a04e1ce9c2 352 #define p29_CLR LPC_GPIO0->FIOCLR = p29_SET_MASK
AjK 0:a3a04e1ce9c2 353 #define p29_IS_SET (bool)(LPC_GPIO0->FIOPIN & p29_SET_MASK)
AjK 0:a3a04e1ce9c2 354 #define p29_IS_CLR !(p29_IS_SET)
AjK 0:a3a04e1ce9c2 355 #define p29_MODE(x) LPC_PINCON->PINMODE0&=p29_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<10)
AjK 1:cb1f38aaae0a 356 #define p29_TOGGLE p29_IS_SET?p29_CLR:p29_SET
AjK 0:a3a04e1ce9c2 357
AjK 0:a3a04e1ce9c2 358 /* p30 is P0.4 */
AjK 0:a3a04e1ce9c2 359 #define p30_SEL_MASK ~(3UL << 8)
AjK 0:a3a04e1ce9c2 360 #define p30_SET_MASK (1UL << 4)
AjK 0:a3a04e1ce9c2 361 #define p30_CLR_MASK ~(p30_SET_MASK)
AjK 0:a3a04e1ce9c2 362 #define p30_AS_OUTPUT LPC_PINCON->PINSEL0&=p30_SEL_MASK;LPC_GPIO0->FIODIR|=p30_SET_MASK
AjK 0:a3a04e1ce9c2 363 #define p30_AS_INPUT LPC_GPIO0->FIOMASK &= p30_CLR_MASK;
AjK 0:a3a04e1ce9c2 364 #define p30_SET LPC_GPIO0->FIOSET = p30_SET_MASK
AjK 0:a3a04e1ce9c2 365 #define p30_CLR LPC_GPIO0->FIOCLR = p30_SET_MASK
AjK 0:a3a04e1ce9c2 366 #define p30_IS_SET (bool)(LPC_GPIO0->FIOPIN & p30_SET_MASK)
AjK 0:a3a04e1ce9c2 367 #define p30_IS_CLR !(p30_IS_SET)
AjK 0:a3a04e1ce9c2 368 #define p30_MODE(x) LPC_PINCON->PINMODE0&=p30_SEL_MASK;LPC_PINCON->PINMODE0|=((x&0x3)<<8)
AjK 1:cb1f38aaae0a 369 #define p30_TOGGLE p30_IS_SET?p30_CLR:p30_SET
AjK 0:a3a04e1ce9c2 370
AjK 0:a3a04e1ce9c2 371 /* The following definitions are for the four Mbed LEDs.
AjK 0:a3a04e1ce9c2 372 LED1 = P1.18
AjK 0:a3a04e1ce9c2 373 LED2 = P1.20
AjK 0:a3a04e1ce9c2 374 LED3 = P1.21
AjK 0:a3a04e1ce9c2 375 LED4 = P1.23 */
AjK 0:a3a04e1ce9c2 376
AjK 0:a3a04e1ce9c2 377 #define P1_18_SEL_MASK ~(3UL << 4)
AjK 0:a3a04e1ce9c2 378 #define P1_18_SET_MASK (1UL << 18)
AjK 0:a3a04e1ce9c2 379 #define P1_18_CLR_MASK ~(P1_18_SET_MASK)
AjK 0:a3a04e1ce9c2 380 #define P1_18_AS_OUTPUT LPC_PINCON->PINSEL3&=P1_18_SEL_MASK;LPC_GPIO1->FIODIR|=P1_18_SET_MASK
AjK 0:a3a04e1ce9c2 381 #define P1_18_AS_INPUT LPC_GPIO1->FIOMASK &= P1_18_CLR_MASK;
AjK 0:a3a04e1ce9c2 382 #define P1_18_SET LPC_GPIO1->FIOSET = P1_18_SET_MASK
AjK 0:a3a04e1ce9c2 383 #define P1_18_CLR LPC_GPIO1->FIOCLR = P1_18_SET_MASK
AjK 0:a3a04e1ce9c2 384 #define P1_18_IS_SET (bool)(LPC_GPIO1->FIOPIN & P1_18_SET_MASK)
AjK 0:a3a04e1ce9c2 385 #define P1_18_IS_CLR !(P1_18_IS_SET)
AjK 0:a3a04e1ce9c2 386 #define LED1_USE P1_18_AS_OUTPUT;P1_18_AS_INPUT
AjK 0:a3a04e1ce9c2 387 #define LED1_ON P1_18_SET
AjK 0:a3a04e1ce9c2 388 #define LED1_OFF P1_18_CLR
AjK 0:a3a04e1ce9c2 389 #define LED1_IS_ON P1_18_IS_SET
AjK 0:a3a04e1ce9c2 390 #define LED1_TOGGLE P1_18_IS_SET?LED1_OFF:LED1_ON
AjK 0:a3a04e1ce9c2 391
AjK 0:a3a04e1ce9c2 392 #define P1_20_SEL_MASK ~(3UL << 8)
AjK 0:a3a04e1ce9c2 393 #define P1_20_SET_MASK (1UL << 20)
AjK 0:a3a04e1ce9c2 394 #define P1_20_CLR_MASK ~(P1_20_SET_MASK)
AjK 0:a3a04e1ce9c2 395 #define P1_20_AS_OUTPUT LPC_PINCON->PINSEL3&=P1_20_SEL_MASK;LPC_GPIO1->FIODIR|=P1_20_SET_MASK
AjK 0:a3a04e1ce9c2 396 #define P1_20_AS_INPUT LPC_GPIO1->FIOMASK &= P1_20_CLR_MASK;
AjK 0:a3a04e1ce9c2 397 #define P1_20_SET LPC_GPIO1->FIOSET = P1_20_SET_MASK
AjK 0:a3a04e1ce9c2 398 #define P1_20_CLR LPC_GPIO1->FIOCLR = P1_20_SET_MASK
AjK 0:a3a04e1ce9c2 399 #define P1_20_IS_SET (bool)(LPC_GPIO1->FIOPIN & P1_20_SET_MASK)
AjK 0:a3a04e1ce9c2 400 #define P1_20_IS_CLR !(P1_20_IS_SET)
AjK 0:a3a04e1ce9c2 401 #define LED2_USE P1_20_AS_OUTPUT;P1_20_AS_INPUT
AjK 0:a3a04e1ce9c2 402 #define LED2_ON P1_20_SET
AjK 0:a3a04e1ce9c2 403 #define LED2_OFF P1_20_CLR
AjK 0:a3a04e1ce9c2 404 #define LED2_IS_ON P1_20_IS_SET
AjK 0:a3a04e1ce9c2 405 #define LED2_TOGGLE P1_20_IS_SET?LED2_OFF:LED2_ON
AjK 0:a3a04e1ce9c2 406
AjK 0:a3a04e1ce9c2 407 #define P1_21_SEL_MASK ~(3UL << 10)
AjK 0:a3a04e1ce9c2 408 #define P1_21_SET_MASK (1UL << 21)
AjK 0:a3a04e1ce9c2 409 #define P1_21_CLR_MASK ~(P1_21_SET_MASK)
AjK 0:a3a04e1ce9c2 410 #define P1_21_AS_OUTPUT LPC_PINCON->PINSEL3&=P1_21_SEL_MASK;LPC_GPIO1->FIODIR|=P1_21_SET_MASK
AjK 0:a3a04e1ce9c2 411 #define P1_21_AS_INPUT LPC_GPIO1->FIOMASK &= P1_21_CLR_MASK;
AjK 0:a3a04e1ce9c2 412 #define P1_21_SET LPC_GPIO1->FIOSET = P1_21_SET_MASK
AjK 0:a3a04e1ce9c2 413 #define P1_21_CLR LPC_GPIO1->FIOCLR = P1_21_SET_MASK
AjK 0:a3a04e1ce9c2 414 #define P1_21_IS_SET (bool)(LPC_GPIO1->FIOPIN & P1_21_SET_MASK)
AjK 0:a3a04e1ce9c2 415 #define P1_21_IS_CLR !(P1_21_IS_SET)
AjK 0:a3a04e1ce9c2 416 #define LED3_USE P1_21_AS_OUTPUT;P1_21_AS_INPUT
AjK 0:a3a04e1ce9c2 417 #define LED3_ON P1_21_SET
AjK 0:a3a04e1ce9c2 418 #define LED3_OFF P1_21_CLR
AjK 0:a3a04e1ce9c2 419 #define LED3_IS_ON P1_21_IS_SET
AjK 0:a3a04e1ce9c2 420 #define LED3_TOGGLE P1_21_IS_SET?LED3_OFF:LED3_ON
AjK 0:a3a04e1ce9c2 421
AjK 0:a3a04e1ce9c2 422 #define P1_23_SEL_MASK ~(3UL << 14)
AjK 0:a3a04e1ce9c2 423 #define P1_23_SET_MASK (1UL << 23)
AjK 0:a3a04e1ce9c2 424 #define P1_23_CLR_MASK ~(P1_23_SET_MASK)
AjK 0:a3a04e1ce9c2 425 #define P1_23_AS_OUTPUT LPC_PINCON->PINSEL3&=P1_23_SEL_MASK;LPC_GPIO1->FIODIR|=P1_23_SET_MASK
AjK 0:a3a04e1ce9c2 426 #define P1_23_AS_INPUT LPC_GPIO1->FIOMASK &= P1_23_CLR_MASK;
AjK 0:a3a04e1ce9c2 427 #define P1_23_SET LPC_GPIO1->FIOSET = P1_23_SET_MASK
AjK 0:a3a04e1ce9c2 428 #define P1_23_CLR LPC_GPIO1->FIOCLR = P1_23_SET_MASK
AjK 0:a3a04e1ce9c2 429 #define P1_23_IS_SET (bool)(LPC_GPIO1->FIOPIN & P1_23_SET_MASK)
AjK 0:a3a04e1ce9c2 430 #define P1_23_IS_CLR !(P1_23_IS_SET)
AjK 0:a3a04e1ce9c2 431 #define LED4_USE P1_23_AS_OUTPUT;P1_23_AS_INPUT
AjK 0:a3a04e1ce9c2 432 #define LED4_ON P1_23_SET
AjK 0:a3a04e1ce9c2 433 #define LED4_OFF P1_23_CLR
AjK 0:a3a04e1ce9c2 434 #define LED4_IS_ON P1_23_IS_SET
AjK 0:a3a04e1ce9c2 435 #define LED4_TOGGLE P1_23_IS_SET?LED4_OFF:LED4_ON
AjK 0:a3a04e1ce9c2 436
AjK 0:a3a04e1ce9c2 437 #endif
AjK 0:a3a04e1ce9c2 438