@@ -73,31 +73,21 @@ extern "C" {
7373
7474WEAK void initVariant (void )
7575{
76- GPIO_InitTypeDef GPIO_InitStruct;
77-
78- // Init lines that we'll be using below
79- __HAL_RCC_GPIOA_CLK_ENABLE ();
80- __HAL_RCC_GPIOC_CLK_ENABLE ();
81- __HAL_RCC_GPIOH_CLK_ENABLE ();
82-
83- /* Set DISCHARGE_3V3 as well as the pins we're not initially using to FLOAT */
84- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
85- GPIO_InitStruct.Pull = GPIO_NOPULL;
86- GPIO_InitStruct.Pin = GPIO_PIN_1;
87- HAL_GPIO_Init (GPIOH, &GPIO_InitStruct); /* PH1 DISCHARGE_3V3 */
88- GPIO_InitStruct.Pin = GPIO_PIN_3;
89- HAL_GPIO_Init (GPIOB, &GPIO_InitStruct); /* PB3 is USB_DETECT */
90- GPIO_InitStruct.Pin = GPIO_PIN_15;
91- HAL_GPIO_Init (GPIOA, &GPIO_InitStruct); /* PA15 is CHARGE_DETECT */
92- GPIO_InitStruct.Pin = GPIO_PIN_4;
93- HAL_GPIO_Init (GPIOA, &GPIO_InitStruct); /* PA4 is BAT_VOLTAGE */
76+ /* All pins set to high-Z (floating) initially */
77+ /* DS11449 Rev 8, Section 3.9.5 - Reset Mode: */
78+ /* In order to improve the consumption under reset, the I/Os state under and after reset is
79+ * “analog state” (the I/O schmitt trigger is disable). In addition, the internal reset pull-up is
80+ * deactivated when the reset source is internal.
81+ */
9482
9583 /* Turn on the 3V3 regulator */
84+ __HAL_RCC_GPIOH_CLK_ENABLE ();
85+ GPIO_InitTypeDef GPIO_InitStruct;
9686 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
9787 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
98- GPIO_InitStruct.Pin = GPIO_PIN_0;
99- HAL_GPIO_Init (GPIOH, &GPIO_InitStruct);
100- HAL_GPIO_WritePin (GPIOH, GPIO_InitStruct.Pin , GPIO_PIN_SET);
88+ GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 ;
89+ HAL_GPIO_Init (GPIOH, &GPIO_InitStruct); /* PH0 is ENABLE_3V3, PH1 is DISCHARGE_3V3 */
90+ HAL_GPIO_WritePin (GPIOH, GPIO_InitStruct.Pin , GPIO_PIN_SET); /* Enable 3V3 regulator and disable discharging */
10191}
10292
10393/* *
0 commit comments