diff --git a/radio/src/targets/common/arm/stm32/watchdog_driver.h b/radio/src/targets/common/arm/stm32/watchdog_driver.h new file mode 100644 index 000000000..b47a60de9 --- /dev/null +++ b/radio/src/targets/common/arm/stm32/watchdog_driver.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * 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. + */ + +#pragma once + +#define WDG_DURATION 500 /*ms*/ +void watchdogInit(unsigned int duration); +#if defined(SIMU) + #define WAS_RESET_BY_WATCHDOG() (false) + #define WAS_RESET_BY_SOFTWARE() (false) + #define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (false) + #define WDG_ENABLE(x) + #define WDG_RESET() +#else + #if defined(WATCHDOG) + #define WDG_ENABLE(x) watchdogInit(x) + #define WDG_RESET() IWDG->KR = 0xAAAA + #else + #define WDG_ENABLE(x) + #define WDG_RESET() + #endif + #define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF)) + #define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF) + #define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF)) +#endif diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index d982ec70e..1f81adda0 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -27,6 +27,8 @@ #include "board_common.h" #include "hal.h" +#include "watchdog_driver.h" + #if defined(HARDWARE_TOUCH) #include "tp_gt911.h" #endif @@ -314,29 +316,6 @@ uint32_t readTrims(); void rotaryEncoderInit(); void rotaryEncoderCheck(); -// WDT driver -#define WDG_DURATION 500 /*ms*/ - -void watchdogInit(unsigned int duration); -#if defined(SIMU) - #define WAS_RESET_BY_WATCHDOG() (false) - #define WAS_RESET_BY_SOFTWARE() (false) - #define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (false) - #define WDG_ENABLE(x) - #define WDG_RESET() -#else - #if defined(WATCHDOG) - #define WDG_ENABLE(x) watchdogInit(x) - #define WDG_RESET() IWDG->KR = 0xAAAA - #else - #define WDG_ENABLE(x) - #define WDG_RESET() - #endif - #define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF)) - #define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF) - #define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF)) -#endif - // ADC driver #if defined(PCBX10) diff --git a/radio/src/targets/nv14/board.h b/radio/src/targets/nv14/board.h index 1ddbce128..efa7d5e53 100644 --- a/radio/src/targets/nv14/board.h +++ b/radio/src/targets/nv14/board.h @@ -37,6 +37,7 @@ #include "touch_driver.h" #include "lcd_driver.h" #include "battery_driver.h" +#include "watchdog_driver.h" #define FLASHSIZE 0x200000 #define BOOTLOADER_SIZE 0x20000 @@ -244,27 +245,6 @@ bool getTrimsAsButtons(); #define DBLKEYS_PRESSED_RGT_UP(in) (false) #define DBLKEYS_PRESSED_LFT_DWN(in) (false) -#define WDG_DURATION 500 /*ms*/ -void watchdogInit(unsigned int duration); -#if defined(SIMU) - #define WAS_RESET_BY_WATCHDOG() (false) - #define WAS_RESET_BY_SOFTWARE() (false) - #define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (false) - #define WDG_ENABLE(x) - #define WDG_RESET() -#else - #if defined(WATCHDOG) - #define WDG_ENABLE(x) watchdogInit(x) - #define WDG_RESET() IWDG->KR = 0xAAAA - #else - #define WDG_ENABLE(x) - #define WDG_RESET() - #endif - #define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF)) - #define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF) - #define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF)) -#endif - // ADC driver #define NUM_POTS 2 #define NUM_XPOTS 0 // NUM_POTS diff --git a/radio/src/targets/simu/backlight_driver.cpp b/radio/src/targets/simu/backlight_driver.cpp index 43a3c25e0..fcb70cc72 100644 --- a/radio/src/targets/simu/backlight_driver.cpp +++ b/radio/src/targets/simu/backlight_driver.cpp @@ -20,4 +20,5 @@ */ void backlightEnable(unsigned char) {} +void backlightEnable(unsigned char, unsigned char) {} void backlightDisable() {} diff --git a/radio/src/targets/simu/led_driver.cpp b/radio/src/targets/simu/led_driver.cpp index d0b37c62e..6ff57c411 100644 --- a/radio/src/targets/simu/led_driver.cpp +++ b/radio/src/targets/simu/led_driver.cpp @@ -21,5 +21,6 @@ void usbChargerLed() {} void ledRed() {} +void ledGreen() {} void ledBlue() {} void ledOff() {} diff --git a/radio/src/targets/simu/module_drivers.cpp b/radio/src/targets/simu/module_drivers.cpp index 644fb47fc..c82c33fc1 100644 --- a/radio/src/targets/simu/module_drivers.cpp +++ b/radio/src/targets/simu/module_drivers.cpp @@ -28,6 +28,8 @@ ModuleFifo intmoduleFifo; void intmoduleStop() {} void intmoduleFifoError() {} void intmoduleFifoReceive(uint8_t){} +void intmodulePxx1PulsesStart() {} +void intmoduleSendNextFramePxx1() {} void extmoduleStop() {} void extmodulePpmStart() {} diff --git a/radio/src/targets/taranis/board.h b/radio/src/targets/taranis/board.h index 4506028c0..7b422d992 100644 --- a/radio/src/targets/taranis/board.h +++ b/radio/src/targets/taranis/board.h @@ -28,6 +28,8 @@ #include "board_common.h" #include "hal.h" +#include "watchdog_driver.h" + #if defined(RADIO_TX12) || defined(RADIO_ZORRO) #define NAVIGATION_X7_TX12 #endif @@ -516,20 +518,6 @@ uint8_t getFSPhysicalState(uint8_t index); #define TRIMS_PRESSED() (readTrims()) #define KEYS_PRESSED() (readKeys()) -// WDT driver -#define WDG_DURATION 500 /*ms*/ -#if !defined(WATCHDOG) || defined(SIMU) - #define WDG_ENABLE(x) - #define WDG_RESET() -#else - #define WDG_ENABLE(x) watchdogInit(x) - #define WDG_RESET() IWDG->KR = 0xAAAA -#endif -void watchdogInit(unsigned int duration); -#define WAS_RESET_BY_SOFTWARE() (RCC->CSR & RCC_CSR_SFTRSTF) -#define WAS_RESET_BY_WATCHDOG() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF)) -#define WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() (RCC->CSR & (RCC_CSR_WDGRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_SFTRSTF)) - // ADC driver enum Analogs { STICK1,