How to properly construct and register Callback Event Handers for Harmony V3?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I feel like I can't find the critical memo that tells me how to construct my own callback event handlers and how to properly register those callbacks for Harmony V3. 

 

I’ve gone through the tutorial for MPLAB Harmony V3 for the ATSAMD21 (https://microchipdeveloper.com/harmony3:samd21-getting-started-training-module ).  I find this to be a good tutorial and it helped me to see, at a high level, how to use Harmony V3.  I can pretty much follow along and see, at a high level, how callback event handlers process the user's functional code and how they are registered.  Sort of like following along and saying yes, I see, but not really knowing how to create something similar from scratch.

 

And so now I'm trying to add TC5 to the mix, to use TC5 to cause an interrupt once every millisecond, and I find myself stumped as to how to set up the arguments for the tc5EventHandler() function.  I'm not sure what the arguments for the tc5EventHandler() should be, or the data types of those arguments.  And I'm not sure what's needed to properly register the callback event handler.  I've done a lot of Googling with little useful results.  Is there some memo or application note that covers this?  Or is this the proper format for the tc5EventHandler() arguments something that I should be able to figure out by looking at the code that Harmony V3 creates?  I've tried that but it's not clear to me what to do.

 

Any help, guidance or suggestions would be appreciated.

 

Paul

 

 

 

This topic has a solution.
Last Edited: Mon. Mar 8, 2021 - 12:59 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
typedef void (*TC_TIMER_CALLBACK) (TC_TIMER_STATUS status, uintptr_t context);

from plib_tc_common.h shows you what the callback function should look like since the register function is:

void TC5_TimerCallbackRegister( TC_TIMER_CALLBACK callback, uintptr_t context );

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lajon wrote:

plib_tc_common.h shows you what the callback function should look like

 

Thank you Lars.  That was what I needed to get me over the hump.  Things are working well for me now.

 

Paul