@@ -48,7 +48,7 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
4848 Cs::reset ();
4949
5050 Dc::reset ();
51- RF_CALL (SpiMaster::transfer (uint8_t (command)));
51+ RF_CALL (SpiMaster::template transfer< 8 > (uint8_t (command)));
5252 Dc::set ();
5353
5454 if (this ->releaseMaster ())
@@ -66,10 +66,10 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
6666 Cs::reset ();
6767
6868 Dc::reset ();
69- RF_CALL (SpiMaster::transfer (uint8_t (command)));
69+ RF_CALL (SpiMaster::template transfer< 8 > (uint8_t (command)));
7070 Dc::set ();
7171
72- RF_CALL (SpiMaster::transfer (data));
72+ RF_CALL (SpiMaster::template transfer< 8 > (data));
7373
7474 if (this ->releaseMaster ())
7575 Cs::set ();
@@ -78,18 +78,18 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
7878 }
7979
8080 modm::ResumableResult<void >
81- writeCommand (Command command, const uint8_t *data, std:: size_t length)
81+ writeCommand (Command command, const uint8_t *data, uint16_t length)
8282 {
8383 RF_BEGIN ();
8484
8585 RF_WAIT_UNTIL (this ->acquireMaster ());
8686 Cs::reset ();
8787
8888 Dc::reset ();
89- RF_CALL (SpiMaster::transfer (uint8_t (command)));
89+ RF_CALL (SpiMaster::template transfer< 8 > (uint8_t (command)));
9090 Dc::set ();
9191
92- RF_CALL (SpiMaster::transfer (data, nullptr , length));
92+ RF_CALL (SpiMaster::template transfer< 8 > (data, nullptr , length));
9393
9494 if (this ->releaseMaster ())
9595 Cs::set ();
@@ -98,14 +98,34 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
9898 }
9999
100100 modm::ResumableResult<void >
101- writeData ( const color::Rgb565 *pixels, size_t length)
101+ writeCommand (Command command, const uint16_t *data, uint16_t length)
102102 {
103103 RF_BEGIN ();
104104
105105 RF_WAIT_UNTIL (this ->acquireMaster ());
106106 Cs::reset ();
107107
108- RF_CALL (SpiMaster::transfer ((uint8_t *)(pixels), nullptr , 2 * length));
108+ Dc::reset ();
109+ RF_CALL (SpiMaster::template transfer<8 >(uint8_t (command)));
110+ Dc::set ();
111+
112+ RF_CALL (SpiMaster::template transfer<16 >(data, nullptr , length));
113+
114+ if (this ->releaseMaster ())
115+ Cs::set ();
116+
117+ RF_END ();
118+ }
119+
120+ modm::ResumableResult<void >
121+ writeData (const color::Rgb565 *pixels, uint16_t length)
122+ {
123+ RF_BEGIN ();
124+
125+ RF_WAIT_UNTIL (this ->acquireMaster ());
126+ Cs::reset ();
127+
128+ RF_CALL (SpiMaster::template transfer<16 >((uint16_t *)(pixels), nullptr , length));
109129
110130 if (this ->releaseMaster ())
111131 Cs::set ();
@@ -121,7 +141,23 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
121141 RF_WAIT_UNTIL (this ->acquireMaster ());
122142 Cs::reset ();
123143
124- RF_CALL (SpiMaster::transfer ((uint8_t *)(&pixel), nullptr , 2 ));
144+ RF_CALL (SpiMaster::template transfer<16 >(pixel.getValue ()));
145+
146+ if (this ->releaseMaster ())
147+ Cs::set ();
148+
149+ RF_END ();
150+ }
151+
152+ modm::ResumableResult<void >
153+ writeData (color::Rgb565 pixel, uint16_t repeat)
154+ {
155+ RF_BEGIN ();
156+
157+ RF_WAIT_UNTIL (this ->acquireMaster ());
158+ Cs::reset ();
159+
160+ RF_CALL (SpiMaster::template transfer<16 >(pixel.getValue (), repeat));
125161
126162 if (this ->releaseMaster ())
127163 Cs::set ();
@@ -138,10 +174,10 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
138174 Cs::reset ();
139175
140176 Dc::reset ();
141- RF_CALL (SpiMaster::transfer (uint8_t (command)));
177+ RF_CALL (SpiMaster::template transfer< 8 > (uint8_t (command)));
142178 Dc::set ();
143179
144- read = RF_CALL (SpiMaster::transfer (0x00 )).getResult ();
180+ read = RF_CALL (SpiMaster::template transfer< 8 > (0x00 )).getResult ();
145181
146182 if (this ->releaseMaster ())
147183 Cs::set ();
@@ -150,18 +186,18 @@ class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< Spi
150186 }
151187
152188 modm::ResumableResult<void >
153- readData (Command command, uint8_t *buffer, size_t length)
189+ readData (Command command, uint8_t *buffer, uint16_t length)
154190 {
155191 RF_BEGIN ();
156192
157193 RF_WAIT_UNTIL (this ->acquireMaster ());
158194 Cs::reset ();
159195
160196 Dc::reset ();
161- RF_CALL (SpiMaster::transfer (uint8_t (command)));
197+ RF_CALL (SpiMaster::template transfer< 8 > (uint8_t (command)));
162198 Dc::set ();
163199
164- RF_CALL (SpiMaster::transfer (nullptr , buffer, length));
200+ RF_CALL (SpiMaster::template transfer< 8 > (nullptr , buffer, length));
165201
166202 if (this ->releaseMaster ())
167203 Cs::set ();
0 commit comments