diff --git a/boop/betty.cfg b/boop/betty.cfg index 77e37d7..4632c1e 100644 --- a/boop/betty.cfg +++ b/boop/betty.cfg @@ -58,9 +58,9 @@ proc betty_init { } { # PLLCFG: 0x42 = psel = 10 (4) = msel= 00010 (3) = 240 mhz Fcco*/ mww 0xe01fc084 0x42 # Activate PLL settings - #mww 0xe01fc08c 0xaa - #mww 0xe01fc08c 0x55 - #sleep 100 + mww 0xe01fc08c 0xaa + mww 0xe01fc08c 0x55 + sleep 100 # Memory Bank Configuration # BCFG0: 16bit, rble, 2wst - 30 mhz : Betty: FLASH 0 @ 0x80000000 @@ -96,8 +96,8 @@ proc betty_init { } { proc flash_boop {IMAGE} { reset init flash erase_sector 0 0 last - flash write_bank 0 $IMAGE 0 - reset run + flash write_bank 0 $IMAGE 0 + reset run } proc start_debug {} { diff --git a/boop/boop_rom.bin b/boop/boop_rom.bin index 4e93cbe..e8c33d8 100644 Binary files a/boop/boop_rom.bin and b/boop/boop_rom.bin differ diff --git a/boop/infrared/infrared.c b/boop/infrared/infrared.c index e0ac240..fcde7b7 100644 --- a/boop/infrared/infrared.c +++ b/boop/infrared/infrared.c @@ -109,11 +109,46 @@ void defStopper(void) void runIR(void) { T1TCR = 0x01; + + /* + PWMTC = 0; + PWMPR = 7; + PWMMR0 = 0x1E6; // pwm rate + PWMMR2 = 0x00; // pwm value + PWMLER = 0x05; + PWMMCR = 0x03; + PWMPCR = (1<<10); + PWMTCR = 0x03; + PWMTCR = 0x09; + */ + + PINSEL1 &= ~(3 << (10)); // IO + PINSEL1 |= (1 << (10)); // PWM5 + + PWMTC = 0; //Timer Counter + PWMPR = 0; //Prescale Register + PWMPC = 0; //Prescale Counter + + PWMMR0 = 416; // pwm rate + PWMMR5 = 0; // pwm value + + PWMLER = 0x21; //Latch Enable + PWMMCR = 0x02; //Match Control + PWMPCR |= (1<<13); + PWMTCR = 0x03; + PWMTCR = 0x09; + + //FIOSET0 = (1<<21); + + } void stopIR(void) { T1TCR = 0x03; + PWMMR5 = 0; // pwm value + PWMLER = 0x21; //Latch Enable + } void copyMapC(unsigned char *map) diff --git a/boop/infrared/infraredirq.c b/boop/infrared/infraredirq.c index 5fa7314..ea9d228 100644 --- a/boop/infrared/infraredirq.c +++ b/boop/infrared/infraredirq.c @@ -36,6 +36,21 @@ extern ir_fn irEncoder; void __attribute__ ((section(".text.fastcode"))) irIRQ(void) { c_cnt++; + + irEncoder(); + + if(mod_enable) { + PWMMR5 = 200; // pwm value + PWMLER = 0x20; //Latch Enable + } else { + PWMMR5 = 0; // pwm value + PWMLER = 0x20; //Latch Enable + } + + + + + /* if(c_cnt <= hi_border) { FIOSET0 = (mod_enable<<21); @@ -61,7 +76,7 @@ void __attribute__ ((section(".text.fastcode"))) irIRQ(void) } } } - +*/ T1IR = 1; // VICVectAddr = 0; } diff --git a/boop/infrared/ir_lirc.c b/boop/infrared/ir_lirc.c index 7e34d60..35f36ad 100644 --- a/boop/infrared/ir_lirc.c +++ b/boop/infrared/ir_lirc.c @@ -32,6 +32,8 @@ extern volatile unsigned char mod_enable; extern volatile unsigned int cycles; extern volatile unsigned long keyMap[42]; +volatile unsigned long act_freq; + /* #define RAW_IDLE 0x00 #define RAW_HI 0x01 @@ -290,6 +292,10 @@ void __attribute__ ((section(".text.fastcode"))) LIRC_Encode (void) { ir.state = LIRC_HEAD_P; } } + + + T1MR0 = (15000000 / (act_freq)) * cycles; + } void LIRC_Init(unsigned char map) @@ -340,6 +346,8 @@ void LIRC_Init(unsigned char map) } } + act_freq = freq; + T1MR0 = 15000000 / (freq * lo_border); diff --git a/boop/main.c b/boop/main.c index 5f8fba8..df5e8e4 100644 --- a/boop/main.c +++ b/boop/main.c @@ -198,6 +198,8 @@ void cpu_idle () if(U0SCR) return; + return; + /* only idle mode instead of power down when: * * backlight on * * IR transmission