In the last several posts we have been discussing how to customize the BSP and even how to add modules and frameworks to an application. Adding these components to a project is one thing, but figuring out how to use them can be a completely different animal. In this post, we are going to examine how to use the automatically generated code along with tips and tricks for looking up the API and accessing the documentation.
The first step a developer should take to use the autogenerated code is to identify the module or framework name for the component that they want to access. This can be done by looking in the HAL/Common Stacks window and examining the component name listed at the top or by clicking the module and finding the name in the property tab. For example, if a developer wanted to change the LED state through the I/O Port module, the developer would look and find that the component is named g_ioport.
Once a developer has identified the name, they can open the thread source where the component is being used. In order to do something useful with the module, the available API calls are going to need to be determined. This can be done with any component by typing the name and then typing .p_api-> . For example, to see the API’s available with g_ioport, a developer would use g_ioport.p_api-> . This code is accessing the API structure associated with the g_ioport module. E2 Studio has an autocomplete feature which will then list all the API’s that are available within the component. A developer simply needs to press enter to autocomplete the API entry.
Once the API has been autocompleted, a developer still may need to pass arguments into the function call. The apparent problem is that the beautiful API prototype is now no longer shown. Another autocomplete feature that developers can use is control + space. Control + space will show the prototype for a function parameter or open the autocomplete dialog if a variable or macro has been partially typed. For example, if a developer wanted to initialize an LED pin to a high state, they could type g_ioport.p_api->pinWrite(leds.p_leds,IOPORT_LEV and then press control + space to see the following options:
The developer can then select IOPORT_LEVEL_HIGH and simply press enter to complete the code. The autocomplete feature can dramatically decrease development type by saving developers time from having to type long statements and even reference documentation. The ISDE has a smart manual built into the environment that allows a developer to let the cursor hover over a register or API call in order to display documentation related to that API call. Leaving the parenthesis from a call will reveal information similar to that shown below:
Including the parenthesis will display similar but slightly different information to developers as shown below:
These little autocomplete and quick accesses to documentation can save time when diving deep into software development. No need to continually dig through a datasheet or access external user manuals and documentation.
Now that the reader is an expert in setting up and configuring a Renesas Synergy™ Project, next time we will dig into the new flashloader solution that has recently been released for the Synergy Platform. In the mean-time,
Live long and profit!
Hot Tip of the Week
If you want more details on the Synergy Platform you can find them in the just released Synergy Platform Book. You can find the handy link to the book on the left side guide bar on any Synergy Platform web page on Renesas.com Click on the “Synergy Book” link and it will take you to the book landing page where you can download the entire book, or skim it chapter by chapter. Notice there are available Projects and Tutorials too. Enjoy! https://www.renesas.com/en-us/products/synergy/book.html