Fahad Mirza
/
Nucleo_HXC900
A demo application for HXC900 LoRaWAN module using Nucleo-L053R8.
Driver/hw_usart.h@39:cb0e5a76ab15, 2019-01-24 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
fahadmirza | 0:a0c5877bd360 | 1 | /****************************************************************************** |
fahadmirza | 0:a0c5877bd360 | 2 | * @file hw_usart.h |
fahadmirza | 0:a0c5877bd360 | 3 | * @author MCD Application Team |
fahadmirza | 0:a0c5877bd360 | 4 | * @version V1.1.4 |
fahadmirza | 0:a0c5877bd360 | 5 | * @date 08-January-2018 |
fahadmirza | 0:a0c5877bd360 | 6 | * @brief This file provides code for the configuration of the USART |
fahadmirza | 0:a0c5877bd360 | 7 | * instances. |
fahadmirza | 0:a0c5877bd360 | 8 | ****************************************************************************** |
fahadmirza | 0:a0c5877bd360 | 9 | * @attention |
fahadmirza | 0:a0c5877bd360 | 10 | * |
fahadmirza | 0:a0c5877bd360 | 11 | * <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V. |
fahadmirza | 0:a0c5877bd360 | 12 | * All rights reserved.</center></h2> |
fahadmirza | 0:a0c5877bd360 | 13 | * |
fahadmirza | 0:a0c5877bd360 | 14 | * Redistribution and use in source and binary forms, with or without |
fahadmirza | 0:a0c5877bd360 | 15 | * modification, are permitted, provided that the following conditions are met: |
fahadmirza | 0:a0c5877bd360 | 16 | * |
fahadmirza | 0:a0c5877bd360 | 17 | * 1. Redistribution of source code must retain the above copyright notice, |
fahadmirza | 0:a0c5877bd360 | 18 | * this list of conditions and the following disclaimer. |
fahadmirza | 0:a0c5877bd360 | 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
fahadmirza | 0:a0c5877bd360 | 20 | * this list of conditions and the following disclaimer in the documentation |
fahadmirza | 0:a0c5877bd360 | 21 | * and/or other materials provided with the distribution. |
fahadmirza | 0:a0c5877bd360 | 22 | * 3. Neither the name of STMicroelectronics nor the names of other |
fahadmirza | 0:a0c5877bd360 | 23 | * contributors to this software may be used to endorse or promote products |
fahadmirza | 0:a0c5877bd360 | 24 | * derived from this software without specific written permission. |
fahadmirza | 0:a0c5877bd360 | 25 | * 4. This software, including modifications and/or derivative works of this |
fahadmirza | 0:a0c5877bd360 | 26 | * software, must execute solely and exclusively on microcontroller or |
fahadmirza | 0:a0c5877bd360 | 27 | * microprocessor devices manufactured by or for STMicroelectronics. |
fahadmirza | 0:a0c5877bd360 | 28 | * 5. Redistribution and use of this software other than as permitted under |
fahadmirza | 0:a0c5877bd360 | 29 | * this license is void and will automatically terminate your rights under |
fahadmirza | 0:a0c5877bd360 | 30 | * this license. |
fahadmirza | 0:a0c5877bd360 | 31 | * |
fahadmirza | 0:a0c5877bd360 | 32 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" |
fahadmirza | 0:a0c5877bd360 | 33 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT |
fahadmirza | 0:a0c5877bd360 | 34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
fahadmirza | 0:a0c5877bd360 | 35 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY |
fahadmirza | 0:a0c5877bd360 | 36 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT |
fahadmirza | 0:a0c5877bd360 | 37 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
fahadmirza | 0:a0c5877bd360 | 38 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
fahadmirza | 0:a0c5877bd360 | 39 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
fahadmirza | 0:a0c5877bd360 | 40 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
fahadmirza | 0:a0c5877bd360 | 41 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
fahadmirza | 0:a0c5877bd360 | 42 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
fahadmirza | 0:a0c5877bd360 | 43 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
fahadmirza | 0:a0c5877bd360 | 44 | * |
fahadmirza | 0:a0c5877bd360 | 45 | ****************************************************************************** |
fahadmirza | 0:a0c5877bd360 | 46 | */ |
fahadmirza | 0:a0c5877bd360 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 48 | #ifndef __usart_H |
fahadmirza | 0:a0c5877bd360 | 49 | #define __usart_H |
fahadmirza | 0:a0c5877bd360 | 50 | #ifdef __cplusplus |
fahadmirza | 0:a0c5877bd360 | 51 | extern "C" { |
fahadmirza | 0:a0c5877bd360 | 52 | #endif |
fahadmirza | 0:a0c5877bd360 | 53 | |
fahadmirza | 0:a0c5877bd360 | 54 | /* Includes ------------------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 55 | #include <stdbool.h> |
fahadmirza | 0:a0c5877bd360 | 56 | |
fahadmirza | 0:a0c5877bd360 | 57 | /* Private defines -----------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 58 | /* Exported constants --------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 59 | |
fahadmirza | 0:a0c5877bd360 | 60 | |
fahadmirza | 0:a0c5877bd360 | 61 | |
fahadmirza | 0:a0c5877bd360 | 62 | |
fahadmirza | 0:a0c5877bd360 | 63 | |
fahadmirza | 0:a0c5877bd360 | 64 | /* External variables --------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 65 | /* Exported macros -----------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 66 | /* Exported functions ------------------------------------------------------- */ |
fahadmirza | 0:a0c5877bd360 | 67 | |
fahadmirza | 0:a0c5877bd360 | 68 | bool HW_UART_Modem_Init(uint32_t BaudRate); |
fahadmirza | 0:a0c5877bd360 | 69 | void HW_UART_Modem_DeInit(void); |
fahadmirza | 0:a0c5877bd360 | 70 | |
fahadmirza | 0:a0c5877bd360 | 71 | void HW_UART_Modem_IRQHandler(void); |
fahadmirza | 0:a0c5877bd360 | 72 | bool HW_UART_Modem_Receive_IT (uint8_t *aRxBuffer); |
fahadmirza | 0:a0c5877bd360 | 73 | |
fahadmirza | 0:a0c5877bd360 | 74 | /****************************************************************************** |
fahadmirza | 0:a0c5877bd360 | 75 | * @Brief : Read characters until Newline |
fahadmirza | 0:a0c5877bd360 | 76 | * @Param : rxBuffer - pointer for received characters |
fahadmirza | 0:a0c5877bd360 | 77 | * rxBufferSize - size of the rxBuffer |
fahadmirza | 0:a0c5877bd360 | 78 | * timeout - timeout value in millisecond |
fahadmirza | 0:a0c5877bd360 | 79 | * @Retval: Return the number of characters received |
fahadmirza | 0:a0c5877bd360 | 80 | ******************************************************************************/ |
fahadmirza | 0:a0c5877bd360 | 81 | uint8_t HW_UART_Modem_GetCharactersUntilNewLine(char *rxBuffer, uint8_t rxBufferSize, uint32_t timeout); |
fahadmirza | 0:a0c5877bd360 | 82 | bool HW_UART_Modem_IsNewCharReceived(void); |
fahadmirza | 0:a0c5877bd360 | 83 | uint8_t HW_UART_Modem_GetNewChar(void); |
fahadmirza | 0:a0c5877bd360 | 84 | |
fahadmirza | 0:a0c5877bd360 | 85 | bool HW_UART_Modem_SendBytes(const char *pData, uint16_t size); |
fahadmirza | 0:a0c5877bd360 | 86 | |
fahadmirza | 0:a0c5877bd360 | 87 | /****************************************************************************** |
fahadmirza | 0:a0c5877bd360 | 88 | * @brief Reset read and write index of the circular buffer |
fahadmirza | 0:a0c5877bd360 | 89 | * @param none |
fahadmirza | 0:a0c5877bd360 | 90 | * @retval none |
fahadmirza | 0:a0c5877bd360 | 91 | ******************************************************************************/ |
fahadmirza | 0:a0c5877bd360 | 92 | void HW_UART_ResetBuffer(void); |
fahadmirza | 0:a0c5877bd360 | 93 | void HW_UART_Modem_Ready(void); |
fahadmirza | 0:a0c5877bd360 | 94 | |
fahadmirza | 0:a0c5877bd360 | 95 | #ifdef __cplusplus |
fahadmirza | 0:a0c5877bd360 | 96 | } |
fahadmirza | 0:a0c5877bd360 | 97 | #endif |
fahadmirza | 0:a0c5877bd360 | 98 | #endif /*__ usart_H */ |
fahadmirza | 0:a0c5877bd360 | 99 | |
fahadmirza | 0:a0c5877bd360 | 100 | /** |
fahadmirza | 0:a0c5877bd360 | 101 | * @} |
fahadmirza | 0:a0c5877bd360 | 102 | */ |
fahadmirza | 0:a0c5877bd360 | 103 | |
fahadmirza | 0:a0c5877bd360 | 104 | /** |
fahadmirza | 0:a0c5877bd360 | 105 | * @} |
fahadmirza | 0:a0c5877bd360 | 106 | */ |
fahadmirza | 0:a0c5877bd360 | 107 | |
fahadmirza | 0:a0c5877bd360 | 108 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
fahadmirza | 0:a0c5877bd360 | 109 |