Optimaze with new mbed os for study
Dependencies: TS_DISCO_F746NG BSP_DISCO_F746NG Graphics
RadarDemo/RadarTimer.h@5:64cafb3c6e7b, 2019-08-23 (annotated)
- Committer:
- ngtkien
- Date:
- Fri Aug 23 16:59:22 2019 +0000
- Revision:
- 5:64cafb3c6e7b
- Parent:
- 4:66f13188c26b
KienNgo optimaze
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karpent | 4:66f13188c26b | 1 | /* |
karpent | 4:66f13188c26b | 2 | RadarTimer.h - Radar time subsystem simulator, inherits timer and implements beam angle calculation method. |
karpent | 4:66f13188c26b | 3 | |
karpent | 4:66f13188c26b | 4 | Copyright(c) 2016 karpent at gmail.com, MIT License |
karpent | 4:66f13188c26b | 5 | |
karpent | 4:66f13188c26b | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), |
karpent | 4:66f13188c26b | 7 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
karpent | 4:66f13188c26b | 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 | 4:66f13188c26b | 9 | |
karpent | 4:66f13188c26b | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
karpent | 4:66f13188c26b | 11 | |
karpent | 4:66f13188c26b | 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 | 4:66f13188c26b | 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 | 4:66f13188c26b | 14 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
karpent | 4:66f13188c26b | 15 | THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
karpent | 4:66f13188c26b | 16 | */ |
karpent | 3:732f7144ec81 | 17 | |
karpent | 3:732f7144ec81 | 18 | |
karpent | 4:66f13188c26b | 19 | #include "mbed.h" |
karpent | 4:66f13188c26b | 20 | |
karpent | 3:732f7144ec81 | 21 | /** |
karpent | 4:66f13188c26b | 22 | * @brief Radar time subsystem simulator, inherits timer and implements beam angle calculation method. |
karpent | 3:732f7144ec81 | 23 | */ |
karpent | 3:732f7144ec81 | 24 | class RadarTimer : public Timer |
karpent | 3:732f7144ec81 | 25 | { |
karpent | 3:732f7144ec81 | 26 | public: |
karpent | 3:732f7144ec81 | 27 | RadarTimer(); |
karpent | 3:732f7144ec81 | 28 | |
karpent | 3:732f7144ec81 | 29 | /** |
karpent | 3:732f7144ec81 | 30 | * @brief Sets scan period in seconds |
karpent | 3:732f7144ec81 | 31 | */ |
karpent | 3:732f7144ec81 | 32 | RadarTimer(uint32_t scanPeriod); |
karpent | 3:732f7144ec81 | 33 | |
karpent | 3:732f7144ec81 | 34 | /** |
karpent | 3:732f7144ec81 | 35 | * @brief Sets scan period in seconds |
karpent | 3:732f7144ec81 | 36 | */ |
karpent | 3:732f7144ec81 | 37 | void SetScanPeriod(uint32_t scanPeriod); |
karpent | 3:732f7144ec81 | 38 | |
karpent | 3:732f7144ec81 | 39 | /** |
karpent | 3:732f7144ec81 | 40 | * @brief Starts the timer |
karpent | 3:732f7144ec81 | 41 | */ |
karpent | 3:732f7144ec81 | 42 | void Start(); |
karpent | 3:732f7144ec81 | 43 | |
karpent | 3:732f7144ec81 | 44 | void RegisterScan(); |
karpent | 3:732f7144ec81 | 45 | |
karpent | 3:732f7144ec81 | 46 | /** |
karpent | 3:732f7144ec81 | 47 | * @brief Get current time in miliseconds |
karpent | 3:732f7144ec81 | 48 | */ |
karpent | 3:732f7144ec81 | 49 | uint32_t GetRunningTime(); |
karpent | 3:732f7144ec81 | 50 | |
karpent | 3:732f7144ec81 | 51 | /** |
karpent | 3:732f7144ec81 | 52 | * @brief Get current beam angle in radians |
karpent | 3:732f7144ec81 | 53 | */ |
karpent | 3:732f7144ec81 | 54 | float GetBeamAngle(); |
karpent | 3:732f7144ec81 | 55 | |
karpent | 3:732f7144ec81 | 56 | private: |
karpent | 3:732f7144ec81 | 57 | /// <summary> |
karpent | 3:732f7144ec81 | 58 | /// The radar scan period in milisecons. |
karpent | 3:732f7144ec81 | 59 | /// </summary> |
karpent | 3:732f7144ec81 | 60 | uint32_t _scanPeriod; |
karpent | 3:732f7144ec81 | 61 | |
karpent | 3:732f7144ec81 | 62 | uint32_t _lastScanTime; |
karpent | 3:732f7144ec81 | 63 | |
karpent | 3:732f7144ec81 | 64 | uint32_t _runningTime; |
karpent | 3:732f7144ec81 | 65 | }; |