Use SPI to "shift out" large data?

Im using a speciality driver IC, the HV5122. Its basically a high voltage, 32-output shift register. (imagine a 32bit 595 shift register).

I’m chaining a few of these.

In the first place, i used a function like this

void setOutputs(unsigned long firstValue, ){
  
  digitalWrite(OE, LOW); //Disable Outputs to prevent flicker
 
  for ( unsigned long i=0; i<32; i++){
    digitalWrite(DATA, bitRead(firstValue,i));  //Select postion to Read and set state
    digitalWrite(CLK, HIGH);  // Set Clock Pin High,
    digitalWrite(CLK,LOW);   // Set Clock Pin Low  
  }
  
  digitalWrite(OE, HIGH); //Enable Outputs
  
}

this took about 500 microseconds to shift 32bits out, wich was way to slow, making the output flicker.
i modifed the code to not use digitalWrite and directly set the output by

PORTE |= _BV(PE4)

This worked for two chained of these.

Now i starting to worry, if i chain about 10 of these, which would result in 320bit to shift out.

I know that the SPI connection does something in form of “shift”, it has a clock and data line.
Is it possible to use the SPI pins SCK and MOSI for this?

Yes, very possible. The SPI subsystem is pretty flexible and it doesn't care if there is a standards-compliant device on the other end or if you're just sending garbage.

There should be a number of examples out there. I think the last time I did something like this it was with a Sparkfun LED ring. I don't remember if that used the SPI pins or other pins. Their example software was pretty good to demonstrate 16-bit serial sending.

The only 'problem' is that, unlike serial, there's no output buffer. You still have to send each byte individually. But you can do useful work while the byte is sending, instead of that awkward digitalWrite() loop.