Skip to content

Commit bace69b

Browse files
committed
Add support for SPI Mode (0-3)
wiringPi has supported SPI initialization with mode since v2.24 (February 2015) This commit adds support for using it via a new `spiMode` member in `DisplayConfigurationStruct` `spiMode` defaults to zero which was the previous default mode.
1 parent c354600 commit bace69b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/controller/Display.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ namespace udd {
110110

111111
printf("spiChannel: %d\n", config.spiChannel);
112112
printf("spiSpeed: %d\n", config.spiSpeed);
113+
printf("spiMode: %d\n", config.spiMode);
113114

114115
printf("handle: %d\n", handle);
115116
}
@@ -122,7 +123,7 @@ namespace udd {
122123
if (handle >= 0) {
123124
close(handle);
124125
}
125-
handle = wiringPiSPISetup(config.spiChannel, config.spiSpeed);
126+
handle = wiringPiSPISetupMode(config.spiChannel, config.spiSpeed, config.spiMode);
126127
}
127128

128129
void Display::visable() {
@@ -430,4 +431,4 @@ namespace udd {
430431
}
431432
*/
432433

433-
}
434+
}

src/controller/Display.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace udd {
3939

4040
int spiChannel = 0;
4141
int spiSpeed = 10000000;
42+
int spiMode = 0; // SPI mode 0,1,2,3
4243

4344

4445
// NeoPixel

0 commit comments

Comments
 (0)