diff options
Diffstat (limited to 'platforms/avr/timer.c')
| -rw-r--r-- | platforms/avr/timer.c | 24 | 
1 files changed, 18 insertions, 6 deletions
| diff --git a/platforms/avr/timer.c b/platforms/avr/timer.c index c2e6c6e081..9fb671ae8d 100644 --- a/platforms/avr/timer.c +++ b/platforms/avr/timer.c @@ -73,7 +73,9 @@ void timer_init(void) {   * FIXME: needs doc   */  inline void timer_clear(void) { -    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { timer_count = 0; } +    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { +        timer_count = 0; +    }  }  /** \brief timer read @@ -83,7 +85,9 @@ inline void timer_clear(void) {  inline uint16_t timer_read(void) {      uint32_t t; -    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; } +    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { +        t = timer_count; +    }      return (t & 0xFFFF);  } @@ -95,7 +99,9 @@ inline uint16_t timer_read(void) {  inline uint32_t timer_read32(void) {      uint32_t t; -    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; } +    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { +        t = timer_count; +    }      return t;  } @@ -107,7 +113,9 @@ inline uint32_t timer_read32(void) {  inline uint16_t timer_elapsed(uint16_t last) {      uint32_t t; -    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; } +    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { +        t = timer_count; +    }      return TIMER_DIFF_16((t & 0xFFFF), last);  } @@ -119,7 +127,9 @@ inline uint16_t timer_elapsed(uint16_t last) {  inline uint32_t timer_elapsed32(uint32_t last) {      uint32_t t; -    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; } +    ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { +        t = timer_count; +    }      return TIMER_DIFF_32(t, last);  } @@ -130,4 +140,6 @@ inline uint32_t timer_elapsed32(uint32_t last) {  #else  #    define TIMER_INTERRUPT_VECTOR TIMER0_COMP_vect  #endif -ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK) { timer_count++; } +ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK) { +    timer_count++; +} | 
