This code should (hopefully) display an image on the rotating arms. I've created a demo mode that enables the creation and display of a predefined demo image. Right now the demo image is just some simple data that should show up as a circle split into a green, blue, and red section (120deg for each color).
The program uses FreeRTOS - the image display task runs on core 0, the communication task runs on core 1. We'll be able to send image data from the communication task to the display task via a queue.
Communication Task is undefined as of now, it'll be completed in the future once we flesh out the protocol.
Here's the basic idea of how an image gets displayed:
Rotation speed calculations are made. Right now new calculations are made every 3 rotations.
Image starts displaying as soon as RPM is above some defined threshold (100 right now).
HW timer that should issue interrupt every 90deg has its interval set based on rotation speed calculations.
Start iterating through angular segments (right now have 120, each segment is 3deg)
For each segment, send the LED data out to all 4 arms. The 90deg HW timer sets a variable that's used to offset the data each arm displays so that an arm will display the data for the quarter its currently rotating through.
New rotation is triggered either when data has been sent out for all segments, or the HES interrupts and causes a new rotation to start before all the segment data is sent out.
Testing
I have no idea whether the image display code will actually display an image properly. However, I have confirmed the HW timer set to interrupt every time the arms rotate 90 degrees works and shifts the mapping between arms/quarters as expected.
Hall effect sensor interrupt works and calculations seem correct so far (tested in lab 11/4)
What is this
This code should (hopefully) display an image on the rotating arms. I've created a demo mode that enables the creation and display of a predefined demo image. Right now the demo image is just some simple data that should show up as a circle split into a green, blue, and red section (120deg for each color).
The program uses FreeRTOS - the image display task runs on core 0, the communication task runs on core 1. We'll be able to send image data from the communication task to the display task via a queue.
Communication Task is undefined as of now, it'll be completed in the future once we flesh out the protocol.
Here's the basic idea of how an image gets displayed:
Testing