68 lines
2.3 KiB
C
68 lines
2.3 KiB
C
/**
|
|
******************************************************************************
|
|
* @file common.h
|
|
* @author MCD Application Team
|
|
* @brief This file contains definitions for COMMON module functionalities.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
|
* All rights reserved.</center></h2>
|
|
*
|
|
* This software component is licensed by ST under Ultimate Liberty license
|
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at:
|
|
* www.st.com/SLA0044
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
|
|
/** @addtogroup USER_APP User App Example
|
|
* @{
|
|
*/
|
|
|
|
/** @addtogroup USER_APP_COMMON Common
|
|
* @{
|
|
*/
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "stm32wlxx.h"
|
|
|
|
/* Exported types ------------------------------------------------------------*/
|
|
/* Exported constants --------------------------------------------------------*/
|
|
/* Constants used by Serial Command Line Mode */
|
|
#define TX_TIMEOUT ((uint32_t)100U)
|
|
#define RX_TIMEOUT ((uint32_t)2000U)
|
|
|
|
/* Exported macro ------------------------------------------------------------*/
|
|
#define IS_CAP_LETTER(c) (((c) >= 'A') && ((c) <= 'F'))
|
|
#define IS_LC_LETTER(c) (((c) >= 'a') && ((c) <= 'f'))
|
|
#define IS_09(c) (((c) >= '0') && ((c) <= '9'))
|
|
#define ISVALIDHEX(c) (IS_CAP_LETTER(c) || IS_LC_LETTER(c) || IS_09(c))
|
|
#define ISVALIDDEC(c) IS_09(c)
|
|
#define CONVERTDEC(c) (c - '0')
|
|
|
|
#define CONVERTHEX_ALPHA(c) (IS_CAP_LETTER(c) ? ((c) - 'A'+10) : ((c) - 'a'+10))
|
|
#define CONVERTHEX(c) (IS_09(c) ? ((c) - '0') : CONVERTHEX_ALPHA(c))
|
|
|
|
/* Exported functions ------------------------------------------------------- */
|
|
uint32_t Str2Int(uint8_t *pInputStr, uint32_t *pIntNum);
|
|
HAL_StatusTypeDef Serial_PutByte(uint8_t uParam);
|
|
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
#endif /* COMMON_H */
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|