HXC Client Shield Repository.

Dependencies:   mbed

Committer:
kashish_mbed
Date:
Mon Apr 19 17:43:09 2021 +0000
Revision:
3:5e1a54378107
Parent:
0:bacc6e701fb4
Successful Build file with CmdProcess Functionality

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kashish_mbed 0:bacc6e701fb4 1 /*
kashish_mbed 0:bacc6e701fb4 2 / _____) _ | |
kashish_mbed 0:bacc6e701fb4 3 ( (____ _____ ____ _| |_ _____ ____| |__
kashish_mbed 0:bacc6e701fb4 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
kashish_mbed 0:bacc6e701fb4 5 _____) ) ____| | | || |_| ____( (___| | | |
kashish_mbed 0:bacc6e701fb4 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
kashish_mbed 0:bacc6e701fb4 7 (C)2013 Semtech
kashish_mbed 0:bacc6e701fb4 8
kashish_mbed 0:bacc6e701fb4 9 Description: Timer objects and scheduling management
kashish_mbed 0:bacc6e701fb4 10
kashish_mbed 0:bacc6e701fb4 11 License: Revised BSD License, see LICENSE.TXT file include in the project
kashish_mbed 0:bacc6e701fb4 12
kashish_mbed 0:bacc6e701fb4 13 Maintainer: Miguel Luis and Gregory Cristian
kashish_mbed 0:bacc6e701fb4 14 */
kashish_mbed 0:bacc6e701fb4 15 /******************************************************************************
kashish_mbed 0:bacc6e701fb4 16 * @file time_server.h
kashish_mbed 0:bacc6e701fb4 17 * @author MCD Application Team
kashish_mbed 0:bacc6e701fb4 18 * @version V1.1.4
kashish_mbed 0:bacc6e701fb4 19 * @date 08-January-2018
kashish_mbed 0:bacc6e701fb4 20 * @brief is the timer server driver
kashish_mbed 0:bacc6e701fb4 21 ******************************************************************************
kashish_mbed 0:bacc6e701fb4 22 * @attention
kashish_mbed 0:bacc6e701fb4 23 *
kashish_mbed 0:bacc6e701fb4 24 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
kashish_mbed 0:bacc6e701fb4 25 * All rights reserved.</center></h2>
kashish_mbed 0:bacc6e701fb4 26 *
kashish_mbed 0:bacc6e701fb4 27 * Redistribution and use in source and binary forms, with or without
kashish_mbed 0:bacc6e701fb4 28 * modification, are permitted, provided that the following conditions are met:
kashish_mbed 0:bacc6e701fb4 29 *
kashish_mbed 0:bacc6e701fb4 30 * 1. Redistribution of source code must retain the above copyright notice,
kashish_mbed 0:bacc6e701fb4 31 * this list of conditions and the following disclaimer.
kashish_mbed 0:bacc6e701fb4 32 * 2. Redistributions in binary form must reproduce the above copyright notice,
kashish_mbed 0:bacc6e701fb4 33 * this list of conditions and the following disclaimer in the documentation
kashish_mbed 0:bacc6e701fb4 34 * and/or other materials provided with the distribution.
kashish_mbed 0:bacc6e701fb4 35 * 3. Neither the name of STMicroelectronics nor the names of other
kashish_mbed 0:bacc6e701fb4 36 * contributors to this software may be used to endorse or promote products
kashish_mbed 0:bacc6e701fb4 37 * derived from this software without specific written permission.
kashish_mbed 0:bacc6e701fb4 38 * 4. This software, including modifications and/or derivative works of this
kashish_mbed 0:bacc6e701fb4 39 * software, must execute solely and exclusively on microcontroller or
kashish_mbed 0:bacc6e701fb4 40 * microprocessor devices manufactured by or for STMicroelectronics.
kashish_mbed 0:bacc6e701fb4 41 * 5. Redistribution and use of this software other than as permitted under
kashish_mbed 0:bacc6e701fb4 42 * this license is void and will automatically terminate your rights under
kashish_mbed 0:bacc6e701fb4 43 * this license.
kashish_mbed 0:bacc6e701fb4 44 *
kashish_mbed 0:bacc6e701fb4 45 * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
kashish_mbed 0:bacc6e701fb4 46 * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
kashish_mbed 0:bacc6e701fb4 47 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
kashish_mbed 0:bacc6e701fb4 48 * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
kashish_mbed 0:bacc6e701fb4 49 * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
kashish_mbed 0:bacc6e701fb4 50 * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
kashish_mbed 0:bacc6e701fb4 51 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
kashish_mbed 0:bacc6e701fb4 52 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
kashish_mbed 0:bacc6e701fb4 53 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
kashish_mbed 0:bacc6e701fb4 54 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
kashish_mbed 0:bacc6e701fb4 55 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
kashish_mbed 0:bacc6e701fb4 56 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kashish_mbed 0:bacc6e701fb4 57 *
kashish_mbed 0:bacc6e701fb4 58 ******************************************************************************
kashish_mbed 0:bacc6e701fb4 59 */
kashish_mbed 0:bacc6e701fb4 60
kashish_mbed 0:bacc6e701fb4 61 /* Define to prevent recursive inclusion -------------------------------------*/
kashish_mbed 0:bacc6e701fb4 62 #ifndef __TIME_SERVER_H__
kashish_mbed 0:bacc6e701fb4 63 #define __TIME_SERVER_H__
kashish_mbed 0:bacc6e701fb4 64
kashish_mbed 0:bacc6e701fb4 65 #ifdef __cplusplus
kashish_mbed 0:bacc6e701fb4 66 extern "C" {
kashish_mbed 0:bacc6e701fb4 67 #endif
kashish_mbed 0:bacc6e701fb4 68
kashish_mbed 0:bacc6e701fb4 69 /* Includes ------------------------------------------------------------------*/
kashish_mbed 0:bacc6e701fb4 70 #include <stdbool.h>
kashish_mbed 0:bacc6e701fb4 71
kashish_mbed 0:bacc6e701fb4 72 /* Exported types ------------------------------------------------------------*/
kashish_mbed 0:bacc6e701fb4 73
kashish_mbed 0:bacc6e701fb4 74 /*!
kashish_mbed 0:bacc6e701fb4 75 * \brief Timer object description
kashish_mbed 0:bacc6e701fb4 76 */
kashish_mbed 0:bacc6e701fb4 77 typedef struct TimerEvent_s
kashish_mbed 0:bacc6e701fb4 78 {
kashish_mbed 0:bacc6e701fb4 79 uint32_t Timestamp; //! Expiring timer value in ticks from TimerContext
kashish_mbed 0:bacc6e701fb4 80 uint32_t ReloadValue; //! Reload Value when Timer is restarted
kashish_mbed 0:bacc6e701fb4 81 bool IsRunning; //! Is the timer currently running
kashish_mbed 0:bacc6e701fb4 82 void ( *Callback )( void ); //! Timer IRQ callback function
kashish_mbed 0:bacc6e701fb4 83 struct TimerEvent_s *Next; //! Pointer to the next Timer object.
kashish_mbed 0:bacc6e701fb4 84 } TimerEvent_t;
kashish_mbed 0:bacc6e701fb4 85
kashish_mbed 0:bacc6e701fb4 86
kashish_mbed 0:bacc6e701fb4 87 /* Exported constants --------------------------------------------------------*/
kashish_mbed 0:bacc6e701fb4 88 /* External variables --------------------------------------------------------*/
kashish_mbed 0:bacc6e701fb4 89 /* Exported macros -----------------------------------------------------------*/
kashish_mbed 0:bacc6e701fb4 90 /* Exported functions ------------------------------------------------------- */
kashish_mbed 0:bacc6e701fb4 91
kashish_mbed 0:bacc6e701fb4 92 /*!
kashish_mbed 0:bacc6e701fb4 93 * \brief Initializes the timer object
kashish_mbed 0:bacc6e701fb4 94 *
kashish_mbed 0:bacc6e701fb4 95 * \remark TimerSetValue function must be called before starting the timer.
kashish_mbed 0:bacc6e701fb4 96 * this function initializes timestamp and reload value at 0.
kashish_mbed 0:bacc6e701fb4 97 *
kashish_mbed 0:bacc6e701fb4 98 * \param [IN] obj Structure containing the timer object parameters
kashish_mbed 0:bacc6e701fb4 99 * \param [IN] callback Function callback called at the end of the timeout
kashish_mbed 0:bacc6e701fb4 100 */
kashish_mbed 0:bacc6e701fb4 101 void TimerInit(TimerEvent_t *obj, void ( *callback )( void ));
kashish_mbed 0:bacc6e701fb4 102
kashish_mbed 0:bacc6e701fb4 103 /*!
kashish_mbed 0:bacc6e701fb4 104 * \brief Set timer new timeout value
kashish_mbed 0:bacc6e701fb4 105 *
kashish_mbed 0:bacc6e701fb4 106 * \param [IN] obj Structure containing the timer object parameters
kashish_mbed 0:bacc6e701fb4 107 * \param [IN] value New timer timeout value
kashish_mbed 0:bacc6e701fb4 108 */
kashish_mbed 0:bacc6e701fb4 109 void TimerSetValue( TimerEvent_t *obj, uint32_t value );
kashish_mbed 0:bacc6e701fb4 110
kashish_mbed 0:bacc6e701fb4 111 /*!
kashish_mbed 0:bacc6e701fb4 112 * \brief Starts and adds the timer object to the list of timer events
kashish_mbed 0:bacc6e701fb4 113 *
kashish_mbed 0:bacc6e701fb4 114 * \param [IN] obj Structure containing the timer object parameters
kashish_mbed 0:bacc6e701fb4 115 */
kashish_mbed 0:bacc6e701fb4 116 void TimerStart(TimerEvent_t *obj);
kashish_mbed 0:bacc6e701fb4 117
kashish_mbed 0:bacc6e701fb4 118 /*!
kashish_mbed 0:bacc6e701fb4 119 * \brief Stops and removes the timer object from the list of timer events
kashish_mbed 0:bacc6e701fb4 120 *
kashish_mbed 0:bacc6e701fb4 121 * \param [IN] obj Structure containing the timer object parameters
kashish_mbed 0:bacc6e701fb4 122 */
kashish_mbed 0:bacc6e701fb4 123 void TimerStop(TimerEvent_t *obj);
kashish_mbed 0:bacc6e701fb4 124
kashish_mbed 0:bacc6e701fb4 125 /*!
kashish_mbed 0:bacc6e701fb4 126 * \brief Resets the timer object
kashish_mbed 0:bacc6e701fb4 127 *
kashish_mbed 0:bacc6e701fb4 128 * \param [IN] obj Structure containing the timer object parameters
kashish_mbed 0:bacc6e701fb4 129 */
kashish_mbed 0:bacc6e701fb4 130 void TimerReset( TimerEvent_t *obj );
kashish_mbed 0:bacc6e701fb4 131
kashish_mbed 0:bacc6e701fb4 132 /*!
kashish_mbed 0:bacc6e701fb4 133 * \brief Read the current time
kashish_mbed 0:bacc6e701fb4 134 *
kashish_mbed 0:bacc6e701fb4 135 * \retval returns current time in ms
kashish_mbed 0:bacc6e701fb4 136 */
kashish_mbed 0:bacc6e701fb4 137 uint32_t TimerGetCurrentTime( void );
kashish_mbed 0:bacc6e701fb4 138
kashish_mbed 0:bacc6e701fb4 139 /*!
kashish_mbed 0:bacc6e701fb4 140 * \brief Return the Time elapsed since a fix moment in Time
kashish_mbed 0:bacc6e701fb4 141 *
kashish_mbed 0:bacc6e701fb4 142 * \param [IN] savedTime fix moment in Time
kashish_mbed 0:bacc6e701fb4 143 * \retval time returns elapsed time in ms
kashish_mbed 0:bacc6e701fb4 144 */
kashish_mbed 0:bacc6e701fb4 145 uint32_t TimerGetElapsedTime(uint32_t savedTime);
kashish_mbed 0:bacc6e701fb4 146
kashish_mbed 0:bacc6e701fb4 147 #ifdef __cplusplus
kashish_mbed 0:bacc6e701fb4 148 }
kashish_mbed 0:bacc6e701fb4 149 #endif
kashish_mbed 0:bacc6e701fb4 150
kashish_mbed 0:bacc6e701fb4 151 #endif /* __TIME_SERVER_H__*/
kashish_mbed 0:bacc6e701fb4 152
kashish_mbed 0:bacc6e701fb4 153 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
kashish_mbed 0:bacc6e701fb4 154