Project structure
Here is an overview of the project structure to help you get started with the assignment. More detailed information regarding the structure of Zephyr projects can be found here.
In the root folder, you will find three important files:
CMakeList.txt
is part of every C project and tells the compiler how to compile your project.prj.conf
allows the user to configure Zephyr's features. Every board (in this case, the stm32f4_disco) already has an initial configuration. With this file, you can customize Zephyr on top of the initial configuration specific to your board. For instance, withCONFIG_CPP
, we tell Zephyr that we want to be able to write C++ code in our application. You don't need to modify it, but you are free to do so. You can find a reference of the CONFIG options here.app.overlay
allows the user to specify additional hardware peripherals. These peripherals are organized into a device tree, a Domain Specific Language (DSL) used by Linux to describe the hardware of an operating system. In a similar fashion toprj.conf
, your board has an initial device tree, and you can extend it with this file. You can find more information about the device tree in Zephyr here.
In the src
folder, you can find all the synthesizer application source code:
- The
audio, buffer, i2c, leds, peripherals, RotaryEncoder, Switch,
andusb
source files contain drivers and utilities for using them. Except foraudio
, you don't have to modify them, buy they contain functions that you might need to use. - The
filter, key, lfo, sine
andsynth
source files specify the functionality of the synthesizer.synth
is the main file where you can compute the output sound, andkey
is the data abstraction for musical notes generated by your laptop keyboard and processed by the synthesizer. Thefilter
andlfo
files specify the configuration of the low-pass filter and low-frequency oscillators, respectively. In the beginning, you won't have to modify anything in these files, but you likely will in later stages. main
is the file you are going to be modifying the most. It contains the main thread that calls all the synthesizer libraries, and you should be able to complete nearly the entire assignment by only making modifications in this file. However, to organize your code, you may want to create additional files that are then included bymain
. This is optional.
NOTE: Should you choose to split up
main
, please document the new design in your report.
During the whole project, you are free to play with the synthesizer. However, bear in mind that, if the synthesizer goes into overload and misses deadlines with the audio amplifier, a very annoying sound will play.