Splitting out a frame of bytes

I like the idea of a function that can calculate the mask - could you elaborate on how this would be achieved using getBits()? It works as is but if I can create a universal function that would be neater and I could keep it for future projects :slight_smile: