Tiny hardware detail check first: you’re using the ESP32 with Arduino framework, and you want to send raw bytes over SPI. You have a DC pin (Data/Command pin) that determines whether the bytes should be understood as command or data by the peripheral. Conventionally, DC=0 → command and DC=1 → data. Correct?
Here’s a neat, reusable way to implement your two functions:
#include <SPI.h>
#define DC_PIN 21 // Change to your actual DC pin number
#define CS_PIN 5 // Chip select, change to your wiring