joystick support for lolshield (A0-up,A1-down,A2-left,A3-right,A5-fire)

This commit is contained in:
Christian Kroll 2014-05-25 11:08:35 +02:00
parent e10166a316
commit 720d547f4a
14 changed files with 337 additions and 75 deletions

View File

@ -37,7 +37,12 @@ SCROLL_X_SPEED=10
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#COMMODORE C64 - All your base are belong to us!!!"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
# JOYSTICK_SUPPORT is not set
JOYSTICK_CHOICE="JOY_PARALLEL"
# CAN_SUPPORT is not set
# MENU_SUPPORT is not set
@ -83,6 +88,7 @@ GOL_DELAY=10
GOL_CYCLES=360
# ANIMATION_BREAKOUT is not set
# ANIMATION_MHERWEG is not set
# ANIMATION_MOIRE is not set
# ANIMATION_LTN_ANT is not set
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=0x00

View File

@ -33,10 +33,16 @@ SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#www.hackerspace-ffm.de"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
JOYSTICK_SUPPORT=y
# PARALLEL_JOYSTICK_SUPPORT is not set
# NES_PAD_SUPPORT is not set
# RFM12_JOYSTICK_SUPPORT is not set
JOYSTICK_CHOICE=JOY_LEDBRETT
#
# Joystick Settings
#
HC165_JOYSTICK_SUPPORT=y
HC165_JOYSTICK_PORT_LOAD=PORTD
HC165_JOYSTICK_BIT_LOAD=2
@ -85,6 +91,7 @@ GOL_DELAY=100
GOL_CYCLES=360
# ANIMATION_BREAKOUT is not set
# ANIMATION_MHERWEG is not set
# ANIMATION_MOIRE is not set
# ANIMATION_LTN_ANT is not set
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=0x00
@ -94,9 +101,16 @@ ANIMATION_BMSCROLLER=y
ANIMATION_AMPHIBIAN=y
# ANIMATION_LOGO_OOS is not set
# ANIMATION_FAIRYDUST is not set
#
# Fixed-point math patterns
#
ANIMATION_PLASMA=y
FP_PLASMA_DELAY=1
ANIMATION_PSYCHEDELIC=y
FP_PSYCHO_DELAY=15
ANIMATION_BLACKHOLE=y
# ANIMATION_SQUARES is not set
ANIMATION_TESTS=y
ANIMATION_OFF=y

View File

@ -34,12 +34,13 @@ SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#Borgware 2D"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
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
JOYSTICK_CHOICE=JOY_LOLSHIELD
LOLSHIELD_JOYSTICK_SUPPORT=y
# CAN_SUPPORT is not set
# MENU_SUPPORT is not set

View File

@ -34,12 +34,13 @@ SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#Borgware 2D"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
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
JOYSTICK_CHOICE=JOY_LOLSHIELD
LOLSHIELD_JOYSTICK_SUPPORT=y
# CAN_SUPPORT is not set
# MENU_SUPPORT is not set

View File

@ -34,12 +34,13 @@ SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#Borgware 2D"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
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
JOYSTICK_CHOICE=JOY_LOLSHIELD
LOLSHIELD_JOYSTICK_SUPPORT=y
# CAN_SUPPORT is not set
# MENU_SUPPORT is not set

View File

@ -42,7 +42,16 @@ SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#www.das-labor.org"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
JOYSTICK_SUPPORT=y
JOYSTICK_CHOICE=JOY_PARALLEL
#
# Joystick Settings
#
PARALLEL_JOYSTICK_SUPPORT=y
JOYSTICK_PIN_UP=PINB
JOYSTICK_BIT_UP=0
@ -54,8 +63,6 @@ JOYSTICK_PIN_RIGHT=PINB
JOYSTICK_BIT_RIGHT=3
JOYSTICK_PIN_FIRE=PIND
JOYSTICK_BIT_FIRE=3
# NES_PAD_SUPPORT is not set
# RFM12_JOYSTICK_SUPPORT is not set
# CAN_SUPPORT is not set
MENU_SUPPORT=y
@ -101,6 +108,7 @@ GOL_DELAY=100
GOL_CYCLES=360
# ANIMATION_BREAKOUT is not set
# ANIMATION_MHERWEG is not set
# ANIMATION_MOIRE is not set
# ANIMATION_LTN_ANT is not set
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=0x00
@ -114,12 +122,12 @@ ANIMATION_FAIRYDUST=y
#
# Fixed-point math patterns
#
FP_DOUBLE_BUFFERING=y
ANIMATION_PLASMA=y
FP_PLASMA_DELAY=1
ANIMATION_PSYCHEDELIC=y
FP_PSYCHO_DELAY=15
# ANIMATION_BLACKHOLE is not set
# ANIMATION_SQUARES is not set
ANIMATION_TESTS=y
ANIMATION_OFF=y

