acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
Arduino_SWPAR16.cpp (46594B)
1 #include "Arduino_SWPAR16.h" 2 3 Arduino_SWPAR16::Arduino_SWPAR16( 4 int8_t dc, int8_t cs, int8_t wr, int8_t rd, 5 int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t d4, int8_t d5, int8_t d6, int8_t d7, 6 int8_t d8, int8_t d9, int8_t d10, int8_t d11, int8_t d12, int8_t d13, int8_t d14, int8_t d15) 7 : _dc(dc), _cs(cs), _wr(wr), _rd(rd), 8 _d0(d0), _d1(d1), _d2(d2), _d3(d3), _d4(d4), _d5(d5), _d6(d6), _d7(d7), 9 _d8(d8), _d9(d9), _d10(d10), _d11(d11), _d12(d12), _d13(d13), _d14(d14), _d15(d15) 10 { 11 } 12 13 bool Arduino_SWPAR16::begin(int32_t speed, int8_t dataMode) 14 { 15 UNUSED(speed); 16 UNUSED(dataMode); 17 18 pinMode(_dc, OUTPUT); 19 digitalWrite(_dc, HIGH); // Data mode 20 if (_cs != GFX_NOT_DEFINED) 21 { 22 pinMode(_cs, OUTPUT); 23 digitalWrite(_cs, HIGH); // Deselect 24 } 25 pinMode(_wr, OUTPUT); 26 digitalWrite(_wr, HIGH); 27 if (_rd != GFX_NOT_DEFINED) 28 { 29 pinMode(_rd, OUTPUT); 30 digitalWrite(_rd, HIGH); 31 } 32 pinMode(_d0, OUTPUT); 33 digitalWrite(_d0, LOW); 34 pinMode(_d1, OUTPUT); 35 digitalWrite(_d1, LOW); 36 pinMode(_d2, OUTPUT); 37 digitalWrite(_d2, LOW); 38 pinMode(_d3, OUTPUT); 39 digitalWrite(_d3, LOW); 40 pinMode(_d4, OUTPUT); 41 digitalWrite(_d4, LOW); 42 pinMode(_d5, OUTPUT); 43 digitalWrite(_d5, LOW); 44 pinMode(_d6, OUTPUT); 45 digitalWrite(_d6, LOW); 46 pinMode(_d7, OUTPUT); 47 digitalWrite(_d7, LOW); 48 pinMode(_d8, OUTPUT); 49 digitalWrite(_d8, LOW); 50 pinMode(_d9, OUTPUT); 51 digitalWrite(_d9, LOW); 52 pinMode(_d10, OUTPUT); 53 digitalWrite(_d10, LOW); 54 pinMode(_d11, OUTPUT); 55 digitalWrite(_d11, LOW); 56 pinMode(_d12, OUTPUT); 57 digitalWrite(_d12, LOW); 58 pinMode(_d13, OUTPUT); 59 digitalWrite(_d13, LOW); 60 pinMode(_d14, OUTPUT); 61 digitalWrite(_d14, LOW); 62 pinMode(_d15, OUTPUT); 63 digitalWrite(_d15, LOW); 64 65 #if defined(USE_FAST_PINIO) 66 #if defined(HAS_PORT_SET_CLR) 67 #if defined(ARDUINO_ARCH_NRF52840) 68 uint32_t pin = digitalPinToPinName((pin_size_t)_dc); 69 NRF_GPIO_Type *reg = nrf_gpio_pin_port_decode(&pin); 70 _dcPortSet = ®->OUTSET; 71 _dcPortClr = ®->OUTCLR; 72 _dcPinMask = 1UL << pin; 73 if (_cs != GFX_NOT_DEFINED) 74 { 75 pin = digitalPinToPinName((pin_size_t)_cs); 76 reg = nrf_gpio_pin_port_decode(&pin); 77 _csPortSet = ®->OUTSET; 78 _csPortClr = ®->OUTCLR; 79 _csPinMask = 1UL << pin; 80 } 81 pin = digitalPinToPinName((pin_size_t)_wr); 82 reg = nrf_gpio_pin_port_decode(&pin); 83 _wrPortSet = ®->OUTSET; 84 _wrPortClr = ®->OUTCLR; 85 _wrPinMask = 1UL << pin; 86 if (_rd != GFX_NOT_DEFINED) 87 { 88 pin = digitalPinToPinName((pin_size_t)_rd); 89 reg = nrf_gpio_pin_port_decode(&pin); 90 _rdPortSet = ®->OUTSET; 91 _rdPortClr = ®->OUTCLR; 92 _rdPinMask = 1UL << pin; 93 } 94 pin = digitalPinToPinName((pin_size_t)_d0); 95 reg = nrf_gpio_pin_port_decode(&pin); 96 _d0PortSet = ®->OUTSET; 97 _d0PortClr = ®->OUTCLR; 98 _d0PinMask = 1UL << pin; 99 pin = digitalPinToPinName((pin_size_t)_d1); 100 reg = nrf_gpio_pin_port_decode(&pin); 101 _d1PortSet = ®->OUTSET; 102 _d1PortClr = ®->OUTCLR; 103 _d1PinMask = 1UL << pin; 104 pin = digitalPinToPinName((pin_size_t)_d2); 105 reg = nrf_gpio_pin_port_decode(&pin); 106 _d2PortSet = ®->OUTSET; 107 _d2PortClr = ®->OUTCLR; 108 _d2PinMask = 1UL << pin; 109 pin = digitalPinToPinName((pin_size_t)_d3); 110 reg = nrf_gpio_pin_port_decode(&pin); 111 _d3PortSet = ®->OUTSET; 112 _d3PortClr = ®->OUTCLR; 113 _d3PinMask = 1UL << pin; 114 pin = digitalPinToPinName((pin_size_t)_d4); 115 reg = nrf_gpio_pin_port_decode(&pin); 116 _d4PortSet = ®->OUTSET; 117 _d4PortClr = ®->OUTCLR; 118 _d4PinMask = 1UL << pin; 119 pin = digitalPinToPinName((pin_size_t)_d5); 120 reg = nrf_gpio_pin_port_decode(&pin); 121 _d5PortSet = ®->OUTSET; 122 _d5PortClr = ®->OUTCLR; 123 _d5PinMask = 1UL << pin; 124 pin = digitalPinToPinName((pin_size_t)_d6); 125 reg = nrf_gpio_pin_port_decode(&pin); 126 _d6PortSet = ®->OUTSET; 127 _d6PortClr = ®->OUTCLR; 128 _d6PinMask = 1UL << pin; 129 pin = digitalPinToPinName((pin_size_t)_d7); 130 reg = nrf_gpio_pin_port_decode(&pin); 131 _d7PortSet = ®->OUTSET; 132 _d7PortClr = ®->OUTCLR; 133 _d7PinMask = 1UL << pin; 134 pin = digitalPinToPinName((pin_size_t)_d8); 135 reg = nrf_gpio_pin_port_decode(&pin); 136 _d8PortSet = ®->OUTSET; 137 _d8PortClr = ®->OUTCLR; 138 _d8PinMask = 1UL << pin; 139 pin = digitalPinToPinName((pin_size_t)_d9); 140 reg = nrf_gpio_pin_port_decode(&pin); 141 _d9PortSet = ®->OUTSET; 142 _d9PortClr = ®->OUTCLR; 143 _d9PinMask = 1UL << pin; 144 pin = digitalPinToPinName((pin_size_t)_d10); 145 reg = nrf_gpio_pin_port_decode(&pin); 146 _d10PortSet = ®->OUTSET; 147 _d10PortClr = ®->OUTCLR; 148 _d10PinMask = 1UL << pin; 149 pin = digitalPinToPinName((pin_size_t)_d11); 150 reg = nrf_gpio_pin_port_decode(&pin); 151 _d11PortSet = ®->OUTSET; 152 _d11PortClr = ®->OUTCLR; 153 _d11PinMask = 1UL << pin; 154 pin = digitalPinToPinName((pin_size_t)_d12); 155 reg = nrf_gpio_pin_port_decode(&pin); 156 _d12PortSet = ®->OUTSET; 157 _d12PortClr = ®->OUTCLR; 158 _d12PinMask = 1UL << pin; 159 pin = digitalPinToPinName((pin_size_t)_d13); 160 reg = nrf_gpio_pin_port_decode(&pin); 161 _d13PortSet = ®->OUTSET; 162 _d13PortClr = ®->OUTCLR; 163 _d13PinMask = 1UL << pin; 164 pin = digitalPinToPinName((pin_size_t)_d14); 165 reg = nrf_gpio_pin_port_decode(&pin); 166 _d14PortSet = ®->OUTSET; 167 _d14PortClr = ®->OUTCLR; 168 _d14PinMask = 1UL << pin; 169 pin = digitalPinToPinName((pin_size_t)_d15); 170 reg = nrf_gpio_pin_port_decode(&pin); 171 _d15PortSet = ®->OUTSET; 172 _d15PortClr = ®->OUTCLR; 173 _d15PinMask = 1UL << pin; 174 #elif defined(TARGET_RP2040) 175 _dcPinMask = digitalPinToBitMask(_dc); 176 _dcPortSet = (PORTreg_t)&sio_hw->gpio_set; 177 _dcPortClr = (PORTreg_t)&sio_hw->gpio_clr; 178 if (_cs != GFX_NOT_DEFINED) 179 { 180 _csPinMask = digitalPinToBitMask(_cs); 181 _csPortSet = (PORTreg_t)&sio_hw->gpio_set; 182 _csPortClr = (PORTreg_t)&sio_hw->gpio_clr; 183 } 184 _wrPinMask = digitalPinToBitMask(_wr); 185 _wrPortSet = (PORTreg_t)&sio_hw->gpio_set; 186 _wrPortClr = (PORTreg_t)&sio_hw->gpio_clr; 187 if (_rd != GFX_NOT_DEFINED) 188 { 189 _rdPinMask = digitalPinToBitMask(_rd); 190 _rdPortSet = (PORTreg_t)&sio_hw->gpio_set; 191 _rdPortClr = (PORTreg_t)&sio_hw->gpio_clr; 192 } 193 _d0PinMask = digitalPinToBitMask(_d0); 194 _d0PortSet = (PORTreg_t)&sio_hw->gpio_set; 195 _d0PortClr = (PORTreg_t)&sio_hw->gpio_clr; 196 _d1PinMask = digitalPinToBitMask(_d1); 197 _d1PortSet = (PORTreg_t)&sio_hw->gpio_set; 198 _d1PortClr = (PORTreg_t)&sio_hw->gpio_clr; 199 _d2PinMask = digitalPinToBitMask(_d2); 200 _d2PortSet = (PORTreg_t)&sio_hw->gpio_set; 201 _d2PortClr = (PORTreg_t)&sio_hw->gpio_clr; 202 _d3PinMask = digitalPinToBitMask(_d3); 203 _d3PortSet = (PORTreg_t)&sio_hw->gpio_set; 204 _d3PortClr = (PORTreg_t)&sio_hw->gpio_clr; 205 _d4PinMask = digitalPinToBitMask(_d4); 206 _d4PortSet = (PORTreg_t)&sio_hw->gpio_set; 207 _d4PortClr = (PORTreg_t)&sio_hw->gpio_clr; 208 _d5PinMask = digitalPinToBitMask(_d5); 209 _d5PortSet = (PORTreg_t)&sio_hw->gpio_set; 210 _d5PortClr = (PORTreg_t)&sio_hw->gpio_clr; 211 _d6PinMask = digitalPinToBitMask(_d6); 212 _d6PortSet = (PORTreg_t)&sio_hw->gpio_set; 213 _d6PortClr = (PORTreg_t)&sio_hw->gpio_clr; 214 _d7PinMask = digitalPinToBitMask(_d7); 215 _d7PortSet = (PORTreg_t)&sio_hw->gpio_set; 216 _d7PortClr = (PORTreg_t)&sio_hw->gpio_clr; 217 _d8PinMask = digitalPinToBitMask(_d8); 218 _d8PortSet = (PORTreg_t)&sio_hw->gpio_set; 219 _d8PortClr = (PORTreg_t)&sio_hw->gpio_clr; 220 _d9PinMask = digitalPinToBitMask(_d9); 221 _d9PortSet = (PORTreg_t)&sio_hw->gpio_set; 222 _d9PortClr = (PORTreg_t)&sio_hw->gpio_clr; 223 _d10PinMask = digitalPinToBitMask(_d10); 224 _d10PortSet = (PORTreg_t)&sio_hw->gpio_set; 225 _d10PortClr = (PORTreg_t)&sio_hw->gpio_clr; 226 _d11PinMask = digitalPinToBitMask(_d11); 227 _d11PortSet = (PORTreg_t)&sio_hw->gpio_set; 228 _d11PortClr = (PORTreg_t)&sio_hw->gpio_clr; 229 _d12PinMask = digitalPinToBitMask(_d12); 230 _d12PortSet = (PORTreg_t)&sio_hw->gpio_set; 231 _d12PortClr = (PORTreg_t)&sio_hw->gpio_clr; 232 _d13PinMask = digitalPinToBitMask(_d13); 233 _d13PortSet = (PORTreg_t)&sio_hw->gpio_set; 234 _d13PortClr = (PORTreg_t)&sio_hw->gpio_clr; 235 _d14PinMask = digitalPinToBitMask(_d14); 236 _d14PortSet = (PORTreg_t)&sio_hw->gpio_set; 237 _d14PortClr = (PORTreg_t)&sio_hw->gpio_clr; 238 _d15PinMask = digitalPinToBitMask(_d15); 239 _d15PortSet = (PORTreg_t)&sio_hw->gpio_set; 240 _d15PortClr = (PORTreg_t)&sio_hw->gpio_clr; 241 #elif defined(ESP32) && (CONFIG_IDF_TARGET_ESP32C3) 242 _dcPinMask = digitalPinToBitMask(_dc); 243 _dcPortSet = (PORTreg_t)&GPIO.out_w1ts; 244 _dcPortClr = (PORTreg_t)&GPIO.out_w1tc; 245 if (_cs != GFX_NOT_DEFINED) 246 { 247 _csPinMask = digitalPinToBitMask(_cs); 248 _csPortSet = (PORTreg_t)&GPIO.out_w1ts; 249 _csPortClr = (PORTreg_t)&GPIO.out_w1tc; 250 } 251 _wrPinMask = digitalPinToBitMask(_wr); 252 _wrPortSet = (PORTreg_t)&GPIO.out_w1ts; 253 _wrPortClr = (PORTreg_t)&GPIO.out_w1tc; 254 if (_rd != GFX_NOT_DEFINED) 255 { 256 _rdPinMask = digitalPinToBitMask(_rd); 257 _rdPortSet = (PORTreg_t)&GPIO.out_w1ts; 258 _rdPortClr = (PORTreg_t)&GPIO.out_w1tc; 259 } 260 _d0PinMask = digitalPinToBitMask(_d0); 261 _d0PortSet = (PORTreg_t)&GPIO.out_w1ts; 262 _d0PortClr = (PORTreg_t)&GPIO.out_w1tc; 263 _d1PinMask = digitalPinToBitMask(_d1); 264 _d1PortSet = (PORTreg_t)&GPIO.out_w1ts; 265 _d1PortClr = (PORTreg_t)&GPIO.out_w1tc; 266 _d2PinMask = digitalPinToBitMask(_d2); 267 _d2PortSet = (PORTreg_t)&GPIO.out_w1ts; 268 _d2PortClr = (PORTreg_t)&GPIO.out_w1tc; 269 _d3PinMask = digitalPinToBitMask(_d3); 270 _d3PortSet = (PORTreg_t)&GPIO.out_w1ts; 271 _d3PortClr = (PORTreg_t)&GPIO.out_w1tc; 272 _d4PinMask = digitalPinToBitMask(_d4); 273 _d4PortSet = (PORTreg_t)&GPIO.out_w1ts; 274 _d4PortClr = (PORTreg_t)&GPIO.out_w1tc; 275 _d5PinMask = digitalPinToBitMask(_d5); 276 _d5PortSet = (PORTreg_t)&GPIO.out_w1ts; 277 _d5PortClr = (PORTreg_t)&GPIO.out_w1tc; 278 _d6PinMask = digitalPinToBitMask(_d6); 279 _d6PortSet = (PORTreg_t)&GPIO.out_w1ts; 280 _d6PortClr = (PORTreg_t)&GPIO.out_w1tc; 281 _d7PinMask = digitalPinToBitMask(_d7); 282 _d7PortSet = (PORTreg_t)&GPIO.out_w1ts; 283 _d7PortClr = (PORTreg_t)&GPIO.out_w1tc; 284 _d8PinMask = digitalPinToBitMask(_d8); 285 _d8PortSet = (PORTreg_t)&GPIO.out_w1ts; 286 _d8PortClr = (PORTreg_t)&GPIO.out_w1tc; 287 _d9PinMask = digitalPinToBitMask(_d9); 288 _d9PortSet = (PORTreg_t)&GPIO.out_w1ts; 289 _d9PortClr = (PORTreg_t)&GPIO.out_w1tc; 290 _d10PinMask = digitalPinToBitMask(_d10); 291 _d10PortSet = (PORTreg_t)&GPIO.out_w1ts; 292 _d10PortClr = (PORTreg_t)&GPIO.out_w1tc; 293 _d11PinMask = digitalPinToBitMask(_d11); 294 _d11PortSet = (PORTreg_t)&GPIO.out_w1ts; 295 _d11PortClr = (PORTreg_t)&GPIO.out_w1tc; 296 _d12PinMask = digitalPinToBitMask(_d12); 297 _d12PortSet = (PORTreg_t)&GPIO.out_w1ts; 298 _d12PortClr = (PORTreg_t)&GPIO.out_w1tc; 299 _d13PinMask = digitalPinToBitMask(_d13); 300 _d13PortSet = (PORTreg_t)&GPIO.out_w1ts; 301 _d13PortClr = (PORTreg_t)&GPIO.out_w1tc; 302 _d14PinMask = digitalPinToBitMask(_d14); 303 _d14PortSet = (PORTreg_t)&GPIO.out_w1ts; 304 _d14PortClr = (PORTreg_t)&GPIO.out_w1tc; 305 _d15PinMask = digitalPinToBitMask(_d15); 306 _d15PortSet = (PORTreg_t)&GPIO.out_w1ts; 307 _d15PortClr = (PORTreg_t)&GPIO.out_w1tc; 308 #elif defined(ESP32) 309 _dcPinMask = digitalPinToBitMask(_dc); 310 if (_dc >= 32) 311 { 312 _dcPortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 313 _dcPortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 314 } 315 else 316 { 317 _dcPortSet = (PORTreg_t)&GPIO.out_w1ts; 318 _dcPortClr = (PORTreg_t)&GPIO.out_w1tc; 319 } 320 if (_cs >= 32) 321 { 322 _csPinMask = digitalPinToBitMask(_cs); 323 _csPortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 324 _csPortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 325 } 326 else if (_cs != GFX_NOT_DEFINED) 327 { 328 _csPinMask = digitalPinToBitMask(_cs); 329 _csPortSet = (PORTreg_t)&GPIO.out_w1ts; 330 _csPortClr = (PORTreg_t)&GPIO.out_w1tc; 331 } 332 _wrPinMask = digitalPinToBitMask(_wr); 333 if (_wr >= 32) 334 { 335 _wrPortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 336 _wrPortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 337 } 338 else 339 { 340 _wrPortSet = (PORTreg_t)&GPIO.out_w1ts; 341 _wrPortClr = (PORTreg_t)&GPIO.out_w1tc; 342 } 343 if (_rd >= 32) 344 { 345 _rdPinMask = digitalPinToBitMask(_rd); 346 _rdPortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 347 _rdPortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 348 } 349 else if (_rd != GFX_NOT_DEFINED) 350 { 351 _rdPinMask = digitalPinToBitMask(_rd); 352 _rdPortSet = (PORTreg_t)&GPIO.out_w1ts; 353 _rdPortClr = (PORTreg_t)&GPIO.out_w1tc; 354 } 355 _d0PinMask = digitalPinToBitMask(_d0); 356 if (_d0 >= 32) 357 { 358 _d0PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 359 _d0PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 360 } 361 else 362 { 363 _d0PortSet = (PORTreg_t)&GPIO.out_w1ts; 364 _d0PortClr = (PORTreg_t)&GPIO.out_w1tc; 365 } 366 _d1PinMask = digitalPinToBitMask(_d1); 367 if (_d1 >= 32) 368 { 369 _d1PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 370 _d1PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 371 } 372 else 373 { 374 _d1PortSet = (PORTreg_t)&GPIO.out_w1ts; 375 _d1PortClr = (PORTreg_t)&GPIO.out_w1tc; 376 } 377 _d2PinMask = digitalPinToBitMask(_d2); 378 if (_d2 >= 32) 379 { 380 _d2PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 381 _d2PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 382 } 383 else 384 { 385 _d2PortSet = (PORTreg_t)&GPIO.out_w1ts; 386 _d2PortClr = (PORTreg_t)&GPIO.out_w1tc; 387 } 388 _d3PinMask = digitalPinToBitMask(_d3); 389 if (_d3 >= 32) 390 { 391 _d3PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 392 _d3PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 393 } 394 else 395 { 396 _d3PortSet = (PORTreg_t)&GPIO.out_w1ts; 397 _d3PortClr = (PORTreg_t)&GPIO.out_w1tc; 398 } 399 _d4PinMask = digitalPinToBitMask(_d4); 400 if (_d4 >= 32) 401 { 402 _d4PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 403 _d4PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 404 } 405 else 406 { 407 _d4PortSet = (PORTreg_t)&GPIO.out_w1ts; 408 _d4PortClr = (PORTreg_t)&GPIO.out_w1tc; 409 } 410 _d5PinMask = digitalPinToBitMask(_d5); 411 if (_d5 >= 32) 412 { 413 _d5PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 414 _d5PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 415 } 416 else 417 { 418 _d5PortSet = (PORTreg_t)&GPIO.out_w1ts; 419 _d5PortClr = (PORTreg_t)&GPIO.out_w1tc; 420 } 421 _d6PinMask = digitalPinToBitMask(_d6); 422 if (_d6 >= 32) 423 { 424 _d6PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 425 _d6PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 426 } 427 else 428 { 429 _d6PortSet = (PORTreg_t)&GPIO.out_w1ts; 430 _d6PortClr = (PORTreg_t)&GPIO.out_w1tc; 431 } 432 _d7PinMask = digitalPinToBitMask(_d7); 433 if (_d7 >= 32) 434 { 435 _d7PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 436 _d7PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 437 } 438 else 439 { 440 _d7PortSet = (PORTreg_t)&GPIO.out_w1ts; 441 _d7PortClr = (PORTreg_t)&GPIO.out_w1tc; 442 } 443 _d8PinMask = digitalPinToBitMask(_d8); 444 if (_d8 >= 32) 445 { 446 _d8PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 447 _d8PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 448 } 449 else 450 { 451 _d8PortSet = (PORTreg_t)&GPIO.out_w1ts; 452 _d8PortClr = (PORTreg_t)&GPIO.out_w1tc; 453 } 454 _d9PinMask = digitalPinToBitMask(_d9); 455 if (_d9 >= 32) 456 { 457 _d9PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 458 _d9PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 459 } 460 else 461 { 462 _d9PortSet = (PORTreg_t)&GPIO.out_w1ts; 463 _d9PortClr = (PORTreg_t)&GPIO.out_w1tc; 464 } 465 _d10PinMask = digitalPinToBitMask(_d10); 466 if (_d10 >= 32) 467 { 468 _d10PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 469 _d10PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 470 } 471 else 472 { 473 _d10PortSet = (PORTreg_t)&GPIO.out_w1ts; 474 _d10PortClr = (PORTreg_t)&GPIO.out_w1tc; 475 } 476 _d11PinMask = digitalPinToBitMask(_d11); 477 if (_d11 >= 32) 478 { 479 _d11PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 480 _d11PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 481 } 482 else 483 { 484 _d11PortSet = (PORTreg_t)&GPIO.out_w1ts; 485 _d11PortClr = (PORTreg_t)&GPIO.out_w1tc; 486 } 487 _d12PinMask = digitalPinToBitMask(_d12); 488 if (_d12 >= 32) 489 { 490 _d12PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 491 _d12PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 492 } 493 else 494 { 495 _d12PortSet = (PORTreg_t)&GPIO.out_w1ts; 496 _d12PortClr = (PORTreg_t)&GPIO.out_w1tc; 497 } 498 _d13PinMask = digitalPinToBitMask(_d13); 499 if (_d13 >= 32) 500 { 501 _d13PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 502 _d13PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 503 } 504 else 505 { 506 _d13PortSet = (PORTreg_t)&GPIO.out_w1ts; 507 _d13PortClr = (PORTreg_t)&GPIO.out_w1tc; 508 } 509 _d14PinMask = digitalPinToBitMask(_d14); 510 if (_d14 >= 32) 511 { 512 _d14PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 513 _d14PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 514 } 515 else 516 { 517 _d14PortSet = (PORTreg_t)&GPIO.out_w1ts; 518 _d14PortClr = (PORTreg_t)&GPIO.out_w1tc; 519 } 520 _d15PinMask = digitalPinToBitMask(_d15); 521 if (_d15 >= 32) 522 { 523 _d15PortSet = (PORTreg_t)&GPIO.out1_w1ts.val; 524 _d15PortClr = (PORTreg_t)&GPIO.out1_w1tc.val; 525 } 526 else 527 { 528 _d15PortSet = (PORTreg_t)&GPIO.out_w1ts; 529 _d15PortClr = (PORTreg_t)&GPIO.out_w1tc; 530 } 531 #elif defined(CORE_TEENSY) 532 #if !defined(KINETISK) 533 _dcPinMask = digitalPinToBitMask(_dc); 534 #endif 535 _dcPortSet = portSetRegister(_dc); 536 _dcPortClr = portClearRegister(_dc); 537 if (_cs != GFX_NOT_DEFINED) 538 { 539 #if !defined(KINETISK) 540 _csPinMask = digitalPinToBitMask(_cs); 541 #endif 542 _csPortSet = portSetRegister(_cs); 543 _csPortClr = portClearRegister(_cs); 544 } 545 #if !defined(KINETISK) 546 _wrPinMask = digitalPinToBitMask(_wr); 547 #endif 548 _wrPortSet = portSetRegister(_wr); 549 _wrPortClr = portClearRegister(_wr); 550 if (_rd != GFX_NOT_DEFINED) 551 { 552 #if !defined(KINETISK) 553 _rdPinMask = digitalPinToBitMask(_rd); 554 #endif 555 _rdPortSet = portSetRegister(_rd); 556 _rdPortClr = portClearRegister(_rd); 557 } 558 #if !defined(KINETISK) 559 _d0PinMask = digitalPinToBitMask(_d0); 560 #endif 561 _d0PortSet = portSetRegister(_d0); 562 _d0PortClr = portClearRegister(_d0); 563 #if !defined(KINETISK) 564 _d1PinMask = digitalPinToBitMask(_d1); 565 #endif 566 _d1PortSet = portSetRegister(_d1); 567 _d1PortClr = portClearRegister(_d1); 568 #if !defined(KINETISK) 569 _d2PinMask = digitalPinToBitMask(_d2); 570 #endif 571 _d2PortSet = portSetRegister(_d2); 572 _d2PortClr = portClearRegister(_d2); 573 #if !defined(KINETISK) 574 _d3PinMask = digitalPinToBitMask(_d3); 575 #endif 576 _d3PortSet = portSetRegister(_d3); 577 _d3PortClr = portClearRegister(_d3); 578 #if !defined(KINETISK) 579 _d4PinMask = digitalPinToBitMask(_d4); 580 #endif 581 _d4PortSet = portSetRegister(_d4); 582 _d4PortClr = portClearRegister(_d4); 583 #if !defined(KINETISK) 584 _d5PinMask = digitalPinToBitMask(_d5); 585 #endif 586 _d5PortSet = portSetRegister(_d5); 587 _d5PortClr = portClearRegister(_d5); 588 #if !defined(KINETISK) 589 _d6PinMask = digitalPinToBitMask(_d6); 590 #endif 591 _d6PortSet = portSetRegister(_d6); 592 _d6PortClr = portClearRegister(_d6); 593 #if !defined(KINETISK) 594 _d7PinMask = digitalPinToBitMask(_d7); 595 #endif 596 _d7PortSet = portSetRegister(_d7); 597 _d7PortClr = portClearRegister(_d7); 598 #if !defined(KINETISK) 599 _d8PinMask = digitalPinToBitMask(_d8); 600 #endif 601 _d8PortSet = portSetRegister(_d8); 602 _d8PortClr = portClearRegister(_d8); 603 #if !defined(KINETISK) 604 _d9PinMask = digitalPinToBitMask(_d9); 605 #endif 606 _d9PortSet = portSetRegister(_d9); 607 _d9PortClr = portClearRegister(_d9); 608 #if !defined(KINETISK) 609 _d10PinMask = digitalPinToBitMask(_d10); 610 #endif 611 _d10PortSet = portSetRegister(_d10); 612 _d10PortClr = portClearRegister(_d10); 613 #if !defined(KINETISK) 614 _d11PinMask = digitalPinToBitMask(_d11); 615 #endif 616 _d11PortSet = portSetRegister(_d11); 617 _d11PortClr = portClearRegister(_d11); 618 #if !defined(KINETISK) 619 _d12PinMask = digitalPinToBitMask(_d12); 620 #endif 621 _d12PortSet = portSetRegister(_d12); 622 _d12PortClr = portClearRegister(_d12); 623 #if !defined(KINETISK) 624 _d13PinMask = digitalPinToBitMask(_d13); 625 #endif 626 _d13PortSet = portSetRegister(_d13); 627 _d13PortClr = portClearRegister(_d13); 628 #if !defined(KINETISK) 629 _d14PinMask = digitalPinToBitMask(_d14); 630 #endif 631 _d14PortSet = portSetRegister(_d14); 632 _d14PortClr = portClearRegister(_d14); 633 #if !defined(KINETISK) 634 _d15PinMask = digitalPinToBitMask(_d15); 635 #endif 636 _d15PortSet = portSetRegister(_d15); 637 _d15PortClr = portClearRegister(_d15); 638 #else // !CORE_TEENSY 639 _dcPinMask = digitalPinToBitMask(_dc); 640 _dcPortSet = &(PORT->Group[g_APinDescription[_dc].ulPort].OUTSET.reg); 641 _dcPortClr = &(PORT->Group[g_APinDescription[_dc].ulPort].OUTCLR.reg); 642 if (_cs != GFX_NOT_DEFINED) 643 { 644 _csPinMask = digitalPinToBitMask(_cs); 645 _csPortSet = &(PORT->Group[g_APinDescription[_cs].ulPort].OUTSET.reg); 646 _csPortClr = &(PORT->Group[g_APinDescription[_cs].ulPort].OUTCLR.reg); 647 } 648 _wrPinMask = digitalPinToBitMask(_wr); 649 _wrPortSet = &(PORT->Group[g_APinDescription[_wr].ulPort].OUTSET.reg); 650 _wrPortClr = &(PORT->Group[g_APinDescription[_wr].ulPort].OUTCLR.reg); 651 if (_rd != GFX_NOT_DEFINED) 652 { 653 _rdPinMask = digitalPinToBitMask(_rd); 654 _rdPortSet = &(PORT->Group[g_APinDescription[_rd].ulPort].OUTSET.reg); 655 _rdPortClr = &(PORT->Group[g_APinDescription[_rd].ulPort].OUTCLR.reg); 656 } 657 _d0PinMask = digitalPinToBitMask(_d0); 658 _d0PortSet = &(PORT->Group[g_APinDescription[_d0].ulPort].OUTSET.reg); 659 _d0PortClr = &(PORT->Group[g_APinDescription[_d0].ulPort].OUTCLR.reg); 660 _d1PinMask = digitalPinToBitMask(_d1); 661 _d1PortSet = &(PORT->Group[g_APinDescription[_d1].ulPort].OUTSET.reg); 662 _d1PortClr = &(PORT->Group[g_APinDescription[_d1].ulPort].OUTCLR.reg); 663 _d2PinMask = digitalPinToBitMask(_d2); 664 _d2PortSet = &(PORT->Group[g_APinDescription[_d2].ulPort].OUTSET.reg); 665 _d2PortClr = &(PORT->Group[g_APinDescription[_d2].ulPort].OUTCLR.reg); 666 _d3PinMask = digitalPinToBitMask(_d3); 667 _d3PortSet = &(PORT->Group[g_APinDescription[_d3].ulPort].OUTSET.reg); 668 _d3PortClr = &(PORT->Group[g_APinDescription[_d3].ulPort].OUTCLR.reg); 669 _d4PinMask = digitalPinToBitMask(_d4); 670 _d4PortSet = &(PORT->Group[g_APinDescription[_d4].ulPort].OUTSET.reg); 671 _d4PortClr = &(PORT->Group[g_APinDescription[_d4].ulPort].OUTCLR.reg); 672 _d5PinMask = digitalPinToBitMask(_d5); 673 _d5PortSet = &(PORT->Group[g_APinDescription[_d5].ulPort].OUTSET.reg); 674 _d5PortClr = &(PORT->Group[g_APinDescription[_d5].ulPort].OUTCLR.reg); 675 _d6PinMask = digitalPinToBitMask(_d6); 676 _d6PortSet = &(PORT->Group[g_APinDescription[_d6].ulPort].OUTSET.reg); 677 _d6PortClr = &(PORT->Group[g_APinDescription[_d6].ulPort].OUTCLR.reg); 678 _d7PinMask = digitalPinToBitMask(_d7); 679 _d7PortSet = &(PORT->Group[g_APinDescription[_d7].ulPort].OUTSET.reg); 680 _d7PortClr = &(PORT->Group[g_APinDescription[_d7].ulPort].OUTCLR.reg); 681 _d8PinMask = digitalPinToBitMask(_d8); 682 _d8PortSet = &(PORT->Group[g_APinDescription[_d8].ulPort].OUTSET.reg); 683 _d8PortClr = &(PORT->Group[g_APinDescription[_d8].ulPort].OUTCLR.reg); 684 _d9PinMask = digitalPinToBitMask(_d9); 685 _d9PortSet = &(PORT->Group[g_APinDescription[_d9].ulPort].OUTSET.reg); 686 _d9PortClr = &(PORT->Group[g_APinDescription[_d9].ulPort].OUTCLR.reg); 687 _d10PinMask = digitalPinToBitMask(_d10); 688 _d10PortSet = &(PORT->Group[g_APinDescription[_d10].ulPort].OUTSET.reg); 689 _d10PortClr = &(PORT->Group[g_APinDescription[_d10].ulPort].OUTCLR.reg); 690 _d11PinMask = digitalPinToBitMask(_d11); 691 _d11PortSet = &(PORT->Group[g_APinDescription[_d11].ulPort].OUTSET.reg); 692 _d11PortClr = &(PORT->Group[g_APinDescription[_d11].ulPort].OUTCLR.reg); 693 _d12PinMask = digitalPinToBitMask(_d12); 694 _d12PortSet = &(PORT->Group[g_APinDescription[_d12].ulPort].OUTSET.reg); 695 _d12PortClr = &(PORT->Group[g_APinDescription[_d12].ulPort].OUTCLR.reg); 696 _d13PinMask = digitalPinToBitMask(_d13); 697 _d13PortSet = &(PORT->Group[g_APinDescription[_d13].ulPort].OUTSET.reg); 698 _d13PortClr = &(PORT->Group[g_APinDescription[_d13].ulPort].OUTCLR.reg); 699 _d14PinMask = digitalPinToBitMask(_d14); 700 _d14PortSet = &(PORT->Group[g_APinDescription[_d14].ulPort].OUTSET.reg); 701 _d14PortClr = &(PORT->Group[g_APinDescription[_d14].ulPort].OUTCLR.reg); 702 _d15PinMask = digitalPinToBitMask(_d15); 703 _d15PortSet = &(PORT->Group[g_APinDescription[_d15].ulPort].OUTSET.reg); 704 _d15PortClr = &(PORT->Group[g_APinDescription[_d15].ulPort].OUTCLR.reg); 705 #endif // end !CORE_TEENSY 706 #else // !HAS_PORT_SET_CLR 707 _dcPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_dc)); 708 _dcPinMaskSet = digitalPinToBitMask(_dc); 709 _dcPinMaskClr = ~_dcPinMaskSet; 710 if (_cs != GFX_NOT_DEFINED) 711 { 712 _csPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_cs)); 713 _csPinMaskSet = digitalPinToBitMask(_cs); 714 _csPinMaskClr = ~_csPinMaskSet; 715 } 716 _wrPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_wr)); 717 _wrPinMaskSet = digitalPinToBitMask(_wr); 718 _wrPinMaskClr = ~_wrPinMaskSet; 719 if (_rd != GFX_NOT_DEFINED) 720 { 721 _rdPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_rd)); 722 _rdPinMaskSet = digitalPinToBitMask(_rd); 723 _rdPinMaskClr = ~_rdPinMaskSet; 724 } 725 _d0Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d0)); 726 _d0PinMaskSet = digitalPinToBitMask(_d0); 727 _d0PinMaskClr = ~_d0PinMaskSet; 728 _d1Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d1)); 729 _d1PinMaskSet = digitalPinToBitMask(_d1); 730 _d1PinMaskClr = ~_d1PinMaskSet; 731 _d2Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d2)); 732 _d2PinMaskSet = digitalPinToBitMask(_d2); 733 _d2PinMaskClr = ~_d2PinMaskSet; 734 _d3Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d3)); 735 _d3PinMaskSet = digitalPinToBitMask(_d3); 736 _d3PinMaskClr = ~_d3PinMaskSet; 737 _d4Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d4)); 738 _d4PinMaskSet = digitalPinToBitMask(_d4); 739 _d4PinMaskClr = ~_d4PinMaskSet; 740 _d5Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d5)); 741 _d5PinMaskSet = digitalPinToBitMask(_d5); 742 _d5PinMaskClr = ~_d5PinMaskSet; 743 _d6Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d6)); 744 _d6PinMaskSet = digitalPinToBitMask(_d6); 745 _d6PinMaskClr = ~_d6PinMaskSet; 746 _d7Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d7)); 747 _d7PinMaskSet = digitalPinToBitMask(_d7); 748 _d7PinMaskClr = ~_d7PinMaskSet; 749 _d8Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d8)); 750 _d8PinMaskSet = digitalPinToBitMask(_d8); 751 _d8PinMaskClr = ~_d8PinMaskSet; 752 _d9Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d9)); 753 _d9PinMaskSet = digitalPinToBitMask(_d9); 754 _d9PinMaskClr = ~_d9PinMaskSet; 755 _d10Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d10)); 756 _d10PinMaskSet = digitalPinToBitMask(_d10); 757 _d10PinMaskClr = ~_d10PinMaskSet; 758 _d11Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d11)); 759 _d11PinMaskSet = digitalPinToBitMask(_d11); 760 _d11PinMaskClr = ~_d11PinMaskSet; 761 _d12Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d12)); 762 _d12PinMaskSet = digitalPinToBitMask(_d12); 763 _d12PinMaskClr = ~_d12PinMaskSet; 764 _d13Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d13)); 765 _d13PinMaskSet = digitalPinToBitMask(_d13); 766 _d13PinMaskClr = ~_d13PinMaskSet; 767 _d14Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d14)); 768 _d14PinMaskSet = digitalPinToBitMask(_d14); 769 _d14PinMaskClr = ~_d14PinMaskSet; 770 _d15Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d15)); 771 _d15PinMaskSet = digitalPinToBitMask(_d15); 772 _d15PinMaskClr = ~_d15PinMaskSet; 773 #endif // !HAS_PORT_SET_CLR 774 #endif // USE_FAST_PINIO 775 776 return true; 777 } 778 779 void Arduino_SWPAR16::beginWrite() 780 { 781 DC_HIGH(); 782 CS_LOW(); 783 } 784 785 void Arduino_SWPAR16::endWrite() 786 { 787 CS_HIGH(); 788 } 789 790 void Arduino_SWPAR16::writeCommand(uint8_t c) 791 { 792 DC_LOW(); 793 794 WRITE(c); 795 796 DC_HIGH(); 797 } 798 799 void Arduino_SWPAR16::writeCommand16(uint16_t c) 800 { 801 DC_LOW(); 802 803 WRITE16(c); 804 805 DC_HIGH(); 806 } 807 808 void Arduino_SWPAR16::write(uint8_t d) 809 { 810 WRITE(d); 811 } 812 813 void Arduino_SWPAR16::write16(uint16_t d) 814 { 815 WRITE16(d); 816 } 817 818 void Arduino_SWPAR16::writeRepeat(uint16_t p, uint32_t len) 819 { 820 #if defined(ESP8266) 821 while (len > (ESP8266SAFEBATCHBITSIZE / 8)) 822 { 823 WRITEREPEAT(p, ESP8266SAFEBATCHBITSIZE / 8); 824 len -= ESP8266SAFEBATCHBITSIZE / 8; 825 yield(); 826 } 827 WRITEREPEAT(p, len); 828 #else 829 WRITEREPEAT(p, len); 830 #endif 831 } 832 833 void Arduino_SWPAR16::writePixels(uint16_t *data, uint32_t len) 834 { 835 while (len--) 836 { 837 WRITE16(*data++); 838 } 839 } 840 841 #if !defined(LITTLE_FOOT_PRINT) 842 void Arduino_SWPAR16::writeC8D8(uint8_t c, uint8_t d) 843 { 844 DC_LOW(); 845 846 WRITE(c); 847 848 DC_HIGH(); 849 850 WRITE(d); 851 } 852 853 void Arduino_SWPAR16::writeC8D16(uint8_t c, uint16_t d) 854 { 855 DC_LOW(); 856 857 WRITE(c); 858 859 DC_HIGH(); 860 861 WRITE16(d); 862 } 863 864 void Arduino_SWPAR16::writeC8D16D16(uint8_t c, uint16_t d1, uint16_t d2) 865 { 866 DC_LOW(); 867 868 WRITE(c); 869 870 DC_HIGH(); 871 872 WRITE16(d1); 873 WRITE16(d2); 874 } 875 876 void Arduino_SWPAR16::writeC8D16D16Split(uint8_t c, uint16_t d1, uint16_t d2) 877 { 878 DC_LOW(); 879 880 WRITE(c); 881 882 DC_HIGH(); 883 884 _data16.value = d1; 885 WRITE(_data16.msb); 886 WRITE(_data16.lsb); 887 888 _data16.value = d2; 889 WRITE(_data16.msb); 890 WRITE(_data16.lsb); 891 } 892 893 void Arduino_SWPAR16::writeBytes(uint8_t *data, uint32_t len) 894 { 895 while (len > 1) 896 { 897 _data16.msb = *data++; 898 _data16.lsb = *data++; 899 WRITE16(_data16.value); 900 len -= 2; 901 } 902 if (len) 903 { 904 WRITE(*data); 905 } 906 } 907 908 void Arduino_SWPAR16::writePattern(uint8_t *data, uint8_t len, uint32_t repeat) 909 { 910 while (repeat--) 911 { 912 writeBytes(data, len); 913 } 914 } 915 916 void Arduino_SWPAR16::writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_t len) 917 { 918 while (len--) 919 { 920 WRITE16(idx[*data++]); 921 } 922 } 923 924 void Arduino_SWPAR16::writeIndexedPixelsDouble(uint8_t *data, uint16_t *idx, uint32_t len) 925 { 926 while (len--) 927 { 928 _data16.value = idx[*data++]; 929 WRITE16(_data16.value); 930 WRITE16(_data16.value); 931 } 932 } 933 #endif // !defined(LITTLE_FOOT_PRINT) 934 935 void Arduino_SWPAR16::WRITE(uint8_t d) 936 { 937 if (d & 0x01) 938 { 939 D0_HIGH(); 940 } 941 else 942 { 943 D0_LOW(); 944 } 945 if (d & 0x02) 946 { 947 D1_HIGH(); 948 } 949 else 950 { 951 D1_LOW(); 952 } 953 if (d & 0x04) 954 { 955 D2_HIGH(); 956 } 957 else 958 { 959 D2_LOW(); 960 } 961 if (d & 0x08) 962 { 963 D3_HIGH(); 964 } 965 else 966 { 967 D3_LOW(); 968 } 969 if (d & 0x10) 970 { 971 D4_HIGH(); 972 } 973 else 974 { 975 D4_LOW(); 976 } 977 if (d & 0x20) 978 { 979 D5_HIGH(); 980 } 981 else 982 { 983 D5_LOW(); 984 } 985 if (d & 0x40) 986 { 987 D6_HIGH(); 988 } 989 else 990 { 991 D6_LOW(); 992 } 993 if (d & 0x80) 994 { 995 D7_HIGH(); 996 } 997 else 998 { 999 D7_LOW(); 1000 } 1001 WR_LOW(); 1002 WR_HIGH(); 1003 } 1004 1005 void Arduino_SWPAR16::WRITE16(uint16_t d) 1006 { 1007 if (d & 0x0001) 1008 { 1009 D0_HIGH(); 1010 } 1011 else 1012 { 1013 D0_LOW(); 1014 } 1015 if (d & 0x0002) 1016 { 1017 D1_HIGH(); 1018 } 1019 else 1020 { 1021 D1_LOW(); 1022 } 1023 if (d & 0x0004) 1024 { 1025 D2_HIGH(); 1026 } 1027 else 1028 { 1029 D2_LOW(); 1030 } 1031 if (d & 0x0008) 1032 { 1033 D3_HIGH(); 1034 } 1035 else 1036 { 1037 D3_LOW(); 1038 } 1039 if (d & 0x0010) 1040 { 1041 D4_HIGH(); 1042 } 1043 else 1044 { 1045 D4_LOW(); 1046 } 1047 if (d & 0x0020) 1048 { 1049 D5_HIGH(); 1050 } 1051 else 1052 { 1053 D5_LOW(); 1054 } 1055 if (d & 0x0040) 1056 { 1057 D6_HIGH(); 1058 } 1059 else 1060 { 1061 D6_LOW(); 1062 } 1063 if (d & 0x0080) 1064 { 1065 D7_HIGH(); 1066 } 1067 else 1068 { 1069 D7_LOW(); 1070 } 1071 if (d & 0x0100) 1072 { 1073 D8_HIGH(); 1074 } 1075 else 1076 { 1077 D8_LOW(); 1078 } 1079 if (d & 0x0200) 1080 { 1081 D9_HIGH(); 1082 } 1083 else 1084 { 1085 D9_LOW(); 1086 } 1087 if (d & 0x0400) 1088 { 1089 D10_HIGH(); 1090 } 1091 else 1092 { 1093 D10_LOW(); 1094 } 1095 if (d & 0x0800) 1096 { 1097 D11_HIGH(); 1098 } 1099 else 1100 { 1101 D11_LOW(); 1102 } 1103 if (d & 0x1000) 1104 { 1105 D12_HIGH(); 1106 } 1107 else 1108 { 1109 D12_LOW(); 1110 } 1111 if (d & 0x2000) 1112 { 1113 D13_HIGH(); 1114 } 1115 else 1116 { 1117 D13_LOW(); 1118 } 1119 if (d & 0x4000) 1120 { 1121 D14_HIGH(); 1122 } 1123 else 1124 { 1125 D14_LOW(); 1126 } 1127 if (d & 0x8000) 1128 { 1129 D15_HIGH(); 1130 } 1131 else 1132 { 1133 D15_LOW(); 1134 } 1135 WR_LOW(); 1136 WR_HIGH(); 1137 } 1138 1139 void Arduino_SWPAR16::WRITEREPEAT(uint16_t p, uint32_t len) 1140 { 1141 WRITE16(p); 1142 while (--len) 1143 { 1144 WR_LOW(); 1145 WR_HIGH(); 1146 } 1147 } 1148 1149 /******** low level bit twiddling **********/ 1150 1151 INLINE void Arduino_SWPAR16::DC_HIGH(void) 1152 { 1153 #if defined(USE_FAST_PINIO) 1154 #if defined(HAS_PORT_SET_CLR) 1155 #if defined(KINETISK) 1156 *_dcPortSet = 1; 1157 #else // !KINETISK 1158 *_dcPortSet = _dcPinMask; 1159 #endif // end !KINETISK 1160 #else // !HAS_PORT_SET_CLR 1161 *_dcPort |= _dcPinMaskSet; 1162 #endif // end !HAS_PORT_SET_CLR 1163 #else // !USE_FAST_PINIO 1164 digitalWrite(_dc, HIGH); 1165 #endif // end !USE_FAST_PINIO 1166 } 1167 1168 INLINE void Arduino_SWPAR16::DC_LOW(void) 1169 { 1170 #if defined(USE_FAST_PINIO) 1171 #if defined(HAS_PORT_SET_CLR) 1172 #if defined(KINETISK) 1173 *_dcPortClr = 1; 1174 #else // !KINETISK 1175 *_dcPortClr = _dcPinMask; 1176 #endif // end !KINETISK 1177 #else // !HAS_PORT_SET_CLR 1178 *_dcPort &= _dcPinMaskClr; 1179 #endif // end !HAS_PORT_SET_CLR 1180 #else // !USE_FAST_PINIO 1181 digitalWrite(_dc, LOW); 1182 #endif // end !USE_FAST_PINIO 1183 } 1184 1185 INLINE void Arduino_SWPAR16::CS_HIGH(void) 1186 { 1187 if (_cs != GFX_NOT_DEFINED) 1188 { 1189 #if defined(USE_FAST_PINIO) 1190 #if defined(HAS_PORT_SET_CLR) 1191 #if defined(KINETISK) 1192 *_csPortSet = 1; 1193 #else // !KINETISK 1194 *_csPortSet = _csPinMask; 1195 #endif // end !KINETISK 1196 #else // !HAS_PORT_SET_CLR 1197 *_csPort |= _csPinMaskSet; 1198 #endif // end !HAS_PORT_SET_CLR 1199 #else // !USE_FAST_PINIO 1200 digitalWrite(_cs, HIGH); 1201 #endif // end !USE_FAST_PINIO 1202 } 1203 } 1204 1205 INLINE void Arduino_SWPAR16::CS_LOW(void) 1206 { 1207 if (_cs != GFX_NOT_DEFINED) 1208 { 1209 #if defined(USE_FAST_PINIO) 1210 #if defined(HAS_PORT_SET_CLR) 1211 #if defined(KINETISK) 1212 *_csPortClr = 1; 1213 #else // !KINETISK 1214 *_csPortClr = _csPinMask; 1215 #endif // end !KINETISK 1216 #else // !HAS_PORT_SET_CLR 1217 *_csPort &= _csPinMaskClr; 1218 #endif // end !HAS_PORT_SET_CLR 1219 #else // !USE_FAST_PINIO 1220 digitalWrite(_cs, LOW); 1221 #endif // end !USE_FAST_PINIO 1222 } 1223 } 1224 1225 INLINE void Arduino_SWPAR16::WR_HIGH(void) 1226 { 1227 #if defined(USE_FAST_PINIO) 1228 #if defined(HAS_PORT_SET_CLR) 1229 #if defined(KINETISK) 1230 *_wrPortSet = 1; 1231 #else // !KINETISK 1232 *_wrPortSet = _wrPinMask; 1233 #endif // end !KINETISK 1234 #else // !HAS_PORT_SET_CLR 1235 *_wrPort |= _wrPinMaskSet; 1236 #endif // end !HAS_PORT_SET_CLR 1237 #else // !USE_FAST_PINIO 1238 digitalWrite(_wr, HIGH); 1239 #endif // end !USE_FAST_PINIO 1240 } 1241 1242 INLINE void Arduino_SWPAR16::WR_LOW(void) 1243 { 1244 #if defined(USE_FAST_PINIO) 1245 #if defined(HAS_PORT_SET_CLR) 1246 #if defined(KINETISK) 1247 *_wrPortClr = 1; 1248 #else // !KINETISK 1249 *_wrPortClr = _wrPinMask; 1250 #endif // end !KINETISK 1251 #else // !HAS_PORT_SET_CLR 1252 *_wrPort &= _wrPinMaskClr; 1253 #endif // end !HAS_PORT_SET_CLR 1254 #else // !USE_FAST_PINIO 1255 digitalWrite(_wr, LOW); 1256 #endif // end !USE_FAST_PINIO 1257 } 1258 1259 INLINE void Arduino_SWPAR16::RD_HIGH(void) 1260 { 1261 if (_rd != GFX_NOT_DEFINED) 1262 { 1263 #if defined(USE_FAST_PINIO) 1264 #if defined(HAS_PORT_SET_CLR) 1265 #if defined(KINETISK) 1266 *_rdPortSet = 1; 1267 #else // !KINETISK 1268 *_rdPortSet = _rdPinMask; 1269 #endif // end !KINETISK 1270 #else // !HAS_PORT_SET_CLR 1271 *_rdPort |= _rdPinMaskSet; 1272 #endif // end !HAS_PORT_SET_CLR 1273 #else // !USE_FAST_PINIO 1274 digitalWrite(_rd, HIGH); 1275 #endif // end !USE_FAST_PINIO 1276 } 1277 } 1278 1279 INLINE void Arduino_SWPAR16::RD_LOW(void) 1280 { 1281 if (_rd != GFX_NOT_DEFINED) 1282 { 1283 #if defined(USE_FAST_PINIO) 1284 #if defined(HAS_PORT_SET_CLR) 1285 #if defined(KINETISK) 1286 *_rdPortClr = 1; 1287 #else // !KINETISK 1288 *_rdPortClr = _rdPinMask; 1289 #endif // end !KINETISK 1290 #else // !HAS_PORT_SET_CLR 1291 *_rdPort &= _rdPinMaskClr; 1292 #endif // end !HAS_PORT_SET_CLR 1293 #else // !USE_FAST_PINIO 1294 digitalWrite(_rd, LOW); 1295 #endif // end !USE_FAST_PINIO 1296 } 1297 } 1298 1299 INLINE void Arduino_SWPAR16::D0_HIGH(void) 1300 { 1301 #if defined(USE_FAST_PINIO) 1302 #if defined(HAS_PORT_SET_CLR) 1303 #if defined(KINETISK) 1304 *_d0PortSet = 1; 1305 #else // !KINETISK 1306 *_d0PortSet = _d0PinMask; 1307 #endif // end !KINETISK 1308 #else // !HAS_PORT_SET_CLR 1309 *_d0Port |= _d0PinMaskSet; 1310 #endif // end !HAS_PORT_SET_CLR 1311 #else // !USE_FAST_PINIO 1312 digitalWrite(_d0, HIGH); 1313 #endif // end !USE_FAST_PINIO 1314 } 1315 1316 INLINE void Arduino_SWPAR16::D0_LOW(void) 1317 { 1318 #if defined(USE_FAST_PINIO) 1319 #if defined(HAS_PORT_SET_CLR) 1320 #if defined(KINETISK) 1321 *_d0PortClr = 1; 1322 #else // !KINETISK 1323 *_d0PortClr = _d0PinMask; 1324 #endif // end !KINETISK 1325 #else // !HAS_PORT_SET_CLR 1326 *_d0Port &= _d0PinMaskClr; 1327 #endif // end !HAS_PORT_SET_CLR 1328 #else // !USE_FAST_PINIO 1329 digitalWrite(_d0, LOW); 1330 #endif // end !USE_FAST_PINIO 1331 } 1332 1333 INLINE void Arduino_SWPAR16::D1_HIGH(void) 1334 { 1335 #if defined(USE_FAST_PINIO) 1336 #if defined(HAS_PORT_SET_CLR) 1337 #if defined(KINETISK) 1338 *_d1PortSet = 1; 1339 #else // !KINETISK 1340 *_d1PortSet = _d1PinMask; 1341 #endif // end !KINETISK 1342 #else // !HAS_PORT_SET_CLR 1343 *_d1Port |= _d1PinMaskSet; 1344 #endif // end !HAS_PORT_SET_CLR 1345 #else // !USE_FAST_PINIO 1346 digitalWrite(_d1, HIGH); 1347 #endif // end !USE_FAST_PINIO 1348 } 1349 1350 INLINE void Arduino_SWPAR16::D1_LOW(void) 1351 { 1352 #if defined(USE_FAST_PINIO) 1353 #if defined(HAS_PORT_SET_CLR) 1354 #if defined(KINETISK) 1355 *_d1PortClr = 1; 1356 #else // !KINETISK 1357 *_d1PortClr = _d1PinMask; 1358 #endif // end !KINETISK 1359 #else // !HAS_PORT_SET_CLR 1360 *_d1Port &= _d1PinMaskClr; 1361 #endif // end !HAS_PORT_SET_CLR 1362 #else // !USE_FAST_PINIO 1363 digitalWrite(_d1, LOW); 1364 #endif // end !USE_FAST_PINIO 1365 } 1366 1367 INLINE void Arduino_SWPAR16::D2_HIGH(void) 1368 { 1369 #if defined(USE_FAST_PINIO) 1370 #if defined(HAS_PORT_SET_CLR) 1371 #if defined(KINETISK) 1372 *_d2PortSet = 1; 1373 #else // !KINETISK 1374 *_d2PortSet = _d2PinMask; 1375 #endif // end !KINETISK 1376 #else // !HAS_PORT_SET_CLR 1377 *_d2Port |= _d2PinMaskSet; 1378 #endif // end !HAS_PORT_SET_CLR 1379 #else // !USE_FAST_PINIO 1380 digitalWrite(_d2, HIGH); 1381 #endif // end !USE_FAST_PINIO 1382 } 1383 1384 INLINE void Arduino_SWPAR16::D2_LOW(void) 1385 { 1386 #if defined(USE_FAST_PINIO) 1387 #if defined(HAS_PORT_SET_CLR) 1388 #if defined(KINETISK) 1389 *_d2PortClr = 1; 1390 #else // !KINETISK 1391 *_d2PortClr = _d2PinMask; 1392 #endif // end !KINETISK 1393 #else // !HAS_PORT_SET_CLR 1394 *_d2Port &= _d2PinMaskClr; 1395 #endif // end !HAS_PORT_SET_CLR 1396 #else // !USE_FAST_PINIO 1397 digitalWrite(_d2, LOW); 1398 #endif // end !USE_FAST_PINIO 1399 } 1400 1401 INLINE void Arduino_SWPAR16::D3_HIGH(void) 1402 { 1403 #if defined(USE_FAST_PINIO) 1404 #if defined(HAS_PORT_SET_CLR) 1405 #if defined(KINETISK) 1406 *_d3PortSet = 1; 1407 #else // !KINETISK 1408 *_d3PortSet = _d3PinMask; 1409 #endif // end !KINETISK 1410 #else // !HAS_PORT_SET_CLR 1411 *_d3Port |= _d3PinMaskSet; 1412 #endif // end !HAS_PORT_SET_CLR 1413 #else // !USE_FAST_PINIO 1414 digitalWrite(_d3, HIGH); 1415 #endif // end !USE_FAST_PINIO 1416 } 1417 1418 INLINE void Arduino_SWPAR16::D3_LOW(void) 1419 { 1420 #if defined(USE_FAST_PINIO) 1421 #if defined(HAS_PORT_SET_CLR) 1422 #if defined(KINETISK) 1423 *_d3PortClr = 1; 1424 #else // !KINETISK 1425 *_d3PortClr = _d3PinMask; 1426 #endif // end !KINETISK 1427 #else // !HAS_PORT_SET_CLR 1428 *_d3Port &= _d3PinMaskClr; 1429 #endif // end !HAS_PORT_SET_CLR 1430 #else // !USE_FAST_PINIO 1431 digitalWrite(_d3, LOW); 1432 #endif // end !USE_FAST_PINIO 1433 } 1434 1435 INLINE void Arduino_SWPAR16::D4_HIGH(void) 1436 { 1437 #if defined(USE_FAST_PINIO) 1438 #if defined(HAS_PORT_SET_CLR) 1439 #if defined(KINETISK) 1440 *_d4PortSet = 1; 1441 #else // !KINETISK 1442 *_d4PortSet = _d4PinMask; 1443 #endif // end !KINETISK 1444 #else // !HAS_PORT_SET_CLR 1445 *_d4Port |= _d4PinMaskSet; 1446 #endif // end !HAS_PORT_SET_CLR 1447 #else // !USE_FAST_PINIO 1448 digitalWrite(_d4, HIGH); 1449 #endif // end !USE_FAST_PINIO 1450 } 1451 1452 INLINE void Arduino_SWPAR16::D4_LOW(void) 1453 { 1454 #if defined(USE_FAST_PINIO) 1455 #if defined(HAS_PORT_SET_CLR) 1456 #if defined(KINETISK) 1457 *_d4PortClr = 1; 1458 #else // !KINETISK 1459 *_d4PortClr = _d4PinMask; 1460 #endif // end !KINETISK 1461 #else // !HAS_PORT_SET_CLR 1462 *_d4Port &= _d4PinMaskClr; 1463 #endif // end !HAS_PORT_SET_CLR 1464 #else // !USE_FAST_PINIO 1465 digitalWrite(_d4, LOW); 1466 #endif // end !USE_FAST_PINIO 1467 } 1468 1469 INLINE void Arduino_SWPAR16::D5_HIGH(void) 1470 { 1471 #if defined(USE_FAST_PINIO) 1472 #if defined(HAS_PORT_SET_CLR) 1473 #if defined(KINETISK) 1474 *_d5PortSet = 1; 1475 #else // !KINETISK 1476 *_d5PortSet = _d5PinMask; 1477 #endif // end !KINETISK 1478 #else // !HAS_PORT_SET_CLR 1479 *_d5Port |= _d5PinMaskSet; 1480 #endif // end !HAS_PORT_SET_CLR 1481 #else // !USE_FAST_PINIO 1482 digitalWrite(_d5, HIGH); 1483 #endif // end !USE_FAST_PINIO 1484 } 1485 1486 INLINE void Arduino_SWPAR16::D5_LOW(void) 1487 { 1488 #if defined(USE_FAST_PINIO) 1489 #if defined(HAS_PORT_SET_CLR) 1490 #if defined(KINETISK) 1491 *_d5PortClr = 1; 1492 #else // !KINETISK 1493 *_d5PortClr = _d5PinMask; 1494 #endif // end !KINETISK 1495 #else // !HAS_PORT_SET_CLR 1496 *_d5Port &= _d5PinMaskClr; 1497 #endif // end !HAS_PORT_SET_CLR 1498 #else // !USE_FAST_PINIO 1499 digitalWrite(_d5, LOW); 1500 #endif // end !USE_FAST_PINIO 1501 } 1502 1503 INLINE void Arduino_SWPAR16::D6_HIGH(void) 1504 { 1505 #if defined(USE_FAST_PINIO) 1506 #if defined(HAS_PORT_SET_CLR) 1507 #if defined(KINETISK) 1508 *_d6PortSet = 1; 1509 #else // !KINETISK 1510 *_d6PortSet = _d6PinMask; 1511 #endif // end !KINETISK 1512 #else // !HAS_PORT_SET_CLR 1513 *_d6Port |= _d6PinMaskSet; 1514 #endif // end !HAS_PORT_SET_CLR 1515 #else // !USE_FAST_PINIO 1516 digitalWrite(_d6, HIGH); 1517 #endif // end !USE_FAST_PINIO 1518 } 1519 1520 INLINE void Arduino_SWPAR16::D6_LOW(void) 1521 { 1522 #if defined(USE_FAST_PINIO) 1523 #if defined(HAS_PORT_SET_CLR) 1524 #if defined(KINETISK) 1525 *_d6PortClr = 1; 1526 #else // !KINETISK 1527 *_d6PortClr = _d6PinMask; 1528 #endif // end !KINETISK 1529 #else // !HAS_PORT_SET_CLR 1530 *_d6Port &= _d6PinMaskClr; 1531 #endif // end !HAS_PORT_SET_CLR 1532 #else // !USE_FAST_PINIO 1533 digitalWrite(_d6, LOW); 1534 #endif // end !USE_FAST_PINIO 1535 } 1536 1537 INLINE void Arduino_SWPAR16::D7_HIGH(void) 1538 { 1539 #if defined(USE_FAST_PINIO) 1540 #if defined(HAS_PORT_SET_CLR) 1541 #if defined(KINETISK) 1542 *_d7PortSet = 1; 1543 #else // !KINETISK 1544 *_d7PortSet = _d7PinMask; 1545 #endif // end !KINETISK 1546 #else // !HAS_PORT_SET_CLR 1547 *_d7Port |= _d7PinMaskSet; 1548 #endif // end !HAS_PORT_SET_CLR 1549 #else // !USE_FAST_PINIO 1550 digitalWrite(_d7, HIGH); 1551 #endif // end !USE_FAST_PINIO 1552 } 1553 1554 INLINE void Arduino_SWPAR16::D7_LOW(void) 1555 { 1556 #if defined(USE_FAST_PINIO) 1557 #if defined(HAS_PORT_SET_CLR) 1558 #if defined(KINETISK) 1559 *_d7PortClr = 1; 1560 #else // !KINETISK 1561 *_d7PortClr = _d7PinMask; 1562 #endif // end !KINETISK 1563 #else // !HAS_PORT_SET_CLR 1564 *_d7Port &= _d7PinMaskClr; 1565 #endif // end !HAS_PORT_SET_CLR 1566 #else // !USE_FAST_PINIO 1567 digitalWrite(_d7, LOW); 1568 #endif // end !USE_FAST_PINIO 1569 } 1570 1571 INLINE void Arduino_SWPAR16::D8_HIGH(void) 1572 { 1573 #if defined(USE_FAST_PINIO) 1574 #if defined(HAS_PORT_SET_CLR) 1575 #if defined(KINETISK) 1576 *_d8PortSet = 1; 1577 #else // !KINETISK 1578 *_d8PortSet = _d8PinMask; 1579 #endif // end !KINETISK 1580 #else // !HAS_PORT_SET_CLR 1581 *_d8Port |= _d8PinMaskSet; 1582 #endif // end !HAS_PORT_SET_CLR 1583 #else // !USE_FAST_PINIO 1584 digitalWrite(_d8, HIGH); 1585 #endif // end !USE_FAST_PINIO 1586 } 1587 1588 INLINE void Arduino_SWPAR16::D8_LOW(void) 1589 { 1590 #if defined(USE_FAST_PINIO) 1591 #if defined(HAS_PORT_SET_CLR) 1592 #if defined(KINETISK) 1593 *_d8PortClr = 1; 1594 #else // !KINETISK 1595 *_d8PortClr = _d8PinMask; 1596 #endif // end !KINETISK 1597 #else // !HAS_PORT_SET_CLR 1598 *_d8Port &= _d8PinMaskClr; 1599 #endif // end !HAS_PORT_SET_CLR 1600 #else // !USE_FAST_PINIO 1601 digitalWrite(_d8, LOW); 1602 #endif // end !USE_FAST_PINIO 1603 } 1604 1605 INLINE void Arduino_SWPAR16::D9_HIGH(void) 1606 { 1607 #if defined(USE_FAST_PINIO) 1608 #if defined(HAS_PORT_SET_CLR) 1609 #if defined(KINETISK) 1610 *_d9PortSet = 1; 1611 #else // !KINETISK 1612 *_d9PortSet = _d9PinMask; 1613 #endif // end !KINETISK 1614 #else // !HAS_PORT_SET_CLR 1615 *_d9Port |= _d9PinMaskSet; 1616 #endif // end !HAS_PORT_SET_CLR 1617 #else // !USE_FAST_PINIO 1618 digitalWrite(_d9, HIGH); 1619 #endif // end !USE_FAST_PINIO 1620 } 1621 1622 INLINE void Arduino_SWPAR16::D9_LOW(void) 1623 { 1624 #if defined(USE_FAST_PINIO) 1625 #if defined(HAS_PORT_SET_CLR) 1626 #if defined(KINETISK) 1627 *_d9PortClr = 1; 1628 #else // !KINETISK 1629 *_d9PortClr = _d9PinMask; 1630 #endif // end !KINETISK 1631 #else // !HAS_PORT_SET_CLR 1632 *_d9Port &= _d9PinMaskClr; 1633 #endif // end !HAS_PORT_SET_CLR 1634 #else // !USE_FAST_PINIO 1635 digitalWrite(_d9, LOW); 1636 #endif // end !USE_FAST_PINIO 1637 } 1638 1639 INLINE void Arduino_SWPAR16::D10_HIGH(void) 1640 { 1641 #if defined(USE_FAST_PINIO) 1642 #if defined(HAS_PORT_SET_CLR) 1643 #if defined(KINETISK) 1644 *_d10PortSet = 1; 1645 #else // !KINETISK 1646 *_d10PortSet = _d10PinMask; 1647 #endif // end !KINETISK 1648 #else // !HAS_PORT_SET_CLR 1649 *_d10Port |= _d10PinMaskSet; 1650 #endif // end !HAS_PORT_SET_CLR 1651 #else // !USE_FAST_PINIO 1652 digitalWrite(_d10, HIGH); 1653 #endif // end !USE_FAST_PINIO 1654 } 1655 1656 INLINE void Arduino_SWPAR16::D10_LOW(void) 1657 { 1658 #if defined(USE_FAST_PINIO) 1659 #if defined(HAS_PORT_SET_CLR) 1660 #if defined(KINETISK) 1661 *_d10PortClr = 1; 1662 #else // !KINETISK 1663 *_d10PortClr = _d10PinMask; 1664 #endif // end !KINETISK 1665 #else // !HAS_PORT_SET_CLR 1666 *_d10Port &= _d10PinMaskClr; 1667 #endif // end !HAS_PORT_SET_CLR 1668 #else // !USE_FAST_PINIO 1669 digitalWrite(_d10, LOW); 1670 #endif // end !USE_FAST_PINIO 1671 } 1672 1673 INLINE void Arduino_SWPAR16::D11_HIGH(void) 1674 { 1675 #if defined(USE_FAST_PINIO) 1676 #if defined(HAS_PORT_SET_CLR) 1677 #if defined(KINETISK) 1678 *_d11PortSet = 1; 1679 #else // !KINETISK 1680 *_d11PortSet = _d11PinMask; 1681 #endif // end !KINETISK 1682 #else // !HAS_PORT_SET_CLR 1683 *_d11Port |= _d11PinMaskSet; 1684 #endif // end !HAS_PORT_SET_CLR 1685 #else // !USE_FAST_PINIO 1686 digitalWrite(_d11, HIGH); 1687 #endif // end !USE_FAST_PINIO 1688 } 1689 1690 INLINE void Arduino_SWPAR16::D11_LOW(void) 1691 { 1692 #if defined(USE_FAST_PINIO) 1693 #if defined(HAS_PORT_SET_CLR) 1694 #if defined(KINETISK) 1695 *_d11PortClr = 1; 1696 #else // !KINETISK 1697 *_d11PortClr = _d11PinMask; 1698 #endif // end !KINETISK 1699 #else // !HAS_PORT_SET_CLR 1700 *_d11Port &= _d11PinMaskClr; 1701 #endif // end !HAS_PORT_SET_CLR 1702 #else // !USE_FAST_PINIO 1703 digitalWrite(_d11, LOW); 1704 #endif // end !USE_FAST_PINIO 1705 } 1706 1707 INLINE void Arduino_SWPAR16::D12_HIGH(void) 1708 { 1709 #if defined(USE_FAST_PINIO) 1710 #if defined(HAS_PORT_SET_CLR) 1711 #if defined(KINETISK) 1712 *_d12PortSet = 1; 1713 #else // !KINETISK 1714 *_d12PortSet = _d12PinMask; 1715 #endif // end !KINETISK 1716 #else // !HAS_PORT_SET_CLR 1717 *_d12Port |= _d12PinMaskSet; 1718 #endif // end !HAS_PORT_SET_CLR 1719 #else // !USE_FAST_PINIO 1720 digitalWrite(_d12, HIGH); 1721 #endif // end !USE_FAST_PINIO 1722 } 1723 1724 INLINE void Arduino_SWPAR16::D12_LOW(void) 1725 { 1726 #if defined(USE_FAST_PINIO) 1727 #if defined(HAS_PORT_SET_CLR) 1728 #if defined(KINETISK) 1729 *_d12PortClr = 1; 1730 #else // !KINETISK 1731 *_d12PortClr = _d12PinMask; 1732 #endif // end !KINETISK 1733 #else // !HAS_PORT_SET_CLR 1734 *_d12Port &= _d12PinMaskClr; 1735 #endif // end !HAS_PORT_SET_CLR 1736 #else // !USE_FAST_PINIO 1737 digitalWrite(_d12, LOW); 1738 #endif // end !USE_FAST_PINIO 1739 } 1740 1741 INLINE void Arduino_SWPAR16::D13_HIGH(void) 1742 { 1743 #if defined(USE_FAST_PINIO) 1744 #if defined(HAS_PORT_SET_CLR) 1745 #if defined(KINETISK) 1746 *_d13PortSet = 1; 1747 #else // !KINETISK 1748 *_d13PortSet = _d13PinMask; 1749 #endif // end !KINETISK 1750 #else // !HAS_PORT_SET_CLR 1751 *_d13Port |= _d13PinMaskSet; 1752 #endif // end !HAS_PORT_SET_CLR 1753 #else // !USE_FAST_PINIO 1754 digitalWrite(_d13, HIGH); 1755 #endif // end !USE_FAST_PINIO 1756 } 1757 1758 INLINE void Arduino_SWPAR16::D13_LOW(void) 1759 { 1760 #if defined(USE_FAST_PINIO) 1761 #if defined(HAS_PORT_SET_CLR) 1762 #if defined(KINETISK) 1763 *_d13PortClr = 1; 1764 #else // !KINETISK 1765 *_d13PortClr = _d13PinMask; 1766 #endif // end !KINETISK 1767 #else // !HAS_PORT_SET_CLR 1768 *_d13Port &= _d13PinMaskClr; 1769 #endif // end !HAS_PORT_SET_CLR 1770 #else // !USE_FAST_PINIO 1771 digitalWrite(_d13, LOW); 1772 #endif // end !USE_FAST_PINIO 1773 } 1774 1775 INLINE void Arduino_SWPAR16::D14_HIGH(void) 1776 { 1777 #if defined(USE_FAST_PINIO) 1778 #if defined(HAS_PORT_SET_CLR) 1779 #if defined(KINETISK) 1780 *_d14PortSet = 1; 1781 #else // !KINETISK 1782 *_d14PortSet = _d6PinMask; 1783 #endif // end !KINETISK 1784 #else // !HAS_PORT_SET_CLR 1785 *_d14Port |= _d14PinMaskSet; 1786 #endif // end !HAS_PORT_SET_CLR 1787 #else // !USE_FAST_PINIO 1788 digitalWrite(_d14, HIGH); 1789 #endif // end !USE_FAST_PINIO 1790 } 1791 1792 INLINE void Arduino_SWPAR16::D14_LOW(void) 1793 { 1794 #if defined(USE_FAST_PINIO) 1795 #if defined(HAS_PORT_SET_CLR) 1796 #if defined(KINETISK) 1797 *_d14PortClr = 1; 1798 #else // !KINETISK 1799 *_d14PortClr = _d14PinMask; 1800 #endif // end !KINETISK 1801 #else // !HAS_PORT_SET_CLR 1802 *_d14Port &= _d14PinMaskClr; 1803 #endif // end !HAS_PORT_SET_CLR 1804 #else // !USE_FAST_PINIO 1805 digitalWrite(_d14, LOW); 1806 #endif // end !USE_FAST_PINIO 1807 } 1808 1809 INLINE void Arduino_SWPAR16::D15_HIGH(void) 1810 { 1811 #if defined(USE_FAST_PINIO) 1812 #if defined(HAS_PORT_SET_CLR) 1813 #if defined(KINETISK) 1814 *_d15PortSet = 1; 1815 #else // !KINETISK 1816 *_d15PortSet = _d15PinMask; 1817 #endif // end !KINETISK 1818 #else // !HAS_PORT_SET_CLR 1819 *_d15Port |= _d15PinMaskSet; 1820 #endif // end !HAS_PORT_SET_CLR 1821 #else // !USE_FAST_PINIO 1822 digitalWrite(_d15, HIGH); 1823 #endif // end !USE_FAST_PINIO 1824 } 1825 1826 INLINE void Arduino_SWPAR16::D15_LOW(void) 1827 { 1828 #if defined(USE_FAST_PINIO) 1829 #if defined(HAS_PORT_SET_CLR) 1830 #if defined(KINETISK) 1831 *_d15PortClr = 1; 1832 #else // !KINETISK 1833 *_d15PortClr = _d15PinMask; 1834 #endif // end !KINETISK 1835 #else // !HAS_PORT_SET_CLR 1836 *_d15Port &= _d15PinMaskClr; 1837 #endif // end !HAS_PORT_SET_CLR 1838 #else // !USE_FAST_PINIO 1839 digitalWrite(_d15, LOW); 1840 #endif // end !USE_FAST_PINIO 1841 }