Skip to content

Commit 4a3e239

Browse files
Added DMA enable and disable functions to hardware timers, thanks to @stevstrong
1 parent 05f008a commit 4a3e239

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

STM32F1/cores/maple/HardwareTimer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ void HardwareTimer::detachInterrupt(int channel) {
138138
timer_detach_interrupt(this->dev, (uint8)channel);
139139
}
140140

141+
142+
void HardwareTimer::enableDMA(int channel) {
143+
timer_dma_enable_req(this->dev, (uint8)channel);
144+
}
145+
146+
void HardwareTimer::disableDMA(int channel) {
147+
timer_dma_disable_req(this->dev, (uint8)channel);
148+
}
149+
141150
void HardwareTimer::refresh(void) {
142151
timer_generate_update(this->dev);
143152
}

STM32F1/cores/maple/HardwareTimer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ class HardwareTimer {
245245

246246
/* Escape hatch */
247247

248+
/**
249+
* @brief Enable/disable DMA request for the input channel.
250+
*/
251+
void enableDMA(int channel);
252+
void disableDMA(int channel);
253+
248254
/**
249255
* @brief Get a pointer to the underlying libmaple timer_dev for
250256
* this HardwareTimer instance.

0 commit comments

Comments
 (0)