LUFA

The LUFA library is Dean Camera's excellent USB library that makes it easy to make full use of the ATmega32U4 USB capabilities on the AVRPi-32U4.

The LUFA example directory that is installed through the setup menu contains a slightly modified LUFA version that adds the AVRPi-32U4 board. The examples are taken from the LUFA example directory and 'ported' to the AVRPi-32U4 board. Only the button and LED configuration needed changing for the most part.

cd src/LUFA-AVRPI32U4/examples/Keyboard
make avrdude

When you connect a USB cable from the board to a linux computer (such as the Pi), run 'lsusb' and look for an 'Atmel Corp. LUFA *' USB device.

pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 007: ID 03eb:2042 Atmel Corp. LUFA Keyboard Demo Application
pi@raspberrypi ~ $ 

If you press the 'USR' button, the USB keyboard from the demo will generate 'F' characters.

Default configuration (overwrite with 'Board' directory in project):

Joystick.h: PORTF
	JOY_PRESS:          PINF1
	JOY_LEFT:           PINF4
	JOY_UP:             PINF5
	JOY_DOWN:           PINF6
	JOY_RIGHT:          PINF7

Buttons.h: PORTE
	BUTTONS_BUTTON1:    PINE2
	BUTTONS_BUTTON2:    PINE6

LEDs.h: PORTB
	LEDS_LED1:          PINB0
	LEDS_LED2:          PINB1
	LEDS_LED3:          PINB2
	LEDS_LED4:          PINB3