NV14 fixed firmware and simu build.
This commit is contained in:
@@ -68,7 +68,7 @@ set(FIRMWARE_TARGET_SRC
|
|||||||
set(BITMAPS_TARGET nv14_bitmaps)
|
set(BITMAPS_TARGET nv14_bitmaps)
|
||||||
set(FONTS_TARGET x12_fonts)
|
set(FONTS_TARGET x12_fonts)
|
||||||
set(LCD_DRIVER lcd_driver.cpp)
|
set(LCD_DRIVER lcd_driver.cpp)
|
||||||
set(LUA_EXPORT lua_export_x10)
|
set(LUA_EXPORT lua_export_nv14)
|
||||||
set(TOUCH_DRIVER touch_driver.cpp)
|
set(TOUCH_DRIVER touch_driver.cpp)
|
||||||
set(HARDWARE_TOUCH YES)
|
set(HARDWARE_TOUCH YES)
|
||||||
|
|
||||||
@@ -77,6 +77,8 @@ set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET} truetype_fonts)
|
|||||||
set(HARDWARE_TOUCH ON)
|
set(HARDWARE_TOUCH ON)
|
||||||
set(SOFTWARE_KEYBOARD ON)
|
set(SOFTWARE_KEYBOARD ON)
|
||||||
|
|
||||||
|
set(FIRMWARE_DEPENDENCIES datacopy)
|
||||||
|
|
||||||
add_definitions(-DSTM32F429_439xx -DSDRAM -DCOLORLCD -DLIBOPENUI -DHARDWARE_TOUCH -DSOFTWARE_KEYBOARD)
|
add_definitions(-DSTM32F429_439xx -DSDRAM -DCOLORLCD -DLIBOPENUI -DHARDWARE_TOUCH -DSOFTWARE_KEYBOARD)
|
||||||
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
|
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
|
||||||
add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
|
add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
|
||||||
@@ -212,4 +214,3 @@ if(PYTHONINTERP_FOUND)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LUA_EXPORT lua_export_nv14)
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
#ifndef _BOARD_H_
|
#ifndef _BOARD_H_
|
||||||
#define _BOARD_H_
|
#define _BOARD_H_
|
||||||
|
|
||||||
#include "../definitions.h"
|
#include "definitions.h"
|
||||||
#include "../opentx_constants.h"
|
#include "opentx_constants.h"
|
||||||
#include "hal.h"
|
|
||||||
#include "board_common.h"
|
#include "board_common.h"
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
#if !defined(LUA_EXPORT_GENERATION)
|
#if !defined(LUA_EXPORT_GENERATION)
|
||||||
#include "stm32f4xx_sdio.h"
|
#include "stm32f4xx_sdio.h"
|
||||||
@@ -265,10 +265,10 @@ uint32_t readTrims();
|
|||||||
extern uint32_t powerupReason;
|
extern uint32_t powerupReason;
|
||||||
extern uint32_t boardState;
|
extern uint32_t boardState;
|
||||||
|
|
||||||
#define SHUTDOWN_REQUEST 0xDEADBEEF
|
/*#define SHUTDOWN_REQUEST 0xDEADBEEF
|
||||||
#define NO_SHUTDOWN_REQUEST ~SHUTDOWN_REQUEST
|
#define NO_SHUTDOWN_REQUEST ~SHUTDOWN_REQUEST
|
||||||
#define DIRTY_SHUTDOWN 0xCAFEDEAD
|
#define DIRTY_SHUTDOWN 0xCAFEDEAD
|
||||||
#define NORMAL_POWER_OFF ~DIRTY_SHUTDOWN
|
#define NORMAL_POWER_OFF ~DIRTY_SHUTDOWN*/
|
||||||
|
|
||||||
#define WDG_DURATION 500 /*ms*/
|
#define WDG_DURATION 500 /*ms*/
|
||||||
void watchdogInit(unsigned int duration);
|
void watchdogInit(unsigned int duration);
|
||||||
@@ -361,6 +361,35 @@ uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps
|
|||||||
#define BATTERY_MIN 35 // 3.5V
|
#define BATTERY_MIN 35 // 3.5V
|
||||||
#define BATTERY_MAX 42 // 4.2V
|
#define BATTERY_MAX 42 // 4.2V
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
enum PowerReason {
|
||||||
|
SHUTDOWN_REQUEST = 0xDEADBEEF,
|
||||||
|
SOFTRESET_REQUEST = 0xCAFEDEAD,
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr uint32_t POWER_REASON_SIGNATURE = 0x0178746F;
|
||||||
|
|
||||||
|
inline bool UNEXPECTED_SHUTDOWN()
|
||||||
|
{
|
||||||
|
#if defined(SIMU) || defined(NO_UNEXPECTED_SHUTDOWN)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (WAS_RESET_BY_WATCHDOG())
|
||||||
|
return true;
|
||||||
|
else if (WAS_RESET_BY_SOFTWARE())
|
||||||
|
return RTC->BKP0R != SOFTRESET_REQUEST;
|
||||||
|
else
|
||||||
|
return RTC->BKP1R == POWER_REASON_SIGNATURE && RTC->BKP0R != SHUTDOWN_REQUEST;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SET_POWER_REASON(uint32_t value)
|
||||||
|
{
|
||||||
|
RTC->BKP0R = value;
|
||||||
|
RTC->BKP1R = POWER_REASON_SIGNATURE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(SIMU)
|
#if defined(__cplusplus) && !defined(SIMU)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -384,11 +413,11 @@ bool pwrPressed();
|
|||||||
#define pwrForcePressed() false
|
#define pwrForcePressed() false
|
||||||
#endif
|
#endif
|
||||||
uint32_t pwrPressedDuration();;
|
uint32_t pwrPressedDuration();;
|
||||||
#if defined(SIMU) || defined(NO_UNEXPECTED_SHUTDOWN)
|
/*#if defined(SIMU) || defined(NO_UNEXPECTED_SHUTDOWN)
|
||||||
#define UNEXPECTED_SHUTDOWN() (false)
|
#define UNEXPECTED_SHUTDOWN() (false)
|
||||||
#else
|
#else
|
||||||
#define UNEXPECTED_SHUTDOWN() (powerupReason == DIRTY_SHUTDOWN)
|
#define UNEXPECTED_SHUTDOWN() (powerupReason == DIRTY_SHUTDOWN)
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
#define AUX_SERIAL_POWER_ON()
|
#define AUX_SERIAL_POWER_ON()
|
||||||
#define AUX_SERIAL_POWER_OFF()
|
#define AUX_SERIAL_POWER_OFF()
|
||||||
|
|||||||
@@ -89,10 +89,10 @@ bool pwrPressed()
|
|||||||
void pwrResetHandler()
|
void pwrResetHandler()
|
||||||
{
|
{
|
||||||
if (boardState != BOARD_POWER_OFF) {
|
if (boardState != BOARD_POWER_OFF) {
|
||||||
powerupReason = boardState != BOARD_REBOOT && WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() ? DIRTY_SHUTDOWN : ~DIRTY_SHUTDOWN;
|
powerupReason = boardState != BOARD_REBOOT && WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() ? SOFTRESET_REQUEST : SHUTDOWN_REQUEST;
|
||||||
RCC->CSR |= RCC_CSR_RMVF; //clear all flags
|
RCC->CSR |= RCC_CSR_RMVF; //clear all flags
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
powerupReason = ~DIRTY_SHUTDOWN;
|
powerupReason = SHUTDOWN_REQUEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user