Changeset 17632 for firmware/FSC


Ignore:
Timestamp:
03/18/14 16:30:12 (11 years ago)
Author:
dneise
Message:
whitespace changes, using global register
Location:
firmware/FSC/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • firmware/FSC/src/timer.c

    r10674 r17632  
    1 #include "typedefs.h"
     1#include "application.h"
    22#include <avr/interrupt.h>
    33
    4 
    5         volatile U16 milisec = 0;
    6         volatile U32 sec = 0;
     4// We use the global volatile register!
     5// gVolReg.time_sec and
    76
    87void timer_init() {
    9         // TIMER2 is used as local clock:
    10         // configure timer 2
    11         TCCR2 = (1<<WGM21); // CTC Modus
    12         TCCR2 |= (1<<CS21) | (1<<CS20); // Prescaler 64 --> counts up every 8us
    13         OCR2 = 125-1;                                   // --> output compare interrupt occurs every 125 x 8us = 1ms
    14         // Compare Interrupt erlauben
    15         TIMSK |= (1<<OCIE2);
    16        
     8    // TIMER2 is used as local clock:
     9    // configure timer 2
     10    TCCR2 = (1<<WGM21); // CTC Modus
     11    TCCR2 |= (1<<CS21) | (1<<CS20); // Prescaler 64 --> counts up every 8us
     12    OCR2 = 125-1;                                       // --> output compare interrupt occurs every 125 x 8us = 1ms
     13    // Compare Interrupt erlauben
     14    TIMSK |= (1<<OCIE2);
    1715}
    1816
    19 ISR (TIMER2_COMP_vect)
    20 {
    21         if (milisec < 999)
    22                 ++milisec;
    23         else {
    24                 milisec = 0;
    25                 sec++;
    26         }
    27                
     17ISR (TIMER2_COMP_vect) {
     18    if (gVolReg.time_ms < 999)
     19        ++gVolReg.time_ms;
     20    else {
     21        gVolReg.time_ms = 0;
     22        gVolReg.time_sec++;
     23    }
    2824}
  • firmware/FSC/src/timer.h

    r10674 r17632  
    22#define __TIMER_H
    33
    4         extern volatile U16 milisec;
    5         extern volatile U32 sec;
    6        
    74void timer_init();
    85ISR (TIMER2_COMP_vect);
Note: See TracChangeset for help on using the changeset viewer.