usb_cables: add battery charger cables
This commit is contained in:
parent
5434633fb3
commit
bfcb54c687
143
usb_cables.c
143
usb_cables.c
|
@ -15,7 +15,7 @@
|
|||
/** USB cable definitions and utilities
|
||||
* @file
|
||||
* @author King Kévin <kingkevin@cuvoodoo.info>
|
||||
* @date 2019
|
||||
* @date 2019-2020
|
||||
*/
|
||||
/* standard libraries */
|
||||
#include <stdint.h> // standard integer types
|
||||
|
@ -801,12 +801,6 @@ static const uint8_t usb_aa0_pins[][2] = {
|
|||
{usb_a_host_pins[4], usb_a_device_pins[4]}, // GND
|
||||
};
|
||||
|
||||
/** USB type A to type A power cable optional pin pairs */
|
||||
static const uint8_t usb_aa0_opts[][2] = {
|
||||
{usb_a_host_pins[2], usb_a_host_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
{usb_a_device_pins[2], usb_a_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
};
|
||||
|
||||
/** USB type A to type A USB 2.0 cable mandatory pin pairs
|
||||
* @implements this cable is not specified since it does not carry USB data signals
|
||||
* @note A-A cable are not specified since they use a host connector on both sides, but some cheap devices use it because the connector is cheap
|
||||
|
@ -850,9 +844,14 @@ static const uint8_t usb__a_host__b__ab0_pins[][2] = {
|
|||
{usb_a_host_pins[4], usb_b_device_pins[4]}, // GND
|
||||
};
|
||||
|
||||
/** USB type A to type B power only cable optional pin pairs */
|
||||
static const uint8_t usb__a_host__b__ab0_opts[][2] = {
|
||||
{usb_b_device_pins[2], usb_b_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
/** USB type A to type B battery charger cable mandatory pin pairs
|
||||
* @implements Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating
|
||||
* @note this cable is not specified since it does not carry USB data signals
|
||||
*/
|
||||
static const uint8_t usb__a_host__b__abbc_pins[][2] = {
|
||||
{usb_a_host_pins[1], usb_b_device_pins[1]}, // VBUS
|
||||
{usb_a_host_pins[4], usb_b_device_pins[4]}, // GND
|
||||
{usb_b_device_pins[2], usb_b_device_pins[3]}, // D+, D-
|
||||
};
|
||||
|
||||
/** USB type A to type B USB 2.0 cable mandatory pin pairs
|
||||
|
@ -895,6 +894,12 @@ static const uint8_t usb__a_device__b__ab0_pins[][2] = {
|
|||
{usb_a_device_pins[4], usb_b_device_pins[4]}, // GND
|
||||
};
|
||||
|
||||
static const uint8_t usb__a_device__b__abbc_pins[][2] = {
|
||||
{usb_a_device_pins[1], usb_b_device_pins[1]}, // VBUS
|
||||
{usb_a_device_pins[4], usb_b_device_pins[4]}, // GND
|
||||
{usb_b_device_pins[2], usb_b_device_pins[3]}, // D+, D-
|
||||
};
|
||||
|
||||
static const uint8_t usb__a_device__b__ab0_opts[][2] = {
|
||||
{usb_b_device_pins[2], usb_b_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
};
|
||||
|
@ -967,9 +972,14 @@ static const uint8_t usb__a_host__minib__amb0_pins[][2] = {
|
|||
{usb_a_host_pins[4], usb_minib_device_pins[5]}, // GND
|
||||
};
|
||||
|
||||
/** USB type A to type mini-B power only cable optional pin pairs */
|
||||
static const uint8_t usb__a_host__minib__amb0_opts[][2] = {
|
||||
{usb_minib_device_pins[2], usb_minib_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
/** USB type A to type mini-B battery charger cable mandatory pin pairs
|
||||
* @implements Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating
|
||||
* @note this cable is not specified since it does not carry USB data signals
|
||||
*/
|
||||
static const uint8_t usb__a_host__minib__ambbc_pins[][2] = {
|
||||
{usb_a_host_pins[1], usb_minib_device_pins[1]}, // VBUS
|
||||
{usb_a_host_pins[4], usb_minib_device_pins[5]}, // GND
|
||||
{usb_minib_device_pins[2], usb_minib_device_pins[3]}, // D+, D-
|
||||
};
|
||||
|
||||
/** USB type A to type mini-B USB 2.0 cable mandatory pin pairs
|
||||
|
@ -995,8 +1005,10 @@ static const uint8_t usb__a_device__minib__amb0_pins[][2] = {
|
|||
{usb_a_device_pins[4], usb_minib_device_pins[5]}, // GND
|
||||
};
|
||||
|
||||
static const uint8_t usb__a_device__minib__amb0_opts[][2] = {
|
||||
{usb_minib_device_pins[2], usb_minib_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
static const uint8_t usb__a_device__minib__ambbc_pins[][2] = {
|
||||
{usb_a_device_pins[1], usb_minib_device_pins[1]}, // VBUS
|
||||
{usb_a_device_pins[4], usb_minib_device_pins[5]}, // GND
|
||||
{usb_minib_device_pins[2], usb_minib_device_pins[3]}, // D+, D-
|
||||
};
|
||||
|
||||
static const uint8_t usb__a_device__minib__amb2_pins[][2] = {
|
||||
|
@ -1054,9 +1066,14 @@ static const uint8_t usb__a_host__microb__aub0_pins[][2] = {
|
|||
{usb_a_host_pins[4], usb_microb_device_pins[5]}, // GND
|
||||
};
|
||||
|
||||
/** USB type A to type micro-B power only cable optional pin pairs */
|
||||
static const uint8_t usb__a_host__microb__aub0_opts[][2] = {
|
||||
{usb_microb_device_pins[2], usb_microb_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
/** USB type A to type micro-B power only cable mandatory pin pairs
|
||||
* @implements Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating
|
||||
* @note this cable is not specified since it does not carry USB data signals
|
||||
*/
|
||||
static const uint8_t usb__a_host__microb__aubbc_pins[][2] = {
|
||||
{usb_a_host_pins[1], usb_microb_device_pins[1]}, // VBUS
|
||||
{usb_a_host_pins[4], usb_microb_device_pins[5]}, // GND
|
||||
{usb_microb_device_pins[2], usb_microb_device_pins[3]}, // D+, D-
|
||||
};
|
||||
|
||||
/** USB type A to type micro-B USB 2.0 cable mandatory pin pairs
|
||||
|
@ -1099,8 +1116,10 @@ static const uint8_t usb__a_device__microb__aub0_pins[][2] = {
|
|||
{usb_a_device_pins[4], usb_microb_device_pins[5]}, // GND
|
||||
};
|
||||
|
||||
static const uint8_t usb__a_device__microb__aub0_opts[][2] = {
|
||||
{usb_microb_device_pins[2], usb_microb_device_pins[3]}, // D+, D- (Battery Charging Specification, Revision 1.1: A Dedicated Charging Port is required to short the D+ line to the D- line. Doing it in the cable on the device side is kind of cheating)
|
||||
static const uint8_t usb__a_device__microb__aubbc_pins[][2] = {
|
||||
{usb_a_device_pins[1], usb_microb_device_pins[1]}, // VBUS
|
||||
{usb_a_device_pins[4], usb_microb_device_pins[5]}, // GND
|
||||
{usb_microb_device_pins[2], usb_microb_device_pins[3]}, // D+, D-
|
||||
};
|
||||
|
||||
static const uint8_t usb__a_device__microb__aub2_pins[][2] = {
|
||||
|
@ -3997,8 +4016,8 @@ const struct usb_cable_t usb_cables[] = {
|
|||
.connectors = usb_a_a_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb_aa0_pins),
|
||||
.mandatory_pairs = usb_aa0_pins,
|
||||
.optional_pairs_nb = LENGTH(usb_aa0_opts),
|
||||
.optional_pairs = usb_aa0_opts,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-A USB 2.0",
|
||||
|
@ -4025,8 +4044,17 @@ const struct usb_cable_t usb_cables[] = {
|
|||
.connectors = usb_a_host_b_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_host__b__ab0_pins),
|
||||
.mandatory_pairs = usb__a_host__b__ab0_pins,
|
||||
.optional_pairs_nb = LENGTH(usb__a_host__b__ab0_opts),
|
||||
.optional_pairs = usb__a_host__b__ab0_opts,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-B battery charger",
|
||||
.connectors_nb = LENGTH(usb_a_host_b_connectors),
|
||||
.connectors = usb_a_host_b_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_host__b__abbc_pins),
|
||||
.mandatory_pairs = usb__a_host__b__abbc_pins,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-B USB 2.0",
|
||||
|
@ -4056,6 +4084,15 @@ const struct usb_cable_t usb_cables[] = {
|
|||
.optional_pairs_nb = LENGTH(usb__a_device__b__ab0_opts),
|
||||
.optional_pairs = usb__a_device__b__ab0_opts,
|
||||
},
|
||||
{
|
||||
.name = "A-B battery charger",
|
||||
.connectors_nb = LENGTH(usb_a_device_b_connectors),
|
||||
.connectors = usb_a_device_b_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_device__b__abbc_pins),
|
||||
.mandatory_pairs = usb__a_device__b__abbc_pins,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-B USB 2.0",
|
||||
.connectors_nb = LENGTH(usb_a_host_b_connectors),
|
||||
|
@ -4093,13 +4130,22 @@ const struct usb_cable_t usb_cables[] = {
|
|||
},
|
||||
// A (host) - mini-B
|
||||
{
|
||||
.name = "A-miniB power",
|
||||
.name = "A-miniB power only",
|
||||
.connectors_nb = LENGTH(usb_a_host_minib_connectors),
|
||||
.connectors = usb_a_host_minib_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_host__minib__amb0_pins),
|
||||
.mandatory_pairs = usb__a_host__minib__amb0_pins,
|
||||
.optional_pairs_nb = LENGTH(usb__a_host__minib__amb0_opts),
|
||||
.optional_pairs = usb__a_host__minib__amb0_opts,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-miniB bettry charger",
|
||||
.connectors_nb = LENGTH(usb_a_host_minib_connectors),
|
||||
.connectors = usb_a_host_minib_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_host__minib__ambbc_pins),
|
||||
.mandatory_pairs = usb__a_host__minib__ambbc_pins,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-miniB USB 2.0",
|
||||
|
@ -4117,8 +4163,17 @@ const struct usb_cable_t usb_cables[] = {
|
|||
.connectors = usb_a_device_minib_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_device__minib__amb0_pins),
|
||||
.mandatory_pairs = usb__a_device__minib__amb0_pins,
|
||||
.optional_pairs_nb = LENGTH(usb__a_device__minib__amb0_opts),
|
||||
.optional_pairs = usb__a_device__minib__amb0_opts,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-miniB bettry charger",
|
||||
.connectors_nb = LENGTH(usb_a_device_minib_connectors),
|
||||
.connectors = usb_a_device_minib_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_device__minib__ambbc_pins),
|
||||
.mandatory_pairs = usb__a_device__minib__ambbc_pins,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-miniB USB 2.0",
|
||||
|
@ -4150,13 +4205,22 @@ const struct usb_cable_t usb_cables[] = {
|
|||
},
|
||||
// A (host) - micro-B
|
||||
{
|
||||
.name = "A-microB power",
|
||||
.name = "A-microB power only",
|
||||
.connectors_nb = LENGTH(usb_a_host_microb_connectors),
|
||||
.connectors = usb_a_host_microb_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_host__microb__aub0_pins),
|
||||
.mandatory_pairs = usb__a_host__microb__aub0_pins,
|
||||
.optional_pairs_nb = LENGTH(usb__a_host__microb__aub0_opts),
|
||||
.optional_pairs = usb__a_host__microb__aub0_opts,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-microB battery charger",
|
||||
.connectors_nb = LENGTH(usb_a_host_microb_connectors),
|
||||
.connectors = usb_a_host_microb_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_host__microb__aubbc_pins),
|
||||
.mandatory_pairs = usb__a_host__microb__aubbc_pins,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-microB USB 2.0",
|
||||
|
@ -4178,13 +4242,22 @@ const struct usb_cable_t usb_cables[] = {
|
|||
},
|
||||
// A (device) - micro-B
|
||||
{
|
||||
.name = "A-microB power",
|
||||
.name = "A-microB power only",
|
||||
.connectors_nb = LENGTH(usb_a_device_microb_connectors),
|
||||
.connectors = usb_a_device_microb_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_device__microb__aub0_pins),
|
||||
.mandatory_pairs = usb__a_device__microb__aub0_pins,
|
||||
.optional_pairs_nb = LENGTH(usb__a_device__microb__aub0_opts),
|
||||
.optional_pairs = usb__a_device__microb__aub0_opts,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-microB battery charger",
|
||||
.connectors_nb = LENGTH(usb_a_device_microb_connectors),
|
||||
.connectors = usb_a_device_microb_connectors,
|
||||
.mandatory_pairs_nb = LENGTH(usb__a_device__microb__aubbc_pins),
|
||||
.mandatory_pairs = usb__a_device__microb__aubbc_pins,
|
||||
.optional_pairs_nb = 0,
|
||||
.optional_pairs = NULL,
|
||||
},
|
||||
{
|
||||
.name = "A-microB USB 2.0",
|
||||
|
|
|
@ -72,7 +72,7 @@ extern const struct usb_pin_t usb_pins[105];
|
|||
/** USB connectors definitions */
|
||||
extern const struct usb_connector_t* usb_connectors[8];
|
||||
/** USB cables definitions */
|
||||
extern const struct usb_cable_t usb_cables[77];
|
||||
extern const struct usb_cable_t usb_cables[83];
|
||||
|
||||
/** set every USB pin from every USB connector to input floating */
|
||||
void usb_cables_pins_float(void);
|
||||
|
|
Loading…
Reference in New Issue