1313
1414#include < modm/architecture/interface/spi_device.hpp>
1515
16- // TODO Prototype
17- template <class Spi >
18- concept SupportsBit16 = requires () {
19- Spi::setDataSize (Spi::DataSize::Bit16);
20- };
21-
2216namespace modm
2317{
2418
@@ -41,7 +35,7 @@ class Ili9341SPIInterface: public ili9341, public modm::SpiDevice<SPI>
4135 __attribute__ ((noinline)) void
4236 writeCommand (Command command)
4337 {
44- if constexpr ( SupportsBit16 <SPI> )
38+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
4539 SPI::setDataSize (SPI::DataSize::Bit8);
4640 Dc::reset (); // enable command
4741 SPI::transferBlocking (i (command));
@@ -50,7 +44,7 @@ class Ili9341SPIInterface: public ili9341, public modm::SpiDevice<SPI>
5044 __attribute__ ((noinline)) void
5145 writeCommand (Command command, uint8_t const *args, std::size_t length)
5246 {
53- if constexpr ( SupportsBit16 <SPI> )
47+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
5448 SPI::setDataSize (SPI::DataSize::Bit8);
5549 Dc::reset (); // enable command
5650 SPI::transferBlocking (i (command));
@@ -63,39 +57,39 @@ class Ili9341SPIInterface: public ili9341, public modm::SpiDevice<SPI>
6357 void
6458 writeData (uint8_t const *data, std::size_t length)
6559 {
66- if constexpr ( SupportsBit16 <SPI> )
60+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
6761 SPI::setDataSize (SPI::DataSize::Bit8);
6862 SPI::transferBlocking (data, nullptr , length);
6963 }
7064
7165 void
7266 writeData (color::Rgb565 rgb565)
7367 {
74- if constexpr ( SupportsBit16 <SPI> )
68+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
7569 SPI::setDataSize (SPI::DataSize::Bit16);
7670 SPI::transferBlocking (rgb565.color );
7771 }
7872
7973 void
8074 writeDataRepeat (color::Rgb565 rgb565, std::size_t repeat)
8175 {
82- if constexpr ( SupportsBit16 <SPI> )
76+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
8377 SPI::setDataSize (SPI::DataSize::Bit16);
8478 SPI::transferBlocking16 (rgb565.color , repeat);
8579 }
8680
8781 void
8882 writeData (color::Rgb565 const *data, std::size_t length)
8983 {
90- if constexpr ( SupportsBit16 <SPI> )
84+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
9185 SPI::setDataSize (SPI::DataSize::Bit16);
9286 SPI::transferBlocking16 (reinterpret_cast <const uint16_t *>(data), nullptr , length);
9387 }
9488
9589 void
9690 writeCommandValue8 (Command command, uint8_t value)
9791 {
98- if constexpr ( SupportsBit16 <SPI> )
92+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
9993 SPI::setDataSize (SPI::DataSize::Bit8);
10094 writeCommand (command, &value, 1 );
10195 }
@@ -105,7 +99,7 @@ class Ili9341SPIInterface: public ili9341, public modm::SpiDevice<SPI>
10599 {
106100 uint8_t b[4 ];
107101
108- if constexpr ( SupportsBit16 <SPI> )
102+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
109103 SPI::setDataSize (SPI::DataSize::Bit8);
110104 Dc::reset ();
111105 SPI::transferBlocking (i (command) << 1 );
@@ -115,7 +109,7 @@ class Ili9341SPIInterface: public ili9341, public modm::SpiDevice<SPI>
115109 uint8_t
116110 readData (Command command)
117111 {
118- if constexpr ( SupportsBit16 <SPI> )
112+ if constexpr ( spi::Support_DataSize_Bit16 <SPI> )
119113 SPI::setDataSize (SPI::DataSize::Bit8);
120114 writeCommand (command);
121115 return SPI::transferBlocking (0 );
0 commit comments