Adding dynamic USB power support

- Each scan module now has a current change callback which passes the available current as a parameter
- No longer attempts to use the max 500 mA immediately, starts with 100 mA then goes to 500 mA after enumeration
- If enumeration fails due to bMaxPower of 500 mA, then attempt again at 100 mA (might also be possible to go even lower to 20 mA in certain cases)
- Now working with the Apple Ipad (no over-power messages)
- Fixed Wake-up behaviour on Apple Ipad (and likely other iOS devices)
- More effecient set_feature/clear_feature handling (device handler)
- Initial power handling via Interconnect (still needs work to get it more dynamic)
This commit is contained in:
Jacob Alexander 2016-02-21 19:56:52 -08:00
parent 62ba0c558b
commit aaae9bc0f2
29 changed files with 503 additions and 48 deletions

View file

@ -1,7 +1,7 @@
/* Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
* Modified by Jacob Alexander (2013-2015)
* Modified by Jacob Alexander (2013-2016)
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -451,7 +451,7 @@ static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
1, // bConfigurationValue
0, // iConfiguration
0xA0, // bmAttributes
250, // bMaxPower
250, // bMaxPower - Entry Index 8
// --- Keyboard HID --- Boot Mode Keyboard Interface
// - 9 bytes -
@ -695,6 +695,8 @@ static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
SYS_CTRL_INTERVAL, // bInterval
};
uint8_t *usb_bMaxPower = &config_descriptor[8];
// ----- String Descriptors -----