diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/rumblepad.h b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/rumblepad.h index 5c42112503f2325b10cba12a2b145cd40ef2b09d..225624ff9a7d0528a9dbb1b9c2a7ff180d4f8d98 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/rumblepad.h +++ b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/inc/af3pihal/rumblepad.h @@ -19,26 +19,25 @@ #define RUMBLEPAD_AXIS_RIGHT_STICK_HORIZONTAL 3 #define RUMBLEPAD_AXIS_RIGHT_STICK_VERTICAL 4 #define RUMBLEPAD_AXIS_R2 5 -//#define RUMBLEPAD_AXIS_CROSS_PAD_HORIZONTAL 4 -//#define RUMBLEPAD_AXIS_CROSS_PAD_VERTICAL 5 +#define RUMBLEPAD_AXIS_CROSS_PAD_HORIZONTAL 16 +#define RUMBLEPAD_AXIS_CROSS_PAD_VERTICAL 17 -#define RUMBLEPAD_BUTTON_A 6 -#define RUMBLEPAD_BUTTON_B 7 -#define RUMBLEPAD_BUTTON_Y 8 -#define RUMBLEPAD_BUTTON_X 9 -#define RUMBLEPAD_BUTTON_L1 10 -#define RUMBLEPAD_BUTTON_R1 11 -#define RUMBLEPAD_BUTTON_SELECT 12 -#define RUMBLEPAD_BUTTON_START 13 -#define RUMBLEPAD_BUTTON_L3 14 -#define RUMBLEPAD_BUTTON_R3 15 -#define RUMBLEPAD_BUTTON_HOME 16 -#define RUMBLEPAD_DPAD_UP 17 -#define RUMBLEPAD_DPAD_DOWN 18 -#define RUMBLEPAD_DPAD_LEFT 19 -#define RUMBLEPAD_DPAD_RIGHT 20 -//#define RUMBLEPAD_BUTTON_LEFT_STICK 16 -//#define RUMBLEPAD_BUTTON_RIGHT_STICK 17 +#define RUMBLEPAD_BUTTON_A 304 +#define RUMBLEPAD_BUTTON_B 305 +#define RUMBLEPAD_BUTTON_Y 307 +#define RUMBLEPAD_BUTTON_X 308 +#define RUMBLEPAD_BUTTON_L1 310 +#define RUMBLEPAD_BUTTON_R1 311 +#define RUMBLEPAD_BUTTON_SELECT 314 +#define RUMBLEPAD_BUTTON_START 315 +#define RUMBLEPAD_BUTTON_MODE 316 +#define RUMBLEPAD_BUTTON_L3 317 +#define RUMBLEPAD_BUTTON_R3 318 + +#define RUMBLEPAD_DPAD_UP 340 +#define RUMBLEPAD_DPAD_DOWN 341 +#define RUMBLEPAD_DPAD_LEFT 342 +#define RUMBLEPAD_DPAD_RIGHT 343 #define RUMBLEPAD_BUTTON_STATE_PRESSED 1 #define RUMBLEPAD_BUTTON_STATE_NPRESSED 0 @@ -46,8 +45,8 @@ struct rumblepad_configuration { const char* device_id; uint64_t waiting_sleep_in_micros; - void (*axis_callback)(uint8_t axis, int16_t value); - void (*button_callback)(uint8_t button, uint16_t old_value, uint16_t new_value); + void (*axis_callback)(uint16_t axis, int16_t value); + void (*button_callback)(uint16_t button, uint16_t old_value, uint16_t new_value); }; typedef struct rumblepad_configuration rumblepad_configuration_t; @@ -55,10 +54,10 @@ typedef struct rumblepad_configuration rumblepad_configuration_t; void rumblepad_initialize(rumblepad_configuration_t* configuration); /** Get the axis position for the given axis. */ -int16_t rumblepad_get_axis_position(uint8_t axisID); +int16_t rumblepad_get_axis_position(uint16_t axisID); /** Get the button state for the given button. */ -int16_t rumblepad_get_button_state(uint8_t buttonID); +int16_t rumblepad_get_button_state(uint16_t buttonID); /** Terminates the rumblepad thread and frees its resources. */ void rumblepad_terminate(); diff --git a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a index 112f85998f84585d9493877dc0d1cf1c740760f1..25fb2cde3c9624de13722a0fa5f49459e62633a1 100644 Binary files a/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a and b/org.fortiss.af3.platform.raspberry/trunk/code-gen-hal/lib/libaf3pihal.a differ diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 1fe1845900eee27f1556c84d2e400293b7a54594..6afa65127b0a2b345f16e495873789a3d46920d6 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -72,6 +72,6 @@ <eClassifiers xsi:type="ecore:EClass" name="ButtonStart" eSuperTypes="#//rumblepad/RumblepadReceiverBase"/> <eClassifiers xsi:type="ecore:EClass" name="ButtonSelect" eSuperTypes="#//rumblepad/RumblepadReceiverBase"/> <eClassifiers xsi:type="ecore:EClass" name="ButtonHome" eSuperTypes="#//rumblepad/RumblepadReceiverBase"/> - <eClassifiers xsi:type="ecore:EClass" name="SimpleRumbleFeature" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Transmitter"/> + <eClassifiers xsi:type="ecore:EClass" name="SimpleRumbleFeature" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter"/> </eSubpackages> </ecore:EPackage> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/MainGenerator.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/MainGenerator.java index 10336121206c92c88ee60b44e72ffaebd3a127e0..6f6d22993c0ca9f08e4d21cf708f273388a102a3 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/MainGenerator.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/MainGenerator.java @@ -32,38 +32,6 @@ import org.fortiss.af3.platform.model.ExecutionUnit; import org.fortiss.af3.platform.model.PlatformConnectorUnit; import org.fortiss.af3.platform.model.Receiver; import org.fortiss.af3.platform.model.Transmitter; -import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; -import org.fortiss.af3.platform.raspberry.model.RaspberryPi; -import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor; -import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor; -import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor; -import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits; -import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor; -import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor; -import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor; -import org.fortiss.af3.platform.raspberry.model.brick.LaserRangeSensor; -import org.fortiss.af3.platform.raspberry.model.brick.UltraSonicSensor; -import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; -import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; -import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; -import org.fortiss.af3.platform.raspberry.model.gamepad.Button4; -import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonL2; -import org.fortiss.af3.platform.raspberry.model.gamepad.ButtonR2; -import org.fortiss.af3.platform.raspberry.model.gamepad.GamepadReceiverBase; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonA; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonB; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonHome; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonSelect; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonStart; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonX; -import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonY; -import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadDown; -import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadLeft; -import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadRight; -import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadUp; -import org.fortiss.af3.platform.raspberry.model.rumblepad.L2_Position; -import org.fortiss.af3.platform.raspberry.model.rumblepad.R2_Position; -import org.fortiss.af3.platform.raspberry.model.rumblepad.RumblepadReceiverBase; import org.fortiss.tooling.kernel.extension.data.ITransformationContext; /** @@ -484,19 +452,7 @@ class MainGenerator { return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_BUTTON_SELECT", inport); } if(receiver instanceof ButtonHome) { - return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_BUTTON_HOME", inport); - } - if(receiver instanceof DPadDown) { - return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_DOWN", inport); - } - if(receiver instanceof DPadUp) { - return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_UP", inport); - } - if(receiver instanceof DPadLeft) { - return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_LEFT", inport); - } - if(receiver instanceof DPadRight) { - return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_RIGHT", inport); + return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_BUTTON_MODE", inport); } if(receiver instanceof org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonL1) { return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_BUTTON_L1", inport); @@ -516,6 +472,18 @@ class MainGenerator { if(receiver instanceof R2_Position) { return gamepadReadCode("rumblepad_get_axis_position", "RUMBLEPAD_AXIS_R2", inport); } + if(receiver instanceof DPadDown) { + return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_DOWN", inport); + } + if(receiver instanceof DPadUp) { + return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_UP", inport); + } + if(receiver instanceof DPadLeft) { + return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_LEFT", inport); + } + if(receiver instanceof DPadRight) { + return gamepadReadCode("rumblepad_get_button_state", "RUMBLEPAD_DPAD_RIGHT", inport); + } if(receiver instanceof org.fortiss.af3.platform.raspberry.model.rumblepad.Left_StickX_Position) { return gamepadReadCode("rumblepad_get_axis_position", "RUMBLEPAD_AXIS_LEFT_STICK_HORIZONTAL", inport);