From 56a267bada11906198b182a8dab072dd9672078b Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Thu, 15 May 2014 21:20:39 +0200 Subject: [PATCH] switch to Timer0 for wait() on LoL Shield platform --- profiles/LoL-Shield | 3 ++- src/borg_hw/config_lolshield.in | 2 ++ src/util.c | 40 ++++++++++++++++++--------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/profiles/LoL-Shield b/profiles/LoL-Shield index 2f9ed83..343e9a9 100644 --- a/profiles/LoL-Shield +++ b/profiles/LoL-Shield @@ -19,6 +19,7 @@ BORG_HW=HW_LOLSHIELD # # lolshield setup # +USER_TIMER0_FOR_WAIT=1 # # Features @@ -26,7 +27,7 @@ BORG_HW=HW_LOLSHIELD RANDOM_SUPPORT=y # LAP_TIME_EXTENSION is not set SCROLLTEXT_SUPPORT=y -SCROLLTEXT_FONT=FONT_SMALL6 +SCROLLTEXT_FONT=FONT_C64 SCROLLTEXT_BUFFER_SIZE=128 SCROLL_X_SPEED=20 SCROLL_Y_SPEED=20 diff --git a/src/borg_hw/config_lolshield.in b/src/borg_hw/config_lolshield.in index 4695361..ceaf309 100644 --- a/src/borg_hw/config_lolshield.in +++ b/src/borg_hw/config_lolshield.in @@ -1,4 +1,6 @@ mainmenu_option next_comment comment "lolshield setup" +define_int USER_TIMER0_FOR_WAIT 1 + endmenu diff --git a/src/util.c b/src/util.c index 436cbda..bdd2a29 100644 --- a/src/util.c +++ b/src/util.c @@ -22,22 +22,19 @@ extern jmp_buf newmode_jmpbuf; void wait(int ms){ -/* TCCR2: FOC2 WGM20 COM21 COM20 WGM21 CS22 CS21 CS20 - CS22 CS21 CS20 - 0 0 0 stop - 0 0 1 clk - 0 1 0 clk/8 - 0 1 1 clk/32 - 1 0 0 clk/64 - 1 0 1 clk/128 - 1 1 0 clk/256 - 1 1 1 clk/1024 -*/ - //TCCR2 = 0x0D; //CTC Mode, clk/128 - //OCR2 = (F_CPU/128000); //1000Hz - - TCCR1B = (1<0;ms--){ @@ -61,8 +58,15 @@ void wait(int ms){ #endif #if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__) - while(!(TIFR1&(1<