Skip to content

Commit

Permalink
Document special nature of setCS in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Jan 3, 2017
1 parent 1981930 commit 20f7bdc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions SPI.cpp
Expand Up @@ -306,6 +306,7 @@ bool SPIClass::pinIsChipSelect(uint8_t pin1, uint8_t pin2)
return true;
}

// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPIClass::setCS(uint8_t pin)
{
switch (pin) {
Expand Down Expand Up @@ -453,6 +454,7 @@ bool SPI1Class::pinIsChipSelect(uint8_t pin1, uint8_t pin2)
return true;
}

// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPI1Class::setCS(uint8_t pin)
{
switch (pin) {
Expand Down Expand Up @@ -585,6 +587,7 @@ bool SPI2Class::pinIsChipSelect(uint8_t pin1, uint8_t pin2)
return true;
}

// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPI2Class::setCS(uint8_t pin)
{
switch (pin) {
Expand Down Expand Up @@ -669,6 +672,7 @@ const uint8_t SPISettings::br_clock_table[30] = {
SPI_BR_SPPR(5) | SPI_BR_SPR(6)
};

// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPIClass::setCS(uint8_t pin)
{
switch (pin) {
Expand All @@ -692,6 +696,7 @@ void SPI1Class::end() {
SPI1_C1 = 0;
}

// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPI1Class::setCS(uint8_t pin)
{
switch (pin) {
Expand Down
10 changes: 10 additions & 0 deletions SPI.h
Expand Up @@ -588,6 +588,8 @@ class SPIClass {
// return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2);
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask
// setCS() is a special function, not intended for use from normal Arduino
// programs/sketches. See the ILI3941_t3 library for an example.
static uint8_t setCS(uint8_t pin);

private:
Expand Down Expand Up @@ -782,6 +784,8 @@ class SPI1Class {
// return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2);
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask
// setCS() is a special function, not intended for use from normal Arduino
// programs/sketches. See the ILI3941_t3 library for an example.
static uint8_t setCS(uint8_t pin);

private:
Expand Down Expand Up @@ -970,6 +974,8 @@ class SPI2Class {
// return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2);
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask
// setCS() is a special function, not intended for use from normal Arduino
// programs/sketches. See the ILI3941_t3 library for an example.
static uint8_t setCS(uint8_t pin);

private:
Expand Down Expand Up @@ -1268,6 +1274,8 @@ class SPIClass {
// return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2) { return false; }
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask
// setCS() is a special function, not intended for use from normal Arduino
// programs/sketches. See the ILI3941_t3 library for an example.
static uint8_t setCS(uint8_t pin);

private:
Expand Down Expand Up @@ -1442,6 +1450,8 @@ class SPI1Class {
// return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2) { return false; }
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask
// setCS() is a special function, not intended for use from normal Arduino
// programs/sketches. See the ILI3941_t3 library for an example.
static uint8_t setCS(uint8_t pin);

private:
Expand Down

0 comments on commit 20f7bdc

Please sign in to comment.