s_joystick.h File Reference


Detailed Description

AVR32 UC3 Control Panel joystick sensor interface.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file s_joystick.h.

#include "compiler.h"

Go to the source code of this file.

Functions

Bool b_joystick_get_value (char *buf)
 Get the current joystick state.


Function Documentation

Bool b_joystick_get_value ( char *  buf  ) 

Get the current joystick state.

Parameters:
buf char buffer in which the joystick state is stored.
Returns:
TRUE upon success, FALSE if error.

Definition at line 94 of file s_joystick.c.

References acpc_js_events, JS_EVENT_DOWN, JS_EVENT_LEFT, JS_EVENT_PUSH, JS_EVENT_RIGHT, JS_EVENT_UP, and x_joystick.

Referenced by device_full_custom_task().

00095 {
00096     // input is pulled up, if 1 : input is not active
00097     if ( !is_joystick_up() )  { Clr_bits(x_joystick, JS_EVENT_UP); }
00098     else                      { Set_bits(x_joystick, JS_EVENT_UP); }
00099 
00100     if ( !is_joystick_down() ) { Clr_bits(x_joystick, JS_EVENT_DOWN); } 
00101     else                       { Set_bits(x_joystick, JS_EVENT_DOWN); }
00102 
00103     if ( !is_joystick_left() )  { Clr_bits(x_joystick, JS_EVENT_LEFT); } 
00104     else                        { Set_bits(x_joystick, JS_EVENT_LEFT); }
00105 
00106     if ( !is_joystick_right() )  { Clr_bits(x_joystick, JS_EVENT_RIGHT); } 
00107     else                         { Set_bits(x_joystick, JS_EVENT_RIGHT); }
00108 
00109     if ( !is_joystick_pressed() ) { Clr_bits(x_joystick, JS_EVENT_PUSH); } 
00110     else                          { Set_bits(x_joystick, JS_EVENT_PUSH); }
00111 
00112    // Build the log string.
00113    sprintf( buf, "%s\r\n", (portCHAR *)acpc_js_events[x_joystick]);
00114    return TRUE;
00115 }


Generated on Fri Feb 19 02:22:52 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5