@@ -120,19 +120,25 @@ extern "C" {
120
120
121
121
WEAK void initVariant (void )
122
122
{
123
- /* Initialize the 3V3 discharge to be OFF and the output power to be ON */
124
- __HAL_RCC_GPIOE_CLK_ENABLE ();
123
+
125
124
GPIO_InitTypeDef GPIO_InitStruct;
126
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
125
+ __HAL_RCC_GPIOE_CLK_ENABLE ();
126
+ __HAL_RCC_GPIOC_CLK_ENABLE ();
127
+
128
+ /* Set the DISCHARGE pin and the USB_DETECT pin to FLOAT */
129
+ GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
127
130
GPIO_InitStruct.Pull = GPIO_NOPULL;
128
- GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
129
131
GPIO_InitStruct.Pin = GPIO_PIN_6;
130
- HAL_GPIO_Init (GPIOE, &GPIO_InitStruct);
131
- HAL_GPIO_WritePin (GPIOE, GPIO_PIN_6, GPIO_PIN_SET);
132
+ HAL_GPIO_Init (GPIOE, &GPIO_InitStruct); /* PE6 DISCHRG */
133
+ HAL_GPIO_Init (GPIOC, &GPIO_InitStruct); /* PC6 is USB_DETECT */
134
+
135
+ /* Turn on the 3V3 regulator */
132
136
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
137
+ GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
133
138
GPIO_InitStruct.Pin = GPIO_PIN_4;
134
139
HAL_GPIO_Init (GPIOE, &GPIO_InitStruct);
135
140
HAL_GPIO_WritePin (GPIOE, GPIO_PIN_4, GPIO_PIN_SET);
141
+
136
142
}
137
143
138
144
/* *
0 commit comments