Skip to content

Commit d4990b0

Browse files
Display drive update
1 parent ed397a7 commit d4990b0

3 files changed

Lines changed: 619 additions & 15 deletions

File tree

src/HT_DEPG0290BxS800FxX_BW.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <HT_Display.h>
55
#include <SPI.h>
66

7+
SPIClass fSPI(HSPI);
78

89
class DEPG0290BxS800FxX_BW : public ScreenDisplay {
910
private:
@@ -41,7 +42,7 @@ GEOMETRY_296_128) {
4142
digitalWrite(_cs, HIGH);
4243
pinMode(_busy, INPUT);
4344
this->buffer = _bbf;
44-
SPI.begin (this->_clk,this->_miso,this->_mosi);
45+
fSPI.begin (this->_clk,this->_miso,this->_mosi);
4546
_spiSettings._clock=this->_freq;
4647
// Pulse Reset low for 10ms
4748
digitalWrite(_rst, HIGH);
@@ -62,27 +63,27 @@ GEOMETRY_296_128) {
6263
int ymax=this->height()>>3;
6364
if(rotate_angle==ANGLE_0_DEGREE)
6465
{
65-
SPI.beginTransaction(SPISettings(6000000, LSBFIRST, SPI_MODE0));
66+
fSPI.beginTransaction(SPISettings(6000000, LSBFIRST, SPI_MODE0));
6667
for(int x=0;x<xmax;x++)
6768
{
6869
for(int y=0;y<ymax;y++)
6970
{
70-
SPI.transfer(~buffer[x + y * xmax]);
71+
fSPI.transfer(~buffer[x + y * xmax]);
7172
}
7273
}
7374
}
7475
else
7576
{
76-
SPI.beginTransaction(SPISettings(6000000, MSBFIRST, SPI_MODE0));
77+
fSPI.beginTransaction(SPISettings(6000000, MSBFIRST, SPI_MODE0));
7778
for(int x=xmax-1;x>=0;x--)
7879
{
7980
for(int y=(ymax-1);y>=0;y--)
8081
{
81-
SPI.transfer(~buffer[x + y * xmax]);
82+
fSPI.transfer(~buffer[x + y * xmax]);
8283
}
8384
}
8485
}
85-
SPI.endTransaction();
86+
fSPI.endTransaction();
8687
digitalWrite(_cs,HIGH);
8788
sendCommand(0x20);
8889
WaitUntilIdle();
@@ -106,27 +107,27 @@ GEOMETRY_296_128) {
106107
int ymax=this->width()>>3;
107108
if(rotate_angle==ANGLE_90_DEGREE)
108109
{
109-
SPI.beginTransaction(SPISettings(6000000, MSBFIRST, SPI_MODE0));
110+
fSPI.beginTransaction(SPISettings(6000000, MSBFIRST, SPI_MODE0));
110111
for(int x=0;x<xmax;x++)
111112
{
112113
for(int y=ymax-1;y>=0;y--)
113114
{
114-
SPI.transfer(~buffer_rotate[x + y * xmax]);
115+
fSPI.transfer(~buffer_rotate[x + y * xmax]);
115116
}
116117
}
117118
}
118119
else
119120
{
120-
SPI.beginTransaction(SPISettings(6000000, LSBFIRST, SPI_MODE0));
121+
fSPI.beginTransaction(SPISettings(6000000, LSBFIRST, SPI_MODE0));
121122
for(int x=xmax-1;x>=0;x--)
122123
{
123124
for(int y=0;y<ymax;y++)
124125
{
125-
SPI.transfer(~buffer_rotate[x + y * xmax]);
126+
fSPI.transfer(~buffer_rotate[x + y * xmax]);
126127
}
127128
}
128129
}
129-
SPI.endTransaction();
130+
fSPI.endTransaction();
130131
digitalWrite(_cs,HIGH);
131132
sendCommand(0x20);
132133
WaitUntilIdle();
@@ -152,15 +153,15 @@ GEOMETRY_296_128) {
152153
inline void sendCommand(uint8_t com) __attribute__((always_inline)){
153154
digitalWrite(_dc, LOW);
154155
digitalWrite(_cs,LOW);
155-
SPI.beginTransaction(_spiSettings);
156-
SPI.transfer(com);
157-
SPI.endTransaction();
156+
fSPI.beginTransaction(_spiSettings);
157+
fSPI.transfer(com);
158+
fSPI.endTransaction();
158159
digitalWrite(_cs,HIGH);
159160
digitalWrite(_dc, HIGH);
160161
}
161162
void sendData(unsigned char data) {
162163
digitalWrite(this->_cs, LOW);
163-
SPI.transfer(data);
164+
fSPI.transfer(data);
164165
digitalWrite(this->_cs, HIGH);
165166
}
166167

0 commit comments

Comments
 (0)