void pwrInit() { GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(PWR_GPIO, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_SWITCH; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_Init(PWR_GPIO, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_LED; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(PWR_GPIO_LED, &GPIO_InitStructure); GPIO_ResetBits(INTMODULE_GPIO_PWR, INTMODULE_GPIO_PIN_PWR); GPIO_InitStructure.GPIO_Pin = INTMODULE_GPIO_PIN_PWR; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(INTMODULE_GPIO_PWR, &GPIO_InitStructure); GPIO_ResetBits(EXTMODULE_GPIO_PWR, EXTMODULE_GPIO_PIN_PWR); GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN_PWR; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(EXTMODULE_GPIO_PWR, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = TRAINER_GPIO_PIN_DETECT; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_Init(TRAINER_GPIO_DETECT, &GPIO_InitStructure); pwrOn(); }
void pwrInit() { // if any changes are done to the PWR PIN or pwrOn() function // then the same changes must be done in _bootStart() GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(PWR_GPIO, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_SWITCH; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_Init(PWR_GPIO, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_LED; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(PWR_GPIO_LED, &GPIO_InitStructure); GPIO_ResetBits(INTMODULE_GPIO_PWR, INTMODULE_GPIO_PIN_PWR); GPIO_InitStructure.GPIO_Pin = INTMODULE_GPIO_PIN_PWR; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(INTMODULE_GPIO_PWR, &GPIO_InitStructure); GPIO_ResetBits(EXTMODULE_GPIO_PWR, EXTMODULE_GPIO_PIN_PWR); GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN_PWR; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_Init(EXTMODULE_GPIO_PWR, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = TRAINER_GPIO_PIN_DETECT; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_Init(TRAINER_GPIO_DETECT, &GPIO_InitStructure); pwrOn(); }