View File

@ -33,6 +33,11 @@ SCROLLTEXT_BUFFER_SIZE=128
SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#LABOR BORG - WIDERSTAND IST ZWECKLOS"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
# JOYSTICK_SUPPORT is not set
# CAN_SUPPORT is not set
# MENU_SUPPORT is not set
@ -79,6 +84,7 @@ GOL_DELAY=100
GOL_CYCLES=360
# ANIMATION_BREAKOUT is not set
# ANIMATION_MHERWEG is not set
# ANIMATION_MOIRE is not set
# ANIMATION_LTN_ANT is not set
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=00
@ -87,9 +93,17 @@ TIME_UPDATE_TIMEOUT=50
# ANIMATION_LABORLOGO is not set
# ANIMATION_AMPHIBIAN is not set
# ANIMATION_LOGO_OOS is not set
# ANIMATION_LOGO_28C3 is not set
# ANIMATION_FAIRYDUST is not set
#
# Fixed-point math patterns
#
ANIMATION_PLASMA=y
FP_PLASMA_DELAY=1
ANIMATION_PSYCHEDELIC=y
FP_PSYCHO_DELAY=15
# ANIMATION_BLACKHOLE is not set
# ANIMATION_SQUARES is not set
# ANIMATION_TESTS is not set
# ANIMATION_OFF is not set

View File

@ -39,7 +39,16 @@ SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#www.das-labor.org"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
JOYSTICK_SUPPORT=y
JOYSTICK_CHOICE=JOY_PARALLEL
#
# Joystick Settings
#
PARALLEL_JOYSTICK_SUPPORT=y
JOYSTICK_PIN_UP=PINB
JOYSTICK_BIT_UP=0
@ -51,8 +60,6 @@ JOYSTICK_PIN_RIGHT=PINB
JOYSTICK_BIT_RIGHT=3
JOYSTICK_PIN_FIRE=PIND
JOYSTICK_BIT_FIRE=3
# NES_PAD_SUPPORT is not set
# RFM12_JOYSTICK_SUPPORT is not set
# CAN_SUPPORT is not set
MENU_SUPPORT=y
@ -98,6 +105,7 @@ 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
@ -111,12 +119,12 @@ ANIMATION_FAIRYDUST=y
#
# Fixed-point math patterns
#
FP_DOUBLE_BUFFERING=y
ANIMATION_PLASMA=y
FP_PLASMA_DELAY=1
ANIMATION_PSYCHEDELIC=y
FP_PSYCHO_DELAY=15
ANIMATION_BLACKHOLE=y
ANIMATION_SQUARES=y
# ANIMATION_TESTS is not set
# ANIMATION_OFF is not set

View File

@ -36,7 +36,13 @@ SCROLLTEXT_BUFFER_SIZE=128
SCROLL_X_SPEED=10
SCROLL_Y_SPEED=30
SCROLLTEXT_TEXT=">5+:<5|90>6:<6|78>:p10d50/#Labor#<5;>5|30<6;>6|40<6;p10+d50/# Borg#2d50-+/#Widerstand#ist#d50-b20p15#ZWECKLOS !"
# RFM12_SUPPORT is not set
#
# Joystick Support
#
# JOYSTICK_SUPPORT is not set
JOYSTICK_CHOICE="JOY_PARALLEL"
CAN_SUPPORT=y
SPI_HARDWARE=y
SPI_PORTIDX=1
@ -91,6 +97,7 @@ GOL_DELAY=12
GOL_CYCLES=180
# ANIMATION_BREAKOUT is not set
# ANIMATION_MHERWEG is not set
# ANIMATION_MOIRE is not set
# ANIMATION_LTN_ANT is not set
ANIMATION_TIME=y
TIME_MASTER_ADDR=00
@ -99,9 +106,17 @@ TIME_UPDATE_TIMEOUT=50
# ANIMATION_LABORLOGO is not set
# ANIMATION_AMPHIBIAN is not set
# ANIMATION_LOGO_OOS is not set
# ANIMATION_LOGO_28C3 is not set
# ANIMATION_FAIRYDUST is not set
#
# Fixed-point math patterns
#
# ANIMATION_PLASMA is not set
FP_PLASMA_DELAY=1
# ANIMATION_PSYCHEDELIC is not set
FP_PSYCHO_DELAY=15
# ANIMATION_BLACKHOLE is not set
# ANIMATION_SQUARES is not set
ANIMATION_TESTS=y
ANIMATION_OFF=y

