2020-09-10 13:57:44 +10:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-05-06 06:09:05 +10:00
|
|
|
|
|
|
|
#include <usb/usb_device.h>
|
|
|
|
#include <usb/class/usb_hid.h>
|
|
|
|
|
2020-05-18 23:11:46 +10:00
|
|
|
#include <zmk/keys.h>
|
|
|
|
#include <zmk/hid.h>
|
2020-05-13 04:15:33 +10:00
|
|
|
|
2020-10-12 09:03:21 +11:00
|
|
|
enum zmk_usb_conn_state {
|
|
|
|
ZMK_USB_CONN_NONE,
|
|
|
|
ZMK_USB_CONN_POWERED,
|
|
|
|
ZMK_USB_CONN_HID,
|
|
|
|
};
|
|
|
|
|
2020-10-05 09:18:44 +11:00
|
|
|
enum usb_dc_status_code zmk_usb_get_status();
|
2020-10-12 09:03:21 +11:00
|
|
|
enum zmk_usb_conn_state zmk_usb_get_conn_state();
|
|
|
|
|
|
|
|
static inline bool zmk_usb_is_powered() { return zmk_usb_get_conn_state() != ZMK_USB_CONN_NONE; }
|
|
|
|
static inline bool zmk_usb_is_hid_ready() { return zmk_usb_get_conn_state() == ZMK_USB_CONN_HID; }
|