Browse Source

Merge pull request #7 from mjs513/WIP2-Bluetooth

Updated with additonal axis page
main
KurtE 5 years ago
parent
commit
427ddc410f
No account linked to committer's email address
2 changed files with 6 additions and 15 deletions
  1. +2
    -11
      examples/JoystickBT/JoystickBT.ino
  2. +4
    -4
      joystick.cpp

+ 2
- 11
examples/JoystickBT/JoystickBT.ino View File

@@ -51,19 +51,10 @@ uint8_t last_bdaddr[6] = {0, 0, 0, 0, 0, 0};

void setup()
{
/* Serial4.begin( 1843200 );
debBegin_tt( &Serial4, LED_BUILTIN, 12);
debTraceShow_tt( -1, "", "", "" );
Serial4.println("\n" __FILE__ " " __DATE__ " " __TIME__);
Serial4.println("\n********\n T4 connected Serial1 *******\n");
Serial4.println("\n" __FILE__ " " __DATE__ " " __TIME__);
Serial4.println("\n********\n T4 connected Serial4 *******\n");
*/

Serial1.begin(2000000);
while (!Serial) ; // wait for Arduino Serial Monitor
//debTraceShow_tt( -2, "", "", "" );
//Serial4.println("\n" __FILE__ " " __DATE__ " " __TIME__);
//Serial1.begin( 1843200 );

Serial.println("\n\nUSB Host Testing");
Serial.println(sizeof(USBHub), DEC);
myusb.begin();

+ 4
- 4
joystick.cpp View File

@@ -328,9 +328,9 @@ hidclaim_t JoystickController::claim_collection(USBHIDParser *driver, Device_t *
axis_change_notify_mask_ = (uint64_t)0xfffffffffffff3ffl; // Start off assume all bits - 10 and 11
break;
default:
additional_axis_usage_page_ = 0;
additional_axis_usage_start_ = 0;
additional_axis_usage_count_ = 0;
additional_axis_usage_page_ = 0x09;
additional_axis_usage_start_ = 0x21;
additional_axis_usage_count_ = 5;
axis_change_notify_mask_ = 0x3ff; // Start off assume only the 10 bits...
}
DBGPrintf("Claim Additional axis: %x %x %d\n", additional_axis_usage_page_, additional_axis_usage_start_, additional_axis_usage_count_);
@@ -354,7 +354,7 @@ void JoystickController::hid_input_begin(uint32_t topusage, uint32_t type, int l

void JoystickController::hid_input_data(uint32_t usage, int32_t value)
{
//DBGPrintf("Joystick: usage=%X, value=%d\n", usage, value);
DBGPrintf("Joystick: usage=%X, value=%d\n", usage, value);
uint32_t usage_page = usage >> 16;
usage &= 0xFFFF;
if (usage_page == 9 && usage >= 1 && usage <= 32) {

Loading…
Cancel
Save