View File

@ -49,9 +49,12 @@ BIT_MISO=6
BIT_SCK=7
PORT_SS=PORTB
BIT_SS=4
#
# Joystick Support
#
JOYSTICK_SUPPORT=y
# PARALLEL_JOYSTICK_SUPPORT is not set
# NES_PAD_SUPPORT is not set
JOYSTICK_CHOICE=JOY_RFM12
RFM12_JOYSTICK_SUPPORT=y
# CAN_SUPPORT is not set
MENU_SUPPORT=y
@ -65,7 +68,7 @@ GAME_TETRIS=y
# GAME_TETRIS_FP is not set
GAME_SPACE_INVADERS=y
GAME_SNAKE=y
# GAME_BREAKOUT is not set
GAME_BREAKOUT=y
#
# Animations
@ -91,14 +94,15 @@ MATRIX_STREAMER_NUM=30
MATRIX_CYCLES=500
MATRIX_DELAY=60
ANIMATION_RANDOM_BRIGHT=y
# ANIMATION_STONEFLY is not set
# ANIMATION_FLYINGDOTS is not set
ANIMATION_STONEFLY=y
ANIMATION_FLYINGDOTS=y
ANIMATION_GAMEOFLIFE=y
GOL_DELAY=100
GOL_CYCLES=360
# ANIMATION_BREAKOUT is not set
ANIMATION_BREAKOUT=y
# ANIMATION_MHERWEG is not set
# ANIMATION_LTN_ANT is not set
ANIMATION_MOIRE=y
ANIMATION_LTN_ANT=y
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=0x00
TIME_UPDATE_TIMEOUT=23
@ -107,9 +111,16 @@ ANIMATION_LABORLOGO=y
# ANIMATION_AMPHIBIAN is not set
# ANIMATION_LOGO_OOS is not set
# ANIMATION_FAIRYDUST is not set
#
# Fixed-point math patterns
#
ANIMATION_PLASMA=y
FP_PLASMA_DELAY=1
ANIMATION_PSYCHEDELIC=y
# ANIMATION_BLACKHOLE is not set
FP_PSYCHO_DELAY=15
ANIMATION_BLACKHOLE=y
ANIMATION_SQUARES=y
ANIMATION_TESTS=y
ANIMATION_OFF=y

View File

@ -18,6 +18,9 @@ endif
ifeq ($(HC165_JOYSTICK_SUPPORT), y)
SRC = hc165_joystick.c
endif
ifeq ($(LOLSHIELD_JOYSTICK_SUPPORT), y)
SRC = lolshield_joystick.c
endif
ifeq ($(NULL_JOYSTICK_SUPPORT), y)
SRC = null_joystick.c
endif

View File

