mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Slight reqork of QC logic to bring back older style + mix in another compatability hack
This commit is contained in:
@@ -233,10 +233,25 @@ void startQC(uint16_t divisor) {
|
||||
|
||||
// Delay 1.25 seconds
|
||||
uint8_t enteredQC = 0;
|
||||
vTaskDelay(125);
|
||||
// Check if D- is low to spot a QC charger
|
||||
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET)
|
||||
for (uint16_t i = 0; i < 200 && enteredQC == 0; i++) {
|
||||
vTaskDelay(1); //10mS pause
|
||||
if (i > 130) {
|
||||
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET) {
|
||||
enteredQC = 1;
|
||||
}
|
||||
if (i == 140) {
|
||||
//For some marginal QC chargers, we try adding a pulldown
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
if (enteredQC) {
|
||||
// We have a QC capable charger
|
||||
QC_Seek9V();
|
||||
|
||||
Reference in New Issue
Block a user