ESP32 C3 with Waveshare E Paper and GxEPD2! (question included)

I spent a long time trying to get the ESP32 C3 chip to work with a waveshare e paper screen and the GxEPD2 library, so I wanted to share with everyone how I got there.

I also have a question for how I can improve this implementation: Does anyone know a good way to allow for me to switch the SPI pins to other ones without edditing any other files (I want to be able to send this design to other computers). Pin 4 is an ADC pin which I want to free up for use as the ESP32 C3 does not have many pins in the first place.
Also, if anyone can recommend other optimizations that would be appreciated!

The GxEPD2_WS_ESP32_Example works great on the waveshare esp32 driver board:
https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board#WiFi_Demo

This demo re-configures the HSPI pins to the non-starndard waveshare pins as it describes in the commented lines. It does this by changing the inputs of "hspi.begin(HSPI_CLK, HSPI_MISO, HSPI_MOSI, HSPI_SS)". This will work for the ESP32 that is on the demo board, but the ESP32 C3 does not have hardware SPI. Instead the SPI controller peripheral imitates SPI transmissions over the bus and acts as an SPI Master.
https://docs.espressif.com/projects/esp-idf/en/release-v3.0/api-reference/peripherals/spi_master.html#:~:text=The%20ESP32%20has%20four%20SPI,%2C%20SPI1%2C%20HSPI%20and%20VSPI.
Per pins_arduino.h, for the ESP32 C3:

static const uint8_t SS = 7;
static const uint8_t MOSI = 6;
static const uint8_t MISO = 5;
static const uint8_t SCK = 4;

It is of course also key to select the correct driver class and board
Here are mine:

#define GxEPD2_DISPLAY_CLASS GxEPD2_BW

and

#define GxEPD2_DRIVER_CLASS GxEPD2_154_D67 // GDEH0154D67 200x200, SSD1681, (HINK-E154A07-A1)

The text on the screen is "HINK-E154A07-A1"

All of the circuitry is the same for the ESP32 C3 except the ESP32 pins will have to be sapped with the applicable ESP32 C3 ones. I recommend you review the schematic for the ESP32 board: https://files.waveshare.com/upload/8/80/E-Paper_ESP32_Driver_Board_Schematic.pdf
(If that does not work, you can navigate to it through the waveshare website. They have good documentation).

Swap These Pins
Pin Name: ESP32 -> ESP32 C3
CLK:...........13........-> 4
BUSY (MISO) 25...-> 5
MOSI.........14........-> 6
CS..............15........-> 7
DC.............27........-> 18
RST............26........-> 19

So, here are the main changes I made to the program:
Comment out this line:

//#define USE_HSPI_FOR_EPD

Calling out the CS, DC, RST, and BUSY (MISO) pins:
update the pins in this line:

GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS)> display(GxEPD2_DRIVER_CLASS(/*CS=*/ 7, /*DC=*/ 18, /*RST=*/ 19, /*BUSY=*/ 5));

I think this is optional, but I also updated the CLK, MISO, MOSI, and SS pins here:
Pin callout is: (HSPI_CLK, HSPI_MISO, HSPI_MOSI, HSPI_SS)

hspi.begin(4, 5, 6, 7); // remap hspi for EPD (swap pins)

Attached is also the file that I use which works!
GxEPD2_WS_ESP32_Example.ino (35.6 KB)

(question included)

... but where is it?

The SPIClass of the ESP32 package remaps the HW SPI pins to the pin numbers defined in pins_arduino.h, if SPI.begin() is called without pin parameters.

If you use these pins, then you don't need to do the remap yourself.

This should be true for ESP32 C3 as well, but I didn't check.