5
5
#include < esp_private/gdma.h>
6
6
#include < hal/dma_types.h>
7
7
8
- // #include <esp_lcd_panel_io_interface.h>
9
- // #include <esp_pm.h>
10
-
11
8
#ifndef LCD_MAX_PIXELS_AT_ONCE
12
9
#define LCD_MAX_PIXELS_AT_ONCE (2048 )
13
10
#endif
@@ -806,11 +803,11 @@ bool Arduino_ESP32LCD8::begin(int32_t speed, int8_t dataMode)
806
803
};
807
804
esp_lcd_new_i80_bus (&bus_config, &_i80_bus);
808
805
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);
810
807
811
808
esp_lcd_panel_io_i80_config_t io_config = {
812
809
.cs_gpio_num = _cs,
813
- .pclk_hz = 10 * 1000 * 1000 , // ??? _speed,
810
+ .pclk_hz = _speed,
814
811
.trans_queue_depth = 10 ,
815
812
// on_color_trans_done = nullptr,
816
813
// user_ctx = nullptr,
@@ -823,25 +820,19 @@ bool Arduino_ESP32LCD8::begin(int32_t speed, int8_t dataMode)
823
820
.dc_data_level = 1 ,
824
821
},
825
822
.flags = {
826
- .swap_color_bytes = 1 ,
823
+ .swap_color_bytes = 0 ,
827
824
.pclk_idle_low = 0 ,
828
825
},
829
826
};
830
827
esp_lcd_new_panel_io_i80 (_i80_bus, &io_config, &_io_handle);
831
828
832
829
// allocate some DMA buffer
833
- // _buffer = (uint8_t *)heap_caps_aligned_alloc(16, LCD_MAX_PIXELS_AT_ONCE * 2 + 16, MALLOC_CAP_DMA);
834
830
_cmd = -1 ;
835
831
_isColor = false ;
836
832
_bufferLen = 0 ;
837
833
_buffer = (uint8_t *)esp_lcd_i80_alloc_draw_buffer (_io_handle, LCD_MAX_PIXELS_AT_ONCE * 2 + 16 , MALLOC_CAP_DMA);
838
834
839
- if (!_buffer)
840
- {
841
- return false ;
842
- }
843
-
844
- return (true );
835
+ return (_buffer != nullptr );
845
836
}
846
837
847
838
/* *
@@ -868,7 +859,7 @@ void Arduino_ESP32LCD8::endWrite()
868
859
void Arduino_ESP32LCD8::writeCommand (uint8_t c)
869
860
{
870
861
flushBuffer ();
871
- Serial.printf (" writeCommand(%02x)\n " , c);
862
+ // Serial.printf("writeCommand(%02x)\n", c);
872
863
_cmd = c;
873
864
_isColor = false ;
874
865
}
@@ -879,14 +870,14 @@ void Arduino_ESP32LCD8::writeCommand(uint8_t c)
879
870
*/
880
871
void Arduino_ESP32LCD8::writeCommand16 (uint16_t c)
881
872
{
882
- Serial.printf (" ESP32LCD8::writeCommand16 not implemented.\n " );
873
+ // Serial.printf("ESP32LCD8::writeCommand16 not implemented.\n");
883
874
}
884
875
885
876
/* * write a set of data as command + params */
886
877
void Arduino_ESP32LCD8::writeCommandBytes (uint8_t *data, uint32_t len)
887
878
{
888
879
flushBuffer ();
889
- Serial.printf (" **writeCommandBytes()\n " );
880
+ // Serial.printf("**writeCommandBytes()\n");
890
881
891
882
if (len)
892
883
{
@@ -939,7 +930,7 @@ void Arduino_ESP32LCD8::write16(uint16_t d)
939
930
*/
940
931
void Arduino_ESP32LCD8::writeRepeat (uint16_t p, uint32_t len)
941
932
{
942
- Serial.printf (" writeRepeat(#%04x, %d)\n " , p, len);
933
+ // Serial.printf(" writeRepeat(#%04x, %d)\n", p, len);
943
934
_isColor = true ;
944
935
945
936
while (len--)
@@ -973,7 +964,7 @@ void Arduino_ESP32LCD8::writeRepeat(uint16_t p, uint32_t len)
973
964
*/
974
965
void Arduino_ESP32LCD8::writePixels (uint16_t *data, uint32_t len)
975
966
{
976
- Serial.printf (" writePixels( [...], %ld)\n " , len);
967
+ // Serial.printf(" writePixels( [...], %ld)\n", len);
977
968
_isColor = true ;
978
969
979
970
// transfer in chunks
@@ -990,7 +981,7 @@ void Arduino_ESP32LCD8::writePixels(uint16_t *data, uint32_t len)
990
981
*/
991
982
void Arduino_ESP32LCD8::writeBytes (uint8_t *data, uint32_t len)
992
983
{
993
- Serial.printf (" writeBytes( [...], %ld)\n " , len);
984
+ // Serial.printf(" writeBytes( [...], %ld)\n", len);
994
985
// transfer in chunks
995
986
while (len--)
996
987
{
@@ -1007,7 +998,7 @@ void Arduino_ESP32LCD8::writeBytes(uint8_t *data, uint32_t len)
1007
998
*/
1008
999
void Arduino_ESP32LCD8::writeIndexedPixels (uint8_t *data, uint16_t *idx, uint32_t len)
1009
1000
{
1010
- Serial.printf (" **writeIndexedPixels(...)\n " );
1001
+ // Serial.printf("**writeIndexedPixels(...)\n");
1011
1002
}
1012
1003
1013
1004
/* *
@@ -1019,7 +1010,7 @@ void Arduino_ESP32LCD8::writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_
1019
1010
*/
1020
1011
void Arduino_ESP32LCD8::writeIndexedPixelsDouble (uint8_t *data, uint16_t *idx, uint32_t len)
1021
1012
{
1022
- Serial.printf (" **writeIndexedPixelsDouble(...)\n " );
1013
+ // Serial.printf("**writeIndexedPixelsDouble(...)\n");
1023
1014
}
1024
1015
1025
1016
// ===== sending the buffer =====
@@ -1033,18 +1024,17 @@ void Arduino_ESP32LCD8::flushBuffer()
1033
1024
if (_cmd == 0x2c )
1034
1025
{
1035
1026
if (!_isColor)
1036
- Serial.printf (" isColor mismatch\n " );
1037
1027
_isColor = true ;
1038
1028
}
1039
1029
1040
1030
if ((_cmd >= 0 ) || (_bufferLen > 0 ))
1041
1031
{
1042
- Serial.printf (" flush(%02x: (%d)" , _cmd, _bufferLen);
1032
+ // Serial.printf(" flush(%02x: (%d)", _cmd, _bufferLen);
1043
1033
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
+ // }
1048
1038
1049
1039
// wait for color completion (when color sending is on the way)
1050
1040
// send cmd and buffer and wait for completion
@@ -1066,7 +1056,7 @@ void Arduino_ESP32LCD8::flushBuffer()
1066
1056
// }
1067
1057
_cmd = -1 ; // next time, we start a data send out without command.
1068
1058
_bufferLen = 0 ;
1069
- Serial.println (" )" );
1059
+ // Serial.println(")");
1070
1060
}
1071
1061
}
1072
1062
0 commit comments