Skip to content

Commit 7d7fd84

Browse files
authored
Merge pull request #4 from dmadison/arduino-rework
Arduino Compatibility Rework
2 parents c6b661f + 8a5d263 commit 7d7fd84

9 files changed

Lines changed: 30 additions & 38 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# TeensyXInput
1+
# Arduino XInput Library

examples/BasicGamepad/BasicGamepad.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Project Teensy XInput Library
2+
* Project Arduino XInput Library
33
* @author David Madison
4-
* @link github.com/dmadison/TeensyXInput
5-
* @license MIT - Copyright (c) 2018 David Madison
4+
* @link github.com/dmadison/ArduinoXInput
5+
* @license MIT - Copyright (c) 2019 David Madison
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal

examples/Blink/Blink.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Project Teensy XInput Library
2+
* Project Arduino XInput Library
33
* @author David Madison
4-
* @link github.com/dmadison/TeensyXInput
5-
* @license MIT - Copyright (c) 2018 David Madison
4+
* @link github.com/dmadison/ArduinoXInput
5+
* @license MIT - Copyright (c) 2019 David Madison
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal

examples/TestAll/TestAll.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Project Teensy XInput Library
2+
* Project Arduino XInput Library
33
* @author David Madison
4-
* @link github.com/dmadison/TeensyXInput
5-
* @license MIT - Copyright (c) 2018 David Madison
4+
* @link github.com/dmadison/ArduinoXInput
5+
* @license MIT - Copyright (c) 2019 David Madison
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal

examples/WiiClassicController/WiiClassicController.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Project Teensy XInput Library
2+
* Project Arduino XInput Library
33
* @author David Madison
4-
* @link github.com/dmadison/TeensyXInput
5-
* @license MIT - Copyright (c) 2018 David Madison
4+
* @link github.com/dmadison/ArduinoXInput
5+
* @license MIT - Copyright (c) 2019 David Madison
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal

keywords.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#######################################
2-
# Syntax Coloring Map For Teensy XInput
2+
# Syntax Coloring Map For Arduino XInput Library
33
#######################################
44

55
#######################################

library.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name=Teensy XInput
1+
name=XInput
22
version=0.0.1
33
author=David Madison
44
maintainer=David Madison
5-
sentence=Library for emulating an Xbox 360 controller with Teensyduino.
6-
paragraph=Library for emulating an Xbox 360 controller with Teensyduino.
5+
sentence=Library for emulating an Xbox controller over USB.
6+
paragraph=Requires a compatible board configuration with the proper USB descriptors.
77
category=Communication
8-
url=https://github.com/dmadison/TeensyXInput
8+
url=https://github.com/dmadison/ArduinoXInput
99
architectures=*
1010
includes=XInput.h

src/XInput.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Project Teensy XInput Library
2+
* Project Arduino XInput Library
33
* @author David Madison
4-
* @link github.com/dmadison/TeensyXInput
5-
* @license MIT - Copyright (c) 2018 David Madison
4+
* @link github.com/dmadison/ArduinoXInput
5+
* @license MIT - Copyright (c) 2019 David Madison
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -43,8 +43,6 @@
4343
#error "Not a supported board! Must use Teensy 3.1/3.2, LC, 3.5, or 3.6"
4444
#endif
4545

46-
#include <limits>
47-
4846
// --------------------------------------------------------
4947
// XInput Button Maps |
5048
// (Matches ID to tx index with bitmask) |
@@ -79,7 +77,7 @@ static const XInputMap_Button Map_ButtonB(3, 5);
7977
static const XInputMap_Button Map_ButtonX(3, 6);
8078
static const XInputMap_Button Map_ButtonY(3, 7);
8179

82-
constexpr const XInputMap_Button * getButtonFromEnum(XInputControl ctrl) {
80+
const XInputMap_Button * getButtonFromEnum(XInputControl ctrl) {
8381
switch (ctrl) {
8482
case(DPAD_UP): return &Map_DpadUp;
8583
case(DPAD_DOWN): return &Map_DpadDown;
@@ -114,15 +112,12 @@ struct XInputMap_Trigger {
114112
const uint8_t index;
115113
};
116114

117-
const XInputGamepad::Range XInputMap_Trigger::range = {
118-
std::numeric_limits<uint8_t>::min(), // 0
119-
std::numeric_limits<uint8_t>::max() // 255
120-
};
115+
const XInputGamepad::Range XInputMap_Trigger::range = { 0, 255 }; // uint8_t
121116

122117
static const XInputMap_Trigger Map_TriggerLeft(4);
123118
static const XInputMap_Trigger Map_TriggerRight(5);
124119

125-
constexpr const XInputMap_Trigger * getTriggerFromEnum(XInputControl ctrl) {
120+
const XInputMap_Trigger * getTriggerFromEnum(XInputControl ctrl) {
126121
switch (ctrl) {
127122
case(TRIGGER_LEFT): return &Map_TriggerLeft;
128123
case(TRIGGER_RIGHT): return &Map_TriggerRight;
@@ -145,15 +140,12 @@ struct XInputMap_Joystick {
145140
const uint8_t y_high;
146141
};
147142

148-
const XInputGamepad::Range XInputMap_Joystick::range = {
149-
std::numeric_limits<int16_t>::min(), // -32768
150-
std::numeric_limits<int16_t>::max() // 32767
151-
};
143+
const XInputGamepad::Range XInputMap_Joystick::range = { -32768, 32767 }; // int16_t
152144

153145
static const XInputMap_Joystick Map_JoystickLeft(6, 7, 8, 9);
154146
static const XInputMap_Joystick Map_JoystickRight(10, 11, 12, 13);
155147

156-
constexpr const XInputMap_Joystick * getJoyFromEnum(XInputControl ctrl) {
148+
const XInputMap_Joystick * getJoyFromEnum(XInputControl ctrl) {
157149
switch (ctrl) {
158150
case(JOY_LEFT): return &Map_JoystickLeft;
159151
case(JOY_RIGHT): return &Map_JoystickRight;

src/XInput.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Project Teensy XInput Library
2+
* Project Arduino XInput Library
33
* @author David Madison
4-
* @link github.com/dmadison/TeensyXInput
5-
* @license MIT - Copyright (c) 2018 David Madison
4+
* @link github.com/dmadison/ArduinoXInput
5+
* @license MIT - Copyright (c) 2019 David Madison
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -27,7 +27,7 @@
2727
#ifndef XInput_h
2828
#define XInput_h
2929

30-
#include "Arduino.h"
30+
#include <Arduino.h>
3131

3232
enum XInputControl {
3333
BUTTON_A,

0 commit comments

Comments
 (0)