Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F746NG Graphics mbed TS_DISCO_F746NG
RadarDemo.h
00001 /* 00002 RadarDemo.h - Simple radar simulator demo, example of graphic commands usage to create 2D graphics. 00003 00004 Copyright(c) 2016 karpent at gmail.com, MIT License 00005 00006 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), 00007 to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions : 00009 00010 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 00011 00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00013 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00014 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 00015 THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00016 */ 00017 00018 /** 00019 * Usage example: 00020 * 00021 @verbatim 00022 #include "RK043FN48H.h" 00023 #include "RadarDemo.h" 00024 00025 RK043FN48H display; 00026 00027 int main() 00028 { 00029 RadarDemo demo(&display); 00030 demo.Initialize(); 00031 00032 while(demo.IsRunning()) { 00033 demo.Render(); 00034 wait(0.04f); 00035 } 00036 } 00037 @endverbatim 00038 */ 00039 00040 #pragma once 00041 00042 #include "Radar.h" 00043 #include "RadarTimer.h" 00044 #include "TouchScreen.h" 00045 00046 typedef enum EUserInputType 00047 { 00048 None = 0, 00049 SingleTouch =1, 00050 MultiplyTouch = 2, 00051 ButtonPressed = 3 00052 } UserInputType; 00053 00054 00055 /// <summary> 00056 /// Radar display demo class. 00057 /// </summary> 00058 /// <seealso cref="Radar" /> 00059 class RadarDemo : public Radar 00060 { 00061 public: 00062 00063 /// <summary> 00064 /// Duration time of the demo in milisecons. 00065 /// Set <c>demoTime</c> to 0 if you do not need the time limit. 00066 /// Set for 0 00067 /// </summary> 00068 uint32_t demoTime; 00069 00070 /// <summary> 00071 /// Class constructor. 00072 /// </summary> 00073 /// <param name="display">The display.</param> 00074 RadarDemo(Display* display); 00075 00076 /// <summary> 00077 /// Class destructor. 00078 /// </summary> 00079 ~RadarDemo(); 00080 00081 /// <summary> 00082 /// Initializes radar demo instance. Generates sample data for the demo. 00083 /// </summary> 00084 void Initialize(); 00085 00086 /// <summary> 00087 /// Renders single frame of radar imaging. 00088 /// </summary> 00089 void Render(); 00090 00091 /// <summary> 00092 /// Determines whether this instance is running. 00093 /// </summary> 00094 /// <returns> 00095 /// <c>true</c> if this instance is running; otherwise, <c>false</c>. 00096 /// </returns> 00097 bool IsRunning(); 00098 00099 /// <summary> 00100 /// Check if background needs redraw while range or center location changes. 00101 /// </summary> 00102 bool NeedsRedraw(); 00103 00104 /// <summary> 00105 /// @brief Force background redraw. 00106 /// Sets the display state for NEEDS REDRAW. 00107 /// </summary> 00108 void UnvalidateBackground(); 00109 00110 /// <summary> 00111 /// Generate sample targets. 00112 /// </summary> 00113 /// <param name="count">The number of targets to create.</param> 00114 void AddSampleTargets(int count); 00115 00116 /// <summary> 00117 /// Detect a touch type on the screen in given area. 00118 /// </summary> 00119 /// <param name="screen">The screen window coordinates.</param> 00120 UserInputType CheckUserInput(Window screen); 00121 00122 RadarTimer timer; 00123 00124 private: 00125 00126 float currentBeamAngle; 00127 float lastBeamAngle; 00128 00129 bool _needsRedraw; 00130 00131 TouchScreen* _ts; 00132 uint32_t _buttonPressTime; 00133 bool TouchScreenDisabled(); 00134 void SetTouchScreenTimeout(); 00135 00136 }; 00137
Generated on Wed Jul 13 2022 08:01:03 by
