lib/SSD1306_Shim/SSD1306_Shim.cpp
// Issue single byte out SPI, either soft or hardware as appropriate.
// SPI transaction/selection must be performed in calling function.
Issue single byte out SPI, either soft or hardware as appropriate.
SPI transaction/selection must be performed in calling function.
Issue single byte out SPI either soft or hardware as appropriate . SPI transaction / selection must be performed in calling function .
inline void SSD1306_Shim::SPIwrite(uint8_t d) {
  if (spi) {
    (void)spi->transfer(d);
  } else {
    for (uint8_t bit = 0x80; bit; bit >>= 1) {
#ifdef HAVE_PORTREG
      if (d & bit)
        *mosiPort |= mosiPinMask;
      else
        *mosiPort &= ~mosiPinMask;
      *clkPort |= clkPinMask;  
      *clkPort &= ~clkPinMask; 
#else
      digitalWrite(mosiPin, d & bit);
      digitalWrite(clkPin, HIGH);
      digitalWrite(clkPin, LOW);
#endif
    }
  }
}
inline void SSD1306_Shim :: SPIwrite ( uint8_t d ) { if ( spi ) { ( void ) spi -> transfer ( d ) ; } else { for ( uint8_t bit = 0x80 ; bit ; bit >>= 1 ) { #ifdef HAVE_PORTREG if ( d & bit ) * mosiPort |= mosiPinMask ; else * mosiPort &= ~ mosiPinMask ; * clkPort |= clkPinMask ; * clkPort &= ~ clkPinMask ; #else digitalWrite ( mosiPin , d & bit ) ; digitalWrite ( clkPin , HIGH ) ; digitalWrite ( clkPin , LOW ) ; #endif } } }
Issue single byte out SPI, either soft or hardware as appropriate.
Issue single byte out SPI either soft or hardware as appropriate .
// Clock high // Clock low