bullshit commit, sync for travel (to zn00H!) :)
[my-code/arm.git] / betty / interrupts.c
index ed33c15..7d319db 100644 (file)
@@ -158,11 +158,13 @@ void interrupt_tc_config(u8 tcnum,u8 mode,u8 cap,u32 psv) {
 
        if(tcnum==0) {
                T0TCR=0x03;
+               T0TC=0;
                T0CTCR=mode|(cap<<2);
                T0PR=psv;
        }
        else {
                T1TCR=0x03;
+               T1TC=0;
                T1CTCR=mode|(cap<<2);
                T1PR=psv;
        }
@@ -209,14 +211,21 @@ void interrupt_tc_ir_set(u8 tcnum,u8 tcmc) {
        if(tcnum>1)
                return;
 
-       if(tcnum==0) {
+       if(tcnum==0)
                T0IR=tcmc;
-               T0TCR=0x01;
-       }
-       else {
+       else
                T1IR=tcmc;
+}
+
+void interrupt_tc_enable(u8 tcnum) {
+
+       if(tcnum>1)
+               return;
+
+       if(tcnum==0)
+               T0TCR=0x01;
+       else
                T1TCR=0x01;
-       }
 }
 
 // pwm interrupts