@ -1,10 +1,28 @@
dep_bool_menu "joystick support" JOYSTICK_SUPPORT y
mainmenu_option next_comment
comment "Joystick Support"
bool "Joystick Support" JOYSTICK_SUPPORT n
if [ "x$JOYSTICK_CHOICE" == "x" ] ; then
define_string JOYSTICK_CHOICE "JOY_PARALLEL"
fi
if [ "$JOYSTICK_SUPPORT" = "y" ]; then
###################### Parallel joystick menu #################################
dep_bool_menu "parallel joystick support" PARALLEL_JOYSTICK_SUPPORT y
choice 'Joystick Type' \
"Atari-9-Pin JOY_PARALLEL \
NES-Game-Pad JOY_NES_PAD \
RFM12 JOY_RFM12 \
LED-Brett JOY_LEDBRETT \
LoL-Shield JOY_LOLSHIELD \
None JOY_NULL" \
'Atari-9-Pin' JOYSTICK_CHOICE
if [ "$PARALLEL_JOYSTICK_SUPPORT" = "y" ]; then
###################### parallel joystick menu #################################
if [ "$JOYSTICK_CHOICE" == "JOY_PARALLEL" ]; then
mainmenu_option next_comment
comment "Joystick Settings"
define_bool PARALLEL_JOYSTICK_SUPPORT y
choice 'Pin up' \
"PINA PINA \
PINB PINB \
@ -94,15 +112,18 @@ if [ "$JOYSTICK_SUPPORT" = "y" ]; then
Bit6 6 \
Bit7 7" \
'Bit3' JOYSTICK_BIT_FIRE
fi
endmenu
fi
###############################################################################
###################### NES-Pad menu #################################
dep_bool_menu "nes-pad support" NES_PAD_SUPPORT y
###################### NES-Pad menu ###########################################
if [ "$JOYSTICK_CHOICE" == "JOY_NES_PAD" ]; then
mainmenu_option next_comment
comment "Joystick Settings"
define_bool NES_PAD_SUPPORT y
if [ "$NES_PAD_SUPPORT" = "y" ]; then
choice 'Port clk' \
"PORTA PORTA \
PORTB PORTB \
@ -157,20 +178,23 @@ if [ "$JOYSTICK_SUPPORT" = "y" ]; then
Bit7 7" \
'Bit2' NES_PAD_BIT_DS
fi
endmenu
fi
###############################################################################
###################### RFM12 joystick menu ####################################
dep_bool_menu "RFM12 Joystick support" RFM12_JOYSTICK_SUPPORT y
endmenu
if [ "$JOYSTICK_CHOICE" == "JOY_RFM12" ]; then
define_bool RFM12_JOYSTICK_SUPPORT y
fi
###############################################################################
###################### 74HC165 joystick menu #################################
dep_bool_menu "74HC165 joystick support" HC165_JOYSTICK_SUPPORT y
if [ "$JOYSTICK_CHOICE" == "JOY_LEDBRETT" ]; then
mainmenu_option next_comment
comment "Joystick Settings"
define_bool HC165_JOYSTICK_SUPPORT y
if [ "$HC165_JOYSTICK_SUPPORT" = "y" ]; then
choice 'Port load' \
"PORTA PORTA \
PORTB PORTB \
@ -188,15 +212,22 @@ if [ "$JOYSTICK_SUPPORT" = "y" ]; then
Bit6 6 \
Bit7 7" \
'Bit2' HC165_JOYSTICK_BIT_LOAD
fi
endmenu
fi
###############################################################################
###################### null joystick menu ####################################
bool "null joystick support" NULL_JOYSTICK_SUPPORT n
###################### LoL Shield joystick menu ###############################
if [ "$JOYSTICK_CHOICE" == "JOY_NULL" ]; then
define_bool NULL_JOYSTICK_SUPPORT y
fi
###############################################################################
###################### null joystick menu #####################################
if [ "$JOYSTICK_CHOICE" == "JOY_LOLSHIELD" ]; then
define_bool LOLSHIELD_JOYSTICK_SUPPORT y
fi
###############################################################################
fi

View File

@ -1,6 +1,10 @@
#ifndef JOYSTICK_H
#define JOYSTICK_H
#ifdef __AVR__
# include <avr/io.h>
#endif
#include "../config.h"
extern unsigned char waitForFire;
@ -49,7 +53,63 @@ void joy_init();
# define JOYISRIGHT (0)
# define JOYISFIRE (0)
# elif defined (LOLSHIELD_JOYSTICK_SUPPORT)
# if defined (__AVR_ATmega48__) || \
defined (__AVR_ATmega48P__) || \
defined (__AVR_ATmega88__) || \
defined (__AVR_ATmega88P__) || \
defined (__AVR_ATmega168__) || \
defined (__AVR_ATmega168P__) || \
defined (__AVR_ATmega328__) || \
defined (__AVR_ATmega328P__)
/*
* A0 => PC0 => JOYISUP
* A1 => PC1 => JOYISDOWN
* A2 => PC2 => JOYISLEFT
* A3 => PC3 => JOYISRIGHT
* A4 => PC4 => NC (JOYIS2GND)
* A5 => PC5 => JOYISFIRE
*/
# define JOYISUP (!(PINC & _BV(PINC0)))
# define JOYISDOWN (!(PINC & _BV(PINC1)))
# define JOYISLEFT (!(PINC & _BV(PINC2)))
# define JOYISRIGHT (!(PINC & _BV(PINC3)))
# define JOYISFIRE (!(PINC & _BV(PINC5)))
# elif defined (__AVR_ATmega32U4__)
/*
* A0 => PF7 => JOYISUP
* A1 => PF6 => JOYISDOWN
* A2 => PF5 => JOYISLEFT
* A3 => PF4 => JOYISRIGHT
* A4 => PF1 => NC (JOYIS2GND)
* A5 => PF0 => JOYISFIRE
*/
# define JOYISUP (!(PINF & _BV(PINF7)))
# define JOYISDOWN (!(PINF & _BV(PINF6)))
# define JOYISLEFT (!(PINF & _BV(PINF5)))
# define JOYISRIGHT (!(PINF & _BV(PINF4)))
# define JOYISFIRE (!(PINF & _BV(PINF0)))
# elif defined (__AVR_ATmega1280__) || \
defined (__AVR_ATmega2560__)
/*
* A0 => PF0 => JOYISUP
* A1 => PF1 => JOYISDOWN
* A2 => PF2 => JOYISLEFT
* A3 => PF3 => JOYISRIGHT
* A4 => PF4 => NC (JOYIS2GND)
* A5 => PF5 => JOYISFIRE
*/
# define JOYISUP (!(PINF & _BV(PINF0)))
# define JOYISDOWN (!(PINF & _BV(PINF1)))
# define JOYISLEFT (!(PINF & _BV(PINF2)))
# define JOYISRIGHT (!(PINF & _BV(PINF3)))
# define JOYISFIRE (!(PINF & _BV(PINF5)))
# else
# error "Unsupported Arduino board!"
# endif
# elif defined (PARALLEL_JOYSTICK_SUPPORT)
# define JOYISUP (!(JOYSTICK_PIN_UP & (1<<JOYSTICK_BIT_UP )))
# define JOYISDOWN (!(JOYSTICK_PIN_DOWN & (1<<JOYSTICK_BIT_DOWN )))

