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



void setup() 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); Serial1.begin(2000000);
while (!Serial) ; // wait for Arduino Serial Monitor 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("\n\nUSB Host Testing");
Serial.println(sizeof(USBHub), DEC); Serial.println(sizeof(USBHub), DEC);
myusb.begin(); myusb.begin();

+ 4
- 4
joystick.cpp View File

axis_change_notify_mask_ = (uint64_t)0xfffffffffffff3ffl; // Start off assume all bits - 10 and 11 axis_change_notify_mask_ = (uint64_t)0xfffffffffffff3ffl; // Start off assume all bits - 10 and 11
break; break;
default: 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... 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_); DBGPrintf("Claim Additional axis: %x %x %d\n", additional_axis_usage_page_, additional_axis_usage_start_, additional_axis_usage_count_);


void JoystickController::hid_input_data(uint32_t usage, int32_t value) 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; uint32_t usage_page = usage >> 16;
usage &= 0xFFFF; usage &= 0xFFFF;
if (usage_page == 9 && usage >= 1 && usage <= 32) { if (usage_page == 9 && usage >= 1 && usage <= 32) {

Loading…
Cancel
Save