Skip to content

Commit

Permalink
Added start/stop interrupts for compare mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pichenettes committed Aug 30, 2012
1 parent 4e640da commit 4b64093
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,23 @@ struct TimerImpl {
}

static inline void Start() {
*InterruptRegister::ptr() |= 1;
*InterruptRegister::ptr() |= _BV(0);
}
static inline void Stop() {
*InterruptRegister::ptr() &= ~1;
*InterruptRegister::ptr() &= ~(_BV(0));
}
static inline void StartInputCapture() {
*InterruptRegister::ptr() |= _BV(5);
}
static inline void StopInputCapture() {
*InterruptRegister::ptr() &= ~(_BV(5));
}
static inline void StartCompare() {
*InterruptRegister::ptr() |= _BV(1);
}
static inline void StopCompare() {
*InterruptRegister::ptr() &= ~(_BV(1));
}

static inline void set_mode(TimerMode mode) {
// Sets the mode registers.
Expand Down Expand Up @@ -168,6 +174,8 @@ struct Timer {
static inline void Stop() { Impl::Stop(); }
static inline void StartInputCapture() { Impl::StartInputCapture(); }
static inline void StopInputCapture() { Impl::StopInputCapture(); }
static inline void StartCompare() { Impl::StartCompare(); }
static inline void StopCompare() { Impl::StopCompare(); }
static inline void set_mode(TimerMode mode) { Impl::set_mode(mode); }
static inline void set_mode(uint8_t a, uint8_t b, uint8_t c) {
Impl::set_mode(a, b, c);
Expand Down

0 comments on commit 4b64093

Please sign in to comment.