Joystick Management
[STK600]

Macros to manage Joystick on stk600. More...

Defines

#define Switches_init()   (DDRB &= ~0xFF, PORTB |= 0xFF)
#define Is_switch_7()   ((PINB & (1<<PINB7)) ? FALSE : TRUE)
#define Is_switch_6()   ((PINB & (1<<PINB6)) ? FALSE : TRUE)
#define Is_switch_5()   ((PINB & (1<<PINB5)) ? FALSE : TRUE)
#define Is_switch_4()   ((PINB & (1<<PINB4)) ? FALSE : TRUE)
#define Is_switch_3()   ((PINB & (1<<PINB3)) ? FALSE : TRUE)
#define Is_switch_2()   ((PINB & (1<<PINB2)) ? FALSE : TRUE)
#define Is_switch_1()   ((PINB & (1<<PINB1)) ? FALSE : TRUE)
#define Is_switch_0()   ((PINB & (1<<PINB0)) ? FALSE : TRUE)
#define Is_not_switch_7()   ((PINB & (1<<PINB7)) ? TRUE : FALSE)
#define Is_not_switch_6()   ((PINB & (1<<PINB6)) ? TRUE : FALSE)
#define Is_not_switch_5()   ((PINB & (1<<PINB5)) ? TRUE : FALSE)
#define Is_not_switch_4()   ((PINB & (1<<PINB4)) ? TRUE : FALSE)
#define Is_not_switch_3()   ((PINB & (1<<PINB3)) ? TRUE : FALSE)
#define Is_not_switch_2()   ((PINB & (1<<PINB2)) ? TRUE : FALSE)
#define Is_not_switch_1()   ((PINB & (1<<PINB1)) ? TRUE : FALSE)
#define Is_not_switch_0()   ((PINB & (1<<PINB0)) ? TRUE : FALSE)
#define Joy_init()   Switches_init()
#define Push_button_init()   Joy_init()
#define Is_btn_left()   Is_switch_6()
#define Is_btn_middle()   Is_switch_5()
#define Is_btn_right()   Is_switch_4()
#define Is_joy_left()   Is_switch_3()
#define Is_joy_right()   Is_switch_2()
#define Is_joy_up()   Is_switch_1()
#define Is_joy_down()   Is_switch_0()
#define Is_btn_not_left()   Is_not_switch_6()
#define Is_btn_not_middle()   Is_not_switch_5()
#define Is_btn_not_right()   Is_not_switch_4()
#define Is_joy_not_left()   Is_not_switch_3()
#define Is_joy_not_right()   Is_not_switch_2()
#define Is_joy_not_up()   Is_not_switch_1()
#define Is_joy_not_down()   Is_not_switch_0()
#define Switches_enable_it()
 Enable interrupts for switches (PINB0 to PINB7)
  • Set up interrupts for switches
  • clear flag
  • enable interrupt.

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


Detailed Description

Macros to manage Joystick on stk600.

The switchs are associated at a key name like STK525 or USB KEY :


Define Documentation

 
#define Switches_init (  )     (DDRB &= ~0xFF, PORTB |= 0xFF)

Definition at line 147 of file stk_600.h.

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

Definition at line 148 of file stk_600.h.

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

Definition at line 149 of file stk_600.h.

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

Definition at line 150 of file stk_600.h.

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

Definition at line 151 of file stk_600.h.

 
#define Is_switch_3 (  )     ((PINB & (1<<PINB3)) ? FALSE : TRUE)

Definition at line 152 of file stk_600.h.

 
#define Is_switch_2 (  )     ((PINB & (1<<PINB2)) ? FALSE : TRUE)

Definition at line 153 of file stk_600.h.

 
#define Is_switch_1 (  )     ((PINB & (1<<PINB1)) ? FALSE : TRUE)

Definition at line 154 of file stk_600.h.

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

Definition at line 155 of file stk_600.h.

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

Definition at line 156 of file stk_600.h.

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

Definition at line 157 of file stk_600.h.

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

Definition at line 158 of file stk_600.h.

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

Definition at line 159 of file stk_600.h.

 
#define Is_not_switch_3 (  )     ((PINB & (1<<PINB3)) ? TRUE : FALSE)

Definition at line 160 of file stk_600.h.

 
#define Is_not_switch_2 (  )     ((PINB & (1<<PINB2)) ? TRUE : FALSE)

Definition at line 161 of file stk_600.h.

 
#define Is_not_switch_1 (  )     ((PINB & (1<<PINB1)) ? TRUE : FALSE)

Definition at line 162 of file stk_600.h.

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

Definition at line 163 of file stk_600.h.

 
#define Joy_init (  )     Switches_init()

Definition at line 165 of file stk_600.h.

 
#define Push_button_init (  )     Joy_init()

Definition at line 166 of file stk_600.h.

 
#define Is_btn_left (  )     Is_switch_6()

Definition at line 168 of file stk_600.h.

 
#define Is_btn_middle (  )     Is_switch_5()

Definition at line 169 of file stk_600.h.

 
#define Is_btn_right (  )     Is_switch_4()

Definition at line 170 of file stk_600.h.

 
#define Is_joy_left (  )     Is_switch_3()

Definition at line 172 of file stk_600.h.

 
#define Is_joy_right (  )     Is_switch_2()

Definition at line 173 of file stk_600.h.

 
#define Is_joy_up (  )     Is_switch_1()

Definition at line 174 of file stk_600.h.

 
#define Is_joy_down (  )     Is_switch_0()

Definition at line 175 of file stk_600.h.

 
#define Is_btn_not_left (  )     Is_not_switch_6()

Definition at line 177 of file stk_600.h.

 
#define Is_btn_not_middle (  )     Is_not_switch_5()

Definition at line 178 of file stk_600.h.

 
#define Is_btn_not_right (  )     Is_not_switch_4()

Definition at line 179 of file stk_600.h.

 
#define Is_joy_not_left (  )     Is_not_switch_3()

Definition at line 181 of file stk_600.h.

 
#define Is_joy_not_right (  )     Is_not_switch_2()

Definition at line 182 of file stk_600.h.

 
#define Is_joy_not_up (  )     Is_not_switch_1()

Definition at line 183 of file stk_600.h.

 
#define Is_joy_not_down (  )     Is_not_switch_0()

Definition at line 184 of file stk_600.h.

 
#define Switches_enable_it (  ) 

Value:

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

Definition at line 191 of file stk_600.h.

 
#define Switches_disable_it (  ) 

Value:

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

Definition at line 200 of file stk_600.h.


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