The SPI Master drivers used in QMK have a set of common functions to allow portability between MCUs.