To view the Code Configurator, press the blue ‘MCC’ button on the toolbar.
Project resources panel – shows all of the existing things being setup by the code configurator.
Adding a new peripheral to code configurator
In the ‘Device Resources’ panel double click the peripheral to all.
A page for it opens and it is added to the ‘Project Resources’ panel.
Generating The Code
‘Project Resources’ panel > ‘Generate’ button.
If you get a “Configuration has warnings” message you can see them in the ‘Notifications [MCC]’ panel of the output window.
Once generated, when you view your project files you will have:
Has the main() function with calls to the necessary initialise code it has generated.
If you have your own main() function then rename it to say ap_main() and call it from here.
MCC Generated Files
These folders will have been added to your ‘Source Files’ and ‘Header Files’ folders. In here you will find all the code the code configurator has created as well as example functions you can call to use the peripherals you’ve setup.
Using the MCC peripherals in your code
Include the header files you want to use from the “MCC Generated Files” folder
Use the code
Look in the .c files “Source Files” > “MCC Generated Files” for functions you can call or use their code as examples and just copy and use what you need in your own code