Forked repo of Platform Drivers- Analog Devices
delay.cpp@17:af1f2416dd26, 2021-07-13 (annotated)
- Committer:
- mahphalke
- Date:
- Tue Jul 13 13:58:07 2021 +0530
- Revision:
- 17:af1f2416dd26
- Child:
- 20:26b1a4570f4b
Restructured the directory- Removed inc/ and src/ folders and moved all source/header files at root
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
17:af1f2416dd26 | 1 | /***************************************************************************//** |
mahphalke |
17:af1f2416dd26 | 2 | * @file delay.cpp |
mahphalke |
17:af1f2416dd26 | 3 | * @brief Implementation of Mbed specific delay functionality |
mahphalke |
17:af1f2416dd26 | 4 | ******************************************************************************** |
mahphalke |
17:af1f2416dd26 | 5 | * Copyright (c) 2019 - 2021 Analog Devices, Inc. |
mahphalke |
17:af1f2416dd26 | 6 | * All rights reserved. |
mahphalke |
17:af1f2416dd26 | 7 | * |
mahphalke |
17:af1f2416dd26 | 8 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke |
17:af1f2416dd26 | 9 | * By using this software you agree to the terms of the associated |
mahphalke |
17:af1f2416dd26 | 10 | * Analog Devices Software License Agreement. |
mahphalke |
17:af1f2416dd26 | 11 | *******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 12 | |
mahphalke |
17:af1f2416dd26 | 13 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 14 | /***************************** Include Files **********************************/ |
mahphalke |
17:af1f2416dd26 | 15 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 16 | |
mahphalke |
17:af1f2416dd26 | 17 | #include <mbed.h> |
mahphalke |
17:af1f2416dd26 | 18 | |
mahphalke |
17:af1f2416dd26 | 19 | // Platform drivers needs to be C-compatible to work with other drivers |
mahphalke |
17:af1f2416dd26 | 20 | #ifdef __cplusplus |
mahphalke |
17:af1f2416dd26 | 21 | extern "C" |
mahphalke |
17:af1f2416dd26 | 22 | { |
mahphalke |
17:af1f2416dd26 | 23 | #endif // _cplusplus |
mahphalke |
17:af1f2416dd26 | 24 | |
mahphalke |
17:af1f2416dd26 | 25 | #include "delay.h" |
mahphalke |
17:af1f2416dd26 | 26 | |
mahphalke |
17:af1f2416dd26 | 27 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 28 | /********************** Macros and Constants Definitions **********************/ |
mahphalke |
17:af1f2416dd26 | 29 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 30 | |
mahphalke |
17:af1f2416dd26 | 31 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 32 | /************************ Functions Definitions *******************************/ |
mahphalke |
17:af1f2416dd26 | 33 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 34 | |
mahphalke |
17:af1f2416dd26 | 35 | /** |
mahphalke |
17:af1f2416dd26 | 36 | * @brief Generate microseconds delay. |
mahphalke |
17:af1f2416dd26 | 37 | * @param usecs - Delay in microseconds. |
mahphalke |
17:af1f2416dd26 | 38 | * @return None. |
mahphalke |
17:af1f2416dd26 | 39 | */ |
mahphalke |
17:af1f2416dd26 | 40 | void udelay(uint32_t usecs) |
mahphalke |
17:af1f2416dd26 | 41 | { |
mahphalke |
17:af1f2416dd26 | 42 | wait_us(usecs); |
mahphalke |
17:af1f2416dd26 | 43 | } |
mahphalke |
17:af1f2416dd26 | 44 | |
mahphalke |
17:af1f2416dd26 | 45 | /** |
mahphalke |
17:af1f2416dd26 | 46 | * @brief Generate miliseconds delay. |
mahphalke |
17:af1f2416dd26 | 47 | * @param msecs - Delay in miliseconds. |
mahphalke |
17:af1f2416dd26 | 48 | * @return None. |
mahphalke |
17:af1f2416dd26 | 49 | */ |
mahphalke |
17:af1f2416dd26 | 50 | void mdelay(uint32_t msecs) |
mahphalke |
17:af1f2416dd26 | 51 | { |
mahphalke |
17:af1f2416dd26 | 52 | if (msecs) { |
mahphalke |
17:af1f2416dd26 | 53 | HAL_Delay(msecs); |
mahphalke |
17:af1f2416dd26 | 54 | } |
mahphalke |
17:af1f2416dd26 | 55 | } |
mahphalke |
17:af1f2416dd26 | 56 | |
mahphalke |
17:af1f2416dd26 | 57 | #ifdef __cplusplus // Closing extern c |
mahphalke |
17:af1f2416dd26 | 58 | } |
mahphalke |
17:af1f2416dd26 | 59 | #endif // _cplusplus |