Skip to content

Commit

Permalink
Update outputselect to use platform connected state API (qmk#16185)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored and 1Conan committed Feb 6, 2022
1 parent 584cfea commit e293ff6
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions drivers/bluetooth/outputselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "outputselect.h"

#if defined(PROTOCOL_LUFA)
# include "lufa.h"
#elif defined(PROTOCOL_CHIBIOS)
# include "usb_main.h"
#endif
#include "usb_util.h"

#ifdef MODULE_ADAFRUIT_BLE
# include "adafruit_ble.h"
Expand Down Expand Up @@ -53,22 +48,12 @@ void set_output(uint8_t output) {
*/
__attribute__((weak)) void set_output_user(uint8_t output) {}

static bool is_usb_configured(void) {
#if defined(PROTOCOL_LUFA)
return USB_DeviceState == DEVICE_STATE_Configured;
#elif defined(PROTOCOL_CHIBIOS)
return USB_DRIVER.state == USB_ACTIVE;
#else
return true;
#endif
}

/** \brief Auto Detect Output
*
* FIXME: Needs doc
*/
uint8_t auto_detect_output(void) {
if (is_usb_configured()) {
if (usb_connected_state()) {
return OUTPUT_USB;
}

Expand Down

0 comments on commit e293ff6

Please sign in to comment.