Joystick Management
[stk526]

Macros to manage Joystick on stk526. More...

Defines

#define Joy_init()   (DDRB &= ~((1<<PINB7)|(1<<PINB6)|(1<<PINB5)|(1<<PINB4)|(1<<PINB0)), PORTB |= ((1<<PINB7)|(1<<PINB6)|(1<<PINB5)|(1<<PINB4)|(1<<PINB0)))
#define Push_button_init()   Joy_init()
#define Is_btn_left()   Is_hwb()
#define Is_btn_middle()   ((PINB & (1<<PINB0)) ? FALSE : TRUE)
#define Is_btn_right()   FALSE
#define Is_joy_down()   ((PINB & (1<<PINB7)) ? FALSE : TRUE)
#define Is_joy_right()   ((PINB & (1<<PINB6)) ? FALSE : TRUE)
#define Is_joy_up()   ((PINB & (1<<PINB5)) ? FALSE : TRUE)
#define Is_joy_left()   ((PINB & (1<<PINB4)) ? FALSE : TRUE)
#define Is_btn_not_left()   Is_not_hwb()
#define Is_btn_not_middle()   ((PINB & (1<<PINB0)) ? TRUE : FALSE)
#define Is_btn_not_right()   TRUE
#define Is_joy_not_down()   ((PINB & (1<<PINB7)) ? TRUE : FALSE)
#define Is_joy_not_right()   ((PINB & (1<<PINB6)) ? TRUE : FALSE)
#define Is_joy_not_up()   ((PINB & (1<<PINB5)) ? TRUE : FALSE)
#define Is_joy_not_left()   ((PINB & (1<<PINB4)) ? TRUE : FALSE)
#define Switches_enable_it()
 Enable interrupts for switches (PINB0 and PINB4 to PINB7)
  • Set up interrupts for switches
  • clear flag
  • enable interrupt.

#define Switches_disable_it()
 Disable interrupts for switches (PINB0 and PINB4 to PINB7)
  • disable interrupt
  • clear flag
  • Clear mask.


Detailed Description

Macros to manage Joystick on stk526.


Define Documentation

 
#define Joy_init (  )     (DDRB &= ~((1<<PINB7)|(1<<PINB6)|(1<<PINB5)|(1<<PINB4)|(1<<PINB0)), PORTB |= ((1<<PINB7)|(1<<PINB6)|(1<<PINB5)|(1<<PINB4)|(1<<PINB0)))

Definition at line 101 of file stk_526.h.

Referenced by device_template_task_init().

 
#define Push_button_init (  )     Joy_init()

Definition at line 102 of file stk_526.h.

 
#define Is_btn_left (  )     Is_hwb()

Definition at line 104 of file stk_526.h.

 
#define Is_btn_middle (  )     ((PINB & (1<<PINB0)) ? FALSE : TRUE)

Definition at line 105 of file stk_526.h.

 
#define Is_btn_right (  )     FALSE

Definition at line 106 of file stk_526.h.

 
#define Is_joy_down (  )     ((PINB & (1<<PINB7)) ? FALSE : TRUE)

Definition at line 108 of file stk_526.h.

 
#define Is_joy_right (  )     ((PINB & (1<<PINB6)) ? FALSE : TRUE)

Definition at line 109 of file stk_526.h.

 
#define Is_joy_up (  )     ((PINB & (1<<PINB5)) ? FALSE : TRUE)

Definition at line 110 of file stk_526.h.

 
#define Is_joy_left (  )     ((PINB & (1<<PINB4)) ? FALSE : TRUE)

Definition at line 111 of file stk_526.h.

 
#define Is_btn_not_left (  )     Is_not_hwb()

Definition at line 113 of file stk_526.h.

 
#define Is_btn_not_middle (  )     ((PINB & (1<<PINB0)) ? TRUE : FALSE)

Definition at line 114 of file stk_526.h.

 
#define Is_btn_not_right (  )     TRUE

Definition at line 115 of file stk_526.h.

 
#define Is_joy_not_down (  )     ((PINB & (1<<PINB7)) ? TRUE : FALSE)

Definition at line 117 of file stk_526.h.

 
#define Is_joy_not_right (  )     ((PINB & (1<<PINB6)) ? TRUE : FALSE)

Definition at line 118 of file stk_526.h.

 
#define Is_joy_not_up (  )     ((PINB & (1<<PINB5)) ? TRUE : FALSE)

Definition at line 119 of file stk_526.h.

 
#define Is_joy_not_left (  )     ((PINB & (1<<PINB4)) ? TRUE : FALSE)

Definition at line 120 of file stk_526.h.

 
#define Switches_enable_it (  ) 

Value:

{  \
      PCMSK0 |= (1<<PCINT0)|(1<<PCINT4)|(1<<PCINT5)|(1<<PCINT6)|(1<<PCINT7);\
      PCIFR |= (1<<PCIF0);       \
      PCICR |= (1<<PCIE0);}
Enable interrupts for switches (PINB0 and PINB4 to PINB7)

Definition at line 127 of file stk_526.h.

 
#define Switches_disable_it (  ) 

Value:

{ \
      PCICR  &= ~(1<<PCIE0);     \
      PCIFR  |= (1<<PCIF0);      \
      PCMSK0 &= ~((1<<PCINT0)|(1<<PCINT4)|(1<<PCINT5)|(1<<PCINT6)|(1<<PCINT7));}
Disable interrupts for switches (PINB0 and PINB4 to PINB7)

Definition at line 136 of file stk_526.h.


Generated on Fri Sep 11 14:23:54 2009 for ATMEL by  doxygen 1.5.3