I have been trying to create my own custom module to add my own functionality into the Synergy Configuration Tool. This file provides GPT Phase Counting Support ( for S7G2 and S3A7 - Please note that this code / pack is not guaranteed in any way , it's just something I've been trying and that seems to work. If you're after a guaranteed version then you'll have to wait until Renesas add Phase Counting to the standard SSP ) Download this zip file and rename it to: Renesas.SynergyPhaseCounting.1.1.0.pack Copy the .pack file to your E2Studio install location, eg. C:\ Renesas \ e2_studio \ internal \ projectgen \ Packs Run E2Studio and create a new Synergy Project. You should have a new module: Driver - Timers - GPT Phase Count Driver on r_gpt_phase_count Via the properties dialogue you can set the GPT Channel to use, Phase Count Mode, Compare Match values to A and B registers, Starting value for the Timer Counter and enable Compare Match A, B, Overflow, Underflow interrupts. The Configuration will show an error stating that you have to enable the Counter Overflow interrupt, but this is not the case. The code will still build and run. When you Generate the Synergy Project, you will see the code in the project directory Your Project name \ synergy \ add_on rather than the standard \ synergy \ src directory A set of APIs are provided to use the Phase Counting Mode open, close, stop, start, reset, counterGet, comparematchSet, counterSet, versionGet As with other Synergy Modules you can add a call back function for the interrupts and use the p_args- event parameter to determine with interrupt has occurred. I hope this is of interest and of use (and works!) Example of usage when driver is added to project: /* HAL-only entry function */ #include "hal_data.h" void hal_entry(void) { /* TODO: add your own code here */ g_gpt_phase_count0.p_api- open(g_gpt_phase_count0.p_ctrl, g_gpt_phase_count0.p_cfg); g_gpt_phase_count0.p_api- start(g_gpt_phase_count0.p_ctrl); while(1); } void cb_gpt_phase_count(gpt_phase_count_callback_args_t * p_args) { switch( p_args- event ) { case GPT_PHASE_COUNTING_EVENT_OVERFLOW: { break; } case GPT_PHASE_COUNTING_EVENT_UNDERFLOW: { break; } case GPT_PHASE_COUNTING_EVENT_COMPARE_MATCH_A: { break; } case GPT_PHASE_COUNTING_EVENT_COMPARE_MATCH_B: { break; } default: break; } }
↧