From afe3d4a1e9f7507cdf2e7da88dff07141ef17af0 Mon Sep 17 00:00:00 2001 From: Damjan Adamic Date: Mon, 2 Jan 2017 11:29:20 +0100 Subject: [PATCH] Custom OpenTX types moved to separate file opentx_types.h, fixes linker problem with lcdDrawBitmapPattern() in release build (#4188) --- radio/src/gui/480x272/layout.h | 2 +- radio/src/gui/480x272/lcd.h | 1 + radio/src/opentx.h | 15 +----------- radio/src/opentx_types.h | 42 ++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 radio/src/opentx_types.h diff --git a/radio/src/gui/480x272/layout.h b/radio/src/gui/480x272/layout.h index 22a1320e8..f212bb473 100644 --- a/radio/src/gui/480x272/layout.h +++ b/radio/src/gui/480x272/layout.h @@ -23,6 +23,7 @@ #include #include "widgets_container.h" +#include "lcd.h" #define MAX_LAYOUT_ZONES 10 #define MAX_LAYOUT_OPTIONS 10 @@ -86,7 +87,6 @@ class BaseLayoutFactory: public LayoutFactory virtual void drawThumb(uint16_t x, uint16_t y, uint32_t flags) const { - extern void lcdDrawBitmapPattern(int x, int y, const uint8_t * bitmap, uint32_t flags, int width=0, int offset=0); lcdDrawBitmapPattern(x, y, bitmap, flags); } diff --git a/radio/src/gui/480x272/lcd.h b/radio/src/gui/480x272/lcd.h index 5c54734bb..92442aa31 100644 --- a/radio/src/gui/480x272/lcd.h +++ b/radio/src/gui/480x272/lcd.h @@ -22,6 +22,7 @@ #define _LCD_H_ #include "bitmapbuffer.h" +#include "opentx_types.h" #if LCD_W >= 480 #define LCD_COLS 40 diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 707195a52..d673e06f8 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -26,6 +26,7 @@ #include #include #include "definitions.h" +#include "opentx_types.h" #if defined(SIMU) #define SWITCH_SIMU(a, b) (a) @@ -349,15 +350,9 @@ void memswap(void * a, void * b, uint8_t size); #include "fifo.h" #include "io/io_arm.h" // This doesn't need protection on this processor - typedef uint32_t tmr10ms_t; extern volatile tmr10ms_t g_tmr10ms; #define get_tmr10ms() g_tmr10ms - typedef int32_t rotenc_t; - typedef int32_t getvalue_t; - typedef uint32_t mixsrc_t; - typedef int32_t swsrc_t; #else - typedef uint16_t tmr10ms_t; extern volatile tmr10ms_t g_tmr10ms; extern inline uint16_t get_tmr10ms() { @@ -367,10 +362,6 @@ void memswap(void * a, void * b, uint8_t size); sei(); return time ; } - typedef int8_t rotenc_t; - typedef int16_t getvalue_t; - typedef uint8_t mixsrc_t; - typedef int8_t swsrc_t; #endif #if defined(NAVIGATION_STICKS) @@ -773,10 +764,8 @@ extern uint16_t s_timeCum16ThrP; #if defined(OVERRIDE_CHANNEL_FUNCTION) #if defined(CPUARM) - typedef int16_t safetych_t; #define OVERRIDE_CHANNEL_UNDEFINED -4096 #else - typedef int8_t safetych_t; #define OVERRIDE_CHANNEL_UNDEFINED -128 #endif extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS]; @@ -1483,10 +1472,8 @@ enum BarThresholdIdx { }; #if defined(CPUARM) - typedef uint16_t bar_threshold_t; #define FILL_THRESHOLD(idx, val) barsThresholds[idx] = (val) #else - typedef uint8_t bar_threshold_t; #define FILL_THRESHOLD(idx, val) barsThresholds[idx] = 128 + (val) #endif diff --git a/radio/src/opentx_types.h b/radio/src/opentx_types.h new file mode 100644 index 000000000..8e8184701 --- /dev/null +++ b/radio/src/opentx_types.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#ifndef _OTXTYPES_H_ +#define _OTXTYPES_H_ + +#if defined(CPUARM) + typedef uint32_t tmr10ms_t; + typedef int32_t rotenc_t; + typedef int32_t getvalue_t; + typedef uint32_t mixsrc_t; + typedef int32_t swsrc_t; + typedef int16_t safetych_t; + typedef uint16_t bar_threshold_t; +#else + typedef uint16_t tmr10ms_t; + typedef int8_t rotenc_t; + typedef int16_t getvalue_t; + typedef uint8_t mixsrc_t; + typedef int8_t swsrc_t; + typedef int8_t safetych_t; + typedef uint8_t bar_threshold_t; +#endif + +#endif // _OTXTYPES_H_