From 47d9b5e548e0dacbbb7e4f7534a61e2df16d0e23 Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Sun, 5 Oct 2014 04:37:55 +0200 Subject: [PATCH] borg_hw_borg16.c: slightly higher contrast for Borg16 (optional) --- config.in | 18 +++++++++++------- profiles/CTDO-Borg | 4 +++- src/borg_hw/borg_hw_borg16.c | 31 ++++++++++++++++++++++++++++--- src/borg_hw/config_borg16.in | 2 ++ 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/config.in b/config.in index 59b2150..a583334 100644 --- a/config.in +++ b/config.in @@ -6,19 +6,23 @@ comment "General Setup" #bool 'Prompt for experimental code' CONFIG_EXPERIMENTAL choice 'Target MCU' \ - "ATmega8 atmega8 \ - ATmega16 atmega16 \ - ATmega168 atmega168 \ - ATmega168P atmega168p \ + "ATmega8 atmega8 \ + ATmega16 atmega16 \ + ATmega164 atmega164 \ + ATmega164P atmega164p \ + ATmega168 atmega168 \ + ATmega168P atmega168p \ ATmega32 atmega32 \ + ATmega324 atmega324 \ + ATmega324P atmega324p \ ATmega32U4 atmega32u4 \ ATmega328 atmega328 \ - ATmega328p atmega328p \ + ATmega328P atmega328p \ ATmega644 atmega644 \ - ATmega644p atmega644p \ + ATmega644P atmega644p \ ATmega1280 atmega1280 \ ATmega1284 atmega1284 \ - ATmega1284p atmega1284p \ + ATmega1284P atmega1284p \ ATmega2560 atmega2560 \ ATmega8515 atmega8515" \ 'ATmega32' MCU diff --git a/profiles/CTDO-Borg b/profiles/CTDO-Borg index 753f350..559333f 100644 --- a/profiles/CTDO-Borg +++ b/profiles/CTDO-Borg @@ -19,6 +19,7 @@ BORG_HW=HW_BORG_16 # # Borg16 port setup # +HIGH_CONTRAST=y UART_SUPPORT=y UART_BAUDRATE_SETTING=19200 COLPORT1=PORTC @@ -86,6 +87,8 @@ GAME_BASTET=y GAME_TETRIS_FP=y GAME_SPACE_INVADERS=y GAME_SNAKE=y +# SNAKE_POV_CONTROL is not set +SNAKE_GAME_DELAY=200 GAME_BREAKOUT=y GAME_KART=y @@ -97,7 +100,6 @@ ANIMATION_SPIRAL=y SPIRAL_DELAY=5 ANIMATION_JOERN1=y ANIMATION_SNAKE=y -SNAKE_GAME_DELAY=200 SNAKE_ANIM_DELAY=100 SNAKE_TERMINATION_DELAY=60 SNAKE_MAX_LENGTH=64 diff --git a/src/borg_hw/borg_hw_borg16.c b/src/borg_hw/borg_hw_borg16.c index 1d12e4e..ce8bcbb 100644 --- a/src/borg_hw/borg_hw_borg16.c +++ b/src/borg_hw/borg_hw_borg16.c @@ -33,7 +33,14 @@ #define COLDDR2 DDR(COLPORT2) #define ROWDDR DDR(ROWPORT) -#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__) +#if defined(__AVR_ATmega164__) || \ + defined(__AVR_ATmega164P__) || \ + defined(__AVR_ATmega324__) || \ + defined(__AVR_ATmega324P__) || \ + defined(__AVR_ATmega644__) || \ + defined(__AVR_ATmega644P__) || \ + defined(__AVR_ATmega1284__) || \ + defined(__AVR_ATmega1284P__) /* more ifdef magic :-( */ #define OCR0 OCR0A #define TIMER0_COMP_vect TIMER0_COMPA_vect @@ -84,7 +91,11 @@ static void nextrow(uint8_t row) { static void rowshow(unsigned char row, unsigned char plane) { // depending on the currently drawn plane, display the row for a specific // amount of time +#ifdef HIGH_CONTRAST + static unsigned char const ocr_table[] = {2, 5, 22}; +#else static unsigned char const ocr_table[] = {3, 4, 22}; +#endif OCR0 = ocr_table[plane]; // output data of the current row to the column drivers @@ -153,7 +164,14 @@ void timer0_off() { COLPORT2 = 0; ROWPORT = 0; -#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__) +#if defined(__AVR_ATmega164__) || \ + defined(__AVR_ATmega164P__) || \ + defined(__AVR_ATmega324__) || \ + defined(__AVR_ATmega324P__) || \ + defined(__AVR_ATmega644__) || \ + defined(__AVR_ATmega644P__) || \ + defined(__AVR_ATmega1284__) || \ + defined(__AVR_ATmega1284P__) TCCR0A = 0x00; TCCR0B = 0x00; #else @@ -175,7 +193,14 @@ static void timer0_on() { 1 0 1 clk/1024 */ -#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__) +#if defined(__AVR_ATmega164__) || \ + defined(__AVR_ATmega164P__) || \ + defined(__AVR_ATmega324__) || \ + defined(__AVR_ATmega324P__) || \ + defined(__AVR_ATmega644__) || \ + defined(__AVR_ATmega644P__) || \ + defined(__AVR_ATmega1284__) || \ + defined(__AVR_ATmega1284P__) TCCR0A = 0x02; // CTC Mode TCCR0B = 0x04; // clk/256 TCNT0 = 0; // reset timer diff --git a/src/borg_hw/config_borg16.in b/src/borg_hw/config_borg16.in index 34283ff..5e63f5f 100644 --- a/src/borg_hw/config_borg16.in +++ b/src/borg_hw/config_borg16.in @@ -17,6 +17,8 @@ comment "Borg16 port setup" #//das dier sind die individuellen Dateneingänge für die Schieberegister #define PIN_SHFT1 PD7 +bool "Higher Contrast" HIGH_CONTRAST n + bool "UART Support" UART_SUPPORT n choice 'Baud Rate' \ "2400 2400 \