title: what is the best way to design a shift register with stm32
body: <p>I am using a STM32F031K6, clocked at 40MHz, and I want to design a program which acts as a looping shift register - an external trigger is used to clock it, the values in the shift register left shift every time a rising/falling edge is received. the output is one pin either high or low.</p>
  <p>I need to make the time between the clocking edge and the output less than 0.5uS, or failing that as quick as possible. The values of the shift register can be changed and the length can also be changed, but for now I'm just starting with a byte like 11000010 .</p>
  <p>I initially thought to implement this with an external interrupt but it was suggested there may be a better way to implement it</p>
  <p>any help much appreciated</p>