The embedded software of Roled was develop to run on a STM32F405 micro-controller, and uses the functionalities of a real-time OS specially designed for embedded system: ChibiOS. It is centred on two main axis: display an image and communicate with a PC.
The display sequence display an image horizontal plates by horizontal plates. It is a quite simple sequence: push to the data toward the drivers via an SPI connection, disable the current on the previous horizontal plates of the cubes, validate the data onto the drivers (now the driver will display the data that we previously push: this is a cool feature of the TLC5951 drivers of TI, you can push data while drivers display the previous image), and then enable the current on the right horizontal plate (the one just above the previous one, unless if you are a the top of the cube obviously…). So to display one image on the cube, we need to do this sequence twelve times. If this explanation is a bit blurry for you, go see the following video.
The difficulties of the display part was to develop a program quick enough so that the image appears steady (if it was too slow, the users would see a annoying blinking of the LEDs). To do that, we send the data to the driver at the same time for the three chain of driver (by calling synchronous and asynchronous send function), and we set very precisely the pause between the different step of the sequence (if it is too fast, data will not be validated in the driver for example)
On the communication side, we choose the serial over USB protocol to implement the communication between our cube and a PC. It is a plug-and-play functionality, with the condition that the PC flushes the memory of the cube at the beginning of the session (it is really simple: you push data until you received an ack from the cube saying « memory flushed »), and the that the PC send the right command to the cube. For example, if you want to send an image, you send as an header the character « start of header » , and then you send your image at the right format: first the red colour of the led at x=0, y=0 and z=0 coded on 8 bits, after you send the green, then the blue, and you pass at the red of the led at x=0, y=1 and z=0. After you have sent all the data for the LEDs which have x=0 and z=0 (so for y=0, y=1… y=11), you increment x by one (now you send x=1, y=0 and z=0). And at last, you increment z.
Also, to avoid that we display an image which has not been received entirely, we have implemented a double buffering for images ready to be display or ready to be written by the PC.