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_SWPAR8.cpp (29050B)

      1 #include "Arduino_SWPAR8.h"
      2 
      3 Arduino_SWPAR8::Arduino_SWPAR8(
      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     : _dc(dc), _cs(cs), _wr(wr), _rd(rd),
      7       _d0(d0), _d1(d1), _d2(d2), _d3(d3), _d4(d4), _d5(d5), _d6(d6), _d7(d7)
      8 {
      9 }
     10 
     11 bool Arduino_SWPAR8::begin(int32_t speed, int8_t dataMode)
     12 {
     13   UNUSED(speed);
     14   UNUSED(dataMode);
     15 
     16   pinMode(_dc, OUTPUT);
     17   digitalWrite(_dc, HIGH); // Data mode
     18   if (_cs != GFX_NOT_DEFINED)
     19   {
     20     pinMode(_cs, OUTPUT);
     21     digitalWrite(_cs, HIGH); // Deselect
     22   }
     23   pinMode(_wr, OUTPUT);
     24   digitalWrite(_wr, HIGH);
     25   if (_rd != GFX_NOT_DEFINED)
     26   {
     27     pinMode(_rd, OUTPUT);
     28     digitalWrite(_rd, HIGH);
     29   }
     30   pinMode(_d0, OUTPUT);
     31   digitalWrite(_d0, LOW);
     32   pinMode(_d1, OUTPUT);
     33   digitalWrite(_d1, LOW);
     34   pinMode(_d2, OUTPUT);
     35   digitalWrite(_d2, LOW);
     36   pinMode(_d3, OUTPUT);
     37   digitalWrite(_d3, LOW);
     38   pinMode(_d4, OUTPUT);
     39   digitalWrite(_d4, LOW);
     40   pinMode(_d5, OUTPUT);
     41   digitalWrite(_d5, LOW);
     42   pinMode(_d6, OUTPUT);
     43   digitalWrite(_d6, LOW);
     44   pinMode(_d7, OUTPUT);
     45   digitalWrite(_d7, LOW);
     46 
     47 #if defined(USE_FAST_PINIO)
     48 #if defined(HAS_PORT_SET_CLR)
     49 #if defined(ARDUINO_ARCH_NRF52840)
     50   uint32_t pin = digitalPinToPinName((pin_size_t)_dc);
     51   NRF_GPIO_Type *reg = nrf_gpio_pin_port_decode(&pin);
     52   _dcPortSet = &reg->OUTSET;
     53   _dcPortClr = &reg->OUTCLR;
     54   _dcPinMask = 1UL << pin;
     55   if (_cs != GFX_NOT_DEFINED)
     56   {
     57     pin = digitalPinToPinName((pin_size_t)_cs);
     58     reg = nrf_gpio_pin_port_decode(&pin);
     59     _csPortSet = &reg->OUTSET;
     60     _csPortClr = &reg->OUTCLR;
     61     _csPinMask = 1UL << pin;
     62   }
     63   pin = digitalPinToPinName((pin_size_t)_wr);
     64   reg = nrf_gpio_pin_port_decode(&pin);
     65   _wrPortSet = &reg->OUTSET;
     66   _wrPortClr = &reg->OUTCLR;
     67   _wrPinMask = 1UL << pin;
     68   if (_rd != GFX_NOT_DEFINED)
     69   {
     70     pin = digitalPinToPinName((pin_size_t)_rd);
     71     reg = nrf_gpio_pin_port_decode(&pin);
     72     _rdPortSet = &reg->OUTSET;
     73     _rdPortClr = &reg->OUTCLR;
     74     _rdPinMask = 1UL << pin;
     75   }
     76   pin = digitalPinToPinName((pin_size_t)_d0);
     77   reg = nrf_gpio_pin_port_decode(&pin);
     78   _d0PortSet = &reg->OUTSET;
     79   _d0PortClr = &reg->OUTCLR;
     80   _d0PinMask = 1UL << pin;
     81   pin = digitalPinToPinName((pin_size_t)_d1);
     82   reg = nrf_gpio_pin_port_decode(&pin);
     83   _d1PortSet = &reg->OUTSET;
     84   _d1PortClr = &reg->OUTCLR;
     85   _d1PinMask = 1UL << pin;
     86   pin = digitalPinToPinName((pin_size_t)_d2);
     87   reg = nrf_gpio_pin_port_decode(&pin);
     88   _d2PortSet = &reg->OUTSET;
     89   _d2PortClr = &reg->OUTCLR;
     90   _d2PinMask = 1UL << pin;
     91   pin = digitalPinToPinName((pin_size_t)_d3);
     92   reg = nrf_gpio_pin_port_decode(&pin);
     93   _d3PortSet = &reg->OUTSET;
     94   _d3PortClr = &reg->OUTCLR;
     95   _d3PinMask = 1UL << pin;
     96   pin = digitalPinToPinName((pin_size_t)_d4);
     97   reg = nrf_gpio_pin_port_decode(&pin);
     98   _d4PortSet = &reg->OUTSET;
     99   _d4PortClr = &reg->OUTCLR;
    100   _d4PinMask = 1UL << pin;
    101   pin = digitalPinToPinName((pin_size_t)_d5);
    102   reg = nrf_gpio_pin_port_decode(&pin);
    103   _d5PortSet = &reg->OUTSET;
    104   _d5PortClr = &reg->OUTCLR;
    105   _d5PinMask = 1UL << pin;
    106   pin = digitalPinToPinName((pin_size_t)_d6);
    107   reg = nrf_gpio_pin_port_decode(&pin);
    108   _d6PortSet = &reg->OUTSET;
    109   _d6PortClr = &reg->OUTCLR;
    110   _d6PinMask = 1UL << pin;
    111   pin = digitalPinToPinName((pin_size_t)_d7);
    112   reg = nrf_gpio_pin_port_decode(&pin);
    113   _d7PortSet = &reg->OUTSET;
    114   _d7PortClr = &reg->OUTCLR;
    115   _d7PinMask = 1UL << pin;
    116 #elif defined(TARGET_RP2040)
    117   _dcPinMask = digitalPinToBitMask(_dc);
    118   _dcPortSet = (PORTreg_t)&sio_hw->gpio_set;
    119   _dcPortClr = (PORTreg_t)&sio_hw->gpio_clr;
    120   if (_cs != GFX_NOT_DEFINED)
    121   {
    122     _csPinMask = digitalPinToBitMask(_cs);
    123     _csPortSet = (PORTreg_t)&sio_hw->gpio_set;
    124     _csPortClr = (PORTreg_t)&sio_hw->gpio_clr;
    125   }
    126   _wrPinMask = digitalPinToBitMask(_wr);
    127   _wrPortSet = (PORTreg_t)&sio_hw->gpio_set;
    128   _wrPortClr = (PORTreg_t)&sio_hw->gpio_clr;
    129   if (_rd != GFX_NOT_DEFINED)
    130   {
    131     _rdPinMask = digitalPinToBitMask(_rd);
    132     _rdPortSet = (PORTreg_t)&sio_hw->gpio_set;
    133     _rdPortClr = (PORTreg_t)&sio_hw->gpio_clr;
    134   }
    135   _d0PinMask = digitalPinToBitMask(_d0);
    136   _d0PortSet = (PORTreg_t)&sio_hw->gpio_set;
    137   _d0PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    138   _d1PinMask = digitalPinToBitMask(_d1);
    139   _d1PortSet = (PORTreg_t)&sio_hw->gpio_set;
    140   _d1PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    141   _d2PinMask = digitalPinToBitMask(_d2);
    142   _d2PortSet = (PORTreg_t)&sio_hw->gpio_set;
    143   _d2PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    144   _d3PinMask = digitalPinToBitMask(_d3);
    145   _d3PortSet = (PORTreg_t)&sio_hw->gpio_set;
    146   _d3PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    147   _d4PinMask = digitalPinToBitMask(_d4);
    148   _d4PortSet = (PORTreg_t)&sio_hw->gpio_set;
    149   _d4PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    150   _d5PinMask = digitalPinToBitMask(_d5);
    151   _d5PortSet = (PORTreg_t)&sio_hw->gpio_set;
    152   _d5PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    153   _d6PinMask = digitalPinToBitMask(_d6);
    154   _d6PortSet = (PORTreg_t)&sio_hw->gpio_set;
    155   _d6PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    156   _d7PinMask = digitalPinToBitMask(_d7);
    157   _d7PortSet = (PORTreg_t)&sio_hw->gpio_set;
    158   _d7PortClr = (PORTreg_t)&sio_hw->gpio_clr;
    159 #elif defined(ESP32) && (CONFIG_IDF_TARGET_ESP32C3)
    160   _dcPinMask = digitalPinToBitMask(_dc);
    161   _dcPortSet = (PORTreg_t)&GPIO.out_w1ts;
    162   _dcPortClr = (PORTreg_t)&GPIO.out_w1tc;
    163   if (_cs != GFX_NOT_DEFINED)
    164   {
    165     _csPinMask = digitalPinToBitMask(_cs);
    166     _csPortSet = (PORTreg_t)&GPIO.out_w1ts;
    167     _csPortClr = (PORTreg_t)&GPIO.out_w1tc;
    168   }
    169   _wrPinMask = digitalPinToBitMask(_wr);
    170   _wrPortSet = (PORTreg_t)&GPIO.out_w1ts;
    171   _wrPortClr = (PORTreg_t)&GPIO.out_w1tc;
    172   if (_rd != GFX_NOT_DEFINED)
    173   {
    174     _rdPinMask = digitalPinToBitMask(_rd);
    175     _rdPortSet = (PORTreg_t)&GPIO.out_w1ts;
    176     _rdPortClr = (PORTreg_t)&GPIO.out_w1tc;
    177   }
    178   _d0PinMask = digitalPinToBitMask(_d0);
    179   _d0PortSet = (PORTreg_t)&GPIO.out_w1ts;
    180   _d0PortClr = (PORTreg_t)&GPIO.out_w1tc;
    181   _d1PinMask = digitalPinToBitMask(_d1);
    182   _d1PortSet = (PORTreg_t)&GPIO.out_w1ts;
    183   _d1PortClr = (PORTreg_t)&GPIO.out_w1tc;
    184   _d2PinMask = digitalPinToBitMask(_d2);
    185   _d2PortSet = (PORTreg_t)&GPIO.out_w1ts;
    186   _d2PortClr = (PORTreg_t)&GPIO.out_w1tc;
    187   _d3PinMask = digitalPinToBitMask(_d3);
    188   _d3PortSet = (PORTreg_t)&GPIO.out_w1ts;
    189   _d3PortClr = (PORTreg_t)&GPIO.out_w1tc;
    190   _d4PinMask = digitalPinToBitMask(_d4);
    191   _d4PortSet = (PORTreg_t)&GPIO.out_w1ts;
    192   _d4PortClr = (PORTreg_t)&GPIO.out_w1tc;
    193   _d5PinMask = digitalPinToBitMask(_d5);
    194   _d5PortSet = (PORTreg_t)&GPIO.out_w1ts;
    195   _d5PortClr = (PORTreg_t)&GPIO.out_w1tc;
    196   _d6PinMask = digitalPinToBitMask(_d6);
    197   _d6PortSet = (PORTreg_t)&GPIO.out_w1ts;
    198   _d6PortClr = (PORTreg_t)&GPIO.out_w1tc;
    199   _d7PinMask = digitalPinToBitMask(_d7);
    200   _d7PortSet = (PORTreg_t)&GPIO.out_w1ts;
    201   _d7PortClr = (PORTreg_t)&GPIO.out_w1tc;
    202 #elif defined(ESP32)
    203   _dcPinMask = digitalPinToBitMask(_dc);
    204   if (_dc >= 32)
    205   {
    206     _dcPortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    207     _dcPortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    208   }
    209   else
    210   {
    211     _dcPortSet = (PORTreg_t)&GPIO.out_w1ts;
    212     _dcPortClr = (PORTreg_t)&GPIO.out_w1tc;
    213   }
    214   if (_cs >= 32)
    215   {
    216     _csPinMask = digitalPinToBitMask(_cs);
    217     _csPortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    218     _csPortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    219   }
    220   else if (_cs != GFX_NOT_DEFINED)
    221   {
    222     _csPinMask = digitalPinToBitMask(_cs);
    223     _csPortSet = (PORTreg_t)&GPIO.out_w1ts;
    224     _csPortClr = (PORTreg_t)&GPIO.out_w1tc;
    225   }
    226   _wrPinMask = digitalPinToBitMask(_wr);
    227   if (_wr >= 32)
    228   {
    229     _wrPortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    230     _wrPortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    231   }
    232   else
    233   {
    234     _wrPortSet = (PORTreg_t)&GPIO.out_w1ts;
    235     _wrPortClr = (PORTreg_t)&GPIO.out_w1tc;
    236   }
    237   if (_rd >= 32)
    238   {
    239     _rdPinMask = digitalPinToBitMask(_rd);
    240     _rdPortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    241     _rdPortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    242   }
    243   else if (_rd != GFX_NOT_DEFINED)
    244   {
    245     _rdPinMask = digitalPinToBitMask(_rd);
    246     _rdPortSet = (PORTreg_t)&GPIO.out_w1ts;
    247     _rdPortClr = (PORTreg_t)&GPIO.out_w1tc;
    248   }
    249   _d0PinMask = digitalPinToBitMask(_d0);
    250   if (_d0 >= 32)
    251   {
    252     _d0PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    253     _d0PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    254   }
    255   else
    256   {
    257     _d0PortSet = (PORTreg_t)&GPIO.out_w1ts;
    258     _d0PortClr = (PORTreg_t)&GPIO.out_w1tc;
    259   }
    260   _d1PinMask = digitalPinToBitMask(_d1);
    261   if (_d1 >= 32)
    262   {
    263     _d1PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    264     _d1PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    265   }
    266   else
    267   {
    268     _d1PortSet = (PORTreg_t)&GPIO.out_w1ts;
    269     _d1PortClr = (PORTreg_t)&GPIO.out_w1tc;
    270   }
    271   _d2PinMask = digitalPinToBitMask(_d2);
    272   if (_d2 >= 32)
    273   {
    274     _d2PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    275     _d2PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    276   }
    277   else
    278   {
    279     _d2PortSet = (PORTreg_t)&GPIO.out_w1ts;
    280     _d2PortClr = (PORTreg_t)&GPIO.out_w1tc;
    281   }
    282   _d3PinMask = digitalPinToBitMask(_d3);
    283   if (_d3 >= 32)
    284   {
    285     _d3PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    286     _d3PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    287   }
    288   else
    289   {
    290     _d3PortSet = (PORTreg_t)&GPIO.out_w1ts;
    291     _d3PortClr = (PORTreg_t)&GPIO.out_w1tc;
    292   }
    293   _d4PinMask = digitalPinToBitMask(_d4);
    294   if (_d4 >= 32)
    295   {
    296     _d4PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    297     _d4PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    298   }
    299   else
    300   {
    301     _d4PortSet = (PORTreg_t)&GPIO.out_w1ts;
    302     _d4PortClr = (PORTreg_t)&GPIO.out_w1tc;
    303   }
    304   _d5PinMask = digitalPinToBitMask(_d5);
    305   if (_d5 >= 32)
    306   {
    307     _d5PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    308     _d5PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    309   }
    310   else
    311   {
    312     _d5PortSet = (PORTreg_t)&GPIO.out_w1ts;
    313     _d5PortClr = (PORTreg_t)&GPIO.out_w1tc;
    314   }
    315   _d6PinMask = digitalPinToBitMask(_d6);
    316   if (_d6 >= 32)
    317   {
    318     _d6PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    319     _d6PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    320   }
    321   else
    322   {
    323     _d6PortSet = (PORTreg_t)&GPIO.out_w1ts;
    324     _d6PortClr = (PORTreg_t)&GPIO.out_w1tc;
    325   }
    326   _d7PinMask = digitalPinToBitMask(_d7);
    327   if (_d7 >= 32)
    328   {
    329     _d7PortSet = (PORTreg_t)&GPIO.out1_w1ts.val;
    330     _d7PortClr = (PORTreg_t)&GPIO.out1_w1tc.val;
    331   }
    332   else
    333   {
    334     _d7PortSet = (PORTreg_t)&GPIO.out_w1ts;
    335     _d7PortClr = (PORTreg_t)&GPIO.out_w1tc;
    336   }
    337 #elif defined(CORE_TEENSY)
    338 #if !defined(KINETISK)
    339   _dcPinMask = digitalPinToBitMask(_dc);
    340 #endif
    341   _dcPortSet = portSetRegister(_dc);
    342   _dcPortClr = portClearRegister(_dc);
    343   if (_cs != GFX_NOT_DEFINED)
    344   {
    345 #if !defined(KINETISK)
    346     _csPinMask = digitalPinToBitMask(_cs);
    347 #endif
    348     _csPortSet = portSetRegister(_cs);
    349     _csPortClr = portClearRegister(_cs);
    350   }
    351 #if !defined(KINETISK)
    352   _wrPinMask = digitalPinToBitMask(_wr);
    353 #endif
    354   _wrPortSet = portSetRegister(_wr);
    355   _wrPortClr = portClearRegister(_wr);
    356   if (_rd != GFX_NOT_DEFINED)
    357   {
    358 #if !defined(KINETISK)
    359     _rdPinMask = digitalPinToBitMask(_rd);
    360 #endif
    361     _rdPortSet = portSetRegister(_rd);
    362     _rdPortClr = portClearRegister(_rd);
    363   }
    364 #if !defined(KINETISK)
    365   _d0PinMask = digitalPinToBitMask(_d0);
    366 #endif
    367   _d0PortSet = portSetRegister(_d0);
    368   _d0PortClr = portClearRegister(_d0);
    369 #if !defined(KINETISK)
    370   _d1PinMask = digitalPinToBitMask(_d1);
    371 #endif
    372   _d1PortSet = portSetRegister(_d1);
    373   _d1PortClr = portClearRegister(_d1);
    374 #if !defined(KINETISK)
    375   _d2PinMask = digitalPinToBitMask(_d2);
    376 #endif
    377   _d2PortSet = portSetRegister(_d2);
    378   _d2PortClr = portClearRegister(_d2);
    379 #if !defined(KINETISK)
    380   _d3PinMask = digitalPinToBitMask(_d3);
    381 #endif
    382   _d3PortSet = portSetRegister(_d3);
    383   _d3PortClr = portClearRegister(_d3);
    384 #if !defined(KINETISK)
    385   _d4PinMask = digitalPinToBitMask(_d4);
    386 #endif
    387   _d4PortSet = portSetRegister(_d4);
    388   _d4PortClr = portClearRegister(_d4);
    389 #if !defined(KINETISK)
    390   _d5PinMask = digitalPinToBitMask(_d5);
    391 #endif
    392   _d5PortSet = portSetRegister(_d5);
    393   _d5PortClr = portClearRegister(_d5);
    394 #if !defined(KINETISK)
    395   _d6PinMask = digitalPinToBitMask(_d6);
    396 #endif
    397   _d6PortSet = portSetRegister(_d6);
    398   _d6PortClr = portClearRegister(_d6);
    399 #if !defined(KINETISK)
    400   _d7PinMask = digitalPinToBitMask(_d7);
    401 #endif
    402   _d7PortSet = portSetRegister(_d7);
    403   _d7PortClr = portClearRegister(_d7);
    404 #else  // !CORE_TEENSY
    405   _dcPinMask = digitalPinToBitMask(_dc);
    406   _dcPortSet = &(PORT->Group[g_APinDescription[_dc].ulPort].OUTSET.reg);
    407   _dcPortClr = &(PORT->Group[g_APinDescription[_dc].ulPort].OUTCLR.reg);
    408   if (_cs != GFX_NOT_DEFINED)
    409   {
    410     _csPinMask = digitalPinToBitMask(_cs);
    411     _csPortSet = &(PORT->Group[g_APinDescription[_cs].ulPort].OUTSET.reg);
    412     _csPortClr = &(PORT->Group[g_APinDescription[_cs].ulPort].OUTCLR.reg);
    413   }
    414   _wrPinMask = digitalPinToBitMask(_wr);
    415   _wrPortSet = &(PORT->Group[g_APinDescription[_wr].ulPort].OUTSET.reg);
    416   _wrPortClr = &(PORT->Group[g_APinDescription[_wr].ulPort].OUTCLR.reg);
    417   if (_rd != GFX_NOT_DEFINED)
    418   {
    419     _rdPinMask = digitalPinToBitMask(_rd);
    420     _rdPortSet = &(PORT->Group[g_APinDescription[_rd].ulPort].OUTSET.reg);
    421     _rdPortClr = &(PORT->Group[g_APinDescription[_rd].ulPort].OUTCLR.reg);
    422   }
    423   _d0PinMask = digitalPinToBitMask(_d0);
    424   _d0PortSet = &(PORT->Group[g_APinDescription[_d0].ulPort].OUTSET.reg);
    425   _d0PortClr = &(PORT->Group[g_APinDescription[_d0].ulPort].OUTCLR.reg);
    426   _d1PinMask = digitalPinToBitMask(_d1);
    427   _d1PortSet = &(PORT->Group[g_APinDescription[_d1].ulPort].OUTSET.reg);
    428   _d1PortClr = &(PORT->Group[g_APinDescription[_d1].ulPort].OUTCLR.reg);
    429   _d2PinMask = digitalPinToBitMask(_d2);
    430   _d2PortSet = &(PORT->Group[g_APinDescription[_d2].ulPort].OUTSET.reg);
    431   _d2PortClr = &(PORT->Group[g_APinDescription[_d2].ulPort].OUTCLR.reg);
    432   _d3PinMask = digitalPinToBitMask(_d3);
    433   _d3PortSet = &(PORT->Group[g_APinDescription[_d3].ulPort].OUTSET.reg);
    434   _d3PortClr = &(PORT->Group[g_APinDescription[_d3].ulPort].OUTCLR.reg);
    435   _d4PinMask = digitalPinToBitMask(_d4);
    436   _d4PortSet = &(PORT->Group[g_APinDescription[_d4].ulPort].OUTSET.reg);
    437   _d4PortClr = &(PORT->Group[g_APinDescription[_d4].ulPort].OUTCLR.reg);
    438   _d5PinMask = digitalPinToBitMask(_d5);
    439   _d5PortSet = &(PORT->Group[g_APinDescription[_d5].ulPort].OUTSET.reg);
    440   _d5PortClr = &(PORT->Group[g_APinDescription[_d5].ulPort].OUTCLR.reg);
    441   _d6PinMask = digitalPinToBitMask(_d6);
    442   _d6PortSet = &(PORT->Group[g_APinDescription[_d6].ulPort].OUTSET.reg);
    443   _d6PortClr = &(PORT->Group[g_APinDescription[_d6].ulPort].OUTCLR.reg);
    444   _d7PinMask = digitalPinToBitMask(_d7);
    445   _d7PortSet = &(PORT->Group[g_APinDescription[_d7].ulPort].OUTSET.reg);
    446   _d7PortClr = &(PORT->Group[g_APinDescription[_d7].ulPort].OUTCLR.reg);
    447 #endif // end !CORE_TEENSY
    448 #else  // !HAS_PORT_SET_CLR
    449   _dcPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_dc));
    450   _dcPinMaskSet = digitalPinToBitMask(_dc);
    451   _dcPinMaskClr = ~_dcPinMaskSet;
    452   if (_cs != GFX_NOT_DEFINED)
    453   {
    454     _csPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_cs));
    455     _csPinMaskSet = digitalPinToBitMask(_cs);
    456   _csPinMaskClr = ~_csPinMaskSet;
    457   }
    458   _wrPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_wr));
    459   _wrPinMaskSet = digitalPinToBitMask(_wr);
    460   _wrPinMaskClr = ~_wrPinMaskSet;
    461   if (_rd != GFX_NOT_DEFINED)
    462   {
    463     _rdPort = (PORTreg_t)portOutputRegister(digitalPinToPort(_rd));
    464     _rdPinMaskSet = digitalPinToBitMask(_rd);
    465   _rdPinMaskClr = ~_rdPinMaskSet;
    466   }
    467   _d0Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d0));
    468   _d0PinMaskSet = digitalPinToBitMask(_d0);
    469   _d0PinMaskClr = ~_d0PinMaskSet;
    470   _d1Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d1));
    471   _d1PinMaskSet = digitalPinToBitMask(_d1);
    472   _d1PinMaskClr = ~_d1PinMaskSet;
    473   _d2Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d2));
    474   _d2PinMaskSet = digitalPinToBitMask(_d2);
    475   _d2PinMaskClr = ~_d2PinMaskSet;
    476   _d3Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d3));
    477   _d3PinMaskSet = digitalPinToBitMask(_d3);
    478   _d3PinMaskClr = ~_d3PinMaskSet;
    479   _d4Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d4));
    480   _d4PinMaskSet = digitalPinToBitMask(_d4);
    481   _d4PinMaskClr = ~_d4PinMaskSet;
    482   _d5Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d5));
    483   _d5PinMaskSet = digitalPinToBitMask(_d5);
    484   _d5PinMaskClr = ~_d5PinMaskSet;
    485   _d6Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d6));
    486   _d6PinMaskSet = digitalPinToBitMask(_d6);
    487   _d6PinMaskClr = ~_d6PinMaskSet;
    488   _d7Port = (PORTreg_t)portOutputRegister(digitalPinToPort(_d7));
    489   _d7PinMaskSet = digitalPinToBitMask(_d7);
    490   _d7PinMaskClr = ~_d7PinMaskSet;
    491 #endif // !HAS_PORT_SET_CLR
    492 #endif // USE_FAST_PINIO
    493 
    494   return true;
    495 }
    496 
    497 void Arduino_SWPAR8::beginWrite()
    498 {
    499   DC_HIGH();
    500   CS_LOW();
    501 }
    502 
    503 void Arduino_SWPAR8::endWrite()
    504 {
    505   CS_HIGH();
    506 }
    507 
    508 void Arduino_SWPAR8::writeCommand(uint8_t c)
    509 {
    510   DC_LOW();
    511 
    512   WRITE(c);
    513 
    514   DC_HIGH();
    515 }
    516 
    517 void Arduino_SWPAR8::writeCommand16(uint16_t c)
    518 {
    519   DC_LOW();
    520 
    521   _data16.value = c;
    522   WRITE(_data16.msb);
    523   WRITE(_data16.lsb);
    524 
    525   DC_HIGH();
    526 }
    527 
    528 void Arduino_SWPAR8::write(uint8_t d)
    529 {
    530   WRITE(d);
    531 }
    532 
    533 void Arduino_SWPAR8::write16(uint16_t d)
    534 {
    535   _data16.value = d;
    536   WRITE(_data16.msb);
    537   WRITE(_data16.lsb);
    538 }
    539 
    540 void Arduino_SWPAR8::writeRepeat(uint16_t p, uint32_t len)
    541 {
    542 #if defined(ESP8266)
    543   while (len > (ESP8266SAFEBATCHBITSIZE / 8))
    544   {
    545     WRITEREPEAT(p, ESP8266SAFEBATCHBITSIZE / 8);
    546     len -= ESP8266SAFEBATCHBITSIZE / 8;
    547     yield();
    548   }
    549   WRITEREPEAT(p, len);
    550 #else
    551   WRITEREPEAT(p, len);
    552 #endif
    553 }
    554 
    555 void Arduino_SWPAR8::writePixels(uint16_t *data, uint32_t len)
    556 {
    557   while (len--)
    558   {
    559     _data16.value = *data++;
    560     WRITE(_data16.msb);
    561     WRITE(_data16.lsb);
    562   }
    563 }
    564 
    565 #if !defined(LITTLE_FOOT_PRINT)
    566 void Arduino_SWPAR8::writeC8D8(uint8_t c, uint8_t d)
    567 {
    568   DC_LOW();
    569 
    570   WRITE(c);
    571 
    572   DC_HIGH();
    573 
    574   WRITE(d);
    575 }
    576 
    577 void Arduino_SWPAR8::writeC8D16(uint8_t c, uint16_t d)
    578 {
    579   DC_LOW();
    580 
    581   WRITE(c);
    582 
    583   DC_HIGH();
    584 
    585   _data16.value = d;
    586   WRITE(_data16.msb);
    587   WRITE(_data16.lsb);
    588 }
    589 
    590 void Arduino_SWPAR8::writeC8D16D16(uint8_t c, uint16_t d1, uint16_t d2)
    591 {
    592   DC_LOW();
    593 
    594   WRITE(c);
    595 
    596   DC_HIGH();
    597 
    598   _data16.value = d1;
    599   WRITE(_data16.msb);
    600   WRITE(_data16.lsb);
    601 
    602   _data16.value = d2;
    603   WRITE(_data16.msb);
    604   WRITE(_data16.lsb);
    605 }
    606 
    607 void Arduino_SWPAR8::writeBytes(uint8_t *data, uint32_t len)
    608 {
    609   while (len--)
    610   {
    611     WRITE(*data++);
    612   }
    613 }
    614 
    615 void Arduino_SWPAR8::writePattern(uint8_t *data, uint8_t len, uint32_t repeat)
    616 {
    617   while (repeat--)
    618   {
    619     writeBytes(data, len);
    620   }
    621 }
    622 
    623 void Arduino_SWPAR8::writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_t len)
    624 {
    625   while (len--)
    626   {
    627     _data16.value = idx[*data++];
    628     WRITE(_data16.msb);
    629     WRITE(_data16.lsb);
    630   }
    631 }
    632 
    633 void Arduino_SWPAR8::writeIndexedPixelsDouble(uint8_t *data, uint16_t *idx, uint32_t len)
    634 {
    635   while (len--)
    636   {
    637     _data16.value = idx[*data++];
    638     WRITE(_data16.msb);
    639     WRITE(_data16.lsb);
    640     WRITE(_data16.msb);
    641     WRITE(_data16.lsb);
    642   }
    643 }
    644 #endif // !defined(LITTLE_FOOT_PRINT)
    645 
    646 void Arduino_SWPAR8::WRITE(uint8_t d)
    647 {
    648   if (d & 0x01)
    649   {
    650     D0_HIGH();
    651   }
    652   else
    653   {
    654     D0_LOW();
    655   }
    656   if (d & 0x02)
    657   {
    658     D1_HIGH();
    659   }
    660   else
    661   {
    662     D1_LOW();
    663   }
    664   if (d & 0x04)
    665   {
    666     D2_HIGH();
    667   }
    668   else
    669   {
    670     D2_LOW();
    671   }
    672   if (d & 0x08)
    673   {
    674     D3_HIGH();
    675   }
    676   else
    677   {
    678     D3_LOW();
    679   }
    680   if (d & 0x10)
    681   {
    682     D4_HIGH();
    683   }
    684   else
    685   {
    686     D4_LOW();
    687   }
    688   if (d & 0x20)
    689   {
    690     D5_HIGH();
    691   }
    692   else
    693   {
    694     D5_LOW();
    695   }
    696   if (d & 0x40)
    697   {
    698     D6_HIGH();
    699   }
    700   else
    701   {
    702     D6_LOW();
    703   }
    704   if (d & 0x80)
    705   {
    706     D7_HIGH();
    707   }
    708   else
    709   {
    710     D7_LOW();
    711   }
    712   WR_LOW();
    713   WR_HIGH();
    714 }
    715 
    716 void Arduino_SWPAR8::WRITEREPEAT(uint16_t p, uint32_t len)
    717 {
    718   _data16.value = p;
    719   if (_data16.msb == _data16.lsb)
    720   {
    721     WRITE(_data16.msb);
    722     len <<= 1;
    723     while (--len)
    724     {
    725       WR_LOW();
    726       WR_HIGH();
    727     }
    728   }
    729   else
    730   {
    731     while (len--)
    732     {
    733       WRITE(_data16.msb);
    734       WRITE(_data16.lsb);
    735     }
    736   }
    737 }
    738 
    739 /******** low level bit twiddling **********/
    740 
    741 INLINE void Arduino_SWPAR8::DC_HIGH(void)
    742 {
    743 #if defined(USE_FAST_PINIO)
    744 #if defined(HAS_PORT_SET_CLR)
    745 #if defined(KINETISK)
    746   *_dcPortSet = 1;
    747 #else  // !KINETISK
    748   *_dcPortSet = _dcPinMask;
    749 #endif // end !KINETISK
    750 #else  // !HAS_PORT_SET_CLR
    751   *_dcPort |= _dcPinMaskSet;
    752 #endif // end !HAS_PORT_SET_CLR
    753 #else  // !USE_FAST_PINIO
    754   digitalWrite(_dc, HIGH);
    755 #endif // end !USE_FAST_PINIO
    756 }
    757 
    758 INLINE void Arduino_SWPAR8::DC_LOW(void)
    759 {
    760 #if defined(USE_FAST_PINIO)
    761 #if defined(HAS_PORT_SET_CLR)
    762 #if defined(KINETISK)
    763   *_dcPortClr = 1;
    764 #else  // !KINETISK
    765   *_dcPortClr = _dcPinMask;
    766 #endif // end !KINETISK
    767 #else  // !HAS_PORT_SET_CLR
    768   *_dcPort &= _dcPinMaskClr;
    769 #endif // end !HAS_PORT_SET_CLR
    770 #else  // !USE_FAST_PINIO
    771   digitalWrite(_dc, LOW);
    772 #endif // end !USE_FAST_PINIO
    773 }
    774 
    775 INLINE void Arduino_SWPAR8::CS_HIGH(void)
    776 {
    777   if (_cs != GFX_NOT_DEFINED)
    778   {
    779 #if defined(USE_FAST_PINIO)
    780 #if defined(HAS_PORT_SET_CLR)
    781 #if defined(KINETISK)
    782     *_csPortSet = 1;
    783 #else  // !KINETISK
    784     *_csPortSet = _csPinMask;
    785 #endif // end !KINETISK
    786 #else  // !HAS_PORT_SET_CLR
    787     *_csPort |= _csPinMaskSet;
    788 #endif // end !HAS_PORT_SET_CLR
    789 #else  // !USE_FAST_PINIO
    790     digitalWrite(_cs, HIGH);
    791 #endif // end !USE_FAST_PINIO
    792   }
    793 }
    794 
    795 INLINE void Arduino_SWPAR8::CS_LOW(void)
    796 {
    797   if (_cs != GFX_NOT_DEFINED)
    798   {
    799 #if defined(USE_FAST_PINIO)
    800 #if defined(HAS_PORT_SET_CLR)
    801 #if defined(KINETISK)
    802     *_csPortClr = 1;
    803 #else  // !KINETISK
    804     *_csPortClr = _csPinMask;
    805 #endif // end !KINETISK
    806 #else  // !HAS_PORT_SET_CLR
    807     *_csPort &= _csPinMaskClr;
    808 #endif // end !HAS_PORT_SET_CLR
    809 #else  // !USE_FAST_PINIO
    810     digitalWrite(_cs, LOW);
    811 #endif // end !USE_FAST_PINIO
    812   }
    813 }
    814 
    815 INLINE void Arduino_SWPAR8::WR_HIGH(void)
    816 {
    817 #if defined(USE_FAST_PINIO)
    818 #if defined(HAS_PORT_SET_CLR)
    819 #if defined(KINETISK)
    820   *_wrPortSet = 1;
    821 #else  // !KINETISK
    822   *_wrPortSet = _wrPinMask;
    823 #endif // end !KINETISK
    824 #else  // !HAS_PORT_SET_CLR
    825   *_wrPort |= _wrPinMaskSet;
    826 #endif // end !HAS_PORT_SET_CLR
    827 #else  // !USE_FAST_PINIO
    828   digitalWrite(_wr, HIGH);
    829 #endif // end !USE_FAST_PINIO
    830 }
    831 
    832 INLINE void Arduino_SWPAR8::WR_LOW(void)
    833 {
    834 #if defined(USE_FAST_PINIO)
    835 #if defined(HAS_PORT_SET_CLR)
    836 #if defined(KINETISK)
    837   *_wrPortClr = 1;
    838 #else  // !KINETISK
    839   *_wrPortClr = _wrPinMask;
    840 #endif // end !KINETISK
    841 #else  // !HAS_PORT_SET_CLR
    842   *_wrPort &= _wrPinMaskClr;
    843 #endif // end !HAS_PORT_SET_CLR
    844 #else  // !USE_FAST_PINIO
    845   digitalWrite(_wr, LOW);
    846 #endif // end !USE_FAST_PINIO
    847 }
    848 
    849 INLINE void Arduino_SWPAR8::RD_HIGH(void)
    850 {
    851   if (_rd != GFX_NOT_DEFINED)
    852   {
    853 #if defined(USE_FAST_PINIO)
    854 #if defined(HAS_PORT_SET_CLR)
    855 #if defined(KINETISK)
    856     *_rdPortSet = 1;
    857 #else  // !KINETISK
    858     *_rdPortSet = _rdPinMask;
    859 #endif // end !KINETISK
    860 #else  // !HAS_PORT_SET_CLR
    861     *_rdPort |= _rdPinMaskSet;
    862 #endif // end !HAS_PORT_SET_CLR
    863 #else  // !USE_FAST_PINIO
    864     digitalWrite(_rd, HIGH);
    865 #endif // end !USE_FAST_PINIO
    866   }
    867 }
    868 
    869 INLINE void Arduino_SWPAR8::RD_LOW(void)
    870 {
    871   if (_rd != GFX_NOT_DEFINED)
    872   {
    873 #if defined(USE_FAST_PINIO)
    874 #if defined(HAS_PORT_SET_CLR)
    875 #if defined(KINETISK)
    876     *_rdPortClr = 1;
    877 #else  // !KINETISK
    878     *_rdPortClr = _rdPinMask;
    879 #endif // end !KINETISK
    880 #else  // !HAS_PORT_SET_CLR
    881     *_rdPort &= _rdPinMaskClr;
    882 #endif // end !HAS_PORT_SET_CLR
    883 #else  // !USE_FAST_PINIO
    884     digitalWrite(_rd, LOW);
    885 #endif // end !USE_FAST_PINIO
    886   }
    887 }
    888 
    889 INLINE void Arduino_SWPAR8::D0_HIGH(void)
    890 {
    891 #if defined(USE_FAST_PINIO)
    892 #if defined(HAS_PORT_SET_CLR)
    893 #if defined(KINETISK)
    894   *_d0PortSet = 1;
    895 #else  // !KINETISK
    896   *_d0PortSet = _d0PinMask;
    897 #endif // end !KINETISK
    898 #else  // !HAS_PORT_SET_CLR
    899   *_d0Port |= _d0PinMaskSet;
    900 #endif // end !HAS_PORT_SET_CLR
    901 #else  // !USE_FAST_PINIO
    902   digitalWrite(_d0, HIGH);
    903 #endif // end !USE_FAST_PINIO
    904 }
    905 
    906 INLINE void Arduino_SWPAR8::D0_LOW(void)
    907 {
    908 #if defined(USE_FAST_PINIO)
    909 #if defined(HAS_PORT_SET_CLR)
    910 #if defined(KINETISK)
    911   *_d0PortClr = 1;
    912 #else  // !KINETISK
    913   *_d0PortClr = _d0PinMask;
    914 #endif // end !KINETISK
    915 #else  // !HAS_PORT_SET_CLR
    916   *_d0Port &= _d0PinMaskClr;
    917 #endif // end !HAS_PORT_SET_CLR
    918 #else  // !USE_FAST_PINIO
    919   digitalWrite(_d0, LOW);
    920 #endif // end !USE_FAST_PINIO
    921 }
    922 
    923 INLINE void Arduino_SWPAR8::D1_HIGH(void)
    924 {
    925 #if defined(USE_FAST_PINIO)
    926 #if defined(HAS_PORT_SET_CLR)
    927 #if defined(KINETISK)
    928   *_d1PortSet = 1;
    929 #else  // !KINETISK
    930   *_d1PortSet = _d1PinMask;
    931 #endif // end !KINETISK
    932 #else  // !HAS_PORT_SET_CLR
    933   *_d1Port |= _d1PinMaskSet;
    934 #endif // end !HAS_PORT_SET_CLR
    935 #else  // !USE_FAST_PINIO
    936   digitalWrite(_d1, HIGH);
    937 #endif // end !USE_FAST_PINIO
    938 }
    939 
    940 INLINE void Arduino_SWPAR8::D1_LOW(void)
    941 {
    942 #if defined(USE_FAST_PINIO)
    943 #if defined(HAS_PORT_SET_CLR)
    944 #if defined(KINETISK)
    945   *_d1PortClr = 1;
    946 #else  // !KINETISK
    947   *_d1PortClr = _d1PinMask;
    948 #endif // end !KINETISK
    949 #else  // !HAS_PORT_SET_CLR
    950   *_d1Port &= _d1PinMaskClr;
    951 #endif // end !HAS_PORT_SET_CLR
    952 #else  // !USE_FAST_PINIO
    953   digitalWrite(_d1, LOW);
    954 #endif // end !USE_FAST_PINIO
    955 }
    956 
    957 INLINE void Arduino_SWPAR8::D2_HIGH(void)
    958 {
    959 #if defined(USE_FAST_PINIO)
    960 #if defined(HAS_PORT_SET_CLR)
    961 #if defined(KINETISK)
    962   *_d2PortSet = 1;
    963 #else  // !KINETISK
    964   *_d2PortSet = _d2PinMask;
    965 #endif // end !KINETISK
    966 #else  // !HAS_PORT_SET_CLR
    967   *_d2Port |= _d2PinMaskSet;
    968 #endif // end !HAS_PORT_SET_CLR
    969 #else  // !USE_FAST_PINIO
    970   digitalWrite(_d2, HIGH);
    971 #endif // end !USE_FAST_PINIO
    972 }
    973 
    974 INLINE void Arduino_SWPAR8::D2_LOW(void)
    975 {
    976 #if defined(USE_FAST_PINIO)
    977 #if defined(HAS_PORT_SET_CLR)
    978 #if defined(KINETISK)
    979   *_d2PortClr = 1;
    980 #else  // !KINETISK
    981   *_d2PortClr = _d2PinMask;
    982 #endif // end !KINETISK
    983 #else  // !HAS_PORT_SET_CLR
    984   *_d2Port &= _d2PinMaskClr;
    985 #endif // end !HAS_PORT_SET_CLR
    986 #else  // !USE_FAST_PINIO
    987   digitalWrite(_d2, LOW);
    988 #endif // end !USE_FAST_PINIO
    989 }
    990 
    991 INLINE void Arduino_SWPAR8::D3_HIGH(void)
    992 {
    993 #if defined(USE_FAST_PINIO)
    994 #if defined(HAS_PORT_SET_CLR)
    995 #if defined(KINETISK)
    996   *_d3PortSet = 1;
    997 #else  // !KINETISK
    998   *_d3PortSet = _d3PinMask;
    999 #endif // end !KINETISK
   1000 #else  // !HAS_PORT_SET_CLR
   1001   *_d3Port |= _d3PinMaskSet;
   1002 #endif // end !HAS_PORT_SET_CLR
   1003 #else  // !USE_FAST_PINIO
   1004   digitalWrite(_d3, HIGH);
   1005 #endif // end !USE_FAST_PINIO
   1006 }
   1007 
   1008 INLINE void Arduino_SWPAR8::D3_LOW(void)
   1009 {
   1010 #if defined(USE_FAST_PINIO)
   1011 #if defined(HAS_PORT_SET_CLR)
   1012 #if defined(KINETISK)
   1013   *_d3PortClr = 1;
   1014 #else  // !KINETISK
   1015   *_d3PortClr = _d3PinMask;
   1016 #endif // end !KINETISK
   1017 #else  // !HAS_PORT_SET_CLR
   1018   *_d3Port &= _d3PinMaskClr;
   1019 #endif // end !HAS_PORT_SET_CLR
   1020 #else  // !USE_FAST_PINIO
   1021   digitalWrite(_d3, LOW);
   1022 #endif // end !USE_FAST_PINIO
   1023 }
   1024 
   1025 INLINE void Arduino_SWPAR8::D4_HIGH(void)
   1026 {
   1027 #if defined(USE_FAST_PINIO)
   1028 #if defined(HAS_PORT_SET_CLR)
   1029 #if defined(KINETISK)
   1030   *_d4PortSet = 1;
   1031 #else  // !KINETISK
   1032   *_d4PortSet = _d4PinMask;
   1033 #endif // end !KINETISK
   1034 #else  // !HAS_PORT_SET_CLR
   1035   *_d4Port |= _d4PinMaskSet;
   1036 #endif // end !HAS_PORT_SET_CLR
   1037 #else  // !USE_FAST_PINIO
   1038   digitalWrite(_d4, HIGH);
   1039 #endif // end !USE_FAST_PINIO
   1040 }
   1041 
   1042 INLINE void Arduino_SWPAR8::D4_LOW(void)
   1043 {
   1044 #if defined(USE_FAST_PINIO)
   1045 #if defined(HAS_PORT_SET_CLR)
   1046 #if defined(KINETISK)
   1047   *_d4PortClr = 1;
   1048 #else  // !KINETISK
   1049   *_d4PortClr = _d4PinMask;
   1050 #endif // end !KINETISK
   1051 #else  // !HAS_PORT_SET_CLR
   1052   *_d4Port &= _d4PinMaskClr;
   1053 #endif // end !HAS_PORT_SET_CLR
   1054 #else  // !USE_FAST_PINIO
   1055   digitalWrite(_d4, LOW);
   1056 #endif // end !USE_FAST_PINIO
   1057 }
   1058 
   1059 INLINE void Arduino_SWPAR8::D5_HIGH(void)
   1060 {
   1061 #if defined(USE_FAST_PINIO)
   1062 #if defined(HAS_PORT_SET_CLR)
   1063 #if defined(KINETISK)
   1064   *_d5PortSet = 1;
   1065 #else  // !KINETISK
   1066   *_d5PortSet = _d5PinMask;
   1067 #endif // end !KINETISK
   1068 #else  // !HAS_PORT_SET_CLR
   1069   *_d5Port |= _d5PinMaskSet;
   1070 #endif // end !HAS_PORT_SET_CLR
   1071 #else  // !USE_FAST_PINIO
   1072   digitalWrite(_d5, HIGH);
   1073 #endif // end !USE_FAST_PINIO
   1074 }
   1075 
   1076 INLINE void Arduino_SWPAR8::D5_LOW(void)
   1077 {
   1078 #if defined(USE_FAST_PINIO)
   1079 #if defined(HAS_PORT_SET_CLR)
   1080 #if defined(KINETISK)
   1081   *_d5PortClr = 1;
   1082 #else  // !KINETISK
   1083   *_d5PortClr = _d5PinMask;
   1084 #endif // end !KINETISK
   1085 #else  // !HAS_PORT_SET_CLR
   1086   *_d5Port &= _d5PinMaskClr;
   1087 #endif // end !HAS_PORT_SET_CLR
   1088 #else  // !USE_FAST_PINIO
   1089   digitalWrite(_d5, LOW);
   1090 #endif // end !USE_FAST_PINIO
   1091 }
   1092 
   1093 INLINE void Arduino_SWPAR8::D6_HIGH(void)
   1094 {
   1095 #if defined(USE_FAST_PINIO)
   1096 #if defined(HAS_PORT_SET_CLR)
   1097 #if defined(KINETISK)
   1098   *_d6PortSet = 1;
   1099 #else  // !KINETISK
   1100   *_d6PortSet = _d6PinMask;
   1101 #endif // end !KINETISK
   1102 #else  // !HAS_PORT_SET_CLR
   1103   *_d6Port |= _d6PinMaskSet;
   1104 #endif // end !HAS_PORT_SET_CLR
   1105 #else  // !USE_FAST_PINIO
   1106   digitalWrite(_d6, HIGH);
   1107 #endif // end !USE_FAST_PINIO
   1108 }
   1109 
   1110 INLINE void Arduino_SWPAR8::D6_LOW(void)
   1111 {
   1112 #if defined(USE_FAST_PINIO)
   1113 #if defined(HAS_PORT_SET_CLR)
   1114 #if defined(KINETISK)
   1115   *_d6PortClr = 1;
   1116 #else  // !KINETISK
   1117   *_d6PortClr = _d6PinMask;
   1118 #endif // end !KINETISK
   1119 #else  // !HAS_PORT_SET_CLR
   1120   *_d6Port &= _d6PinMaskClr;
   1121 #endif // end !HAS_PORT_SET_CLR
   1122 #else  // !USE_FAST_PINIO
   1123   digitalWrite(_d6, LOW);
   1124 #endif // end !USE_FAST_PINIO
   1125 }
   1126 
   1127 INLINE void Arduino_SWPAR8::D7_HIGH(void)
   1128 {
   1129 #if defined(USE_FAST_PINIO)
   1130 #if defined(HAS_PORT_SET_CLR)
   1131 #if defined(KINETISK)
   1132   *_d7PortSet = 1;
   1133 #else  // !KINETISK
   1134   *_d7PortSet = _d7PinMask;
   1135 #endif // end !KINETISK
   1136 #else  // !HAS_PORT_SET_CLR
   1137   *_d7Port |= _d7PinMaskSet;
   1138 #endif // end !HAS_PORT_SET_CLR
   1139 #else  // !USE_FAST_PINIO
   1140   digitalWrite(_d7, HIGH);
   1141 #endif // end !USE_FAST_PINIO
   1142 }
   1143 
   1144 INLINE void Arduino_SWPAR8::D7_LOW(void)
   1145 {
   1146 #if defined(USE_FAST_PINIO)
   1147 #if defined(HAS_PORT_SET_CLR)
   1148 #if defined(KINETISK)
   1149   *_d7PortClr = 1;
   1150 #else  // !KINETISK
   1151   *_d7PortClr = _d7PinMask;
   1152 #endif // end !KINETISK
   1153 #else  // !HAS_PORT_SET_CLR
   1154   *_d7Port &= _d7PinMaskClr;
   1155 #endif // end !HAS_PORT_SET_CLR
   1156 #else  // !USE_FAST_PINIO
   1157   digitalWrite(_d7, LOW);
   1158 #endif // end !USE_FAST_PINIO
   1159 }