1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 20:10:08 +03:00

BootCmd should be always high

This commit is contained in:
Bertrand Songis 2019-05-07 11:17:51 +02:00
parent 8819259144
commit f1867cccb2
6 changed files with 41 additions and 7 deletions

View file

@ -70,6 +70,7 @@ set(BOOTLOADER_SRC
../../../../../targets/${TARGET_DIR}/backlight_driver.cpp ../../../../../targets/${TARGET_DIR}/backlight_driver.cpp
../../../../../targets/${TARGET_DIR}/keys_driver.cpp ../../../../../targets/${TARGET_DIR}/keys_driver.cpp
../../../../../targets/${TARGET_DIR}/diskio.cpp ../../../../../targets/${TARGET_DIR}/diskio.cpp
../../../../../targets/${TARGET_DIR}/board_preinit.cpp
../../../../../targets/${TARGET_DIR}/pwr_driver.cpp ../../../../../targets/${TARGET_DIR}/pwr_driver.cpp
../../../../../targets/${TARGET_DIR}/bootloader/boot_menu.cpp ../../../../../targets/${TARGET_DIR}/bootloader/boot_menu.cpp
../usbd_usr.cpp ../usbd_usr.cpp

View file

@ -219,6 +219,8 @@ int main()
rotaryEncoderInit(); rotaryEncoderInit();
#endif #endif
boardPreInit();
// wait for inputs to stabilize // wait for inputs to stabilize
for (uint32_t i = 0; i < 50000; i += 1) { for (uint32_t i = 0; i < 50000; i += 1) {
wdt_reset(); wdt_reset();

View file

@ -34,6 +34,7 @@ extern uint16_t ResetReason;
#define FIRMWARE_ADDRESS 0x00400000 #define FIRMWARE_ADDRESS 0x00400000
// Board driver // Board driver
void boardPreInit(void);
void boardInit(void); void boardInit(void);
#define boardOff() pwrOff() #define boardOff() pwrOff()

View file

@ -114,6 +114,7 @@ extern "C" {
extern uint16_t sessionTimer; extern uint16_t sessionTimer;
// Board driver // Board driver
void boardPreInit(void);
void boardInit(void); void boardInit(void);
void boardOff(void); void boardOff(void);

View file

@ -0,0 +1,36 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "board.h"
void boardPreInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
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;
#if defined(INTMODULE_BOOTCMD_GPIO)
GPIO_SetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
GPIO_InitStructure.GPIO_Pin = INTMODULE_BOOTCMD_GPIO_PIN;
GPIO_Init(INTMODULE_BOOTCMD_GPIO, &GPIO_InitStructure);
#endif
}

View file

@ -37,13 +37,6 @@ void pwrInit()
GPIO_InitStructure.GPIO_Pin = EXTMODULE_PWR_GPIO_PIN; GPIO_InitStructure.GPIO_Pin = EXTMODULE_PWR_GPIO_PIN;
GPIO_Init(EXTMODULE_PWR_GPIO, &GPIO_InitStructure); GPIO_Init(EXTMODULE_PWR_GPIO, &GPIO_InitStructure);
#if defined(INTMODULE_BOOTCMD_GPIO)
GPIO_SetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
GPIO_InitStructure.GPIO_Pin = INTMODULE_BOOTCMD_GPIO_PIN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(INTMODULE_BOOTCMD_GPIO, &GPIO_InitStructure);
#endif
#if defined(PCBREV_GPIO_PIN) #if defined(PCBREV_GPIO_PIN)
GPIO_ResetBits(PCBREV_GPIO, PCBREV_GPIO_PIN); GPIO_ResetBits(PCBREV_GPIO, PCBREV_GPIO_PIN);
GPIO_InitStructure.GPIO_Pin = PCBREV_GPIO_PIN; GPIO_InitStructure.GPIO_Pin = PCBREV_GPIO_PIN;