Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various small cleanups #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions Adafruit_SPIDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(defined(SPI_INTERFACES_COUNT) && (SPI_INTERFACES_COUNT > 0))

//#define DEBUG_SERIAL Serial
// #define DEBUG_SWSERIAL

/*!
* @brief Create an SPI device with the given CS pin and settings
Expand All @@ -20,7 +21,6 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, uint32_t freq,
_cs = cspin;
_sck = _mosi = _miso = -1;
_spi = theSPI;
_begun = false;
_spiSetting = new SPISettings(freq, dataOrder, dataMode);
_freq = freq;
_dataOrder = dataOrder;
Expand Down Expand Up @@ -67,7 +67,6 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin,
_freq = freq;
_dataOrder = dataOrder;
_dataMode = dataMode;
_begun = false;
_spiSetting = new SPISettings(freq, dataOrder, dataMode);
_spi = nullptr;
}
Expand Down Expand Up @@ -109,7 +108,6 @@ bool Adafruit_SPIDevice::begin(void) {
}
}

_begun = true;
return true;
}

Expand Down Expand Up @@ -151,13 +149,12 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
uint8_t reply = 0;
uint8_t send = buffer[i];

/*
#ifdef DEBUG_SWSERIAL
Serial.print("\tSending software SPI byte 0x");
Serial.print(send, HEX);
Serial.print(" -> 0x");
*/
#endif

// Serial.print(send, HEX);
for (uint8_t b = startbit; b != 0;
b = (_dataOrder == SPI_BITORDER_LSBFIRST) ? b << 1 : b >> 1) {

Expand Down
1 change: 0 additions & 1 deletion Adafruit_SPIDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class Adafruit_SPIDevice {
BusIO_PortReg *mosiPort, *clkPort, *misoPort, *csPort;
BusIO_PortMask mosiPinMask, misoPinMask, clkPinMask, csPinMask;
#endif
bool _begun;
};

#endif // has SPI defined
Expand Down