55#include < esp_private/gdma.h>
66#include < hal/dma_types.h>
77
8- // #include <esp_lcd_panel_io_interface.h>
9- // #include <esp_pm.h>
10-
118#ifndef LCD_MAX_PIXELS_AT_ONCE
129#define LCD_MAX_PIXELS_AT_ONCE (2048 )
1310#endif
@@ -806,11 +803,11 @@ bool Arduino_ESP32LCD8::begin(int32_t speed, int8_t dataMode)
806803 };
807804 esp_lcd_new_i80_bus (&bus_config, &_i80_bus);
808805
809- Serial.printf (" max_transfer_bytes=%zu\n " , bus_config.max_transfer_bytes );
806+ // Serial.printf("max_transfer_bytes=%zu\n", bus_config.max_transfer_bytes);
810807
811808 esp_lcd_panel_io_i80_config_t io_config = {
812809 .cs_gpio_num = _cs,
813- .pclk_hz = 10 * 1000 * 1000 , // ??? _speed,
810+ .pclk_hz = _speed,
814811 .trans_queue_depth = 10 ,
815812 // on_color_trans_done = nullptr,
816813 // user_ctx = nullptr,
@@ -823,25 +820,19 @@ bool Arduino_ESP32LCD8::begin(int32_t speed, int8_t dataMode)
823820 .dc_data_level = 1 ,
824821 },
825822 .flags = {
826- .swap_color_bytes = 1 ,
823+ .swap_color_bytes = 0 ,
827824 .pclk_idle_low = 0 ,
828825 },
829826 };
830827 esp_lcd_new_panel_io_i80 (_i80_bus, &io_config, &_io_handle);
831828
832829 // allocate some DMA buffer
833- // _buffer = (uint8_t *)heap_caps_aligned_alloc(16, LCD_MAX_PIXELS_AT_ONCE * 2 + 16, MALLOC_CAP_DMA);
834830 _cmd = -1 ;
835831 _isColor = false ;
836832 _bufferLen = 0 ;
837833 _buffer = (uint8_t *)esp_lcd_i80_alloc_draw_buffer (_io_handle, LCD_MAX_PIXELS_AT_ONCE * 2 + 16 , MALLOC_CAP_DMA);
838834
839- if (!_buffer)
840- {
841- return false ;
842- }
843-
844- return (true );
835+ return (_buffer != nullptr );
845836}
846837
847838/* *
@@ -868,7 +859,7 @@ void Arduino_ESP32LCD8::endWrite()
868859void Arduino_ESP32LCD8::writeCommand (uint8_t c)
869860{
870861 flushBuffer ();
871- Serial.printf (" writeCommand(%02x)\n " , c);
862+ // Serial.printf("writeCommand(%02x)\n", c);
872863 _cmd = c;
873864 _isColor = false ;
874865}
@@ -879,14 +870,14 @@ void Arduino_ESP32LCD8::writeCommand(uint8_t c)
879870 */
880871void Arduino_ESP32LCD8::writeCommand16 (uint16_t c)
881872{
882- Serial.printf (" ESP32LCD8::writeCommand16 not implemented.\n " );
873+ // Serial.printf("ESP32LCD8::writeCommand16 not implemented.\n");
883874}
884875
885876/* * write a set of data as command + params */
886877void Arduino_ESP32LCD8::writeCommandBytes (uint8_t *data, uint32_t len)
887878{
888879 flushBuffer ();
889- Serial.printf (" **writeCommandBytes()\n " );
880+ // Serial.printf("**writeCommandBytes()\n");
890881
891882 if (len)
892883 {
@@ -939,7 +930,7 @@ void Arduino_ESP32LCD8::write16(uint16_t d)
939930 */
940931void Arduino_ESP32LCD8::writeRepeat (uint16_t p, uint32_t len)
941932{
942- Serial.printf (" writeRepeat(#%04x, %d)\n " , p, len);
933+ // Serial.printf(" writeRepeat(#%04x, %d)\n", p, len);
943934 _isColor = true ;
944935
945936 while (len--)
@@ -973,7 +964,7 @@ void Arduino_ESP32LCD8::writeRepeat(uint16_t p, uint32_t len)
973964 */
974965void Arduino_ESP32LCD8::writePixels (uint16_t *data, uint32_t len)
975966{
976- Serial.printf (" writePixels( [...], %ld)\n " , len);
967+ // Serial.printf(" writePixels( [...], %ld)\n", len);
977968 _isColor = true ;
978969
979970 // transfer in chunks
@@ -990,7 +981,7 @@ void Arduino_ESP32LCD8::writePixels(uint16_t *data, uint32_t len)
990981 */
991982void Arduino_ESP32LCD8::writeBytes (uint8_t *data, uint32_t len)
992983{
993- Serial.printf (" writeBytes( [...], %ld)\n " , len);
984+ // Serial.printf(" writeBytes( [...], %ld)\n", len);
994985 // transfer in chunks
995986 while (len--)
996987 {
@@ -1007,7 +998,7 @@ void Arduino_ESP32LCD8::writeBytes(uint8_t *data, uint32_t len)
1007998 */
1008999void Arduino_ESP32LCD8::writeIndexedPixels (uint8_t *data, uint16_t *idx, uint32_t len)
10091000{
1010- Serial.printf (" **writeIndexedPixels(...)\n " );
1001+ // Serial.printf("**writeIndexedPixels(...)\n");
10111002}
10121003
10131004/* *
@@ -1019,7 +1010,7 @@ void Arduino_ESP32LCD8::writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_
10191010 */
10201011void Arduino_ESP32LCD8::writeIndexedPixelsDouble (uint8_t *data, uint16_t *idx, uint32_t len)
10211012{
1022- Serial.printf (" **writeIndexedPixelsDouble(...)\n " );
1013+ // Serial.printf("**writeIndexedPixelsDouble(...)\n");
10231014}
10241015
10251016// ===== sending the buffer =====
@@ -1033,18 +1024,17 @@ void Arduino_ESP32LCD8::flushBuffer()
10331024 if (_cmd == 0x2c )
10341025 {
10351026 if (!_isColor)
1036- Serial.printf (" isColor mismatch\n " );
10371027 _isColor = true ;
10381028 }
10391029
10401030 if ((_cmd >= 0 ) || (_bufferLen > 0 ))
10411031 {
1042- Serial.printf (" flush(%02x: (%d)" , _cmd, _bufferLen);
1032+ // Serial.printf(" flush(%02x: (%d)", _cmd, _bufferLen);
10431033
1044- for (int n = 0 ; (n < _bufferLen) && (n < 32 ); n++)
1045- {
1046- Serial.printf (" %02x" , _buffer[n]);
1047- }
1034+ // for (int n = 0; (n < _bufferLen) && (n < 32); n++)
1035+ // {
1036+ // Serial.printf(" %02x", _buffer[n]);
1037+ // }
10481038
10491039 // wait for color completion (when color sending is on the way)
10501040 // send cmd and buffer and wait for completion
@@ -1066,7 +1056,7 @@ void Arduino_ESP32LCD8::flushBuffer()
10661056 // }
10671057 _cmd = -1 ; // next time, we start a data send out without command.
10681058 _bufferLen = 0 ;
1069- Serial.println (" )" );
1059+ // Serial.println(")");
10701060 }
10711061}
10721062
0 commit comments