Skip to content

Commit e5d4af0

Browse files
author
wamisnet
committed
SPI制御インスタンスを変更
1 parent 3e27da2 commit e5d4af0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cores/esp32/nefry/inc/led/Adafruit_DotStar.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#if !defined(__AVR_ATtiny85__)
2929
#include "./../SPI/src/SPI.h"
3030
#endif
31-
31+
SPIClass SPI2;
3232
#define USE_HW_SPI 255 // Assign this to dataPin to indicate 'hard' SPI
3333

3434
// Constructor for hardware SPI -- must connect to MOSI, SCK pins
@@ -112,30 +112,30 @@ void Adafruit_DotStar::hw_spi_init(void) { // Initialize hardware SPI
112112
PORTB &= ~(_BV(PORTB1) | _BV(PORTB2)); // Outputs
113113
DDRB |= _BV(PORTB1) | _BV(PORTB2); // DO (NOT MOSI) + SCK
114114
#elif (SPI_INTERFACES_COUNT > 0) || !defined(SPI_INTERFACES_COUNT)
115-
SPI.begin();
115+
SPI2.begin();
116116
#if defined(__AVR__) || defined(CORE_TEENSY) || defined(__ARDUINO_ARC__) || defined(__ARDUINO_X86__)
117-
SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (6 MHz on Pro Trinket 3V)
117+
SPI2.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (6 MHz on Pro Trinket 3V)
118118
#else
119119
#if defined(ESP8266) || defined(ESP31B) || defined(ESP32)
120-
SPI.setFrequency(8000000L);
120+
SPI2.setFrequency(8000000L);
121121
#elif defined(PIC32)
122122
// Use begin/end transaction to set SPI clock rate
123-
SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
124-
SPI.endTransaction();
123+
SPI2.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
124+
SPI2.endTransaction();
125125
#else
126-
SPI.setClockDivider((F_CPU + 4000000L) / 8000000L); // 8-ish MHz on Due
126+
SPI2.setClockDivider((F_CPU + 4000000L) / 8000000L); // 8-ish MHz on Due
127127
#endif
128128
#endif
129-
SPI.setBitOrder(MSBFIRST);
130-
SPI.setDataMode(SPI_MODE0);
129+
SPI2.setBitOrder(MSBFIRST);
130+
SPI2.setDataMode(SPI_MODE0);
131131
#endif
132132
}
133133

134134
void Adafruit_DotStar::hw_spi_end(void) { // Stop hardware SPI
135135
#ifdef __AVR_ATtiny85__
136136
DDRB &= ~(_BV(PORTB1) | _BV(PORTB2)); // Inputs
137137
#elif (SPI_INTERFACES_COUNT > 0) || !defined(SPI_INTERFACES_COUNT)
138-
SPI.end();
138+
SPI2.end();
139139
#endif
140140
}
141141

@@ -177,7 +177,7 @@ static void spi_out(uint8_t n) { // Clock out one byte
177177

178178
// All other boards have full-featured hardware support for SPI
179179

180-
#define spi_out(n) (void)SPI.transfer(n)
180+
#define spi_out(n) (void)SPI2.transfer(n)
181181
// Pipelining reads next byte while current byte is clocked out
182182
#if (defined(__AVR__) && !defined(__AVR_ATtiny85__)) || defined(CORE_TEENSY)
183183
#define SPI_PIPELINE

0 commit comments

Comments
 (0)