3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 10:35:27 +02:00

Add another bit to channel types so we can fit rumble

This commit is contained in:
Brad Davis 2015-10-23 12:55:04 -07:00
parent 56deef9d6e
commit 4110324b35
2 changed files with 10 additions and 9 deletions
libraries/controllers/src/controllers

View file

@ -9,10 +9,9 @@
#include "Input.h"
namespace controller {
const uint16_t Input::INVALID_DEVICE = 0xffff;
const uint16_t Input::INVALID_CHANNEL = 0x1fff;
const uint16_t Input::INVALID_TYPE = (uint16_t)ChannelType::INVALID;
const Input Input::INVALID_INPUT = Input(INVALID_DEVICE, INVALID_CHANNEL, ChannelType::INVALID);
const Input Input::INVALID_INPUT = Input(0x7fffffff);
const uint16_t Input::INVALID_DEVICE = Input::INVALID_INPUT.device;
const uint16_t Input::INVALID_CHANNEL = Input::INVALID_INPUT.channel;
const uint16_t Input::INVALID_TYPE = Input::INVALID_INPUT.type;
}

View file

@ -16,10 +16,12 @@
namespace controller {
enum class ChannelType {
INVALID = 0,
BUTTON = 1,
UNKNOWN = 0,
BUTTON,
AXIS,
POSE,
RUMBLE,
INVALID = 0x7
};
// Input is the unique identifier to find a n input channel of a particular device
@ -30,8 +32,8 @@ struct Input {
uint32_t id{ 0 }; // by default Input is 0 meaning invalid
struct {
uint16_t device; // Up to 64K possible devices
uint16_t channel : 13 ; // 2^13 possible channel per Device
uint16_t type : 2; // 2 bits to store the Type directly in the ID
uint16_t channel : 12 ; // 2^12 possible channel per Device
uint16_t type : 3; // 2 bits to store the Type directly in the ID
uint16_t padding : 1; // 2 bits to store the Type directly in the ID
};
};