]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/main.c
bit operation optimizing
[z180-stamp.git] / avr / main.c
index 1fba3cbfcea8031a6b16e034f800aa6f5b44eec4..486d992ca345f839680d1a63ce07ff6798402cfb 100644 (file)
@@ -85,6 +85,7 @@ void print_reset_reason(void)
 ISR(INT5_vect)
 {
        Stat |= S_MSG_PENDING;
+       Stat |= S_IO_0X40;
 }
 
 ISR(INT6_vect)
@@ -110,7 +111,7 @@ void setup_avr(void)
                _BV(PRUSART3) | _BV(PRUSART2) | _BV(PRUSART1);
 
 
-       /* disable analog comparator */
+       /* Disable analog comparator */
        ACSR = _BV(ACD);
        /* Ports */
 
@@ -118,11 +119,8 @@ void setup_avr(void)
        CLKPR = _BV(CLKPCE);
        CLKPR = 0;
 
-       /* Timer */
-       PRR1 &= ~_BV(PRTIM4);
-       OCR4A = F_CPU / 1000 - 1;       /* Timer4: 1000Hz interval */
-       TCCR4B = (0b00<<WGM42)|(0b001<<CS40); /* Normal Mode, Prescaler 1 */
-       TIMSK4 = _BV(OCIE4A);           /* Enable Output Compare A interrupt */
+       /* System timer */
+       setup_timer();
 
        /* INT5, INT6: falling edge */
        EICRB = (EICRB & ~((0b11 << ISC50) | (0b11 << ISC60))) |