Fahad Mirza
/
Nucleo_HXC900
A demo application for HXC900 LoRaWAN module using Nucleo-L053R8.
Driver/debug.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 debug.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 Header for driver debug.c module |
fahadmirza | 0:a0c5877bd360 | 7 | ****************************************************************************** |
fahadmirza | 0:a0c5877bd360 | 8 | * @attention |
fahadmirza | 0:a0c5877bd360 | 9 | * |
fahadmirza | 0:a0c5877bd360 | 10 | * <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V. |
fahadmirza | 0:a0c5877bd360 | 11 | * All rights reserved.</center></h2> |
fahadmirza | 0:a0c5877bd360 | 12 | * |
fahadmirza | 0:a0c5877bd360 | 13 | * Redistribution and use in source and binary forms, with or without |
fahadmirza | 0:a0c5877bd360 | 14 | * modification, are permitted, provided that the following conditions are met: |
fahadmirza | 0:a0c5877bd360 | 15 | * |
fahadmirza | 0:a0c5877bd360 | 16 | * 1. Redistribution of source code must retain the above copyright notice, |
fahadmirza | 0:a0c5877bd360 | 17 | * this list of conditions and the following disclaimer. |
fahadmirza | 0:a0c5877bd360 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
fahadmirza | 0:a0c5877bd360 | 19 | * this list of conditions and the following disclaimer in the documentation |
fahadmirza | 0:a0c5877bd360 | 20 | * and/or other materials provided with the distribution. |
fahadmirza | 0:a0c5877bd360 | 21 | * 3. Neither the name of STMicroelectronics nor the names of other |
fahadmirza | 0:a0c5877bd360 | 22 | * contributors to this software may be used to endorse or promote products |
fahadmirza | 0:a0c5877bd360 | 23 | * derived from this software without specific written permission. |
fahadmirza | 0:a0c5877bd360 | 24 | * 4. This software, including modifications and/or derivative works of this |
fahadmirza | 0:a0c5877bd360 | 25 | * software, must execute solely and exclusively on microcontroller or |
fahadmirza | 0:a0c5877bd360 | 26 | * microprocessor devices manufactured by or for STMicroelectronics. |
fahadmirza | 0:a0c5877bd360 | 27 | * 5. Redistribution and use of this software other than as permitted under |
fahadmirza | 0:a0c5877bd360 | 28 | * this license is void and will automatically terminate your rights under |
fahadmirza | 0:a0c5877bd360 | 29 | * this license. |
fahadmirza | 0:a0c5877bd360 | 30 | * |
fahadmirza | 0:a0c5877bd360 | 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" |
fahadmirza | 0:a0c5877bd360 | 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT |
fahadmirza | 0:a0c5877bd360 | 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
fahadmirza | 0:a0c5877bd360 | 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY |
fahadmirza | 0:a0c5877bd360 | 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT |
fahadmirza | 0:a0c5877bd360 | 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
fahadmirza | 0:a0c5877bd360 | 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
fahadmirza | 0:a0c5877bd360 | 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
fahadmirza | 0:a0c5877bd360 | 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
fahadmirza | 0:a0c5877bd360 | 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
fahadmirza | 0:a0c5877bd360 | 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
fahadmirza | 0:a0c5877bd360 | 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
fahadmirza | 0:a0c5877bd360 | 43 | * |
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 __DEBUG_H__ |
fahadmirza | 0:a0c5877bd360 | 49 | #define __DEBUG_H__ |
fahadmirza | 0:a0c5877bd360 | 50 | |
fahadmirza | 0:a0c5877bd360 | 51 | #ifdef __cplusplus |
fahadmirza | 0:a0c5877bd360 | 52 | extern "C" { |
fahadmirza | 0:a0c5877bd360 | 53 | #endif |
fahadmirza | 0:a0c5877bd360 | 54 | |
fahadmirza | 0:a0c5877bd360 | 55 | /* Includes ------------------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 56 | |
fahadmirza | 0:a0c5877bd360 | 57 | |
fahadmirza | 0:a0c5877bd360 | 58 | |
fahadmirza | 0:a0c5877bd360 | 59 | #include <string.h> |
fahadmirza | 0:a0c5877bd360 | 60 | #include <stdio.h> |
fahadmirza | 0:a0c5877bd360 | 61 | #include "hw_conf.h" |
fahadmirza | 0:a0c5877bd360 | 62 | //#include "vcom.h" /* if vcom is used for trace purpose*/ |
fahadmirza | 0:a0c5877bd360 | 63 | |
fahadmirza | 0:a0c5877bd360 | 64 | /* Exported types ------------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 65 | /* Exported constants --------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 66 | /* External variables --------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 67 | /* Exported macros -----------------------------------------------------------*/ |
fahadmirza | 0:a0c5877bd360 | 68 | /* Exported functions ------------------------------------------------------- */ |
fahadmirza | 0:a0c5877bd360 | 69 | |
fahadmirza | 0:a0c5877bd360 | 70 | void DBG_Init( void ); |
fahadmirza | 0:a0c5877bd360 | 71 | |
fahadmirza | 0:a0c5877bd360 | 72 | void Error_Handler( void ); |
fahadmirza | 0:a0c5877bd360 | 73 | /** |
fahadmirza | 0:a0c5877bd360 | 74 | * @brief Sends string on debug com port |
fahadmirza | 0:a0c5877bd360 | 75 | * @param String |
fahadmirza | 0:a0c5877bd360 | 76 | * @retval None |
fahadmirza | 0:a0c5877bd360 | 77 | */ |
fahadmirza | 0:a0c5877bd360 | 78 | void Debug_UART_SendBytes(const char *format, ...); |
fahadmirza | 0:a0c5877bd360 | 79 | void Debug_UART_Init(void); |
fahadmirza | 0:a0c5877bd360 | 80 | |
fahadmirza | 0:a0c5877bd360 | 81 | #ifdef DEBUG |
fahadmirza | 0:a0c5877bd360 | 82 | |
fahadmirza | 0:a0c5877bd360 | 83 | #define DBG_GPIO_WRITE( gpio, n, x ) HAL_GPIO_WritePin( gpio, n, (GPIO_PinState)(x) ) |
fahadmirza | 0:a0c5877bd360 | 84 | |
fahadmirza | 0:a0c5877bd360 | 85 | #define DBG_GPIO_SET( gpio, n ) gpio->BSRR = n |
fahadmirza | 0:a0c5877bd360 | 86 | |
fahadmirza | 0:a0c5877bd360 | 87 | #define DBG_GPIO_RST( gpio, n ) gpio->BRR = n |
fahadmirza | 0:a0c5877bd360 | 88 | |
fahadmirza | 0:a0c5877bd360 | 89 | #define DBG_RTC_OUTPUT RTC_OUTPUT_DISABLE; /* RTC_OUTPUT_ALARMA on PC13 */ |
fahadmirza | 0:a0c5877bd360 | 90 | |
fahadmirza | 0:a0c5877bd360 | 91 | #define DBG( x ) do{ x } while(0) |
fahadmirza | 0:a0c5877bd360 | 92 | |
fahadmirza | 0:a0c5877bd360 | 93 | #ifdef TRACE |
fahadmirza | 0:a0c5877bd360 | 94 | |
fahadmirza | 0:a0c5877bd360 | 95 | #define DBG_PRINTF(...) printf(__VA_ARGS__) /*vcom_Send(__VA_ARGS__)*/ |
fahadmirza | 0:a0c5877bd360 | 96 | |
fahadmirza | 0:a0c5877bd360 | 97 | #define DBG_PRINTF_CRITICAL(...) /*vcom_Send_Lp(__VA_ARGS__)*/ |
fahadmirza | 0:a0c5877bd360 | 98 | |
fahadmirza | 0:a0c5877bd360 | 99 | #else /*TRACE*/ |
fahadmirza | 0:a0c5877bd360 | 100 | |
fahadmirza | 0:a0c5877bd360 | 101 | #define DBG_PRINTF(...) |
fahadmirza | 0:a0c5877bd360 | 102 | |
fahadmirza | 0:a0c5877bd360 | 103 | #define DBG_PRINTF_CRITICAL(...) |
fahadmirza | 0:a0c5877bd360 | 104 | |
fahadmirza | 0:a0c5877bd360 | 105 | #endif /*TRACE*/ |
fahadmirza | 0:a0c5877bd360 | 106 | |
fahadmirza | 0:a0c5877bd360 | 107 | |
fahadmirza | 0:a0c5877bd360 | 108 | #else /* DEBUG */ |
fahadmirza | 0:a0c5877bd360 | 109 | |
fahadmirza | 0:a0c5877bd360 | 110 | #define DBG_GPIO_WRITE( gpio, n, x ) |
fahadmirza | 0:a0c5877bd360 | 111 | |
fahadmirza | 0:a0c5877bd360 | 112 | #define DBG_GPIO_SET( gpio, n ) |
fahadmirza | 0:a0c5877bd360 | 113 | |
fahadmirza | 0:a0c5877bd360 | 114 | #define DBG_GPIO_RST( gpio, n ) |
fahadmirza | 0:a0c5877bd360 | 115 | |
fahadmirza | 0:a0c5877bd360 | 116 | #define DBG( x ) do{ } while(0) |
fahadmirza | 0:a0c5877bd360 | 117 | |
fahadmirza | 0:a0c5877bd360 | 118 | #define DBG_PRINTF(...) Debug_UART_SendBytes(__VA_ARGS__) |
fahadmirza | 0:a0c5877bd360 | 119 | |
fahadmirza | 0:a0c5877bd360 | 120 | #define DBG_PRINTF_CRITICAL(...) |
fahadmirza | 0:a0c5877bd360 | 121 | |
fahadmirza | 0:a0c5877bd360 | 122 | #define DBG_RTC_OUTPUT RTC_OUTPUT_DISABLE; |
fahadmirza | 0:a0c5877bd360 | 123 | |
fahadmirza | 0:a0c5877bd360 | 124 | #endif /* DEBUG */ |
fahadmirza | 0:a0c5877bd360 | 125 | |
fahadmirza | 0:a0c5877bd360 | 126 | #ifdef __cplusplus |
fahadmirza | 0:a0c5877bd360 | 127 | } |
fahadmirza | 0:a0c5877bd360 | 128 | #endif |
fahadmirza | 0:a0c5877bd360 | 129 | |
fahadmirza | 0:a0c5877bd360 | 130 | #endif /* __DEBUG_H__*/ |
fahadmirza | 0:a0c5877bd360 | 131 | |
fahadmirza | 0:a0c5877bd360 | 132 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
fahadmirza | 0:a0c5877bd360 | 133 |