diff --git a/boop/audio/soundirq.c b/boop/audio/soundirq.c index 2b06570..81635e7 100644 --- a/boop/audio/soundirq.c +++ b/boop/audio/soundirq.c @@ -35,7 +35,6 @@ extern volatile char last_sample; */ unsigned int tval; -unsigned char bl_val, cmp_val; // backlight PWM unsigned int slen; unsigned char *sdata; unsigned char sact; @@ -211,16 +210,4 @@ void __attribute__ ((section(".text.fastcode"))) soundIRQ (void) } } -/* // backlight pwm - cmp_val += bl_val; - if (cmp_val >= 63) - { - FIODIR0 |= (1<<4); // sck0/P0.4 - cmp_val -= 63; - } - else - { - FIODIR0 &= ~(1<<4); // sck0/P0.4 - } -*/ } diff --git a/boop/boop_rom.bin b/boop/boop_rom.bin index 5a46ad7..dc098e9 100644 Binary files a/boop/boop_rom.bin and b/boop/boop_rom.bin differ diff --git a/boop/timer/timerfuncs.c b/boop/timer/timerfuncs.c index f7749c1..7467050 100644 --- a/boop/timer/timerfuncs.c +++ b/boop/timer/timerfuncs.c @@ -42,7 +42,7 @@ void startTimerIRQ(void) T0TCR = 0x02; // reset timer T0TC = 1870; T0PR = 0x0e; // 15.000.000 Hz / 15 = 1.000.000 Hz --> PR = 15 - 1 = 0x0e - T0MR0 = 5000; // 1.000.000 Hz / 5000 = 200 Hz = 5 msec intervall time + T0MR0 = 250; // 1.000.000 Hz / 250 = 4000 Hz = 0,25msec intervall time T0MCR = 0x03; // reset and issue IRQ on TC == MR0 T0TCR = 0x01; // enable timer diff --git a/boop/timer/timerirq.c b/boop/timer/timerirq.c index a19cfae..873274f 100644 --- a/boop/timer/timerirq.c +++ b/boop/timer/timerirq.c @@ -21,14 +21,37 @@ #include "timerfuncs.h" #include "lcd.h" +#define TIMER_PRESCALER 20 + struct CB callbacks[MAX_CB]; unsigned long* timeouts[MAX_TO]; +unsigned char timerPrescaler = TIMER_PRESCALER; +unsigned char bl_val, cmp_val; // backlight PWM - -// wird alle 5 ms aufgerufen (s. startTimerIRQ() in timerfuncs) +// wird alle 0.25 ms aufgerufen (s. startTimerIRQ() in timerfuncs) // bearbeitet eingetragene "timer" void __attribute__ ((section(".text.fastcode"))) timerIRQ(void) { + // backlight pwm + cmp_val += bl_val; + if (cmp_val >= 63) + { + FIODIR0 |= (1<<4); // sck0/P0.4 + cmp_val -= 63; + } + else + { + FIODIR0 &= ~(1<<4); // sck0/P0.4 + } + + + if(--timerPrescaler) { + T0IR = 1; + return; + } + timerPrescaler = TIMER_PRESCALER; + + //5 msec intervall time unsigned int cnt; struct CB *cur_cb;