forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
258 additions
and
204 deletions.
There are no files selected for viewing
216 changes: 108 additions & 108 deletions
216
tmk_core/protocol/arm_atsam/usb/usb2422.h → drivers/usb2422.c
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* Copyright 2021 QMK | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
|
||
#ifndef USB2422_ADDRESS | ||
# define USB2422_ADDRESS 0x58 | ||
#endif | ||
|
||
#ifndef USB2422_VENDOR_ID | ||
# define USB2422_VENDOR_ID 0xFEED | ||
#endif | ||
#ifndef USB2422_PRODUCT_ID | ||
# define USB2422_PRODUCT_ID 0x0001 | ||
#endif | ||
#ifndef USB2422_DEVICE_VER | ||
# define USB2422_DEVICE_VER 0x0001 | ||
#endif | ||
|
||
#ifndef USB2422_MANUFACTURER | ||
# define USB2422_MANUFACTURER "QMK" | ||
#endif | ||
#ifndef USB2422_PRODUCT | ||
# define USB2422_PRODUCT "QMK Hub" | ||
#endif | ||
|
||
/** \brief Initialises the dependent subsystems */ | ||
void USB2422_init(void); | ||
|
||
/** \brief Push configuration to the USB2422 device */ | ||
void USB2422_configure(void); | ||
|
||
/** \brief Reset the chip (RESET_N) | ||
* | ||
* NOTE: | ||
* Depends on a valid USB2422_RESET_PIN configuration | ||
*/ | ||
void USB2422_reset(void); | ||
|
||
/** \brief Indicates the USB state of the hub (SUSP_IND) | ||
* | ||
* NOTE: | ||
* Depends on a valid USB2422_ACTIVE_PIN configuration | ||
*/ | ||
bool USB2422_active(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright 2018 Massdrop Inc. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _USB2422_H_ | ||
#define _USB2422_H_ | ||
|
||
#define REV_USB2422 0x100 | ||
|
||
#define PORT_DETECT_RETRY_INTERVAL 2000 | ||
|
||
#define USB_EXTRA_ADC_THRESHOLD 900 | ||
|
||
#define USB_EXTRA_STATE_DISABLED 0 | ||
#define USB_EXTRA_STATE_ENABLED 1 | ||
#define USB_EXTRA_STATE_UNKNOWN 2 | ||
#define USB_EXTRA_STATE_DISABLED_UNTIL_REPLUG 3 | ||
|
||
#define USB_HOST_PORT_1 0 | ||
#define USB_HOST_PORT_2 1 | ||
#define USB_HOST_PORT_UNKNOWN 2 | ||
|
||
extern uint8_t usb_host_port; | ||
extern uint8_t usb_extra_state; | ||
extern uint8_t usb_extra_manual; | ||
extern uint8_t usb_gcr_auto; | ||
|
||
void USB_Hub_init(void); | ||
uint8_t USB_Hub_Port_Detect_Init(void); | ||
void USB_reset(void); | ||
void USB_configure(void); | ||
uint16_t USB_active(void); | ||
void USB_set_host_by_voltage(void); | ||
uint16_t adc_get(uint8_t muxpos); | ||
void USB_HandleExtraDevice(void); | ||
void USB_ExtraSetState(uint8_t state); | ||
|
||
#endif //_USB2422_H_ |