23
23
#ifdef ARDUINO_INKPLATE4
24
24
25
25
SPISettings epdSpiSettings (4000000UL , MSBFIRST, SPI_MODE0);
26
+ SPIClass SPI2 (HSPI);
26
27
27
28
/* *
28
29
* @brief begin function initialize Inkplate object with predefined
@@ -36,7 +37,7 @@ bool Inkplate::begin()
36
37
if (!_beginDone)
37
38
{
38
39
// Begin SPI
39
- SPI .begin (EPAPER_CLK, -1 , EPAPER_DIN, -1 );
40
+ SPI2 .begin (EPAPER_CLK, -1 , EPAPER_DIN, -1 );
40
41
41
42
// Set up EPD communication pins
42
43
pinMode (EPAPER_CS_PIN, OUTPUT);
@@ -169,7 +170,7 @@ void Inkplate::setPanelDeepSleep(bool _state)
169
170
if (_panelState)
170
171
{
171
172
// Set SPI pins
172
- SPI .begin (EPAPER_CLK, -1 , EPAPER_DIN, -1 );
173
+ SPI2 .begin (EPAPER_CLK, -1 , EPAPER_DIN, -1 );
173
174
174
175
// Set up EPD communication pins
175
176
pinMode (EPAPER_CS_PIN, OUTPUT);
@@ -195,7 +196,7 @@ void Inkplate::setPanelDeepSleep(bool _state)
195
196
delay (1 );
196
197
197
198
// Disable SPI
198
- SPI .end ();
199
+ SPI2 .end ();
199
200
200
201
// To reduce power consumption, set SPI pins as outputs
201
202
pinMode (EPAPER_RST_PIN, INPUT);
@@ -240,9 +241,9 @@ void Inkplate::sendCommand(uint8_t _command)
240
241
digitalWrite (EPAPER_CS_PIN, LOW);
241
242
digitalWrite (EPAPER_DC_PIN, LOW);
242
243
delayMicroseconds (10 );
243
- SPI .beginTransaction (epdSpiSettings);
244
- SPI .writeBytes ((const uint8_t *)(&_command), 1 );
245
- SPI .endTransaction ();
244
+ SPI2 .beginTransaction (epdSpiSettings);
245
+ SPI2 .writeBytes ((const uint8_t *)(&_command), 1 );
246
+ SPI2 .endTransaction ();
246
247
digitalWrite (EPAPER_CS_PIN, HIGH);
247
248
delay (1 );
248
249
}
@@ -261,9 +262,9 @@ void Inkplate::sendData(uint8_t *_data, int _n)
261
262
digitalWrite (EPAPER_CS_PIN, LOW);
262
263
digitalWrite (EPAPER_DC_PIN, HIGH);
263
264
delayMicroseconds (10 );
264
- SPI .beginTransaction (epdSpiSettings);
265
- SPI .writeBytes ((const uint8_t *)_data, _n);
266
- SPI .endTransaction ();
265
+ SPI2 .beginTransaction (epdSpiSettings);
266
+ SPI2 .writeBytes ((const uint8_t *)_data, _n);
267
+ SPI2 .endTransaction ();
267
268
digitalWrite (EPAPER_CS_PIN, HIGH);
268
269
delay (1 );
269
270
}
@@ -279,9 +280,9 @@ void Inkplate::sendData(uint8_t _data)
279
280
digitalWrite (EPAPER_CS_PIN, LOW);
280
281
digitalWrite (EPAPER_DC_PIN, HIGH);
281
282
delayMicroseconds (10 );
282
- SPI .beginTransaction (epdSpiSettings);
283
- SPI .writeBytes ((const uint8_t *)(&_data), 1 );
284
- SPI .endTransaction ();
283
+ SPI2 .beginTransaction (epdSpiSettings);
284
+ SPI2 .writeBytes ((const uint8_t *)(&_data), 1 );
285
+ SPI2 .endTransaction ();
285
286
digitalWrite (EPAPER_CS_PIN, HIGH);
286
287
delay (1 );
287
288
}
0 commit comments