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: mbed
TIME_AD.cpp@0:0e20215b178e, 2020-08-06 (annotated)
- Committer:
- peng103617
- Date:
- Thu Aug 06 06:52:19 2020 +0000
- Revision:
- 0:0e20215b178e
AD7190_LoRa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
peng103617 | 0:0e20215b178e | 1 | /***************************************************************************//** |
peng103617 | 0:0e20215b178e | 2 | * @file TIME_AD.c |
peng103617 | 0:0e20215b178e | 3 | * @brief Implementation of TIME Driver. |
peng103617 | 0:0e20215b178e | 4 | * @author Dan Nechita |
peng103617 | 0:0e20215b178e | 5 | ******************************************************************************** |
peng103617 | 0:0e20215b178e | 6 | * Copyright 2012(c) Analog Devices, Inc. |
peng103617 | 0:0e20215b178e | 7 | * |
peng103617 | 0:0e20215b178e | 8 | * All rights reserved. |
peng103617 | 0:0e20215b178e | 9 | * |
peng103617 | 0:0e20215b178e | 10 | * Redistribution and use in source and binary forms, with or without |
peng103617 | 0:0e20215b178e | 11 | * modification, are permitted provided that the following conditions are met: |
peng103617 | 0:0e20215b178e | 12 | * - Redistributions of source code must retain the above copyright |
peng103617 | 0:0e20215b178e | 13 | * notice, this list of conditions and the following disclaimer. |
peng103617 | 0:0e20215b178e | 14 | * - Redistributions in binary form must reproduce the above copyright |
peng103617 | 0:0e20215b178e | 15 | * notice, this list of conditions and the following disclaimer in |
peng103617 | 0:0e20215b178e | 16 | * the documentation and/or other materials provided with the |
peng103617 | 0:0e20215b178e | 17 | * distribution. |
peng103617 | 0:0e20215b178e | 18 | * - Neither the name of Analog Devices, Inc. nor the names of its |
peng103617 | 0:0e20215b178e | 19 | * contributors may be used to endorse or promote products derived |
peng103617 | 0:0e20215b178e | 20 | * from this software without specific prior written permission. |
peng103617 | 0:0e20215b178e | 21 | * - The use of this software may or may not infringe the patent rights |
peng103617 | 0:0e20215b178e | 22 | * of one or more patent holders. This license does not release you |
peng103617 | 0:0e20215b178e | 23 | * from the requirement that you obtain separate licenses from these |
peng103617 | 0:0e20215b178e | 24 | * patent holders to use this software. |
peng103617 | 0:0e20215b178e | 25 | * - Use of the software either in source or binary form, must be run |
peng103617 | 0:0e20215b178e | 26 | * on or directly connected to an Analog Devices Inc. component. |
peng103617 | 0:0e20215b178e | 27 | * |
peng103617 | 0:0e20215b178e | 28 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
peng103617 | 0:0e20215b178e | 29 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
peng103617 | 0:0e20215b178e | 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
peng103617 | 0:0e20215b178e | 31 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
peng103617 | 0:0e20215b178e | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
peng103617 | 0:0e20215b178e | 33 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
peng103617 | 0:0e20215b178e | 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
peng103617 | 0:0e20215b178e | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
peng103617 | 0:0e20215b178e | 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
peng103617 | 0:0e20215b178e | 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
peng103617 | 0:0e20215b178e | 38 | * |
peng103617 | 0:0e20215b178e | 39 | *******************************************************************************/ |
peng103617 | 0:0e20215b178e | 40 | |
peng103617 | 0:0e20215b178e | 41 | /******************************************************************************/ |
peng103617 | 0:0e20215b178e | 42 | /***************************** Include Files **********************************/ |
peng103617 | 0:0e20215b178e | 43 | /******************************************************************************/ |
peng103617 | 0:0e20215b178e | 44 | #include "TIME_AD.h" |
peng103617 | 0:0e20215b178e | 45 | #include "mbed.h" |
peng103617 | 0:0e20215b178e | 46 | /******************************************************************************/ |
peng103617 | 0:0e20215b178e | 47 | /************************ Variables Declarations ******************************/ |
peng103617 | 0:0e20215b178e | 48 | /******************************************************************************/ |
peng103617 | 0:0e20215b178e | 49 | |
peng103617 | 0:0e20215b178e | 50 | |
peng103617 | 0:0e20215b178e | 51 | /******************************************************************************/ |
peng103617 | 0:0e20215b178e | 52 | /************************ Functions Definitions *******************************/ |
peng103617 | 0:0e20215b178e | 53 | /******************************************************************************/ |
peng103617 | 0:0e20215b178e | 54 | |
peng103617 | 0:0e20215b178e | 55 | /***************************************************************************//** |
peng103617 | 0:0e20215b178e | 56 | * @brief Initializes the timer used in this driver. |
peng103617 | 0:0e20215b178e | 57 | * |
peng103617 | 0:0e20215b178e | 58 | * @return status - Result of the initialization procedure. |
peng103617 | 0:0e20215b178e | 59 | * Example: 1 - if initialization was successful; |
peng103617 | 0:0e20215b178e | 60 | * 0 - if initialization was unsuccessful. |
peng103617 | 0:0e20215b178e | 61 | *******************************************************************************/ |
peng103617 | 0:0e20215b178e | 62 | unsigned char TIME_Init(void) |
peng103617 | 0:0e20215b178e | 63 | { |
peng103617 | 0:0e20215b178e | 64 | // Add your code here. |
peng103617 | 0:0e20215b178e | 65 | return 1; |
peng103617 | 0:0e20215b178e | 66 | } |
peng103617 | 0:0e20215b178e | 67 | |
peng103617 | 0:0e20215b178e | 68 | /***************************************************************************//** |
peng103617 | 0:0e20215b178e | 69 | * @brief The timer begins to count in steps of microseconds(us) until the user |
peng103617 | 0:0e20215b178e | 70 | * calls a stop measurement function. |
peng103617 | 0:0e20215b178e | 71 | * |
peng103617 | 0:0e20215b178e | 72 | * @return None. |
peng103617 | 0:0e20215b178e | 73 | *******************************************************************************/ |
peng103617 | 0:0e20215b178e | 74 | void TIME_StartMeasure(void) |
peng103617 | 0:0e20215b178e | 75 | { |
peng103617 | 0:0e20215b178e | 76 | // Add your code here. |
peng103617 | 0:0e20215b178e | 77 | } |
peng103617 | 0:0e20215b178e | 78 | |
peng103617 | 0:0e20215b178e | 79 | /***************************************************************************//** |
peng103617 | 0:0e20215b178e | 80 | * @brief Stops the measurement process when the functions is called. |
peng103617 | 0:0e20215b178e | 81 | * |
peng103617 | 0:0e20215b178e | 82 | * @return Time(in microseconds) elapsed since the measurement began. |
peng103617 | 0:0e20215b178e | 83 | *******************************************************************************/ |
peng103617 | 0:0e20215b178e | 84 | unsigned long TIME_StopMeasure(void) |
peng103617 | 0:0e20215b178e | 85 | { |
peng103617 | 0:0e20215b178e | 86 | // Add your code here. |
peng103617 | 0:0e20215b178e | 87 | return 0; |
peng103617 | 0:0e20215b178e | 88 | } |
peng103617 | 0:0e20215b178e | 89 | |
peng103617 | 0:0e20215b178e | 90 | /***************************************************************************//** |
peng103617 | 0:0e20215b178e | 91 | * @brief Creates a delay of microseconds. |
peng103617 | 0:0e20215b178e | 92 | * |
peng103617 | 0:0e20215b178e | 93 | * @return None. |
peng103617 | 0:0e20215b178e | 94 | *******************************************************************************/ |
peng103617 | 0:0e20215b178e | 95 | void TIME_DelayUs(unsigned short usUnits) |
peng103617 | 0:0e20215b178e | 96 | { |
peng103617 | 0:0e20215b178e | 97 | // Add your code here. |
peng103617 | 0:0e20215b178e | 98 | wait_us(usUnits); |
peng103617 | 0:0e20215b178e | 99 | } |
peng103617 | 0:0e20215b178e | 100 | |
peng103617 | 0:0e20215b178e | 101 | /***************************************************************************//** |
peng103617 | 0:0e20215b178e | 102 | * @brief Creates a delay of milliseconds. |
peng103617 | 0:0e20215b178e | 103 | * |
peng103617 | 0:0e20215b178e | 104 | * @return None. |
peng103617 | 0:0e20215b178e | 105 | *******************************************************************************/ |
peng103617 | 0:0e20215b178e | 106 | void TIME_DelayMs(unsigned short msUnits) |
peng103617 | 0:0e20215b178e | 107 | { |
peng103617 | 0:0e20215b178e | 108 | // Add your code here. |
peng103617 | 0:0e20215b178e | 109 | wait_ms(msUnits); |
peng103617 | 0:0e20215b178e | 110 | } |