View File

@ -0,0 +1,89 @@
/**
* @file lolshield_joystick.c
* @brief Driver for Jimmie Rodgers' LoL Shield
* @author Christian Kroll
* @date 2014
* @copyright GNU Public License 2 or later
* @see http://jimmieprodgers.com/kits/lolshield/
*
* This driver prepares the A0-A5 pins of an Ardunino device to serve as
* joystick input lines.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <avr/io.h>
void joy_init(){
#if defined (__AVR_ATmega48__) || \
defined (__AVR_ATmega48P__) || \
defined (__AVR_ATmega88__) || \
defined (__AVR_ATmega88P__) || \
defined (__AVR_ATmega168__) || \
defined (__AVR_ATmega168P__) || \
defined (__AVR_ATmega328__) || \
defined (__AVR_ATmega328P__)
/*
* A0 => PC0 => JOYISUP
* A1 => PC1 => JOYISDOWN
* A2 => PC2 => JOYISLEFT
* A3 => PC3 => JOYISRIGHT
* A4 => PC4 => NC (JOYIS2GND)
* A5 => PC5 => JOYISFIRE
*/
// set joystick pins to input
DDRC &= ~(_BV(PINC0) | _BV(PINC1) | _BV(PINC2) |
_BV(PINC3) | _BV(PINC4) | _BV(PINC5));
// activate pullups
PORTC |= _BV(PINC0) | _BV(PINC1) | _BV(PINC2) |
_BV(PINC3) | _BV(PINC4) | _BV(PINC5);
#elif defined (__AVR_ATmega32U4__)
/*
* A0 => PF7 => JOYISUP
* A1 => PF6 => JOYISDOWN
* A2 => PF5 => JOYISLEFT
* A3 => PF4 => JOYISRIGHT
* A4 => PF1 => NC (JOYIS2GND)
* A5 => PF0 => JOYISFIRE
*/
// set joystick pins to input
DDRF &= ~(_BV(PINF7) | _BV(PINF6) | _BV(PINF5) |
_BV(PINF4) | _BV(PINF1) | _BV(PINF0));
// activate pullups
PORTF |= _BV(PINF7) | _BV(PINF6) | _BV(PINF5) | _BV(PINF4) |
_BV(PINF1) | _BV(PINF0);
#elif defined (__AVR_ATmega1280__) || \
defined (__AVR_ATmega2560__)
/*
* A0 => PF0 => JOYISUP
* A1 => PF1 => JOYISDOWN
* A2 => PF2 => JOYISLEFT
* A3 => PF3 => JOYISRIGHT
* A4 => PF4 => NC (JOYIS2GND)
* A5 => PF5 => JOYISFIRE
*/
// set joystick pins to input
DDRF &= ~(_BV(PINF0) | _BV(PINF1) | _BV(PINF2) |
_BV(PINF3) | _BV(PINF4) | _BV(PINF5));
// activate pullups
PORTF |= _BV(PINF0) | _BV(PINF1) | _BV(PINF2) |
_BV(PINF3) | _BV(PINF4) | _BV(PINF5);
#else
# error "Unsupported Arduino board!"
#endif
}