ButterflyMP3

button.h File Reference

Butterfly MP3 Button Handling. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PINB_MASK   ((1<<PINB4)|(1<<PINB6)|(1<<PINB7))
 Button masks for pin change interupt handling.
#define PINE_MASK   ((1<<PINE2)|(1<<PINE3))
#define BUTTON_A   6
 Button Hardware definitions.
#define BUTTON_B   7
 DOWN.
#define BUTTON_C   2
 LEFT.
#define BUTTON_D   3
 RIGHT.
#define BUTTON_O   4
 PUSH.
#define BUTTON_TIMEOUT_VALUE   (TIMER0_TICKSPERSECOND/50)
#define MATRIXPORT   PORTD
 use PORTD to mux the joystick pins
#define MATRIXDDR   DDRD
#define MATRIXCOLS   7
 setup 7 columns from 0..6
#define MATRIXROWS   3
 setup 3 rows on PORTB4,6,7
#define MATRIXDELAY   TIMER0_TICKSPERSECOND/50
 number of timer calls before scanning next column
#define KEY_NULL   0
 Button logical definitions ( virtual keys)
#define KEY_ENTER   1
 Center click detected.
#define KEY_NEXT   4
 Right click detected.
#define KEY_PREV   5
 left click detected
#define KEY_PLUS   2
 up click detected
#define KEY_MINUS   3
 down click detected
#define KEY_JOYSTICKMAX   5
 Maxvalue for KEY from joystick press.

Functions

void PinChangeInterrupt (void)
 PinChangeInterrupt.
void Button_Init (void)
 Button_Init.
char getkey (void)
 getkey
char ButtonBouncing (void)

Detailed Description

Butterfly MP3 Button Handling.

Author:
Nick Lott
Date:
January 2005

Copyright (C) 2005 Nick Lott <nick_Lott@bigfoot.com>

This is a simple MP3 player based around the AVR Butterfly.It currently uses a VS1001 mp3 decoder, MMC card and Nokia LCD. It has been heavily influenced by the Yampp system by Jesper Hansen <jesperh@telia.com>.

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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Target(s)...: ATmega169

Compiler....: AVR-GCC 3.3.1; avr-libc 1.0

Id:
button.h,v 1.7 2009/01/19 23:36:09 brokentoaster Exp

Definition in file button.h.


Define Documentation

#define BUTTON_A   6

Button Hardware definitions.

UP

Definition at line 40 of file button.h.

Referenced by PinChangeInterrupt().

#define BUTTON_B   7

DOWN.

Definition at line 41 of file button.h.

Referenced by PinChangeInterrupt().

#define BUTTON_C   2

LEFT.

Definition at line 42 of file button.h.

Referenced by PinChangeInterrupt().

#define BUTTON_D   3

RIGHT.

Definition at line 43 of file button.h.

Referenced by PinChangeInterrupt().

#define BUTTON_O   4

PUSH.

Definition at line 44 of file button.h.

Referenced by PinChangeInterrupt().

#define BUTTON_TIMEOUT_VALUE   (TIMER0_TICKSPERSECOND/50)

Definition at line 47 of file button.h.

Referenced by mainTimer().

#define KEY_ENTER   1

Center click detected.

Definition at line 58 of file button.h.

Referenced by handle_interface(), and PinChangeInterrupt().

#define KEY_JOYSTICKMAX   5

Maxvalue for KEY from joystick press.

Definition at line 63 of file button.h.

Referenced by handle_interface().

#define KEY_MINUS   3

down click detected

Definition at line 62 of file button.h.

Referenced by handle_interface(), and PinChangeInterrupt().

#define KEY_NEXT   4

Right click detected.

Definition at line 59 of file button.h.

Referenced by handle_interface(), and PinChangeInterrupt().

#define KEY_NULL   0

Button logical definitions ( virtual keys)

No key has been pressed

Definition at line 57 of file button.h.

Referenced by getkey(), handle_interface(), and PinChangeInterrupt().

#define KEY_PLUS   2

up click detected

Definition at line 61 of file button.h.

Referenced by handle_interface(), and PinChangeInterrupt().

#define KEY_PREV   5

left click detected

Definition at line 60 of file button.h.

Referenced by handle_interface(), and PinChangeInterrupt().

#define MATRIXCOLS   7

setup 7 columns from 0..6

Definition at line 52 of file button.h.

#define MATRIXDDR   DDRD

Definition at line 51 of file button.h.

#define MATRIXDELAY   TIMER0_TICKSPERSECOND/50

number of timer calls before scanning next column

Definition at line 54 of file button.h.

#define MATRIXPORT   PORTD

use PORTD to mux the joystick pins

Definition at line 50 of file button.h.

#define MATRIXROWS   3

setup 3 rows on PORTB4,6,7

Definition at line 53 of file button.h.

Referenced by PinChangeInterrupt().

#define PINB_MASK   ((1<<PINB4)|(1<<PINB6)|(1<<PINB7))

Button masks for pin change interupt handling.

Definition at line 36 of file button.h.

Referenced by Button_Init(), and PinChangeInterrupt().

#define PINE_MASK   ((1<<PINE2)|(1<<PINE3))

Definition at line 37 of file button.h.

Referenced by Button_Init(), and PinChangeInterrupt().


Function Documentation

void Button_Init ( void  )

Button_Init.

Initializes the five button pin

Definition at line 111 of file button.c.

References PINB_MASK, and PINE_MASK.

Referenced by init_HW().

char ButtonBouncing ( void  )
char getkey ( void  )

getkey

Get the valid key

The valid key

Definition at line 228 of file button.c.

References FALSE, gButtonTimeout, KEY, KEY_NULL, and KEY_VALID.

Referenced by handle_interface(), and Power_off().

void PinChangeInterrupt ( void  )

PinChangeInterrupt.

Check status on the joystick

Definition at line 139 of file button.c.

References BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_O, FALSE, gButtonTimeout, KEY, KEY_ENTER, KEY_MINUS, KEY_NEXT, KEY_NULL, KEY_PLUS, KEY_PREV, KEY_VALID, MATRIXROWS, PINB_MASK, PINE_MASK, and TRUE.

 All Files Functions Variables Typedefs Enumerations Enumerator Defines