Schupp

Transparent cache

Nov 12th, 2023
1,060
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const esp_partition_t* part;
  2. spi_flash_mmap_handle_t handle;
  3. void* data;
  4. esp_err_t err;
  5.  
  6. void setup() {
  7. part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
  8. esp_partition_find(ESP_PARTITION_TYPE_DATA,ESP_PARTITION_SUBTYPE_ANY, "storage");
  9. err = esp_partition_mmap(part, 0, part->size, SPI_FLASH_MMAP_DATA, (const void**)&data, &handle);
  10.  
  11. if (err != ESP_OK)
  12.   {
  13.     printf("esp_partition_mmap failed. (%d)\n", err);
  14.     //delay(10000);
  15.     abort();
  16.   }
  17. //Example for Display data without overhead:
  18. vspi->beginTransaction(SPISettings(spiClk, MSBFIRST, SPI_MODE0));
  19. digitalWrite(5, LOW); //pull SS slow to prep other end for transfer
  20. unsigned long offset=0;
  21. //Access Partition on StartByte 0, sending Bytes directly to SPI Display
  22. vspi->writeBytes((uint8_t*)data + offset, width*height * 3);
  23. digitalWrite(5, HIGH); //pull ss high
  24. }
  25. }
  26.  
  27. void loop(){
  28. }
Advertisement
Add Comment
Please, Sign In to add comment