Added new lines

This commit is contained in:
Benjamin Ramhorst 2022-03-25 18:16:21 +00:00 committed by GitHub
parent 3c8c3def94
commit 9bf12dcfae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,17 +3,17 @@ The following document outlines the design, implementation and real-time depende
## System tasks ## System tasks
The sytem at hand executes several real-time tasks, including: The sytem at hand executes several real-time tasks, including:
*Reading the key matrix * Reading the key matrix
*Updating the display * Updating the display
*Generating sound * Generating sound
### Reading the key matrix ### Reading the key matrix
**Purpose:** **Purpose:**
*Decode the key matrix, obtaining the states of the keys, knobs and joysticks * Decode the key matrix, obtaining the states of the keys, knobs and joysticks
*Obtain the currently selected note from the decoded key matrix * Obtain the currently selected note from the decoded key matrix
*Select the appopriate step size for the currently selected note * Select the appopriate step size for the currently selected note
*Transmit the currently selected note, along side its state (pressed or released) using CAN * Transmit the currently selected note, along side its state (pressed or released) using CAN
*Obtain any changes in the knobs from the decoded key matrix, corresponding to volume, octave or waveform * Obtain any changes in the knobs from the decoded key matrix, corresponding to volume, octave or waveform
**Function:** code(void scanKeysTask(void *pvParameters)) **Function:** code(void scanKeysTask(void *pvParameters))
**Implementation:** Thread, executing every 50ms **Implementation:** Thread, executing every 50ms
@ -23,10 +23,10 @@ The sytem at hand executes several real-time tasks, including:
### Updating the display ### Updating the display
**Purpose:** **Purpose:**
*Display the currently selected note (string) * Display the currently selected note (string)
*Display the current volume (int) * Display the current volume (int)
*Display the current octave (int) * Display the current octave (int)
*Display the current waveform (XMB icons) * Display the current waveform (XMB icons)
**Function:** code(displayUpdateTask(void *pvParameters) **Function:** code(displayUpdateTask(void *pvParameters)
**Implementation:** Thread, executing every 100ms. While a refresh rate of 10Hz does not sound impressive; the display is largely static. Therefore, 100ms was perfectly accetable, without any noticeable delays. **Implementation:** Thread, executing every 100ms. While a refresh rate of 10Hz does not sound impressive; the display is largely static. Therefore, 100ms was perfectly accetable, without any noticeable delays.
@ -36,9 +36,9 @@ The sytem at hand executes several real-time tasks, including:
### Generating the sound ### Generating the sound
**Purpose:** **Purpose:**
*Adds the sample rate to the accumulated value, corresponding to the desired frequency * Adds the sample rate to the accumulated value, corresponding to the desired frequency
*Sets the output voltage, by using the accumlated value and the desired volume * Sets the output voltage, by using the accumlated value and the desired volume
*Writes to analogue output, generating the desired sound * Writes to analogue output, generating the desired sound
**Function:** code(sampleISR()) **Function:** code(sampleISR())
**Implementation:** Interrupt executing with a frequency of 44.1kHz **Implementation:** Interrupt executing with a frequency of 44.1kHz
@ -63,14 +63,14 @@ TO BE ADDED - After system is completed; see this link: https://edstem.org/us/co
## Shared data structures ## Shared data structures
Shared data structures: Shared data structures:
*code(currentStepSize), safe access guaranteed using code(std::atomic<uint32_t>) * code(currentStepSize), safe access guaranteed using code(std::atomic<uint32_t>)
*code(keyArray), each element within the array is of type code(std::atomic<uint8_t>) * code(keyArray), each element within the array is of type code(std::atomic<uint8_t>)
*msgInQ, handled by FreeRTOS * msgInQ, handled by FreeRTOS
*code(RX_Message), handled by code(std::atomic_flag) * code(RX_Message), handled by code(std::atomic_flag)
It was desiced to use C++ code(std::atomic), as it is easier to use and implement, while providing the same functionality as a mutex. According to the documentation: *"Each instantiation and full specialization of the std::atomic template defines an atomic type. If one thread writes to an atomic object while another thread reads from it, the behavior is well-defined (see memory model for details on data races). In addition, accesses to atomic objects may establish inter-thread synchronization and order non-atomic memory accesses as specified by std::memory_order."* (https://en.cppreference.com/w/cpp/atomic/atomic) It was desiced to use C++ code(std::atomic), as it is easier to use and implement, while providing the same functionality as a mutex. According to the documentation: *"Each instantiation and full specialization of the std::atomic template defines an atomic type. If one thread writes to an atomic object while another thread reads from it, the behavior is well-defined (see memory model for details on data races). In addition, accesses to atomic objects may establish inter-thread synchronization and order non-atomic memory accesses as specified by std::memory_order.*"(https://en.cppreference.com/w/cpp/atomic/atomic)
TODO - Expand on the memory model for std:: atomic. TODO - Expand on the memory model for std::atomic.
TODO - Explain how FreeRTOS handles msgInQ. TODO - Explain how FreeRTOS handles msgInQ.
TODO - Once CAN is completed, expand on the protection of RX_Message TODO - Once CAN is completed, expand on the protection of RX_Message