Added DMA enable and disable functions to hardware timers, thanks to @stevstrong

This commit is contained in:
Roger Clark 2017-10-31 20:05:31 +11:00
parent 05f008acbe
commit 4a3e23949b
2 changed files with 15 additions and 0 deletions

View File

@ -138,6 +138,15 @@ void HardwareTimer::detachInterrupt(int channel) {
timer_detach_interrupt(this->dev, (uint8)channel);
}
void HardwareTimer::enableDMA(int channel) {
timer_dma_enable_req(this->dev, (uint8)channel);
}
void HardwareTimer::disableDMA(int channel) {
timer_dma_disable_req(this->dev, (uint8)channel);
}
void HardwareTimer::refresh(void) {
timer_generate_update(this->dev);
}

View File

@ -245,6 +245,12 @@ public:
/* Escape hatch */
/**
* @brief Enable/disable DMA request for the input channel.
*/
void enableDMA(int channel);
void disableDMA(int channel);
/**
* @brief Get a pointer to the underlying libmaple timer_dev for
* this HardwareTimer instance.