Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing structure definitions, fix existing. #213

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move controller keycodes into a enum
removes the default definitions and puts them inside a enum
  • Loading branch information
Backporter committed Feb 13, 2023
commit fb3f0881d99e154dc766da7f0caf4b4546065170
59 changes: 32 additions & 27 deletions include/orbis/_types/pad.h
Original file line number Diff line number Diff line change
@@ -3,29 +3,29 @@
#include <stdint.h>

#define ORBIS_PAD_PORT_TYPE_STANDARD 0
#define ORBIS_PAD_MAX_TOUCH_NUM 2
#define ORBIS_PAD_MAX_DATA_NUM 0x40

#define ORBIS_PAD_BUTTON_L3 0x0002
#define ORBIS_PAD_BUTTON_R3 0x0004
#define ORBIS_PAD_BUTTON_OPTIONS 0x0008
#define ORBIS_PAD_BUTTON_UP 0x0010
#define ORBIS_PAD_BUTTON_RIGHT 0x0020
#define ORBIS_PAD_BUTTON_DOWN 0x0040
#define ORBIS_PAD_BUTTON_LEFT 0x0080

#define ORBIS_PAD_BUTTON_L2 0x0100
#define ORBIS_PAD_BUTTON_R2 0x0200
#define ORBIS_PAD_BUTTON_L1 0x0400
#define ORBIS_PAD_BUTTON_R1 0x0800

#define ORBIS_PAD_BUTTON_TRIANGLE 0x1000
#define ORBIS_PAD_BUTTON_CIRCLE 0x2000
#define ORBIS_PAD_BUTTON_CROSS 0x4000
#define ORBIS_PAD_BUTTON_SQUARE 0x8000

#define ORBIS_PAD_BUTTON_TOUCH_PAD 0x100000

#define ORBIS_PAD_MAX_TOUCH_NUM 2
#define ORBIS_PAD_MAX_DATA_NUM 0x40
typedef enum OrbisPadButtonDataOffset : uint32_t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify that this does not break C support/samples.

{
ORBIS_PAD_BUTTON_L3 = 0x00000002,
ORBIS_PAD_BUTTON_R3 = 0x00000004,
ORBIS_PAD_BUTTON_OPTIONS = 0x00000008,
ORBIS_PAD_BUTTON_UP = 0x00000010,
ORBIS_PAD_BUTTON_RIGHT = 0x00000020,
ORBIS_PAD_BUTTON_DOWN = 0x00000040,
ORBIS_PAD_BUTTON_LEFT = 0x00000080,
ORBIS_PAD_BUTTON_L2 = 0x00000100,
ORBIS_PAD_BUTTON_R2 = 0x00000200,
ORBIS_PAD_BUTTON_L1 = 0x00000400,
ORBIS_PAD_BUTTON_R1 = 0x00000800,
ORBIS_PAD_BUTTON_TRIANGLE = 0x00001000,
ORBIS_PAD_BUTTON_CIRCLE = 0x00002000,
ORBIS_PAD_BUTTON_CROSS = 0x00004000,
ORBIS_PAD_BUTTON_SQUARE = 0x00008000,
ORBIS_PAD_BUTTON_TOUCH_PAD = 0x00100000,
ORBIS_PAD_BUTTON_INTERCEPTED = 0x80000000,
} OrbisPadButtonDataOffset;

typedef struct vec_float3
{
@@ -54,13 +54,15 @@ typedef struct analog
uint8_t r2;
} analog;

typedef struct OrbisPadTouch {
typedef struct OrbisPadTouch
{
uint16_t x, y;
uint8_t finger;
uint8_t pad[3];
} OrbisPadTouch;

typedef struct OrbisPadTouchData {
typedef struct OrbisPadTouchData
{
uint8_t fingers;
uint8_t pad1[3];
uint32_t pad2;
@@ -69,7 +71,8 @@ typedef struct OrbisPadTouchData {

// The ScePadData Structure contains data polled from the DS4 controller. This includes button states, analogue
// positional data, and touchpad related data.
typedef struct OrbisPadData {
typedef struct OrbisPadData
{
unsigned int buttons;
stick leftStick;
stick rightStick;
@@ -87,14 +90,16 @@ typedef struct OrbisPadData {
} OrbisPadData;

// The PadColor structure contains RGBA for the DS4 controller lightbar.
typedef struct OrbisPadColor {
typedef struct OrbisPadColor
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
} OrbisPadColor;

typedef struct OrbisPadVibeParam {
typedef struct OrbisPadVibeParam
{
uint8_t lgMotor;
uint8_t smMotor;
} OrbisPadVibeParam;