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
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);
7977static const XInputMap_Button Map_ButtonX (3 , 6 );
8078static 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
122117static const XInputMap_Trigger Map_TriggerLeft (4 );
123118static 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
153145static const XInputMap_Joystick Map_JoystickLeft (6 , 7 , 8 , 9 );
154146static 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;
0 commit comments