Optimaze with new mbed os for study

Dependencies:   TS_DISCO_F746NG BSP_DISCO_F746NG Graphics

Committer:
karpent
Date:
Fri Nov 04 23:07:04 2016 +0000
Revision:
2:8db224cc1fcb
Parent:
1:5e49b46de1b0
Touchscreen support added to change the range and center location.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
karpent 1:5e49b46de1b0 1 /*
karpent 1:5e49b46de1b0 2 Target.h - Simple simulation of radar target.
karpent 1:5e49b46de1b0 3
karpent 1:5e49b46de1b0 4 Copyright(c) 2016 karpent at gmail.com, MIT License
karpent 1:5e49b46de1b0 5
karpent 1:5e49b46de1b0 6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"),
karpent 1:5e49b46de1b0 7 to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
karpent 1:5e49b46de1b0 8 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 :
karpent 1:5e49b46de1b0 9
karpent 1:5e49b46de1b0 10 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
karpent 1:5e49b46de1b0 11
karpent 1:5e49b46de1b0 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
karpent 1:5e49b46de1b0 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
karpent 1:5e49b46de1b0 14 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
karpent 1:5e49b46de1b0 15 THE USE OR OTHER DEALINGS IN THE SOFTWARE.
karpent 1:5e49b46de1b0 16 */
karpent 0:d8b9955d2b36 17
karpent 0:d8b9955d2b36 18 #pragma once
karpent 0:d8b9955d2b36 19
karpent 0:d8b9955d2b36 20 #include "Location.h"
karpent 0:d8b9955d2b36 21 #include "mbed.h" // for uint32_t
karpent 0:d8b9955d2b36 22
karpent 2:8db224cc1fcb 23 /**
karpent 2:8db224cc1fcb 24 * @brief Simple simulation of radar target.
karpent 2:8db224cc1fcb 25 */
karpent 0:d8b9955d2b36 26 class Target
karpent 0:d8b9955d2b36 27 {
karpent 0:d8b9955d2b36 28 public:
karpent 0:d8b9955d2b36 29 /// <summary>
karpent 0:d8b9955d2b36 30 /// Initializes a new instance of the <see cref="Target"/> class.
karpent 0:d8b9955d2b36 31 /// </summary>
karpent 0:d8b9955d2b36 32 /// <param name="id">The identifier.</param>
karpent 0:d8b9955d2b36 33 /// <param name="speed">The speed.</param>
karpent 0:d8b9955d2b36 34 /// <param name="direction">The direction.</param>
karpent 0:d8b9955d2b36 35 Target(int id, float speed, float direction);
karpent 0:d8b9955d2b36 36
karpent 0:d8b9955d2b36 37 Target(int id, float x, float y, float h, float speed, float direction);
karpent 0:d8b9955d2b36 38
karpent 0:d8b9955d2b36 39 /// <summary>
karpent 0:d8b9955d2b36 40 /// Sets the location angular.
karpent 0:d8b9955d2b36 41 /// </summary>
karpent 0:d8b9955d2b36 42 /// <param name="distance">The distance.</param>
karpent 0:d8b9955d2b36 43 /// <param name="azimuth">The azimuth.</param>
karpent 0:d8b9955d2b36 44 void SetLocationAngular(float distance, float azimuth);
karpent 0:d8b9955d2b36 45
karpent 0:d8b9955d2b36 46 /// <summary>
karpent 0:d8b9955d2b36 47 /// Gets the location of target.
karpent 0:d8b9955d2b36 48 /// </summary>
karpent 0:d8b9955d2b36 49 /// <returns>Target location</returns>
karpent 0:d8b9955d2b36 50 Location GetLocation();
karpent 0:d8b9955d2b36 51
karpent 0:d8b9955d2b36 52 /// <summary>
karpent 0:d8b9955d2b36 53 /// Sets target location.
karpent 0:d8b9955d2b36 54 /// </summary>
karpent 0:d8b9955d2b36 55 /// <param name="x">x value.</param>
karpent 0:d8b9955d2b36 56 /// <param name="y">y value.</param>
karpent 0:d8b9955d2b36 57 void SetLocation(float x, float y);
karpent 0:d8b9955d2b36 58
karpent 0:d8b9955d2b36 59 /// <summary>
karpent 0:d8b9955d2b36 60 /// Update target location for the specified time in miliseconds.
karpent 0:d8b9955d2b36 61 /// </summary>
karpent 0:d8b9955d2b36 62 /// <param name="currentTime">The current time.</param>
karpent 0:d8b9955d2b36 63 void UpdateLocationForTime(uint32_t currentTime);
karpent 0:d8b9955d2b36 64
karpent 0:d8b9955d2b36 65 float GetX();
karpent 0:d8b9955d2b36 66 float GetY();
karpent 0:d8b9955d2b36 67 float GetAzimuth();
karpent 0:d8b9955d2b36 68 float GetDistance();
karpent 0:d8b9955d2b36 69
karpent 0:d8b9955d2b36 70 float GetSpeed();
karpent 0:d8b9955d2b36 71 float GetDirection();
karpent 0:d8b9955d2b36 72 int GetType();
karpent 0:d8b9955d2b36 73
karpent 0:d8b9955d2b36 74 int Id;
karpent 0:d8b9955d2b36 75
karpent 0:d8b9955d2b36 76 protected:
karpent 0:d8b9955d2b36 77 Location _location;
karpent 0:d8b9955d2b36 78 float _speed;
karpent 0:d8b9955d2b36 79 float _direction;
karpent 0:d8b9955d2b36 80 int _type;
karpent 0:d8b9955d2b36 81 uint32_t _lastUpdateTime;
karpent 0:d8b9955d2b36 82 };
karpent 0:d8b9955d2b36 83