SPI.H library to control APA102
take a look at the datasheet, compare it vs. your code for any incompliance.

based on my quick reading, your code isn't consistent with the datasheet.

put the communications in a routine would help maintain uniformity.