A demo application for HXC900 LoRaWAN module using Nucleo-L053R8.

Dependencies:   mbed

Committer:
fahadmirza
Date:
Thu Jan 24 23:45:12 2019 +0000
Revision:
39:cb0e5a76ab15
Parent:
5:53302861bfea
Doxygen style header

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fahadmirza 0:a0c5877bd360 1 /*
fahadmirza 0:a0c5877bd360 2 / _____) _ | |
fahadmirza 0:a0c5877bd360 3 ( (____ _____ ____ _| |_ _____ ____| |__
fahadmirza 0:a0c5877bd360 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
fahadmirza 0:a0c5877bd360 5 _____) ) ____| | | || |_| ____( (___| | | |
fahadmirza 0:a0c5877bd360 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
fahadmirza 0:a0c5877bd360 7 (C)2013 Semtech
fahadmirza 0:a0c5877bd360 8
fahadmirza 0:a0c5877bd360 9 Description: Bleeper board GPIO driver implementation
fahadmirza 0:a0c5877bd360 10
fahadmirza 0:a0c5877bd360 11 License: Revised BSD License, see LICENSE.TXT file include in the project
fahadmirza 0:a0c5877bd360 12
fahadmirza 0:a0c5877bd360 13 Maintainer: Miguel Luis and Gregory Cristian
fahadmirza 0:a0c5877bd360 14 */
fahadmirza 0:a0c5877bd360 15 /******************************************************************************
fahadmirza 0:a0c5877bd360 16 * @file hw_rtc.h
fahadmirza 0:a0c5877bd360 17 * @author MCD Application Team
fahadmirza 0:a0c5877bd360 18 * @version V1.1.4
fahadmirza 0:a0c5877bd360 19 * @date 08-January-2018
fahadmirza 0:a0c5877bd360 20 * @brief Header for driver hw_rtc.c module
fahadmirza 0:a0c5877bd360 21 ******************************************************************************
fahadmirza 0:a0c5877bd360 22 * @attention
fahadmirza 0:a0c5877bd360 23 *
fahadmirza 0:a0c5877bd360 24 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
fahadmirza 0:a0c5877bd360 25 * All rights reserved.</center></h2>
fahadmirza 0:a0c5877bd360 26 *
fahadmirza 0:a0c5877bd360 27 * Redistribution and use in source and binary forms, with or without
fahadmirza 0:a0c5877bd360 28 * modification, are permitted, provided that the following conditions are met:
fahadmirza 0:a0c5877bd360 29 *
fahadmirza 0:a0c5877bd360 30 * 1. Redistribution of source code must retain the above copyright notice,
fahadmirza 0:a0c5877bd360 31 * this list of conditions and the following disclaimer.
fahadmirza 0:a0c5877bd360 32 * 2. Redistributions in binary form must reproduce the above copyright notice,
fahadmirza 0:a0c5877bd360 33 * this list of conditions and the following disclaimer in the documentation
fahadmirza 0:a0c5877bd360 34 * and/or other materials provided with the distribution.
fahadmirza 0:a0c5877bd360 35 * 3. Neither the name of STMicroelectronics nor the names of other
fahadmirza 0:a0c5877bd360 36 * contributors to this software may be used to endorse or promote products
fahadmirza 0:a0c5877bd360 37 * derived from this software without specific written permission.
fahadmirza 0:a0c5877bd360 38 * 4. This software, including modifications and/or derivative works of this
fahadmirza 0:a0c5877bd360 39 * software, must execute solely and exclusively on microcontroller or
fahadmirza 0:a0c5877bd360 40 * microprocessor devices manufactured by or for STMicroelectronics.
fahadmirza 0:a0c5877bd360 41 * 5. Redistribution and use of this software other than as permitted under
fahadmirza 0:a0c5877bd360 42 * this license is void and will automatically terminate your rights under
fahadmirza 0:a0c5877bd360 43 * this license.
fahadmirza 0:a0c5877bd360 44 *
fahadmirza 0:a0c5877bd360 45 * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
fahadmirza 0:a0c5877bd360 46 * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
fahadmirza 0:a0c5877bd360 47 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
fahadmirza 0:a0c5877bd360 48 * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
fahadmirza 0:a0c5877bd360 49 * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
fahadmirza 0:a0c5877bd360 50 * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
fahadmirza 0:a0c5877bd360 51 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
fahadmirza 0:a0c5877bd360 52 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
fahadmirza 0:a0c5877bd360 53 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
fahadmirza 0:a0c5877bd360 54 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
fahadmirza 0:a0c5877bd360 55 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
fahadmirza 0:a0c5877bd360 56 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
fahadmirza 0:a0c5877bd360 57 *
fahadmirza 0:a0c5877bd360 58 ******************************************************************************
fahadmirza 0:a0c5877bd360 59 */
fahadmirza 0:a0c5877bd360 60
fahadmirza 0:a0c5877bd360 61 #ifndef __HW_RTC_H__
fahadmirza 0:a0c5877bd360 62 #define __HW_RTC_H__
fahadmirza 0:a0c5877bd360 63
fahadmirza 0:a0c5877bd360 64 #ifdef __cplusplus
fahadmirza 0:a0c5877bd360 65 extern "C" {
fahadmirza 0:a0c5877bd360 66 #endif
fahadmirza 0:a0c5877bd360 67
fahadmirza 0:a0c5877bd360 68 /* Includes ------------------------------------------------------------------*/
fahadmirza 0:a0c5877bd360 69 #include "utilities.h"
fahadmirza 0:a0c5877bd360 70
fahadmirza 0:a0c5877bd360 71 /* Exported types ------------------------------------------------------------*/
fahadmirza 0:a0c5877bd360 72 /* Exported constants --------------------------------------------------------*/
fahadmirza 0:a0c5877bd360 73 /* External variables --------------------------------------------------------*/
fahadmirza 0:a0c5877bd360 74 /* Exported macros -----------------------------------------------------------*/
fahadmirza 0:a0c5877bd360 75 /* Exported functions ------------------------------------------------------- */
fahadmirza 0:a0c5877bd360 76
fahadmirza 0:a0c5877bd360 77 /*!
fahadmirza 0:a0c5877bd360 78 * @brief Initializes the RTC timer
fahadmirza 0:a0c5877bd360 79 * @note The timer is based on the RTC
fahadmirza 0:a0c5877bd360 80 * @param none
fahadmirza 0:a0c5877bd360 81 * @retval none
fahadmirza 0:a0c5877bd360 82 */
fahadmirza 0:a0c5877bd360 83 void HW_RTC_Init( void );
fahadmirza 0:a0c5877bd360 84
fahadmirza 0:a0c5877bd360 85 /*!
fahadmirza 0:a0c5877bd360 86 * @brief Stop the Alarm
fahadmirza 0:a0c5877bd360 87 * @param none
fahadmirza 0:a0c5877bd360 88 * @retval none
fahadmirza 0:a0c5877bd360 89 */
fahadmirza 0:a0c5877bd360 90 void HW_RTC_StopAlarm( void );
fahadmirza 0:a0c5877bd360 91
fahadmirza 0:a0c5877bd360 92 /*!
fahadmirza 0:a0c5877bd360 93 * @brief Return the minimum timeout the RTC is able to handle
fahadmirza 0:a0c5877bd360 94 * @param none
fahadmirza 0:a0c5877bd360 95 * @retval minimum value for a timeout
fahadmirza 0:a0c5877bd360 96 */
fahadmirza 0:a0c5877bd360 97 uint32_t HW_RTC_GetMinimumTimeout( void );
fahadmirza 0:a0c5877bd360 98
fahadmirza 0:a0c5877bd360 99 /*!
fahadmirza 0:a0c5877bd360 100 * @brief Set the alarm
fahadmirza 0:a0c5877bd360 101 * @note The alarm is set at Reference + timeout
fahadmirza 0:a0c5877bd360 102 * @param timeout Duration of the Timer in ticks
fahadmirza 0:a0c5877bd360 103 */
fahadmirza 0:a0c5877bd360 104 void HW_RTC_SetAlarm( uint32_t timeout );
fahadmirza 0:a0c5877bd360 105
fahadmirza 0:a0c5877bd360 106 /*!
fahadmirza 0:a0c5877bd360 107 * @brief Get the RTC timer elapsed time since the last Reference was set
fahadmirza 0:a0c5877bd360 108 * @retval RTC Elapsed time in ticks
fahadmirza 0:a0c5877bd360 109 */
fahadmirza 0:a0c5877bd360 110 uint32_t HW_RTC_GetTimerElapsedTime( void );
fahadmirza 0:a0c5877bd360 111
fahadmirza 0:a0c5877bd360 112 /*!
fahadmirza 0:a0c5877bd360 113 * @brief Get the RTC timer value
fahadmirza 0:a0c5877bd360 114 * @retval none
fahadmirza 0:a0c5877bd360 115 */
fahadmirza 0:a0c5877bd360 116 uint32_t HW_RTC_GetTimerValue( void );
fahadmirza 0:a0c5877bd360 117
fahadmirza 0:a0c5877bd360 118 /*!
fahadmirza 0:a0c5877bd360 119 * @brief Set the RTC timer Reference
fahadmirza 0:a0c5877bd360 120 * @retval Timer Reference Value in Ticks
fahadmirza 0:a0c5877bd360 121 */
fahadmirza 0:a0c5877bd360 122 uint32_t HW_RTC_SetTimerContext( void );
fahadmirza 0:a0c5877bd360 123
fahadmirza 0:a0c5877bd360 124 /*!
fahadmirza 0:a0c5877bd360 125 * @brief Get the RTC timer Reference
fahadmirza 0:a0c5877bd360 126 * @retval Timer Value in Ticks
fahadmirza 0:a0c5877bd360 127 */
fahadmirza 0:a0c5877bd360 128 uint32_t HW_RTC_GetTimerContext( void );
fahadmirza 0:a0c5877bd360 129 /*!
fahadmirza 0:a0c5877bd360 130 * @brief RTC IRQ Handler on the RTC Alarm
fahadmirza 0:a0c5877bd360 131 * @param none
fahadmirza 0:a0c5877bd360 132 * @retval none
fahadmirza 0:a0c5877bd360 133 */
fahadmirza 0:a0c5877bd360 134 void HW_RTC_IrqHandler ( void );
fahadmirza 0:a0c5877bd360 135
fahadmirza 0:a0c5877bd360 136 /*!
fahadmirza 0:a0c5877bd360 137 * @brief a delay of delay ms by polling RTC
fahadmirza 0:a0c5877bd360 138 * @param delay in ms
fahadmirza 0:a0c5877bd360 139 * @param none
fahadmirza 0:a0c5877bd360 140 * @retval none
fahadmirza 0:a0c5877bd360 141 */
fahadmirza 0:a0c5877bd360 142 void HW_RTC_DelayMs( uint32_t delay );
fahadmirza 0:a0c5877bd360 143
fahadmirza 0:a0c5877bd360 144 /*!
fahadmirza 0:a0c5877bd360 145 * @brief calculates the wake up time between wake up and mcu start
fahadmirza 0:a0c5877bd360 146 * @note resolution in RTC_ALARM_TIME_BASE
fahadmirza 0:a0c5877bd360 147 * @param none
fahadmirza 0:a0c5877bd360 148 * @retval none
fahadmirza 0:a0c5877bd360 149 */
fahadmirza 0:a0c5877bd360 150 void HW_RTC_setMcuWakeUpTime( void );
fahadmirza 0:a0c5877bd360 151
fahadmirza 0:a0c5877bd360 152 /*!
fahadmirza 0:a0c5877bd360 153 * @brief returns the wake up time in us
fahadmirza 0:a0c5877bd360 154 * @param none
fahadmirza 0:a0c5877bd360 155 * @retval wake up time in ticks
fahadmirza 0:a0c5877bd360 156 */
fahadmirza 0:a0c5877bd360 157 int16_t HW_RTC_getMcuWakeUpTime( void );
fahadmirza 0:a0c5877bd360 158
fahadmirza 0:a0c5877bd360 159 /*!
fahadmirza 0:a0c5877bd360 160 * @brief converts time in ms to time in ticks
fahadmirza 0:a0c5877bd360 161 * @param [IN] time in milliseconds
fahadmirza 0:a0c5877bd360 162 * @retval returns time in timer ticks
fahadmirza 0:a0c5877bd360 163 */
fahadmirza 0:a0c5877bd360 164 uint32_t HW_RTC_ms2Tick( uint32_t timeMicroSec );
fahadmirza 0:a0c5877bd360 165
fahadmirza 0:a0c5877bd360 166 /*!
fahadmirza 0:a0c5877bd360 167 * @brief converts time in ticks to time in ms
fahadmirza 0:a0c5877bd360 168 * @param [IN] time in timer ticks
fahadmirza 0:a0c5877bd360 169 * @retval returns time in timer milliseconds
fahadmirza 0:a0c5877bd360 170 */
fahadmirza 0:a0c5877bd360 171 uint32_t HW_RTC_Tick2ms( uint32_t tick );
fahadmirza 0:a0c5877bd360 172
fahadmirza 0:a0c5877bd360 173 #ifdef __cplusplus
fahadmirza 0:a0c5877bd360 174 }
fahadmirza 0:a0c5877bd360 175 #endif
fahadmirza 0:a0c5877bd360 176
fahadmirza 0:a0c5877bd360 177 #endif /* __HW_RTC_H__ */
fahadmirza 0:a0c5877bd360 178
fahadmirza 0:a0c5877bd360 179 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
fahadmirza 0:a0c5877bd360 180