completed support for Arduino Mega 2560 (now tested)
This commit is contained in:
parent
7edb0188f9
commit
ad2a7939ab
|
@ -0,0 +1,125 @@
|
||||||
|
#
|
||||||
|
# Automatically generated by make menuconfig: don't edit
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# General Setup
|
||||||
|
#
|
||||||
|
MCU=atmega2560
|
||||||
|
FREQ=16000000
|
||||||
|
|
||||||
|
#
|
||||||
|
# Borg Hardware
|
||||||
|
#
|
||||||
|
NUM_ROWS=9
|
||||||
|
NUM_COLS=14
|
||||||
|
NUMPLANE=3
|
||||||
|
BORG_HW=HW_LOLSHIELD
|
||||||
|
|
||||||
|
#
|
||||||
|
# lolshield setup
|
||||||
|
#
|
||||||
|
USER_TIMER0_FOR_WAIT=1
|
||||||
|
BRIGHTNESS=127
|
||||||
|
|
||||||
|
#
|
||||||
|
# Features
|
||||||
|
#
|
||||||
|
RANDOM_SUPPORT=y
|
||||||
|
# LAP_TIME_EXTENSION is not set
|
||||||
|
SCROLLTEXT_SUPPORT=y
|
||||||
|
SCROLLTEXT_FONT=FONT_C64
|
||||||
|
SCROLLTEXT_BUFFER_SIZE=128
|
||||||
|
SCROLL_X_SPEED=20
|
||||||
|
SCROLL_Y_SPEED=20
|
||||||
|
SCROLLTEXT_TEXT="</#Borgware 2D"
|
||||||
|
# RFM12_SUPPORT is not set
|
||||||
|
JOYSTICK_SUPPORT=y
|
||||||
|
# PARALLEL_JOYSTICK_SUPPORT is not set
|
||||||
|
# NES_PAD_SUPPORT is not set
|
||||||
|
# RFM12_JOYSTICK_SUPPORT is not set
|
||||||
|
# HC165_JOYSTICK_SUPPORT is not set
|
||||||
|
NULL_JOYSTICK_SUPPORT=y
|
||||||
|
# CAN_SUPPORT is not set
|
||||||
|
# MENU_SUPPORT is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Games
|
||||||
|
#
|
||||||
|
GAME_TETRIS_CORE=y
|
||||||
|
# GAME_TETRIS is not set
|
||||||
|
# GAME_BASTET is not set
|
||||||
|
# GAME_TETRIS_FP is not set
|
||||||
|
# GAME_SPACE_INVADERS is not set
|
||||||
|
# GAME_SNAKE is not set
|
||||||
|
GAME_BREAKOUT=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Animations
|
||||||
|
#
|
||||||
|
ANIMATION_SCROLLTEXT=y
|
||||||
|
ANIMATION_SPIRAL=y
|
||||||
|
SPIRAL_DELAY=5
|
||||||
|
ANIMATION_JOERN1=y
|
||||||
|
ANIMATION_SNAKE=y
|
||||||
|
SNAKE_CYCLE_DELAY=100
|
||||||
|
SNAKE_TERMINATION_DELAY=60
|
||||||
|
SNAKE_MAX_LENGTH=64
|
||||||
|
SNAKE_MAX_APPLES=10
|
||||||
|
ANIMATION_CHECKERBOARD=y
|
||||||
|
ANIMATION_FIRE=y
|
||||||
|
FIRE_S=30
|
||||||
|
FIRE_N=5
|
||||||
|
FIRE_DIV=44
|
||||||
|
FIRE_DELAY=50
|
||||||
|
FIRE_CYCLES=800
|
||||||
|
ANIMATION_MATRIX=y
|
||||||
|
MATRIX_STREAMER_NUM=30
|
||||||
|
MATRIX_CYCLES=500
|
||||||
|
MATRIX_DELAY=60
|
||||||
|
ANIMATION_RANDOM_BRIGHT=y
|
||||||
|
ANIMATION_STONEFLY=y
|
||||||
|
ANIMATION_FLYINGDOTS=y
|
||||||
|
ANIMATION_GAMEOFLIFE=y
|
||||||
|
GOL_DELAY=100
|
||||||
|
GOL_CYCLES=360
|
||||||
|
ANIMATION_BREAKOUT=y
|
||||||
|
# ANIMATION_MHERWEG is not set
|
||||||
|
ANIMATION_MOIRE=y
|
||||||
|
ANIMATION_LTN_ANT=y
|
||||||
|
# ANIMATION_TIME is not set
|
||||||
|
TIME_MASTER_ADDR=00
|
||||||
|
TIME_UPDATE_TIMEOUT=50
|
||||||
|
ANIMATION_BMSCROLLER=y
|
||||||
|
# ANIMATION_LABORLOGO is not set
|
||||||
|
ANIMATION_AMPHIBIAN=y
|
||||||
|
# ANIMATION_LOGO_OOS is not set
|
||||||
|
ANIMATION_FAIRYDUST=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fixed-point math patterns
|
||||||
|
#
|
||||||
|
ANIMATION_PLASMA=y
|
||||||
|
FP_PLASMA_DELAY=10
|
||||||
|
ANIMATION_PSYCHEDELIC=y
|
||||||
|
FP_PSYCHO_DELAY=25
|
||||||
|
ANIMATION_BLACKHOLE=y
|
||||||
|
ANIMATION_SQUARES=y
|
||||||
|
# ANIMATION_TESTS is not set
|
||||||
|
# ANIMATION_OFF is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# small Animations
|
||||||
|
#
|
||||||
|
# SMALLANIMATION_ROWWALK is not set
|
||||||
|
SMALLANIMATION_ROWWALK_SPEED=50
|
||||||
|
SMALLANIMATION_ROWWALK_COUNT=10
|
||||||
|
# SMALLANIMATION_COLWALK is not set
|
||||||
|
SMALLANIMATION_COLWALK_SPEED=50
|
||||||
|
SMALLANIMATION_COLWALK_COUNT=10
|
||||||
|
# SMALLANIMATION_ROWBOUNCE is not set
|
||||||
|
SMALLANIMATION_ROWBOUNCE_SPEED=50
|
||||||
|
SMALLANIMATION_ROWBOUNCE_COUNT=10
|
||||||
|
# SMALLANIMATION_COLBOUNCE is not set
|
||||||
|
SMALLANIMATION_COLBOUNCE_SPEED=50
|
||||||
|
SMALLANIMATION_COLBOUNCE_COUNT=10
|
|
@ -234,7 +234,10 @@ static void compose_cycle(uint8_t const cycle, uint8_t plane) {
|
||||||
uint8_t *const p = &pixmap[plane][0][0];
|
uint8_t *const p = &pixmap[plane][0][0];
|
||||||
|
|
||||||
#if defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
|
#if defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
|
||||||
# warning "BEWARE: Borgware-2D has not been tested on Arduino Mega 1280/2560!"
|
# ifdef __AVR_ATmega1280__
|
||||||
|
# warning "BEWARE: Borgware-2D has not been tested on Arduino Mega 1280!"
|
||||||
|
# endif
|
||||||
|
|
||||||
// Set sink pin to Vcc/source, turning off current.
|
// Set sink pin to Vcc/source, turning off current.
|
||||||
static uint8_t sink_b = 0, sink_e = 0, sink_g = 0, sink_h = 0;
|
static uint8_t sink_b = 0, sink_e = 0, sink_g = 0, sink_h = 0;
|
||||||
PINB = sink_b;
|
PINB = sink_b;
|
||||||
|
@ -247,13 +250,13 @@ static void compose_cycle(uint8_t const cycle, uint8_t plane) {
|
||||||
DDRG &= ~0x20;
|
DDRG &= ~0x20;
|
||||||
DDRH &= ~0x78;
|
DDRH &= ~0x78;
|
||||||
|
|
||||||
static uint8_t const sink_b_cycle[] =
|
static uint8_t const PROGMEM sink_b_cycle[] =
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0x80};
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0x80};
|
||||||
static uint8_t const sink_e_cycle[] =
|
static uint8_t const PROGMEM sink_e_cycle[] =
|
||||||
{0x10, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
{0x10, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
static uint8_t const sink_g_cycle[] =
|
static uint8_t const PROGMEM sink_g_cycle[] =
|
||||||
{0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
{0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
static uint8_t const sink_h_cycle[] =
|
static uint8_t const PROGMEM sink_h_cycle[] =
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00};
|
{0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
uint8_t pins_b = sink_b = pgm_read_byte(&sink_b_cycle[cycle]);
|
uint8_t pins_b = sink_b = pgm_read_byte(&sink_b_cycle[cycle]);
|
||||||
|
@ -662,7 +665,7 @@ static void compose_cycle(uint8_t const cycle, uint8_t plane) {
|
||||||
// (I could have done this with a lookup table, but that would be slower as
|
// (I could have done this with a lookup table, but that would be slower as
|
||||||
// non-constant bit shifts are quite expensive on AVR)
|
// non-constant bit shifts are quite expensive on AVR)
|
||||||
// NOTE: (0,0) is UPPER RIGHT in the Borgware realm
|
// NOTE: (0,0) is UPPER RIGHT in the Borgware realm
|
||||||
if (plane < NUMPLANE) {
|
if (plane < NUMPLANE) {
|
||||||
switch(cycle) {
|
switch(cycle) {
|
||||||
case 0:
|
case 0:
|
||||||
pins_b |= (0x02u & p[ 0]) << 4; // x= 1, y= 0, mapped pin D13
|
pins_b |= (0x02u & p[ 0]) << 4; // x= 1, y= 0, mapped pin D13
|
||||||
|
@ -815,7 +818,7 @@ static void compose_cycle(uint8_t const cycle, uint8_t plane) {
|
||||||
pins_d |= (0x40u & p[16]) >> 1; // x= 6, y= 8, mapped pin D5
|
pins_d |= (0x40u & p[16]) >> 1; // x= 6, y= 8, mapped pin D5
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable pullups on new output pins.
|
// Enable pullups on new output pins.
|
||||||
PORTD = pins_d;
|
PORTD = pins_d;
|
||||||
|
|
|
@ -5,8 +5,13 @@ TARGET = objects_avr
|
||||||
include $(MAKETOPDIR)/defaults.mk
|
include $(MAKETOPDIR)/defaults.mk
|
||||||
|
|
||||||
#for AVR
|
#for AVR
|
||||||
SRC = prng.c persistentCounter.c
|
ifeq ($(findstring atmega256,$(MCU)),atmega256)
|
||||||
ASRC = noekeon_asm.S memxor.S
|
# handmade assembler routines don't work on ATmega2560
|
||||||
|
SRC = prng.c persistentCounter.c noekeon.c memxor_c.c
|
||||||
|
else
|
||||||
|
SRC = prng.c persistentCounter.c
|
||||||
|
ASRC = noekeon_asm.S memxor.S
|
||||||
|
endif
|
||||||
|
|
||||||
#for simulator
|
#for simulator
|
||||||
SRC_SIM = prng.c persistentCounter.c noekeon.c memxor_c.c
|
SRC_SIM = prng.c persistentCounter.c noekeon.c memxor_c.c
|
||||||
|
|
|
@ -98,7 +98,7 @@ void noekeon_round(uint32_t* key, uint32_t* state, uint8_t const1, uint8_t const
|
||||||
pi2(state);
|
pi2(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t rc_tab[]
|
uint8_t const rc_tab[]
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
PROGMEM
|
PROGMEM
|
||||||
#endif
|
#endif
|
||||||
|
@ -146,7 +146,7 @@ void noekeon_enc(void* buffer, const void* key){
|
||||||
for(i=0; i<ROUND_NR; ++i){
|
for(i=0; i<ROUND_NR; ++i){
|
||||||
noekeon_round((uint32_t*)keyb, (uint32_t*)buffer, rc, 0);
|
noekeon_round((uint32_t*)keyb, (uint32_t*)buffer, rc, 0);
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
rc = pgm_read_byte(rc_tab+i);
|
rc = pgm_read_byte(&rc_tab[i]);
|
||||||
#else
|
#else
|
||||||
rc = rc_tab[i];
|
rc = rc_tab[i];
|
||||||
#endif
|
#endif
|
||||||
|
@ -177,7 +177,7 @@ void noekeon_dec(void* buffer, const void* key){
|
||||||
|
|
||||||
for(i=ROUND_NR-1; i>=0; --i){
|
for(i=ROUND_NR-1; i>=0; --i){
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
rc = pgm_read_byte(rc_tab+i);
|
rc = pgm_read_byte(&rc_tab[i]);
|
||||||
#else
|
#else
|
||||||
rc = rc_tab[i];
|
rc = rc_tab[i];
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue