https://developer.mbed.org/users/ohneta/code/PixelArray/#73f575b34114