瀏覽代碼

Document special nature of setCS in comments

main
PaulStoffregen 8 年之前
父節點
當前提交
20f7bdcfbf
共有 2 個檔案被更改,包括 15 行新增0 行删除
  1. +5
    -0
      SPI.cpp
  2. +10
    -0
      SPI.h

+ 5
- 0
SPI.cpp 查看文件

return true; return true;
} }


// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPIClass::setCS(uint8_t pin) uint8_t SPIClass::setCS(uint8_t pin)
{ {
switch (pin) { switch (pin) {
return true; return true;
} }


// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPI1Class::setCS(uint8_t pin) uint8_t SPI1Class::setCS(uint8_t pin)
{ {
switch (pin) { switch (pin) {
return true; return true;
} }


// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPI2Class::setCS(uint8_t pin) uint8_t SPI2Class::setCS(uint8_t pin)
{ {
switch (pin) { switch (pin) {
SPI_BR_SPPR(5) | SPI_BR_SPR(6) 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) uint8_t SPIClass::setCS(uint8_t pin)
{ {
switch (pin) { switch (pin) {
SPI1_C1 = 0; SPI1_C1 = 0;
} }


// setCS() is not intended for use from normal Arduino programs/sketches.
uint8_t SPI1Class::setCS(uint8_t pin) uint8_t SPI1Class::setCS(uint8_t pin)
{ {
switch (pin) { switch (pin) {

+ 10
- 0
SPI.h 查看文件

// return true if both pin1 and pin2 have independent chip select capability // return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2); static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2);
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask // 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); static uint8_t setCS(uint8_t pin);


private: private:
// return true if both pin1 and pin2 have independent chip select capability // return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2); static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2);
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask // 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); static uint8_t setCS(uint8_t pin);


private: private:
// return true if both pin1 and pin2 have independent chip select capability // return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2); static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2);
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask // 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); static uint8_t setCS(uint8_t pin);


private: private:
// return true if both pin1 and pin2 have independent chip select capability // return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2) { return false; } static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2) { return false; }
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask // 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); static uint8_t setCS(uint8_t pin);


private: private:
// return true if both pin1 and pin2 have independent chip select capability // return true if both pin1 and pin2 have independent chip select capability
static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2) { return false; } static bool pinIsChipSelect(uint8_t pin1, uint8_t pin2) { return false; }
// configure a pin for chip select and return its SPI_MCR_PCSIS bitmask // 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); static uint8_t setCS(uint8_t pin);


private: private:

Loading…
取消
儲存