浏览代码

Keep SPI0 pin config in sync with AVR SPI emulation

main
PaulStoffregen 7 年前
父节点
当前提交
8d59205728
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. +9
    -0
      SPI.cpp

+ 9
- 0
SPI.cpp 查看文件

@@ -473,6 +473,9 @@ uint8_t SPIClass::setCS(uint8_t pin)

void SPIClass::setMOSI(uint8_t pin)
{
if (hardware_addr == (uintptr_t)&spi0_hardware) {
SPCR.setMOSI_soft(pin);
}
if (pin != hardware().mosi_pin[mosi_pin_index]) {
for (unsigned int i = 0; i < sizeof(hardware().mosi_pin); i++) {
if (pin == hardware().mosi_pin[i]) {
@@ -492,6 +495,9 @@ void SPIClass::setMOSI(uint8_t pin)

void SPIClass::setMISO(uint8_t pin)
{
if (hardware_addr == (uintptr_t)&spi0_hardware) {
SPCR.setMISO_soft(pin);
}
if (pin != hardware().miso_pin[miso_pin_index]) {
for (unsigned int i = 0; i < sizeof(hardware().miso_pin); i++) {
if (pin == hardware().miso_pin[i]) {
@@ -511,6 +517,9 @@ void SPIClass::setMISO(uint8_t pin)

void SPIClass::setSCK(uint8_t pin)
{
if (hardware_addr == (uintptr_t)&spi0_hardware) {
SPCR.setSCK_soft(pin);
}
if (pin != hardware().sck_pin[sck_pin_index]) {
for (unsigned int i = 0; i < sizeof(hardware().sck_pin); i++) {
if (pin == hardware().sck_pin[i]) {

正在加载...
取消
保存