Definition in file s_joystick.c.
#include <string.h>
#include <stdio.h>
#include "compiler.h"
#include "s_joystick.h"
#include "joystick.h"
#include "FreeRTOS.h"
Go to the source code of this file.
Defines | |
#define | JS_EVENT_DOWN 0x10 |
#define | JS_EVENT_LEFT 0x02 |
#define | JS_EVENT_PUSH 0x01 |
#define | JS_EVENT_RIGHT 0x04 |
#define | JS_EVENT_UP 0x08 |
#define | JS_NB_EVENT 32 |
Functions | |
Bool | b_joystick_get_value (char *buf) |
Get the current joystick state. | |
Variables | |
const signed portCHAR * | acpc_js_events [JS_NB_EVENT] |
static unsigned short | x_joystick = 0 |
#define JS_EVENT_DOWN 0x10 |
#define JS_EVENT_LEFT 0x02 |
#define JS_EVENT_PUSH 0x01 |
Mask for events on joystick.
Definition at line 61 of file s_joystick.c.
Referenced by b_joystick_get_value().
#define JS_EVENT_RIGHT 0x04 |
#define JS_EVENT_UP 0x08 |
#define JS_NB_EVENT 32 |
Max number of events on joystick.
Definition at line 58 of file s_joystick.c.
Bool b_joystick_get_value | ( | char * | buf | ) |
Get the current joystick state.
buf | char buffer in which the joystick state is stored. |
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 }
const signed portCHAR* acpc_js_events[JS_NB_EVENT] |
Initial value:
{ (signed portCHAR *)"RELEASE",(signed portCHAR *)"PRESS",(signed portCHAR *)"LEFT",(signed portCHAR *)"LEFT/PRESS", (signed portCHAR *)"RIGHT",(signed portCHAR *)"RIGHT/PRESS",(signed portCHAR *)"?",(signed portCHAR *)"?", (signed portCHAR *)"UP",(signed portCHAR *)"UP/PRESS",(signed portCHAR *)"UP/LEFT",(signed portCHAR *)"UP/LEFT/PRESS", (signed portCHAR *)"UP/RIGHT",(signed portCHAR *)"UP/RIGHT/PRESS",(signed portCHAR *)"?",(signed portCHAR *)"?", (signed portCHAR *)"DOWN",(signed portCHAR *)"DOWN/PRESS",(signed portCHAR *)"DOWN/LEFT",(signed portCHAR *)"DOWN/LEFT/PRESS", (signed portCHAR *)"DOWN/RIGHT",(signed portCHAR *)"DOWN/RIGHT/PRESS",(signed portCHAR *)"?",(signed portCHAR *)"?", (signed portCHAR *)"?",(signed portCHAR *)"?",(signed portCHAR *)"?",(signed portCHAR *)"?", (signed portCHAR *)"?",(signed portCHAR *)"?",(signed portCHAR *)"?",(signed portCHAR *)"?", }
Definition at line 70 of file s_joystick.c.
Referenced by b_joystick_get_value().
unsigned short x_joystick = 0 [static] |