Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cores/arduino/HardwareTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,18 @@ void HardwareTimer::refresh()
HAL_TIM_GenerateEvent(&(_timerObj.handle), TIM_EVENTSOURCE_UPDATE);
}

/**
* @brief Return the timer object handle object for more advanced setup
* @note Using this function and editing the Timer handle is at own risk! No support will
* be provided whatsoever if the HardwareTimer does not work as expected when editing
* the handle using the HAL functionality or other custom coding.
* @retval TIM_HandleTypeDef address
*/
TIM_HandleTypeDef *HardwareTimer::getHandle()
{
return &_timerObj.handle;
}

/**
* @brief Generic Update (rollover) callback which will call user callback
* @param htim: HAL timer handle
Expand Down
2 changes: 2 additions & 0 deletions cores/arduino/HardwareTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class HardwareTimer {
static void captureCompareCallback(TIM_HandleTypeDef *htim); // Generic Caputre and Compare callback which will call user callback
static void updateCallback(TIM_HandleTypeDef *htim); // Generic Update (rollover) callback which will call user callback

// The following function(s) are available for more advanced timer options
TIM_HandleTypeDef *getHandle(); // return the handle address for HAL related configuration
private:
TIM_OC_InitTypeDef _channelOC[TIMER_CHANNELS];
TIM_IC_InitTypeDef _channelIC[TIMER_CHANNELS];
Expand Down