From 817d51f65f68f29a180da18516ff908c5f21103a Mon Sep 17 00:00:00 2001 From: Hom-Wang Date: Sat, 29 Oct 2016 00:56:36 +0800 Subject: [PATCH] Update UWBAdapter_ApplicationSTD_serialPacket 10/29 --- .../Program/algorithms/mathUnit.h | 54 +++- .../Program/algorithms/string.c | 98 ++++--- .../Program/algorithms/string.h | 60 ++-- .../Program/drivers/stm32f4_delay.c | 61 ++-- .../Program/drivers/stm32f4_delay.h | 46 ++- .../Program/drivers/stm32f4_system.h | 101 ++++--- .../Program/drivers/stm32f4_usart.c | 158 +++++----- .../Program/drivers/stm32f4_usart.h | 50 +++- .../Program/main.c | 81 +++++- .../Program/modules/kSerial.c | 148 ++++++---- .../Program/modules/kSerial.h | 73 +++-- .../Program/modules/serial.c | 274 +++++++++--------- .../Program/modules/serial.h | 40 ++- .../Program/sampleRate.h | 105 +++++++ .../Program/stm32f4xx_conf.h | 2 +- .../Program/uwbAdapter.c | 31 -- .../Program/uwbAdapter.h | 14 - .../Program/uwbAdapter_bsp.c | 80 ++++- .../Program/uwbAdapter_bsp.h | 82 ++++-- .../Program/uwbAdapter_it.c | 48 ++- .../STM32F411C_STM32F411CEUx.dbgconf | 33 +++ ...uvguix.Hom-MSI => ProjectSTM32.uvguix.Hom} | 72 ++--- .../ProjectUWBA/ProjectSTM32.uvoptx | 34 +-- .../ProjectUWBA/ProjectSTM32.uvprojx | 13 +- .../kSerial.m | 16 +- .../serialPacket.m | 31 +- 26 files changed, 1173 insertions(+), 632 deletions(-) create mode 100644 Software/UWBAdapter_ApplicationSTD_serialPacket/Program/sampleRate.h delete mode 100644 Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.c delete mode 100644 Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.h create mode 100644 Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/DebugConfig/STM32F411C_STM32F411CEUx.dbgconf rename Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/{ProjectSTM32.uvguix.Hom-MSI => ProjectSTM32.uvguix.Hom} (88%) diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/mathUnit.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/mathUnit.h index 2447740..2a6266e 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/mathUnit.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/mathUnit.h @@ -1,22 +1,52 @@ -/* #include "algorithms\mathUnit.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file mathUnit.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __MATHUNIT_H #define __MATHUNIT_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include "stm32f4xx.h" #include "arm_math.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -#define invSqrtf( iSq ) (1.0f / sqrtf((float)(iSq))) -#define squa( Sq ) (((float)Sq) * ((float)(Sq))) + +/* Exported types --------------------------------------------------------------------------*/ + +/** + * @brief euler angle structure definition + */ +typedef struct { + float32_t pitch; + float32_t roll; + float32_t yaw; +} __attribute__((aligned(4))) eulerAngle_t; + +/* Exported constants ----------------------------------------------------------------------*/ +/* Exported macro --------------------------------------------------------------------------*/ +#define invSqrtf( iSq ) (1.0f / sqrtf((float32_t)(iSq))) +#define squa( Sq ) (((float32_t)Sq) * ((float32_t)(Sq))) #define toRad( _mathD ) ((_mathD) * 0.0174532925f) #define toDeg( _mathR ) ((_mathR) * 57.2957795f) -typedef struct { - float pitch; - float roll; - float yaw; -} eulerAngle_t; -/*====================================================================================================*/ -/*====================================================================================================*/ +/* Exported functions ----------------------------------------------------------------------*/ + +#ifdef __cplusplus +} +#endif + #endif diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.c index e8c4609..51daeac 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.c @@ -1,35 +1,60 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file string.c + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" #include "algorithms\string.h" -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : num2Char -**功能 : Number to string -**輸入 : type, lens, *pChar, number -**輸出 : None -**使用 : num2Str(type, lens, pChar, number); -**====================================================================================================*/ -/*====================================================================================================*/ -void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ) + +/** @addtogroup STM32_Algorithm + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +/* Private define --------------------------------------------------------------------------*/ +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ +/* Private function prototypes -------------------------------------------------------------*/ +/* Private functions -----------------------------------------------------------------------*/ + +/** + * @brief num2Str + * @param type: + * @param lens: + * @param pStr: + * @param number: + * @retval None + */ +void num2Str( StringType_t type, uint8_t lens, char *pStr, int32_t number ) { uint8_t i = 0; uint32_t tmpStr[48] = {0}; uint32_t tmpNum = 1; - switch(type) { + switch (type) { - case Type_B: - case Type_O: - case Type_D: - case Type_H: - for(i = 0; i < lens; i++) { + case S_BIN: + case S_OCT: + case S_DEC: + case S_HEX: + for (i = 0; i < lens; i++) { tmpStr[i] = ((uint32_t)number) / tmpNum; tmpNum = tmpNum * type; } - for(i = 0; i < lens; i++) { + for (i = 0; i < lens; i++) { pStr[lens-i-1] = tmpStr[i] - tmpStr[i+1] * type; - if(pStr[lens-i-1] > 9) + if (pStr[lens-i-1] > 9) pStr[lens-i-1] += 55; // 65-10 else pStr[lens-i-1] += 48; @@ -37,49 +62,46 @@ void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ) pStr[lens] = '\0'; break; - case Type_I: - if(number < 0) { + case S_INT: + if (number < 0) { pStr[0] = '-'; number = (~number) + 1; } else { pStr[0] = '+'; } - for(i = 1; i < lens + 1; i++) { + for (i = 1; i < lens + 1; i++) { tmpStr[i-1] = ((uint32_t)number) / tmpNum; tmpNum = tmpNum * 10; } - for(i = 1; i < lens + 1; i++) { + for (i = 1; i < lens + 1; i++) { pStr[lens-i+1] = tmpStr[i-1] - tmpStr[i] * 10; pStr[lens-i+1] += 48; } pStr[lens+1] = '\0'; break; - case Type_F: + case S_FLOAT: break; } } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : lenOfStr -**功能 : String Lens -**輸入 : *pStr -**輸出 : strLens -**使用 : strLens = lenOfStr("Hello World!!"); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief lenOfStr + * @param pStr: + * @retval string lengths + */ uint16_t lenOfStr( char *pStr ) { uint16_t strLens = 0; - if(pStr == NULL) + if (pStr == NULL) return strLens; - while(*(pStr++)) + while (*(pStr++)) strLens++; return strLens; } -/*====================================================================================================*/ -/*====================================================================================================*/ + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.h index ea5f503..21ac06d 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/algorithms/string.h @@ -1,23 +1,49 @@ -/* #include "algorithm_string.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file string.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ -#ifndef __ALGORITHM_STRING_H -#define __ALGORITHM_STRING_H +/* Define to prevent recursive inclusion ---------------------------------------------------*/ +#ifndef __STRING_H +#define __STRING_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ +#include #include "stm32f4xx.h" -/*====================================================================================================*/ -/*====================================================================================================*/ + +/* Exported types --------------------------------------------------------------------------*/ typedef enum { - Type_B = 2, // 無號數二進制 - Type_O = 8, // 無號數八進制 - Type_D = 10, // 無號數十進制 - Type_H = 16, // 無號數十六進制 - Type_I = 0, // 有號數 - Type_F = 1, // 浮點數 -} StringType; -/*====================================================================================================*/ -/*====================================================================================================*/ -void num2Str( StringType type, uint8_t lens, char *pStr, int32_t number ); + S_BIN = 2, /* unsigned binary */ + S_OCT = 8, /* unsigned octal */ + S_DEC = 10, /* unsigned decimal */ + S_HEX = 16, /* unsigned hexadecimal */ + S_INT = 0, /* signed decimal */ + S_FLOAT = 1, /* float point */ +} StringType_t; + +/* Exported constants ----------------------------------------------------------------------*/ +/* Exported functions ----------------------------------------------------------------------*/ +void num2Str( StringType_t type, uint8_t lens, char *pStr, int32_t number ); uint16_t lenOfStr( char *pStr ); -/*====================================================================================================*/ -/*====================================================================================================*/ + +#ifdef __cplusplus +} +#endif + #endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.c index 0c74a0e..f1c7c4d 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.c @@ -1,12 +1,35 @@ -/*=====================================================================================================*/ -/*=====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file stm32f4_delay.c + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "stm32f4_system.h" #include "stm32f4_delay.h" -/*=====================================================================================================*/ -/*=====================================================================================================*/ + +/** @addtogroup STM32_Driver + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +/* Private define --------------------------------------------------------------------------*/ +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ static __IO uint32_t uwTick; -/*=====================================================================================================*/ -/*=====================================================================================================*/ + +/* Private function prototypes -------------------------------------------------------------*/ +/* Private functions -----------------------------------------------------------------------*/ + void HAL_InitTick( void ) { NVIC_InitTypeDef NVIC_InitStruct; @@ -21,36 +44,36 @@ void HAL_InitTick( void ) NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStruct); } + void HAL_IncTick( void ) { uwTick++; } + uint32_t HAL_GetTick( void ) { return uwTick; } -void HAL_Delay( __IO uint32_t Delay ) + +void HAL_Delay( __IO uint32_t delay ) { uint32_t tickstart = 0; tickstart = HAL_GetTick(); - while((HAL_GetTick() - tickstart) < Delay) + while((HAL_GetTick() - tickstart) < delay) { } } -/*=====================================================================================================*/ -/*=====================================================================================================* -**函數 : delay_us -**功能 : Delay us -**輸入 : vCnt_us -**輸出 : None -**使用 : delay_us(times); -**=====================================================================================================*/ -/*=====================================================================================================*/ + +/** + * @brief delay_us + * @param vCnt_us: delay us time. + * @retval None + */ void delay_us( __IO uint32_t vCnt_us ) { __IO uint32_t vCnt; while(vCnt_us--) for(vCnt = 7; vCnt != 0; vCnt--); } -/*=====================================================================================================*/ -/*=====================================================================================================*/ + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.h index e1ac927..00ed556 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_delay.h @@ -1,19 +1,45 @@ -/* #include "stm32f4_delay.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file stm32f4_delay.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __STM32F4_DELAY_H #define __STM32F4_DELAY_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include "stm32f4xx.h" -/*=====================================================================================================*/ -/*=====================================================================================================*/ + +/* Exported types --------------------------------------------------------------------------*/ +/* Exported constants ----------------------------------------------------------------------*/ +#define delay_ms(__ms) HAL_Delay(__ms) + +/* Exported functions ----------------------------------------------------------------------*/ void HAL_InitTick( void ); void HAL_IncTick( void ); uint32_t HAL_GetTick( void ); void HAL_Delay( __IO uint32_t Delay ); -/*=====================================================================================================*/ -/*=====================================================================================================*/ -#define delay_ms(__ms) HAL_Delay(__ms) -void delay_us( __IO uint32_t vCnt_us ); -/*=====================================================================================================*/ -/*=====================================================================================================*/ -#endif + +void delay_us( __IO uint32_t vCnt_us ); + +#ifdef __cplusplus +} +#endif + +#endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_system.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_system.h index 16c0923..efa431a 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_system.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_system.h @@ -1,46 +1,75 @@ -/* #include "stm32f4_system.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file stm32f4_system.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __STM32F4_SYSTEM_H #define __STM32F4_SYSTEM_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include "stm32f4xx.h" #include "stm32f4_delay.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -#define __GPIO_SET(_PORT, _PIN) (_PORT->BSRRL = _PIN) -#define __GPIO_RST(_PORT, _PIN) (_PORT->BSRRH = _PIN) -#define __GPIO_TOG(_PORT, _PIN) (_PORT->ODR ^= _PIN) -#define __GPIO_READ(_PORT, _PIN) (_PORT->IDR & _PIN) -/*====================================================================================================*/ -/*====================================================================================================*/ -#define U8_MAX ((uint8_t)255) -#define S8_MAX ((int8_t)127) -#define S8_MIN ((int8_t)-128) -#define U16_MAX ((uint16_t)65535u) -#define S16_MAX ((int16_t)32767) -#define S16_MIN ((int16_t)-32768) -#define U32_MAX ((uint32_t)4294967295uL) -#define S32_MAX ((int32_t)2147483647) -#define S32_MIN ((int32_t)-2147483648) - -#define Byte32(Type, Byte4, Byte3, Byte2, Byte1) ((Type)((((uint8_t)(Byte4))<<24) | (((uint8_t)(Byte3))<<16) | (((uint8_t)(Byte2))<<8) | ((uint8_t)(Byte1)))) -#define Byte32U16H(Byte32U16) ((uint16_t)(((uint32_t)(Byte32U16)&0xFFFF0000)>>16)) -#define Byte32U16L(Byte32U16) ((uint16_t)( (uint32_t)(Byte32U16)&0x0000FFFF)) -#define Byte32U8_4(Byte32U8) ((uint8_t)(((uint32_t)(Byte32U8)&0xFF000000)>>24)) -#define Byte32U8_3(Byte32U8) ((uint8_t)(((uint32_t)(Byte32U8)&0x00FF0000)>>16)) -#define Byte32U8_2(Byte32U8) ((uint8_t)(((uint32_t)(Byte32U8)&0x0000FF00)>>8)) -#define Byte32U8_1(Byte32U8) ((uint8_t)( (uint32_t)(Byte32U8)&0x000000FF)) - -#define Byte16(Type, ByteH, ByteL) ((Type)((((uint16_t)(ByteH))<<8) | ((uint16_t)(ByteL)))) -#define Byte16U8H(Byte16U8) ((uint8_t)(((uint16_t)(Byte16U8)&0xFF00)>>8)) -#define Byte16U8L(Byte16U8) ((uint8_t)( (uint16_t)(Byte16U8)&0x00FF)) - -#define Byte8H(ByteH) ((uint8_t)(((uint16_t)(ByteH)&0xFF00)>>8)) -#define Byte8L(ByteL) ((uint8_t)( (uint16_t)(ByteL)&0x00FF)) +#include "algorithms\mathUnit.h" + +/* Exported types --------------------------------------------------------------------------*/ +typedef void (*pFunc)(void); +/* Exported constants ----------------------------------------------------------------------*/ + +#define U8_MAX ((uint8_t)255) +#define S8_MAX ((int8_t)127) +#define S8_MIN ((int8_t)-128) +#define U16_MAX ((uint16_t)65535u) +#define S16_MAX ((int16_t)32767) +#define S16_MIN ((int16_t)-32768) +#define U32_MAX ((uint32_t)4294967295uL) +#define S32_MAX ((int32_t)2147483647) +#define S32_MIN ((int32_t)-2147483648) + +#if !defined(NULL) #define NULL 0 +#endif -typedef void (*pFunc)(void); -/*====================================================================================================*/ -/*====================================================================================================*/ +/* Exported macro --------------------------------------------------------------------------*/ +#define __GPIO_SET(_PORT, _PIN) ((_PORT)->BSRRL = (_PIN)) +#define __GPIO_RST(_PORT, _PIN) ((_PORT)->BSRRH = (_PIN)) +#define __GPIO_TOG(_PORT, _PIN) ((_PORT)->ODR ^= (_PIN)) +#define __GPIO_READ(_PORT, _PIN) ((_PORT)->IDR & (_PIN)) + +#define Byte32(_BH2, _BH1, _BL2, _BL1) (((uint8_t)(_BH2)<<24) | ((uint8_t)(_BH1)<<16) | \\ + ((uint8_t)(_BL2)<<8) | ((uint8_t)(_BL1))) +#define Byte32U16H(_B32U16) ((uint16_t)(((uint32_t)(_B32U16)&0xFFFF0000)>>16)) +#define Byte32U16L(_B32U16) ((uint16_t)( (uint32_t)(_B32U16)&0x0000FFFF)) +#define Byte32U8_4(_B32U8) ((uint8_t)(((uint32_t)(_B32U8)&0xFF000000)>>24)) +#define Byte32U8_3(_B32U8) ((uint8_t)(((uint32_t)(_B32U8)&0x00FF0000)>>16)) +#define Byte32U8_2(_B32U8) ((uint8_t)(((uint32_t)(_B32U8)&0x0000FF00)>>8)) +#define Byte32U8_1(_B32U8) ((uint8_t)( (uint32_t)(_B32U8)&0x000000FF)) + +#define Byte16(_BH, _BL) ((((uint16_t)(_BH))<<8) | ((uint16_t)(_BL))) +#define Byte16U8H(_B16U8) ((uint8_t)(((uint16_t)(_B16U8)&0xFF00)>>8)) +#define Byte16U8L(_B16U8) ((uint8_t)( (uint16_t)(_B16U8)&0x00FF)) + +/* Exported functions ----------------------------------------------------------------------*/ + +#ifdef __cplusplus +} #endif + +#endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.c index 0a961a7..4e8cfd5 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.c @@ -1,104 +1,122 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file stm32f4_usart.c + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "stm32f4_system.h" #include "stm32f4_usart.h" -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : UART_SendByte -**功能 : Send Byte -**輸入 : USARTx, *sendData -**輸出 : None -**使用 : UART_SendByte(USARTx, 'A'); -**====================================================================================================*/ -/*====================================================================================================*/ -void UART_SendByte( USART_TypeDef *USARTx, uint8_t *sendData ) + +/** @addtogroup STM32_Driver + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +/* Private define --------------------------------------------------------------------------*/ +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ +/* Private function prototypes -------------------------------------------------------------*/ +/* Private functions -----------------------------------------------------------------------*/ + +/** + * @brief UART_SendByte + * @param USARTx: + * @param sendByte: + * @retval None + */ +void UART_SendByte( USART_TypeDef *USARTx, uint8_t *sendByte ) { - USARTx->DR = (*sendData & (uint16_t)0x01FF); - while(!(USARTx->SR & USART_FLAG_TC)); + USARTx->DR = (*sendByte & (uint16_t)0x01FF); + while (!(USARTx->SR & USART_FLAG_TC)); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : UART_RecvByte -**功能 : Recv Byte -**輸入 : USARTx, *recvData -**輸出 : None -**使用 : UART_RecvByte(USARTx, recvData); -**====================================================================================================*/ -/*====================================================================================================*/ -void UART_RecvByte( USART_TypeDef *USARTx, uint8_t *recvData ) + +/** + * @brief UART_RecvByte + * @param USARTx: + * @param recvByte: + * @retval None + */ +void UART_RecvByte( USART_TypeDef *USARTx, uint8_t *recvByte ) { while(!(USARTx->SR & USART_FLAG_RXNE)); - *recvData = (uint16_t)(USARTx->DR & (uint16_t)0x01FF); + *recvByte = (uint16_t)(USARTx->DR & (uint16_t)0x01FF); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : UART_RecvByteWTO -**功能 : Recv Byte with Timeout -**輸入 : USARTx, *recvData, timeoutMs -**輸出 : State -**使用 : UART_RecvByteWTO(USARTx, recvData, 200); -**====================================================================================================*/ -/*====================================================================================================*/ -int8_t UART_RecvByteWTO( USART_TypeDef *USARTx, uint8_t *recvData, uint32_t timeoutMs ) + +/** + * @brief UART_RecvByteWTO + * @param USARTx: + * @param recvByte: + * @param timeoutMs: + * @retval state of receive + */ +int8_t UART_RecvByteWTO( USART_TypeDef *USARTx, uint8_t *recvByte, uint32_t timeoutMs ) { - while((USARTx->SR & USART_FLAG_RXNE) == RESET) { - if(timeoutMs-- > 0) + while ((USARTx->SR & USART_FLAG_RXNE) == RESET) { + if (timeoutMs-- > 0) delay_ms(1); else return ERROR; // timeout } - *recvData = (uint16_t)(USARTx->DR & (uint16_t)0x01FF); + *recvByte = (uint16_t)(USARTx->DR & (uint16_t)0x01FF); return SUCCESS; } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : UART_SendData -**功能 : Send Data -**輸入 : USARTx, *sendData, lens -**輸出 : None -**使用 : UART_SendData(USARTx, sendData, lens); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief UART_SendData + * @param USARTx: + * @param sendData: + * @param lens: + * @retval None + */ void UART_SendData( USART_TypeDef *USARTx, uint8_t *sendData, uint16_t lens ) { do { UART_SendByte(USARTx, sendData++); - } while(--lens); + } while (--lens); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : UART_RecvData -**功能 : Recv Data -**輸入 : USARTx, *recvData, lens -**輸出 : None -**使用 : UART_RecvData(USARTx, recvData, lens); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief UART_RecvData + * @param USARTx: + * @param recvData: + * @param lens: + * @retval None + */ void UART_RecvData( USART_TypeDef *USARTx, uint8_t *recvData, uint16_t lens ) { do { UART_RecvByte(USARTx, recvData++); - } while(--lens); + } while (--lens); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : UART_RecvDataWTO -**功能 : Recv Data With Timeout -**輸入 : USARTx, *recvData, lens, timeoutMs -**輸出 : state -**使用 : UART_RecvDataWTO(USARTx, recvData, lens, 200); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief UART_RecvDataWTO + * @param USARTx: + * @param recvData: + * @param lens: + * @param timeoutMs: + * @retval state of receive + */ int8_t UART_RecvDataWTO( USART_TypeDef *USARTx, uint8_t *recvData, uint16_t lens, uint32_t timeoutMs ) { int8_t state = ERROR; do { state = UART_RecvByteWTO(USARTx, recvData++, timeoutMs); - } while((--lens) && (state != ERROR)); + } while ((--lens) && (state != ERROR)); return state; } -/*====================================================================================================*/ -/*====================================================================================================*/ + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.h index b128877..4083642 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/drivers/stm32f4_usart.h @@ -1,17 +1,43 @@ -/* #include "stm32f4_usart.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file stm32f4_usart.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __STM32F4_USART_H #define __STM32F4_USART_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include "stm32f4xx.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -void UART_SendByte( USART_TypeDef *USARTx, uint8_t *SendData ); -void UART_RecvByte( USART_TypeDef *USARTx, uint8_t *RecvData ); -int8_t UART_RecvByteWTO( USART_TypeDef *USARTx, uint8_t *RecvData, uint32_t TimeoutMs ); -void UART_SendData( USART_TypeDef *USARTx, uint8_t *SendData, uint16_t DataLen ); -void UART_RecvData( USART_TypeDef *USARTx, uint8_t *RecvData, uint16_t DataLen ); -int8_t UART_RecvDataWTO( USART_TypeDef *USARTx, uint8_t *RecvData, uint16_t DataLen, uint32_t TimeoutMs ); -/*====================================================================================================*/ -/*====================================================================================================*/ -#endif + +/* Exported types --------------------------------------------------------------------------*/ +/* Exported constants ----------------------------------------------------------------------*/ +/* Exported functions ----------------------------------------------------------------------*/ +void UART_SendByte( USART_TypeDef *USARTx, uint8_t *sendByte ); +void UART_RecvByte( USART_TypeDef *USARTx, uint8_t *recvByte ); +int8_t UART_RecvByteWTO( USART_TypeDef *USARTx, uint8_t *recvByte, uint32_t timeoutMs ); +void UART_SendData( USART_TypeDef *USARTx, uint8_t *sendData, uint16_t lens ); +void UART_RecvData( USART_TypeDef *USARTx, uint8_t *recvData, uint16_t lens ); +int8_t UART_RecvDataWTO( USART_TypeDef *USARTx, uint8_t *recvData, uint16_t lens, uint32_t timeoutMs ); + +#ifdef __cplusplus +} +#endif + +#endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/main.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/main.c index e7fb8ac..6ad34d8 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/main.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/main.c @@ -1,16 +1,79 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file main.c + * @author KitSprout + * @date 29-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" +#include "modules\serial.h" +#include "modules\kSerial.h" +#include "uwbAdapter_bsp.h" +#include "sampleRate.h" + +/** @addtogroup STM32_Program + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +/* Private define --------------------------------------------------------------------------*/ +#define PACKET_DATALENS 3 + +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ +struct { + float32_t msec; + float32_t sec; + float32_t min; +} time; + +/* Private function prototypes -------------------------------------------------------------*/ +void TIM4_EvenCallBack( void ); + +/* Private functions -----------------------------------------------------------------------*/ -#include "uwbAdapter.h" -/*====================================================================================================*/ -/*====================================================================================================*/ int main( void ) { + float32_t sendBuf[PACKET_DATALENS] = {0}; + HAL_InitTick(); - UWBA_Init(); - UWBA_Loop(); + UWBA_GPIO_Config(); + UWBA_UART_Config(NULL); + UWBA_TIM4_Config(TIM4_EvenCallBack); + + while (1) { + sendBuf[0] = time.min; + sendBuf[1] = time.sec; + sendBuf[2] = time.msec; + kSerial_sendData(sendBuf, PACKET_DATALENS, KS_FLOAT32); + } } -/*====================================================================================================*/ -/*====================================================================================================*/ + +void TIM4_EvenCallBack( void ) +{ + LED_R_Set(); + + time.msec += SAMPLE_RATE; + if (time.msec >= 1.0f) { + time.msec = 0.0f; + time.sec += 1.0f; + if (time.sec >= 60.0f) { + time.sec = 0.0f; + time.min += 1.0f; + } + } + + LED_R_Reset(); +} + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.c index bdd7901..acfa743 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.c @@ -1,78 +1,100 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file kSerial.c + * @author KitSprout + * @date 13-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" -#include "modules\kSerial.h" -/*====================================================================================================*/ -/*====================================================================================================*/ +#include "kSerial.h" + +/** @addtogroup STM32_Module + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +/* Private define --------------------------------------------------------------------------*/ +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ static ptrSerial pSerialFunc = NULL; -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : kSerial_config -**功能 : Point to Serial Send Function -**輸入 : None -**輸出 : None -**使用 : kSerial_config(Serial_SendByte); -**====================================================================================================*/ -/*====================================================================================================*/ + +static uint16_t sequenceNum = 0; +static uint8_t packet[256] = {0}; + +static const uint16_t typeTable[10][2] = { + { 0x0000, 0 }, /* KS_INT8 8'b0000_xxxx*/ + { 0x1000, 1 }, /* KS_INT16 8'b0001_xxxx*/ + { 0x2000, 2 }, /* KS_INT32 8'b0010_xxxx*/ + { 0x3000, 3 }, /* KS_INT64 8'b0011_xxxx*/ + { 0x4000, 0 }, /* KS_UINT8 8'b0100_xxxx*/ + { 0x5000, 1 }, /* KS_UINT16 8'b0101_xxxx*/ + { 0x6000, 2 }, /* KS_UINT32 8'b0110_xxxx*/ + { 0x7000, 3 }, /* KS_UINT64 8'b0111_xxxx*/ + { 0xA000, 2 }, /* KS_FLOAT32 8'b1010_xxxx*/ + { 0xB000, 3 }, /* KS_FLOAT64 8'b1011_xxxx*/ +// { 0x8000, 0 }, /* KS_RECV1 8'b1000_xxxx*/ +// { 0x9000, 0 }, /* KS_RECV2 8'b1001_xxxx*/ +// { 0xC000, 0 }, /* KS_RECV3 8'b1100_xxxx*/ +// { 0xD000, 0 }, /* KS_RECV4 8'b1101_xxxx*/ +// { 0xE000, 0 }, /* KS_RECV5 8'b1110_xxxx*/ +// { 0xF000, 0 } /* KS_RECV6 8'b1111_xxxx*/ +}; + +/* Private function prototypes -------------------------------------------------------------*/ +/* Private functions -----------------------------------------------------------------------*/ + +/** + * @brief kSerial_config + * @param pSerial: point to serial send byte function + * @retval None + */ void kSerial_config( ptrSerial pSerial ) { pSerialFunc = pSerial; + + packet[0] = 'K'; /* header 'K' */ + packet[1] = 'S'; /* header 'S' */ } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : getTypeSize -**功能 : get data type size -**輸入 : type -**輸出 : dataSize -**使用 : dataSize = getTypeSize(KS_INT16); -**====================================================================================================*/ -/*====================================================================================================*/ -static uint8_t getTypeSize( uint8_t type ) -{ - switch(type) { - case KS_INT8: return 1; - case KS_UINT8: return 1; - case KS_INT16: return 2; - case KS_UINT16: return 2; - case KS_INT32: return 4; - case KS_UINT32: return 4; - case KS_INT64: return 8; - case KS_UINT64: return 8; - case KS_FLOAT32: return 4; - case KS_FLOAT64: return 8; - default: return 0; - } -} -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : kSerial_sendData -**功能 : kSerial Send Data -**輸入 : *signalData, lens, type -**輸出 : None -**使用 : kSerial_sendData(signalData, 12, KS_INT16); -**====================================================================================================*/ -/*====================================================================================================*/ -void kSerial_sendData( void *signalData, uint8_t lens, uint8_t type ) + +/** + * @brief kSerial_sendData + * @param data: point to send data + * @param lens: data lengths + * @param type: data type + * @retval None + */ +void kSerial_sendData( void *data, const uint8_t lens, const uint8_t type ) { - uint8_t packet[64] = {0}; - uint8_t *pPacket = packet; + const uint16_t dataBytes = lens << typeTable[type][1]; + const uint16_t packetInfo = typeTable[type][0] | dataBytes; - uint16_t dataBytes = lens * getTypeSize(type); - uint16_t packetSize = dataBytes + 6; - uint16_t packetInfo = ((uint16_t)type << 8) | dataBytes; + uint8_t *pPacket = packet; + uint16_t packetSize = dataBytes + 8; - packet[0] = 'K'; /* header 'K' */ - packet[1] = 'S'; /* header 'S' */ + sequenceNum++; +// packet[0] = 'K'; /* header 'K' */ +// packet[1] = 'S'; /* header 'S' */ packet[2] = (packetInfo & 0x00FF); /* lens & type */ packet[3] = (packetInfo & 0xFF00) >> 8; /* lens & type */ - for(uint8_t count = 0; count < dataBytes; count++) /* data */ - packet[count + 4] = ((uint8_t*)signalData)[count]; - packet[packetSize - 2] = '\r'; /* 'r' */ - packet[packetSize - 1] = '\n'; /* 'n' */ + for (uint8_t count = 0; count < dataBytes; count++) /* data */ + packet[count + 4] = ((uint8_t*)data)[count]; + packet[packetSize - 4] = (sequenceNum & 0x00FF); /* seqNum L */ + packet[packetSize - 3] = (sequenceNum & 0xFF00) >> 8; /* seqNum H */ + packet[packetSize - 2] = '\r'; /* end 'r' */ + packet[packetSize - 1] = '\n'; /* end 'n' */ do { pSerialFunc(*pPacket++); - } while(--packetSize); + } while (--packetSize); } -/*====================================================================================================*/ -/*====================================================================================================*/ + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.h index 05dec5a..b6c707e 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/kSerial.h @@ -1,35 +1,54 @@ -/* #include "modules\kSerial.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file kSerial.h + * @author KitSprout + * @date 12-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __KSERIAL_H #define __KSERIAL_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include "algorithms\mathUnit.h" -/*=====================================================================================================*/ -/*=====================================================================================================*/ + +/* Exported types --------------------------------------------------------------------------*/ typedef enum { - KS_INT8 = 0x00, /* 8'b0000_xxxx */ - KS_INT16 = 0x10, /* 8'b0001_xxxx */ - KS_INT32 = 0x20, /* 8'b0010_xxxx */ - KS_INT64 = 0x30, /* 8'b0011_xxxx */ - KS_UINT8 = 0x40, /* 8'b0100_xxxx */ - KS_UINT16 = 0x50, /* 8'b0101_xxxx */ - KS_UINT32 = 0x60, /* 8'b0110_xxxx */ - KS_UINT64 = 0x70, /* 8'b0111_xxxx */ -// KS_RECV1 = 0x80, /* 8'b1000_xxxx */ -// KS_RECV. = 0x90, /* 8'b1001_xxxx */ - KS_FLOAT32 = 0xA0, /* 8'b1010_xxxx */ - KS_FLOAT64 = 0xB0, /* 8'b1011_xxxx */ -// KS_CMD01 = 0xC0, /* 8'b1100_xxxx */ -// KS_CMD02 = 0xD0, /* 8'b1101_xxxx */ -// KS_CMD03 = 0xE0, /* 8'b1110_xxxx */ -// KS_CMD04 = 0xF0, /* 8'b1111_xxxx */ -} KSerial_TypeDef; - -typedef void (*ptrSerial)( uint8_t ); -/*=====================================================================================================*/ -/*=====================================================================================================*/ + KS_INT8 = 0, + KS_INT16, + KS_INT32, + KS_INT64, + KS_UINT8, + KS_UINT16, + KS_UINT32, + KS_UINT64, + KS_FLOAT32, + KS_FLOAT64 +} KSerial_TypeIndex; + +typedef void (*ptrSerial)(uint8_t); + +/* Exported constants ----------------------------------------------------------------------*/ +/* Exported functions ----------------------------------------------------------------------*/ void kSerial_config( ptrSerial pSerial ); -void kSerial_sendData( void *signalData, uint8_t lens, uint8_t type ); -/*=====================================================================================================*/ -/*=====================================================================================================*/ +void kSerial_sendData( void *data, const uint8_t lens, const uint8_t type ); + +#ifdef __cplusplus +} +#endif + #endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.c index e0ec5cd..734850a 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.c @@ -1,45 +1,60 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file serial.c + * @author KitSprout + * @date 28-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" #include "drivers\stm32f4_usart.h" -#include "algorithms\string.h" #include "modules\serial.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -#define UARTx USART1 -#define UARTx_CLK_ENABLE() RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE) -#define UARTx_IRQn USART1_IRQn - -#define UARTx_RX_PIN GPIO_Pin_6 -#define UARTx_RX_GPIO_PORT GPIOB -#define UARTx_RX_AF GPIO_AF_USART1 -#define UARTx_RX_SOURCE GPIO_PinSource6 - -#define UARTx_TX_PIN GPIO_Pin_7 -#define UARTx_TX_GPIO_PORT GPIOB -#define UARTx_TX_AF GPIO_AF_USART1 -#define UARTx_TX_SOURCE GPIO_PinSource7 - -#define UARTx_BAUDRATE 256000 -#define UARTx_BYTESIZE USART_WordLength_8b -#define UARTx_STOPBITS USART_StopBits_1 -#define UARTx_PARITY USART_Parity_No -#define UARTx_HARDWARECTRL USART_HardwareFlowControl_None -#define UARTx_MODE USART_Mode_Rx | USART_Mode_Tx -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_Config -**功能 : Serial Config -**輸入 : None -**輸出 : None -**使用 : Serial_Config(); -**====================================================================================================*/ -/*====================================================================================================*/ -void Serial_Config( void ) + +/** @addtogroup STM32_Module + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +/* Private define --------------------------------------------------------------------------*/ +#define UARTx USART1 +#define UARTx_CLK_ENABLE() RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE) +#define UARTx_IRQn USART1_IRQn + +#define UARTx_TX_PIN GPIO_Pin_6 +#define UARTx_TX_GPIO_PORT GPIOB +#define UARTx_TX_AF GPIO_AF_USART1 +#define UARTx_TX_SOURCE GPIO_PinSource6 + +#define UARTx_RX_PIN GPIO_Pin_7 +#define UARTx_RX_GPIO_PORT GPIOB +#define UARTx_RX_AF GPIO_AF_USART1 +#define UARTx_RX_SOURCE GPIO_PinSource7 + +#define UARTx_BAUDRATE 256000 +#define UARTx_BYTESIZE USART_WordLength_8b +#define UARTx_STOPBITS USART_StopBits_1 +#define UARTx_PARITY USART_Parity_No +#define UARTx_HARDWARECTRL USART_HardwareFlowControl_None +#define UARTx_MODE (USART_Mode_Rx | USART_Mode_Tx) + +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ +/* Private function prototypes -------------------------------------------------------------*/ +/* Private functions -----------------------------------------------------------------------*/ + +void Serial_Config( uint8_t interrupt ) { GPIO_InitTypeDef GPIO_InitStruct; USART_InitTypeDef UART_InitStruct; -// NVIC_InitTypeDef NVIC_InitStruct; + NVIC_InitTypeDef NVIC_InitStruct; /* UART Clk ******************************************************************/ UARTx_CLK_ENABLE(); @@ -61,12 +76,12 @@ void Serial_Config( void ) GPIO_Init(UARTx_RX_GPIO_PORT, &GPIO_InitStruct); /* UART IT *******************************************************************/ -// NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); -// NVIC_InitStruct.NVIC_IRQChannel = UARTx_IRQn; -// NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x000F; -// NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0; -// NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; -// NVIC_Init(&NVIC_InitStruct); + NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); + NVIC_InitStruct.NVIC_IRQChannel = UARTx_IRQn; + NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x000F; + NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStruct); /* UART Init *****************************************************************/ UART_InitStruct.USART_BaudRate = UARTx_BAUDRATE; @@ -78,162 +93,147 @@ void Serial_Config( void ) USART_Init(UARTx, &UART_InitStruct); /* UART Enable ***************************************************************/ -// USART_ITConfig(UARTx, USART_IT_RXNE, ENABLE); + if (interrupt == ENABLE) { + USART_ITConfig(UARTx, USART_IT_RXNE, ENABLE); + } + else { + USART_ITConfig(UARTx, USART_IT_RXNE, DISABLE); + } USART_Cmd(UARTx, ENABLE); USART_ClearFlag(UARTx, USART_FLAG_TC); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_SendByte -**功能 : Send Byte -**輸入 : SendByte -**輸出 : None -**使用 : Serial_SendByte('A'); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_SendByte + * @param sendByte: + * @retval None + */ void Serial_SendByte( uint8_t sendByte ) { UART_SendByte(UARTx, &sendByte); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_SendData -**功能 : Send Data -**輸入 : *sendData, lens -**輸出 : None -**使用 : Serial_SendData(sendData, lens); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_SendData + * @param sendData: + * @param lens: + * @retval None + */ void Serial_SendData( uint8_t *sendData, uint16_t lens ) { UART_SendData(UARTx, sendData, lens); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_SendStr -**功能 : Send String -**輸入 : *pWord -**輸出 : None -**使用 : Serial_SendStr("Hellow World!"); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_SendStr + * @param pWord: + * @retval None + */ void Serial_SendStr( char *pWord ) { - while(*pWord != '\0') { + while (*pWord != '\0') { UART_SendByte(UARTx, (uint8_t*)pWord++); } } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_SendNum -**功能 : Send Number -**輸入 : type, lens, sendNum -**輸出 : None -**使用 : Serial_SendNum(Type_D, 6, 1024); -**====================================================================================================*/ -/*====================================================================================================*/ -void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ) + +/** + * @brief Serial_SendNum + * @param type: + * @param lens: + * @param sendNum: + * @retval None + */ +void Serial_SendNum( StringType_t type, uint8_t lens, int32_t number ) { char tmpStr[32] = {0}; char *pWord = tmpStr; - num2Str(type, lens, tmpStr, sendNum); + num2Str(type, lens, tmpStr, number); - while(*pWord != '\0') { + while (*pWord != '\0') { UART_SendByte(UARTx, (uint8_t*)pWord++); } } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_RecvByte -**功能 : Recv Byte -**輸入 : *recvByte -**輸出 : None -**使用 : recvByte = Serial_RecvByte(); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_RecvByte + * @param None + * @retval receive byte + */ uint8_t Serial_RecvByte( void ) { uint8_t recvByte = 0; UART_RecvByte(UARTx, &recvByte); return recvByte; } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_RecvData -**功能 : Recv Data -**輸入 : *recvData, lens -**輸出 : None -**使用 : Serial_RecvData(recvData, lens); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_RecvData + * @param recvData: + * @param lens: + * @retval None + */ void Serial_RecvData( uint8_t *recvData, uint16_t lens ) { UART_RecvData(UARTx, recvData, lens); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_RecvDataWTO -**功能 : Recv Data Wait Timeout -**輸入 : *recvData, lens, timeoutMs -**輸出 : state -**使用 : state = Serial_RecvDataWTO(recvData, lens, timeoutMs); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_RecvDataWTO + * @param recvData: + * @param lens: + * @param timeoutMs: + * @retval state of receive + */ int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ) { return UART_RecvDataWTO(UARTx, recvData, lens, timeoutMs); } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_RecvStr -**功能 : Recv String -**輸入 : *pWord -**輸出 : None -**使用 : Serial_RecvStr(recvStr); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_RecvStr + * @param pWord: + * @retval None + */ void Serial_RecvStr( char *pWord ) { do { UART_RecvByte(UARTx, (uint8_t*)pWord++); - } while(*(pWord-1) != '\0'); + } while (*(pWord-1) != '\0'); *pWord = '\0'; } -/*====================================================================================================*/ -/*====================================================================================================* -**函數 : Serial_RecvStrWTO -**功能 : Recv String Wait Timeout -**輸入 : *pWord, timeoutMs -**輸出 : State -**使用 : Serial_RecvStrWTO(RecvStr, 200); -**====================================================================================================*/ -/*====================================================================================================*/ + +/** + * @brief Serial_RecvStrWTO + * @param pWord: + * @param timeoutMs: + * @retval state of receive + */ int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ) { int8_t state = ERROR; do { state = UART_RecvByteWTO(UARTx, (uint8_t*)pWord++, timeoutMs); - if(state == ERROR) + if (state == ERROR) return ERROR; - } while(*(pWord-1) != '\0'); + } while (*(pWord-1) != '\0'); *pWord = '\0'; return SUCCESS; } -/*====================================================================================================*/ -/*====================================================================================================*/ + int fputc( int ch, FILE *f ) { UARTx->DR = ((uint8_t)ch & (uint16_t)0x01FF); - while(!(UARTx->SR & USART_FLAG_TC)); + while (!(UARTx->SR & USART_FLAG_TC)); return (ch); } + int fgetc( FILE *f ) { - while(!(UARTx->SR & USART_FLAG_RXNE)); + while (!(UARTx->SR & USART_FLAG_RXNE)); return (uint16_t)(UARTx->DR & (uint16_t)0x01FF); } -/*====================================================================================================*/ -/*====================================================================================================*/ + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.h index 90b2213..ab79139 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/modules/serial.h @@ -1,23 +1,49 @@ -/* #include "modules\serial.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file serial.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __SERIAL_H #define __SERIAL_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include #include "algorithms\string.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -void Serial_Config( void ); +/* Exported types --------------------------------------------------------------------------*/ +/* Exported constants ----------------------------------------------------------------------*/ +/* Exported functions ----------------------------------------------------------------------*/ +void Serial_Config( uint8_t interrupt ); void Serial_SendByte( uint8_t sendByte ); void Serial_SendData( uint8_t *sendData, uint16_t lens ); void Serial_SendStr( char *pWord ); -void Serial_SendNum( StringType type, uint8_t lens, int32_t sendNum ); +void Serial_SendNum( StringType_t type, uint8_t lens, int32_t number ); uint8_t Serial_RecvByte( void ); void Serial_RecvData( uint8_t *recvData, uint16_t lens ); int8_t Serial_RecvDataWTO( uint8_t *recvData, uint16_t lens, int32_t timeoutMs ); void Serial_RecvStr( char *pWord ); int8_t Serial_RecvStrWTO( char *pWord, int32_t timeoutMs ); -/*====================================================================================================*/ -/*====================================================================================================*/ + +#ifdef __cplusplus +} #endif + +#endif + +/*************************************** END OF FILE ****************************************/ + diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/sampleRate.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/sampleRate.h new file mode 100644 index 0000000..806018b --- /dev/null +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/sampleRate.h @@ -0,0 +1,105 @@ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file sampleRate.h + * @author KitSprout + * @date 29-Oct-2016 + * @brief + * + */ + +/* Define to prevent recursive inclusion ---------------------------------------------------*/ +#ifndef __SAMPLERATE_H +#define __SAMPLERATE_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ +#include "drivers\stm32f4_system.h" + +/* Exported types --------------------------------------------------------------------------*/ +/* Exported constants ----------------------------------------------------------------------*/ +#define __SAMPLE_RATE_FREQ1KHz_ + +#ifdef __SAMPLE_RATE_FREQ10Hz_ + #define SAMPLE_RATE_FREQ ((uint16_t)10) // 10Hz + #define SAMPLE_RATE ((float32_t)0.1f) // 100ms + #define SAMPLE_RATE_HELF ((float32_t)0.05f) // 50ms +#endif + +#ifdef __SAMPLE_RATE_FREQ50Hz_ + #define SAMPLE_RATE_FREQ ((uint16_t)50) // 50Hz + #define SAMPLE_RATE ((float32_t)0.02f) // 20ms + #define SAMPLE_RATE_HELF ((float32_t)0.01f) // 10ms +#endif + +#ifdef __SAMPLE_RATE_FREQ100Hz_ + #define SAMPLE_RATE_FREQ ((uint16_t)100) // 100Hz + #define SAMPLE_RATE ((float32_t)0.01f) // 10ms + #define SAMPLE_RATE_HELF ((float32_t)0.005f) // 5ms +#endif + +#ifdef __SAMPLE_RATE_FREQ200Hz_ + #define SAMPLE_RATE_FREQ ((uint16_t)200) // 200Hz + #define SAMPLE_RATE ((float32_t)0.005f) // 5ms + #define SAMPLE_RATE_HELF ((float32_t)0.0025f) // 2.5ms +#endif + +#ifdef __SAMPLE_RATE_FREQ400Hz_ + #define SAMPLE_RATE_FREQ ((uint16_t)400) // 400Hz + #define SAMPLE_RATE ((float32_t)0.0025f) // 2.5ms + #define SAMPLE_RATE_HELF ((float32_t)0.00125f) // 1.25ms +#endif + +#ifdef __SAMPLE_RATE_FREQ500Hz_ + #define SAMPLE_RATE_FREQ ((uint16_t)500) // 500Hz + #define SAMPLE_RATE ((float32_t)0.002f) // 2.0ms + #define SAMPLE_RATE_HELF ((float32_t)0.001f) // 1.0ms +#endif + +#ifdef __SAMPLE_RATE_FREQ1KHz_ + #define SAMPLE_RATE_FREQ ((uint16_t)1000) // 1KHz + #define SAMPLE_RATE ((float32_t)0.001f) // 1.0ms + #define SAMPLE_RATE_HELF ((float32_t)0.0005f) // 0.5ms +#endif + +#ifdef __SAMPLE_RATE_FREQ2KHz_ + #define SAMPLE_RATE_FREQ ((uint16_t)2000) // 2KHz + #define SAMPLE_RATE ((float32_t)0.0005f) // 0.5ms + #define SAMPLE_RATE_HELF ((float32_t)0.00025f) // 0.25ms +#endif + +#ifdef __SAMPLE_RATE_FREQ4KHz_ + #define SAMPLE_RATE_FREQ ((uint16_t)4000) // 4KHz + #define SAMPLE_RATE ((float32_t)0.00025f) // 0.25ms + #define SAMPLE_RATE_HELF ((float32_t)0.000125f) // 0.125ms +#endif + +#ifdef __SAMPLE_RATE_FREQ10KHz_ + #define SAMPLE_RATE_FREQ ((uint16_t)10000) // 10KHz + #define SAMPLE_RATE ((float32_t)0.0001f) // 10us + #define SAMPLE_RATE_HELF ((float32_t)0.00005f) // 5us +#endif + +#ifdef __SAMPLE_RATE_FREQ20KHz_ + #define SAMPLE_RATE_FREQ ((uint16_t)20000) // 20KHz + #define SAMPLE_RATE ((float32_t)0.00005f) // 5us + #define SAMPLE_RATE_HELF ((float32_t)0.000025f) // 25us +#endif + +/* Exported functions ----------------------------------------------------------------------*/ + +#ifdef __cplusplus +} +#endif + +#endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/stm32f4xx_conf.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/stm32f4xx_conf.h index 41ff923..7b59334 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/stm32f4xx_conf.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/stm32f4xx_conf.h @@ -53,7 +53,7 @@ //#include "stm32f4xx_sdio.h" //#include "stm32f4xx_spi.h" //#include "stm32f4xx_syscfg.h" -//#include "stm32f4xx_tim.h" +#include "stm32f4xx_tim.h" #include "stm32f4xx_usart.h" //#include "stm32f4xx_wwdg.h" #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.c deleted file mode 100644 index 173ec2d..0000000 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.c +++ /dev/null @@ -1,31 +0,0 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ -#include "drivers\stm32f4_system.h" -#include "modules\serial.h" -#include "modules\kSerial.h" - -#include "uwbAdapter.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -void UWBA_Init( void ) -{ - UWBA_GPIO_Config(); - UWBA_UART_Config(NULL); -} -/*====================================================================================================*/ -/*====================================================================================================*/ -void UWBA_Loop( void ) -{ - float32_t count = 0; - float32_t sendBuf[4] = {0}; - - while(1) { - sendBuf[0] = 1; - sendBuf[1] = 2; - sendBuf[2] = 3; - sendBuf[3] = count++; - kSerial_sendData(sendBuf, 4, KS_FLOAT32); - } -} -/*====================================================================================================*/ -/*====================================================================================================*/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.h deleted file mode 100644 index 97a26d3..0000000 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter.h +++ /dev/null @@ -1,14 +0,0 @@ -/* #include "uwbAdapter.h" */ - -#ifndef __UWBADAPTER_H -#define __UWBADAPTER_H - -#include "stm32f4xx.h" -#include "uwbAdapter_bsp.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -void UWBA_Init( void ); -void UWBA_Loop( void ); -/*====================================================================================================*/ -/*====================================================================================================*/ -#endif diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.c index fba0897..7a6a8c7 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.c @@ -1,12 +1,39 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file uwbAdapter_bsp.c + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" #include "modules\serial.h" #include "modules\kSerial.h" - #include "uwbAdapter_bsp.h" -/*====================================================================================================*/ -/*====================================================================================================*/ +#include "sampleRate.h" + +/** @addtogroup STM32_Program + * @{ + */ + +/* Private typedef -------------------------------------------------------------------------*/ +pFunc IRQEven_TIM4 = NULL; +pFunc IRQEven_UART1 = NULL; + +/* Private define --------------------------------------------------------------------------*/ +/* Private macro ---------------------------------------------------------------------------*/ +/* Private variables -----------------------------------------------------------------------*/ +/* Private function prototypes -------------------------------------------------------------*/ +/* Private functions -----------------------------------------------------------------------*/ + void UWBA_GPIO_Config( void ) { GPIO_InitTypeDef GPIO_InitStruct; @@ -54,16 +81,45 @@ void UWBA_GPIO_Config( void ) LED_G_Set(); LED_B_Set(); } -/*====================================================================================================*/ -/*====================================================================================================*/ -pFunc UART1_irqEven = NULL; + void UWBA_UART_Config( pFunc pUARTx ) { - UART1_irqEven = pUARTx; + uint8_t interrupt = (pUARTx == NULL) ? DISABLE : ENABLE; + IRQEven_UART1 = pUARTx; - Serial_Config(); + Serial_Config(interrupt); kSerial_config(Serial_SendByte); printf("\r\nHello World!\r\n\r\n"); } -/*====================================================================================================*/ -/*====================================================================================================*/ + +void UWBA_TIM4_Config( pFunc pTIMx ) +{ + NVIC_InitTypeDef NVIC_InitStruct; + TIM_TimeBaseInitTypeDef TIM_TimeBaseStruct; + + IRQEven_TIM4 = pTIMx; + + /* TIMX Clk ******************************************************************/ + RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); + + /* NVIC Config ***************************************************************/ + NVIC_InitStruct.NVIC_IRQChannel = TIM4_IRQn; + NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x02; + NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStruct); + + /* TIM Base Config ************************************************************/ + TIM_TimeBaseStruct.TIM_Prescaler = (SystemCoreClock / (SAMPLE_RATE_FREQ * 1000)) - 1; + TIM_TimeBaseStruct.TIM_Period = 1000 - 1; + TIM_TimeBaseStruct.TIM_ClockDivision = TIM_CKD_DIV1; + TIM_TimeBaseStruct.TIM_CounterMode = TIM_CounterMode_Up; + TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStruct); + + /* TIM Enable *****************************************************************/ + TIM_ClearFlag(TIM4, TIM_FLAG_Update); + TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE); + TIM_Cmd(TIM4, ENABLE); +} + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.h b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.h index d12dab9..c0215ea 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.h +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_bsp.h @@ -1,38 +1,62 @@ -/* #include "uwbAdapter_bsp.h" */ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file uwbAdapter_bsp.h + * @author KitSprout + * @date 6-Oct-2016 + * @brief + * + */ +/* Define to prevent recursive inclusion ---------------------------------------------------*/ #ifndef __UWBADAPTER_BSP_H #define __UWBADAPTER_BSP_H +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" -/*====================================================================================================*/ -/*====================================================================================================*/ -#define LED_R_PIN GPIO_Pin_12 -#define LED_R_GPIO_PORT GPIOA -#define LED_R_Set() __GPIO_SET(LED_R_GPIO_PORT, LED_R_PIN) -#define LED_R_Reset() __GPIO_RST(LED_R_GPIO_PORT, LED_R_PIN) -#define LED_R_Toggle() __GPIO_TOG(LED_R_GPIO_PORT, LED_R_PIN) - -#define LED_G_PIN GPIO_Pin_11 -#define LED_G_GPIO_PORT GPIOA -#define LED_G_Set() __GPIO_SET(LED_G_GPIO_PORT, LED_G_PIN) -#define LED_G_Reset() __GPIO_RST(LED_G_GPIO_PORT, LED_G_PIN) -#define LED_G_Toggle() __GPIO_TOG(LED_G_GPIO_PORT, LED_G_PIN) - -#define LED_B_PIN GPIO_Pin_10 -#define LED_B_GPIO_PORT GPIOA -#define LED_B_Set() __GPIO_SET(LED_B_GPIO_PORT, LED_B_PIN) -#define LED_B_Reset() __GPIO_RST(LED_B_GPIO_PORT, LED_B_PIN) -#define LED_B_Toggle() __GPIO_TOG(LED_B_GPIO_PORT, LED_B_PIN) - -#define KEY_PIN GPIO_Pin_3 -#define KEY_GPIO_PORT GPIOA -#define KEY_Read() (__GPIO_READ(KEY_GPIO_PORT, KEY_PIN) == KEY_PIN) -/*====================================================================================================*/ -/*====================================================================================================*/ -extern pFunc UART1_irqEven; +/* Exported types --------------------------------------------------------------------------*/ +/* Exported constants ----------------------------------------------------------------------*/ +#define LED_R_PIN GPIO_Pin_12 +#define LED_R_GPIO_PORT GPIOA +#define LED_R_Set() __GPIO_SET(LED_R_GPIO_PORT, LED_R_PIN) +#define LED_R_Reset() __GPIO_RST(LED_R_GPIO_PORT, LED_R_PIN) +#define LED_R_Toggle() __GPIO_TOG(LED_R_GPIO_PORT, LED_R_PIN) + +#define LED_G_PIN GPIO_Pin_11 +#define LED_G_GPIO_PORT GPIOA +#define LED_G_Set() __GPIO_SET(LED_G_GPIO_PORT, LED_G_PIN) +#define LED_G_Reset() __GPIO_RST(LED_G_GPIO_PORT, LED_G_PIN) +#define LED_G_Toggle() __GPIO_TOG(LED_G_GPIO_PORT, LED_G_PIN) + +#define LED_B_PIN GPIO_Pin_10 +#define LED_B_GPIO_PORT GPIOA +#define LED_B_Set() __GPIO_SET(LED_B_GPIO_PORT, LED_B_PIN) +#define LED_B_Reset() __GPIO_RST(LED_B_GPIO_PORT, LED_B_PIN) +#define LED_B_Toggle() __GPIO_TOG(LED_B_GPIO_PORT, LED_B_PIN) + +#define KEY_PIN GPIO_Pin_3 +#define KEY_GPIO_PORT GPIOA +#define KEY_Read() (__GPIO_READ(KEY_GPIO_PORT, KEY_PIN) == KEY_PIN) + +/* Exported functions ----------------------------------------------------------------------*/ void UWBA_GPIO_Config( void ); void UWBA_UART_Config( pFunc pUARTx ); -/*====================================================================================================*/ -/*====================================================================================================*/ +void UWBA_TIM4_Config( pFunc pTIMx ); + +#ifdef __cplusplus +} #endif + +#endif + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_it.c b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_it.c index 89a46a9..e5b32f6 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_it.c +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/Program/uwbAdapter_it.c @@ -1,10 +1,31 @@ -/*====================================================================================================*/ -/*====================================================================================================*/ +/** + * __ ____ + * / /__ _ __ / __/ __ + * / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_ + * / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/ + * /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/ + * /_/ github.com/KitSprout + * + * @file uwbAdapter_it.c + * @author KitSprout + * @date 28-Oct-2016 + * @brief + * + */ + +/* Includes --------------------------------------------------------------------------------*/ #include "drivers\stm32f4_system.h" -#include "uwbAdapter_bsp.h" -/*====================================================================================================*/ -/*====================================================================================================*/ +/** @addtogroup STM32_Interrupt + * @{ + */ + +/* Private variables -----------------------------------------------------------------------*/ +extern pFunc IRQEven_TIM4; +extern pFunc IRQEven_UART1; + +/* Private functions -----------------------------------------------------------------------*/ + void NMI_Handler( void ) { while(1); } void HardFault_Handler( void ) { while(1); } void MemManage_Handler( void ) { while(1); } @@ -14,8 +35,7 @@ void SVC_Handler( void ) {} void DebugMon_Handler( void ) {} void PendSV_Handler( void ) {} void SysTick_Handler( void ) { HAL_IncTick(); } -/*====================================================================================================*/ -/*====================================================================================================*/ + //void WWDG_IRQHandler( void ) //void PVD_IRQHandler( void ) //void TAMP_STAMP_IRQHandler( void ) @@ -42,7 +62,13 @@ void SysTick_Handler( void ) { HAL_IncTick(); } //void TIM1_CC_IRQHandler( void ) //void TIM2_IRQHandler( void ) //void TIM3_IRQHandler( void ) -//void TIM4_IRQHandler( void ) +void TIM4_IRQHandler( void ) +{ + if(TIM_GetITStatus(TIM4, TIM_IT_Update) != RESET) { + TIM_ClearITPendingBit(TIM4, TIM_IT_Update); + IRQEven_TIM4(); + } +} //void I2C1_EV_IRQHandler( void ) //void I2C1_ER_IRQHandler( void ) //void I2C2_EV_IRQHandler( void ) @@ -52,7 +78,7 @@ void SysTick_Handler( void ) { HAL_IncTick(); } void USART1_IRQHandler( void ) { if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) { - UART1_irqEven(); + IRQEven_UART1(); } USART_ClearFlag(USART1, USART_IT_RXNE); } @@ -79,5 +105,5 @@ void USART1_IRQHandler( void ) //void FPU_IRQHandler( void ) //void SPI4_IRQHandler( void ) //void SPI5_IRQHandler( void ) -/*====================================================================================================*/ -/*====================================================================================================*/ + +/*************************************** END OF FILE ****************************************/ diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/DebugConfig/STM32F411C_STM32F411CEUx.dbgconf b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/DebugConfig/STM32F411C_STM32F411CEUx.dbgconf new file mode 100644 index 0000000..7fac71b --- /dev/null +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/DebugConfig/STM32F411C_STM32F411CEUx.dbgconf @@ -0,0 +1,33 @@ +// <<< Use Configuration Wizard in Context Menu >>> + +// Debug MCU Configuration +// DBG_SLEEP Debug Sleep Mode +// DBG_STOP Debug Stop Mode +// DBG_STANDBY Debug Standby Mode +// +DbgMCU_CR = 0x00000007; + +// Debug MCU APB1 Freeze +// DBG_TIM2_STOP Timer 2 Stopped when Core is halted +// DBG_TIM3_STOP Timer 3 Stopped when Core is halted +// DBG_TIM4_STOP Timer 4 Stopped when Core is halted +// DBG_TIM5_STOP Timer 5 Stopped when Core is halted +// DBG_RTC_STOP RTC Stopped when Core is halted +// DBG_WWDG_STOP Window Watchdog Stopped when Core is halted +// DBG_IWDG_STOP Independent Watchdog Stopped when Core is halted +// DBG_I2C1_SMBUS_TIMEOUT I2C1 SMBUS Timeout Mode Stopped when Core is halted +// DBG_I2C2_SMBUS_TIMEOUT I2C2 SMBUS Timeout Mode Stopped when Core is halted +// DBG_I2C3_SMBUS_TIMEOUT I2C3 SMBUS Timeout Mode Stopped when Core is halted +// +DbgMCU_APB1_Fz = 0x00000000; + + +// Debug MCU APB2 Freeze +// DBG_TIM1_STOP Timer 1 Stopped when Core is halted +// DBG_TIM9_STOP Timer 9 Stopped when Core is halted +// DBG_TIM10_STOP Timer 10 Stopped when Core is halted +// DBG_TIM11_STOP Timer 11 Stopped when Core is halted +// +DbgMCU_APB2_Fz = 0x00000000; + +// <<< end of configuration section >>> \ No newline at end of file diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvguix.Hom-MSI b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvguix.Hom similarity index 88% rename from Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvguix.Hom-MSI rename to Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvguix.Hom index 3c0581b..b01ef61 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvguix.Hom-MSI +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvguix.Hom @@ -11,7 +11,7 @@ 38003 Registers - 115 96 + 115 90 346 @@ -77,18 +77,18 @@ 2 3 - -1 - -1 + -32000 + -32000 -1 -1 - 144 - 312 - 1163 - 719 + 96 + 271 + 1187 + 762 @@ -124,7 +124,7 @@ 1005 1005 - 0 + 1 0 0 0 @@ -134,7 +134,7 @@ 0 16 - 160000004F000000E70000001C030000 + 0300000066000000D4000000A0020000 16 @@ -144,7 +144,7 @@ 109 109 - 0 + 1 0 0 0 @@ -154,7 +154,7 @@ 0 16 - 45FFFFFF4F0000001600000032030000 + 0300000066000000D4000000A0020000 16 @@ -178,7 +178,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -278,7 +278,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -424,7 +424,7 @@ 195 195 - 0 + 1 0 0 0 @@ -434,7 +434,7 @@ 0 16 - 45FFFFFF4F0000001600000032030000 + 0300000066000000D4000000A0020000 16 @@ -444,7 +444,7 @@ 196 196 - 0 + 1 0 0 0 @@ -454,7 +454,7 @@ 0 16 - 45FFFFFF4F0000001600000032030000 + 0300000066000000D4000000A0020000 16 @@ -464,7 +464,7 @@ 197 197 - 0 + 1 0 0 0 @@ -474,7 +474,7 @@ 0 16 - 1600000023030000A005000084030000 + 00000000D1020000A005000032030000 16 @@ -514,7 +514,7 @@ 0 16 - 19000000D40200009D05000019030000 + 03000000D40200009D05000019030000 16 @@ -538,7 +538,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -558,7 +558,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -638,7 +638,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -658,7 +658,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -678,7 +678,7 @@ 16 - 560000006D0000006A020000E2000000 + BE000000D5000000D20200004A010000 @@ -1114,7 +1114,7 @@ 0 16 - 0000000063000000D700000032030000 + 0300000066000000D4000000A0020000 16 @@ -1134,7 +1134,7 @@ 0 16 - 19000000D40200009D05000019030000 + 03000000D40200009D05000019030000 16 @@ -1154,7 +1154,7 @@ 0 16 - 19000000D40200009D05000019030000 + 03000000D40200009D05000019030000 16 @@ -1682,15 +1682,15 @@ - 3172 - 000000000B000000000000000020000000000000FFFFFFFFFFFFFFFFB8000000C400000028040000C8000000000000000100000004000000010000000000000000000000FFFFFFFF06000000CB00000057010000CC000000F08B00005A01000079070000FFFF02000B004354616262656450616E650020000000000000B80000006600000028040000DB000000B80000004F00000028040000C40000000000000040280046060000000B446973617373656D626C7900000000CB00000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A6572000000005701000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A657200000000CC00000001000000FFFFFFFFFFFFFFFF0E4C6F67696320416E616C797A657200000000F08B000001000000FFFFFFFFFFFFFFFF0D436F646520436F766572616765000000005A01000001000000FFFFFFFFFFFFFFFF11496E737472756374696F6E205472616365000000007907000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFCB00000001000000FFFFFFFFCB000000000000000040000000000000FFFFFFFFFFFFFFFF700300004F00000074030000BD010000000000000200000004000000010000000000000000000000FFFFFFFF2B000000E2050000CA0900002D8C00002E8C00002F8C0000308C0000318C0000328C0000338C0000348C0000358C0000368C0000378C0000388C0000398C00003A8C00003B8C00003C8C00003D8C00003E8C00003F8C0000408C0000418C000050C3000051C3000052C3000053C3000054C3000055C3000056C3000057C3000058C3000059C300005AC300005BC300005CC300005DC300005EC300005FC3000060C3000061C3000062C3000063C3000001800040000000000000740300006600000028040000D4010000740300004F00000028040000BD01000000000000404100462B0000000753796D626F6C7300000000E205000001000000FFFFFFFFFFFFFFFF0A5472616365204461746100000000CA09000001000000FFFFFFFFFFFFFFFF00000000002D8C000001000000FFFFFFFFFFFFFFFF00000000002E8C000001000000FFFFFFFFFFFFFFFF00000000002F8C000001000000FFFFFFFFFFFFFFFF0000000000308C000001000000FFFFFFFFFFFFFFFF0000000000318C000001000000FFFFFFFFFFFFFFFF0000000000328C000001000000FFFFFFFFFFFFFFFF0000000000338C000001000000FFFFFFFFFFFFFFFF0000000000348C000001000000FFFFFFFFFFFFFFFF0000000000358C000001000000FFFFFFFFFFFFFFFF0000000000368C000001000000FFFFFFFFFFFFFFFF0000000000378C000001000000FFFFFFFFFFFFFFFF0000000000388C000001000000FFFFFFFFFFFFFFFF0000000000398C000001000000FFFFFFFFFFFFFFFF00000000003A8C000001000000FFFFFFFFFFFFFFFF00000000003B8C000001000000FFFFFFFFFFFFFFFF00000000003C8C000001000000FFFFFFFFFFFFFFFF00000000003D8C000001000000FFFFFFFFFFFFFFFF00000000003E8C000001000000FFFFFFFFFFFFFFFF00000000003F8C000001000000FFFFFFFFFFFFFFFF0000000000408C000001000000FFFFFFFFFFFFFFFF0000000000418C000001000000FFFFFFFFFFFFFFFF000000000050C3000001000000FFFFFFFFFFFFFFFF000000000051C3000001000000FFFFFFFFFFFFFFFF000000000052C3000001000000FFFFFFFFFFFFFFFF000000000053C3000001000000FFFFFFFFFFFFFFFF000000000054C3000001000000FFFFFFFFFFFFFFFF000000000055C3000001000000FFFFFFFFFFFFFFFF000000000056C3000001000000FFFFFFFFFFFFFFFF000000000057C3000001000000FFFFFFFFFFFFFFFF000000000058C3000001000000FFFFFFFFFFFFFFFF000000000059C3000001000000FFFFFFFFFFFFFFFF00000000005AC3000001000000FFFFFFFFFFFFFFFF00000000005BC3000001000000FFFFFFFFFFFFFFFF00000000005CC3000001000000FFFFFFFFFFFFFFFF00000000005DC3000001000000FFFFFFFFFFFFFFFF00000000005EC3000001000000FFFFFFFFFFFFFFFF00000000005FC3000001000000FFFFFFFFFFFFFFFF000000000060C3000001000000FFFFFFFFFFFFFFFF000000000061C3000001000000FFFFFFFFFFFFFFFF000000000062C3000001000000FFFFFFFFFFFFFFFF000000000063C3000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFE205000001000000FFFFFFFFE2050000000000000080000000000000FFFFFFFFFFFFFFFF00000000A901000028040000AD01000000000000010000000400000001000000000000000000000000000000000000000000000001000000C6000000FFFFFFFF0E0000008F070000930700009407000095070000960700009007000091070000B5010000B8010000B9050000BA050000BB050000BC050000CB0900000180008000000000000000000000C4010000280400004D02000000000000AD010000280400003602000000000000404100460E0000001343616C6C20537461636B202B204C6F63616C73000000008F07000001000000FFFFFFFFFFFFFFFF0755415254202331000000009307000001000000FFFFFFFFFFFFFFFF0755415254202332000000009407000001000000FFFFFFFFFFFFFFFF0755415254202333000000009507000001000000FFFFFFFFFFFFFFFF15446562756720287072696E74662920566965776572000000009607000001000000FFFFFFFFFFFFFFFF0757617463682031000000009007000001000000FFFFFFFFFFFFFFFF0757617463682032000000009107000001000000FFFFFFFFFFFFFFFF10547261636520457863657074696F6E7300000000B501000001000000FFFFFFFFFFFFFFFF0E4576656E7420436F756E7465727300000000B801000001000000FFFFFFFFFFFFFFFF084D656D6F7279203100000000B905000001000000FFFFFFFFFFFFFFFF084D656D6F7279203200000000BA05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203300000000BB05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203400000000BC05000001000000FFFFFFFFFFFFFFFF105472616365204E617669676174696F6E00000000CB09000001000000FFFFFFFFFFFFFFFFFFFFFFFF0000000001000000000000000000000001000000FFFFFFFF14020000AD010000180200003602000000000000020000000400000000000000000000000000000000000000000000000000000002000000C6000000FFFFFFFF8F07000001000000FFFFFFFF8F07000001000000C6000000000000000080000000000000FFFFFFFFFFFFFFFF16000000B9020000A0050000BD020000000000000100000004000000010000000000000000000000FFFFFFFF03000000C7000000B4010000779400000180008000000000000016000000D4020000A00500004903000016000000BD020000A0050000320300000000000040820046030000000D46696E6420496E2046696C657300000000C700000001000000FFFFFFFFFFFFFFFF0A4572726F72204C69737400000000B401000001000000FFFFFFFFFFFFFFFF0742726F77736572000000007794000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFC700000001000000FFFFFFFFC7000000000000000010000000000000FFFFFFFFFFFFFFFFD70000004F000000DB0000003203000000000000020000000400000001000000000000000000000000000000000000000000000001000000FFFFFFFF0100000073940000018000100000000000000000000066000000D700000049030000000000004F000000D70000003203000000000000404100460100000009526567697374657273000000007394000001000000FFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF7394000001000000FFFFFFFF739400000000000005000000ED03000000100000010000001600000066000000E7000000330300000100000000000000010000006D000000001000000100000045FFFFFF660000001600000049030000000000000000000000000000C3000000001000000100000045FFFFFF660000001600000049030000000000000000000000000000C4000000001000000100000045FFFFFF660000001600000049030000000000000100000000000000C50000000080000001000000160000003A030000A00500009B03000001000000010000000100000000000000 + 3119 + 000000000B000000000000000020000000000000FFFFFFFFFFFFFFFFB8000000C400000028040000C8000000000000000100000004000000010000000000000000000000FFFFFFFF06000000CB00000057010000CC000000F08B00005A01000079070000FFFF02000B004354616262656450616E650020000000000000B80000006600000028040000DB000000B80000004F00000028040000C40000000000000040280046060000000B446973617373656D626C7900000000CB00000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A6572000000005701000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A657200000000CC00000001000000FFFFFFFFFFFFFFFF0E4C6F67696320416E616C797A657200000000F08B000001000000FFFFFFFFFFFFFFFF0D436F646520436F766572616765000000005A01000001000000FFFFFFFFFFFFFFFF11496E737472756374696F6E205472616365000000007907000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFCB00000001000000FFFFFFFFCB000000000000000040000000000000FFFFFFFFFFFFFFFF700300004F00000074030000BD010000000000000200000004000000010000000000000000000000FFFFFFFF2B000000E2050000CA0900002D8C00002E8C00002F8C0000308C0000318C0000328C0000338C0000348C0000358C0000368C0000378C0000388C0000398C00003A8C00003B8C00003C8C00003D8C00003E8C00003F8C0000408C0000418C000050C3000051C3000052C3000053C3000054C3000055C3000056C3000057C3000058C3000059C300005AC300005BC300005CC300005DC300005EC300005FC3000060C3000061C3000062C3000063C3000001800040000000000000740300006600000028040000D4010000740300004F00000028040000BD01000000000000404100462B0000000753796D626F6C7300000000E205000001000000FFFFFFFFFFFFFFFF0A5472616365204461746100000000CA09000001000000FFFFFFFFFFFFFFFF00000000002D8C000001000000FFFFFFFFFFFFFFFF00000000002E8C000001000000FFFFFFFFFFFFFFFF00000000002F8C000001000000FFFFFFFFFFFFFFFF0000000000308C000001000000FFFFFFFFFFFFFFFF0000000000318C000001000000FFFFFFFFFFFFFFFF0000000000328C000001000000FFFFFFFFFFFFFFFF0000000000338C000001000000FFFFFFFFFFFFFFFF0000000000348C000001000000FFFFFFFFFFFFFFFF0000000000358C000001000000FFFFFFFFFFFFFFFF0000000000368C000001000000FFFFFFFFFFFFFFFF0000000000378C000001000000FFFFFFFFFFFFFFFF0000000000388C000001000000FFFFFFFFFFFFFFFF0000000000398C000001000000FFFFFFFFFFFFFFFF00000000003A8C000001000000FFFFFFFFFFFFFFFF00000000003B8C000001000000FFFFFFFFFFFFFFFF00000000003C8C000001000000FFFFFFFFFFFFFFFF00000000003D8C000001000000FFFFFFFFFFFFFFFF00000000003E8C000001000000FFFFFFFFFFFFFFFF00000000003F8C000001000000FFFFFFFFFFFFFFFF0000000000408C000001000000FFFFFFFFFFFFFFFF0000000000418C000001000000FFFFFFFFFFFFFFFF000000000050C3000001000000FFFFFFFFFFFFFFFF000000000051C3000001000000FFFFFFFFFFFFFFFF000000000052C3000001000000FFFFFFFFFFFFFFFF000000000053C3000001000000FFFFFFFFFFFFFFFF000000000054C3000001000000FFFFFFFFFFFFFFFF000000000055C3000001000000FFFFFFFFFFFFFFFF000000000056C3000001000000FFFFFFFFFFFFFFFF000000000057C3000001000000FFFFFFFFFFFFFFFF000000000058C3000001000000FFFFFFFFFFFFFFFF000000000059C3000001000000FFFFFFFFFFFFFFFF00000000005AC3000001000000FFFFFFFFFFFFFFFF00000000005BC3000001000000FFFFFFFFFFFFFFFF00000000005CC3000001000000FFFFFFFFFFFFFFFF00000000005DC3000001000000FFFFFFFFFFFFFFFF00000000005EC3000001000000FFFFFFFFFFFFFFFF00000000005FC3000001000000FFFFFFFFFFFFFFFF000000000060C3000001000000FFFFFFFFFFFFFFFF000000000061C3000001000000FFFFFFFFFFFFFFFF000000000062C3000001000000FFFFFFFFFFFFFFFF000000000063C3000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFE205000001000000FFFFFFFFE2050000000000000010000001000000FFFFFFFFFFFFFFFFD70000004F000000DB000000B90200000100000002000010040000000100000037FFFFFFCC040000FFFFFFFF05000000ED0300006D000000C3000000C400000073940000018000100000010000000000000066000000D7000000D0020000000000004F000000D7000000B90200000000000040410056050000000750726F6A65637401000000ED03000001000000FFFFFFFFFFFFFFFF05426F6F6B73010000006D00000001000000FFFFFFFFFFFFFFFF0946756E6374696F6E7301000000C300000001000000FFFFFFFFFFFFFFFF0954656D706C6174657301000000C400000001000000FFFFFFFFFFFFFFFF09526567697374657273000000007394000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFFED03000001000000FFFFFFFFED030000000000000080000000000000FFFFFFFFFFFFFFFF00000000A901000028040000AD01000000000000010000000400000001000000000000000000000000000000000000000000000001000000C6000000FFFFFFFF0E0000008F070000930700009407000095070000960700009007000091070000B5010000B8010000B9050000BA050000BB050000BC050000CB0900000180008000000000000000000000C4010000280400004D02000000000000AD010000280400003602000000000000404100460E0000001343616C6C20537461636B202B204C6F63616C73000000008F07000001000000FFFFFFFFFFFFFFFF0755415254202331000000009307000001000000FFFFFFFFFFFFFFFF0755415254202332000000009407000001000000FFFFFFFFFFFFFFFF0755415254202333000000009507000001000000FFFFFFFFFFFFFFFF15446562756720287072696E74662920566965776572000000009607000001000000FFFFFFFFFFFFFFFF0757617463682031000000009007000001000000FFFFFFFFFFFFFFFF0757617463682032000000009107000001000000FFFFFFFFFFFFFFFF10547261636520457863657074696F6E7300000000B501000001000000FFFFFFFFFFFFFFFF0E4576656E7420436F756E7465727300000000B801000001000000FFFFFFFFFFFFFFFF084D656D6F7279203100000000B905000001000000FFFFFFFFFFFFFFFF084D656D6F7279203200000000BA05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203300000000BB05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203400000000BC05000001000000FFFFFFFFFFFFFFFF105472616365204E617669676174696F6E00000000CB09000001000000FFFFFFFFFFFFFFFFFFFFFFFF0000000001000000000000000000000001000000FFFFFFFF14020000AD010000180200003602000000000000020000000400000000000000000000000000000000000000000000000000000002000000C6000000FFFFFFFF8F07000001000000FFFFFFFF8F07000001000000C6000000000000000080000001000000FFFFFFFFFFFFFFFF00000000B9020000A0050000BD020000010000000100001004000000010000000000000000000000FFFFFFFF04000000C5000000C7000000B4010000779400000180008000000100000000000000D4020000A00500004903000000000000BD020000A0050000320300000000000040820056040000000C4275696C64204F757470757401000000C500000001000000FFFFFFFFFFFFFFFF0D46696E6420496E2046696C657300000000C700000001000000FFFFFFFFFFFFFFFF0A4572726F72204C69737400000000B401000001000000FFFFFFFFFFFFFFFF0742726F77736572000000007794000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFFC500000001000000FFFFFFFFC5000000000000000000000000000000 59392 File - 2031 - 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000400020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000004000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000004000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000004000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000400000000000000000000000000000000000001000000010000009600000002002050000000000C535049785F43534D5F4C2829960000000000000001000C535049785F43534D5F4C282900000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000004001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000400160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020000001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000 + 2339 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000400020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000004000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000004000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000004000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE8030000000004000000000000000000000000000000000000010000000100000096000000020020500000000016636F6E6669675359535449434B5F434C4F434B5F485A9600000000000000140016636F6E6669675359535449434B5F434C4F434B5F485A04307834320953454C454354494F4E0553485432310C4D41585F434D445F4C454E530C524543564255465F4C454E5309616C7068615F6163630E6163635F66696C7465645F6F6C64076163635F6F6C640E6163635F66696C7465645F6E6577114D50555F4D61675F46756C6C5363616C650E373438343736323434323930326607616C69676E656410303230393336303530313632393836660B6D6167537472656E677468066D662D3E6B7005685665637403657272076E6F726D416363155175617465726E696F6E5F52756E67654B757474610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000004001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000400160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000 1423 @@ -1705,8 +1705,8 @@ 59399 Build - 678 - 00200000010000001000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F0000000004001C0000000000000000000000000000000001000000010000000180D07F0000000000001D000000000000000000000000000000000100000001000000018030800000000000001E00000000000000000000000000000000010000000100000001809E8A0000000000001F0000000000000000000000000000000001000000010000000180D17F0000000004002000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000002100000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6EBA0000000000000000000000000000000000000000000000000100000001000000960000000300205000000000084B44574D3130303096000000000000000100084B44574D31303030000000000180EB880000000000002200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000230000000000000000000000000000000001000000010000000180B08A000000000400240000000000000000000000000000000001000000010000000180A8010000000000004E00000000000000000000000000000000010000000100000001807202000000000000530000000000000000000000000000000001000000010000000180BE010000000000005000000000000000000000000000000000010000000100000000000000054275696C64CF010000 + 682 + 00200000010000001000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F0000000004001C0000000000000000000000000000000001000000010000000180D07F0000000000001D000000000000000000000000000000000100000001000000018030800000000000001E00000000000000000000000000000000010000000100000001809E8A0000000000001F0000000000000000000000000000000001000000010000000180D17F0000000004002000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000002100000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6EBA00000000000000000000000000000000000000000000000001000000010000009600000003002050000000000A53544D33324634313143960000000000000001000A53544D33324634313143000000000180EB880000000000002200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000230000000000000000000000000000000001000000010000000180B08A000000000400240000000000000000000000000000000001000000010000000180A8010000000000004E00000000000000000000000000000000010000000100000001807202000000000000530000000000000000000000000000000001000000010000000180BE010000000000005000000000000000000000000000000000010000000100000000000000054275696C64CF010000 583 @@ -1721,8 +1721,8 @@ 59400 Debug - 2372 - 00200000000000001900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000002500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000002600000000000000000000000000000000010000000100000001801D800000000000002700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000002800000000000000000000000000000000010000000100000001801B80000000000000290000000000000000000000000000000001000000010000000180E57F0000000000002A00000000000000000000000000000000010000000100000001801C800000000000002B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000002C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B0000000000002D0000000000000000000000000000000001000000010000000180F07F0000000000002E0000000000000000000000000000000001000000010000000180E8880000000000003700000000000000000000000000000000010000000100000001803B010000000000002F0000000000000000000000000000000001000000010000000180BB8A00000000000030000000000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E0E01000000000000310000000D57617463682057696E646F7773000000000000000000000000010000000100000000000000000000000100000003001380D88B00000000000031000000085761746368202631000000000000000000000000010000000100000000000000000000000100000000001380D98B00000000000031000000085761746368202632000000000000000000000000010000000100000000000000000000000100000000001380CE01000000000000FFFFFFFF0C576174636820416E63686F720100000000000000010000000000000001000000000000000000000001000000000013800F01000000000000320000000E4D656D6F72792057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380D28B00000000000032000000094D656D6F7279202631000000000000000000000000010000000100000000000000000000000100000000001380D38B00000000000032000000094D656D6F7279202632000000000000000000000000010000000100000000000000000000000100000000001380D48B00000000000032000000094D656D6F7279202633000000000000000000000000010000000100000000000000000000000100000000001380D58B00000000000032000000094D656D6F72792026340000000000000000000000000100000001000000000000000000000001000000000013801001000000000000330000000E53657269616C2057696E646F777300000000000000000000000001000000010000000000000000000000010000000400138093070000000000003300000008554152542023263100000000000000000000000001000000010000000000000000000000010000000000138094070000000000003300000008554152542023263200000000000000000000000001000000010000000000000000000000010000000000138095070000000000003300000008554152542023263300000000000000000000000001000000010000000000000000000000010000000000138096070000000000003300000015446562756720287072696E746629205669657765720000000000000000000000000100000001000000000000000000000001000000000013803C010000000000003400000010416E616C797369732057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380658A000000000000340000000F264C6F67696320416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380DC7F0000000000003E0000001526506572666F726D616E636520416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380E788000000000000380000000E26436F646520436F766572616765000000000000000000000000010000000100000000000000000000000100000000001380CD01000000000000FFFFFFFF0F416E616C7973697320416E63686F7201000000000000000100000000000000010000000000000000000000010000000000138053010000000000003F0000000D54726163652057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013805401000000000000FFFFFFFF115472616365204D656E7520416E63686F720100000000000000010000000000000001000000000000000000000001000000000013802901000000000000350000001553797374656D205669657765722057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013804B01000000000000FFFFFFFF1453797374656D2056696577657220416E63686F720100000000000000010000000000000001000000000000000000000001000000000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000013800189000000000000360000000F26546F6F6C626F782057696E646F7700000000000000000000000001000000010000000000000000000000010000000300138044C5000000000000FFFFFFFF0E5570646174652057696E646F77730100000000000000010000000000000001000000000000000000000001000000000013800000000000000400FFFFFFFF000000000000000000010000000000000001000000000000000000000001000000000013805B01000000000000FFFFFFFF12546F6F6C626F78204D656E75416E63686F72010000000000000001000000000000000100000000000000000000000100000000000000000005446562756764020000 + 2373 + 00200000000000001900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000002500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000002600000000000000000000000000000000010000000100000001801D800000000000002700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000002800000000000000000000000000000000010000000100000001801B80000000000000290000000000000000000000000000000001000000010000000180E57F0000000000002A00000000000000000000000000000000010000000100000001801C800000000000002B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000002C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B0000000000002D0000000000000000000000000000000001000000010000000180F07F0000000000002E0000000000000000000000000000000001000000010000000180E8880000000000003700000000000000000000000000000000010000000100000001803B010000000000002F0000000000000000000000000000000001000000010000000180BB8A00000000000030000000000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E0E01000000000000310000000D57617463682057696E646F7773000000000000000000000000010000000100000000000000000000000100000003001380D88B00000000000031000000085761746368202631000000000000000000000000010000000100000000000000000000000100000000001380D98B00000000000031000000085761746368202632000000000000000000000000010000000100000000000000000000000100000000001380CE01000000000000FFFFFFFF0C576174636820416E63686F720100000000000000010000000000000001000000000000000000000001000000000013800F01000000000000320000000E4D656D6F72792057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380D28B00000000000032000000094D656D6F7279202631000000000000000000000000010000000100000000000000000000000100000000001380D38B00000000000032000000094D656D6F7279202632000000000000000000000000010000000100000000000000000000000100000000001380D48B00000000000032000000094D656D6F7279202633000000000000000000000000010000000100000000000000000000000100000000001380D58B00000000000032000000094D656D6F72792026340000000000000000000000000100000001000000000000000000000001000000000013801001000000000000330000000E53657269616C2057696E646F77730000000000000000000000000100000001000000000000000000000001000000040013809307000000000000330000000855415254202326310000000000000000000000000100000001000000000000000000000001000000000013809407000000000000330000000855415254202326320000000000000000000000000100000001000000000000000000000001000000000013809507000000000000330000000855415254202326330000000000000000000000000100000001000000000000000000000001000000000013809607000000000000330000001626446562756720287072696E746629205669657765720000000000000000000000000100000001000000000000000000000001000000000013803C010000000000003400000010416E616C797369732057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380658A000000000000340000000F264C6F67696320416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380DC7F0000000000003E0000001526506572666F726D616E636520416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380E788000000000000380000000E26436F646520436F766572616765000000000000000000000000010000000100000000000000000000000100000000001380CD01000000000000FFFFFFFF0F416E616C7973697320416E63686F7201000000000000000100000000000000010000000000000000000000010000000000138053010000000000003F0000000D54726163652057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013805401000000000000FFFFFFFF115472616365204D656E7520416E63686F720100000000000000010000000000000001000000000000000000000001000000000013802901000000000000350000001553797374656D205669657765722057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013804B01000000000000FFFFFFFF1453797374656D2056696577657220416E63686F720100000000000000010000000000000001000000000000000000000001000000000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000013800189000000000000360000000F26546F6F6C626F782057696E646F7700000000000000000000000001000000010000000000000000000000010000000300138044C5000000000000FFFFFFFF0E5570646174652057696E646F77730100000000000000010000000000000001000000000000000000000001000000000013800000000000000400FFFFFFFF000000000000000000010000000000000001000000000000000000000001000000000013805B01000000000000FFFFFFFF12546F6F6C626F78204D656E75416E63686F72010000000000000001000000000000000100000000000000000000000100000000000000000005446562756764020000 898 diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvoptx b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvoptx index bf68a9c..26ced40 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvoptx +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvoptx @@ -22,14 +22,14 @@ - KDWM1000 + STM32F411C 0x4 ARM-ADS 8000000 1 - 1 + 0 1 0 0 @@ -323,6 +323,18 @@ 2 7 + 1 + 0 + 0 + 0 + ..\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_tim.c + stm32f4xx_tim.c + 0 + 0 + + + 2 + 8 5 0 0 @@ -342,7 +354,7 @@ 0 3 - 8 + 9 1 0 0 @@ -354,7 +366,7 @@ 3 - 9 + 10 1 0 0 @@ -374,7 +386,7 @@ 0 4 - 10 + 11 1 0 0 @@ -384,18 +396,6 @@ 0 0 - - 4 - 11 - 1 - 0 - 0 - 0 - ..\Program\uwbAdapter.c - uwbAdapter.c - 0 - 0 - 4 12 diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvprojx b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvprojx index 2d9e52e..c3c6e17 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvprojx +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/ProjectUWBA/ProjectSTM32.uvprojx @@ -7,7 +7,7 @@ - KDWM1000 + STM32F411C 0x4 ARM-ADS 5060300::V5.06 update 3 (build 300)::ARMCC @@ -330,6 +330,7 @@ 0 0 0 + 0 USE_STDPERIPH_DRIVER, STM32F411xE, ARM_MATH_CM4, __FPU_PRESENT = 1 @@ -413,6 +414,11 @@ 1 ..\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_usart.c + + stm32f4xx_tim.c + 1 + ..\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_tim.c + stm32f4xx_conf.h 5 @@ -443,11 +449,6 @@ 1 ..\Program\main.c - - uwbAdapter.c - 1 - ..\Program\uwbAdapter.c - uwbAdapter_bsp.c 1 diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/kSerial.m b/Software/UWBAdapter_ApplicationSTD_serialPacket/kSerial.m index a7ddd5b..8402d85 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/kSerial.m +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/kSerial.m @@ -1,4 +1,3 @@ - classdef kSerial < handle properties (SetAccess = public) @@ -122,6 +121,7 @@ function initPacket( s ) s.packet.recvBufLengths = 0; s.packet.recvBuffer = zeros(s.packet.recvBufSize, 1); + s.packet.sequenceNum = 0; s.packet.availableData = 0; s.packet.availableIndex = zeros(1, 256); % fix(s.packet.recvBufSize / s.packet.packetSize) + 1 end @@ -135,7 +135,7 @@ function initPacket( s ) % update packet information s.packet.dataLengths = dataLens; s.packet.dataType = dataType; - s.packet.packetSize = 6 + dataLens * s.sizeof(dataType); + s.packet.packetSize = 8 + dataLens * s.sizeof(dataType); % start to read nBytes = get(s.serial, 'BytesAvailable'); @@ -168,12 +168,13 @@ function initPacket( s ) i = s.packet.availableIndex(indexLens); s.packet.gType = s.getDataType(fix(s.packet.recvBuffer(i + 3) / 16)); s.packet.gLens = s.packet.recvBuffer(i + 2) + mod(s.packet.recvBuffer(i + 3), 16) * 256 + 1; + s.packet.sequenceNum = typecast(uint8(s.packet.recvBuffer(i + s.packet.packetSize - 4 : i + s.packet.packetSize - 3)), 'uint16'); % get data from buffer s.packet.data = zeros(s.packet.dataLengths, indexLens); for k = 1 : indexLens j = s.packet.availableIndex(k); - s.packet.data(:, k) = typecast(uint8(s.packet.recvBuffer(j + 4 : j + s.packet.packetSize - 3)), s.packet.dataType); % s.packet.gType + s.packet.data(:, k) = typecast(uint8(s.packet.recvBuffer(j + 4 : j + s.packet.packetSize - 5)), s.packet.dataType); % s.packet.gType end % update recv buffer & lengths @@ -187,6 +188,11 @@ function initPacket( s ) varargout = { s.packet.data, s.packet.availableData }; end + function freq = getFreq( s, index, length ) + sec_s = s.dataBuffer(index(1), end - length + 1) * 60 + s.dataBuffer(index(2), end - length + 1) + s.dataBuffer(index(3), end - length + 1); + sec_e = s.dataBuffer(index(1), end) * 60 + s.dataBuffer(index(2), end) + s.dataBuffer(index(3), end); + freq = length / (sec_e - sec_s); + end end methods (Access = private) @@ -201,8 +207,8 @@ function initPacket( s ) case 5, type = 'uint32'; case 6, type = 'int64'; case 7, type = 'uint64'; - case 8, type = 'single'; - case 9, type = 'double'; + case 10, type = 'single'; + case 11, type = 'double'; end end diff --git a/Software/UWBAdapter_ApplicationSTD_serialPacket/serialPacket.m b/Software/UWBAdapter_ApplicationSTD_serialPacket/serialPacket.m index 6189560..9d248ab 100644 --- a/Software/UWBAdapter_ApplicationSTD_serialPacket/serialPacket.m +++ b/Software/UWBAdapter_ApplicationSTD_serialPacket/serialPacket.m @@ -1,31 +1,36 @@ clear; -dataSize = 4; +dataLens = 3; +dataType = 'single'; + s = kSerial(256000, 'clear'); -s.dataBuffer = zeros(dataSize, 1024 * 8); +s.dataBuffer = zeros(dataLens, 1024 * 16); s.open(); -getFirstSequenceNum = true; +getFirstRecord = true; firstSequenceNum = 0; tic for i = 1 : 10000 %while true - [packetData, packetLens] = s.packetRecv(dataSize, 'single'); + [packetData, packetLens] = s.packetRecv(dataLens, dataType); if packetLens > 0 s.dataBuffer = [s.dataBuffer(:, packetLens + 1 : end), packetData]; % record data - leastSequenceNum = s.dataBuffer(end); - fprintf('[%5i][%2i][%8.3f, %8.3f, %8.3f]\n', leastSequenceNum, packetLens, s.dataBuffer(1 : end - 1, end)); - if getFirstSequenceNum - firstSequenceNum = leastSequenceNum; - getFirstSequenceNum = false; + time = s.dataBuffer(1 : 3, end); + time(3) = fix(time(3) * 100); + freq = s.getFreq([1, 2, 3], 256); + fprintf('[%05i][%02i][%02i:%02i:%02i][%3dHz]\n', s.packet.sequenceNum, packetLens, time, fix(freq)); + if getFirstRecord + getFirstRecord = false; + firstSequenceNum = s.packet.sequenceNum - packetLens + 1; end end end -time = toc; +systic = toc; -lostPacket = (leastSequenceNum - firstSequenceNum + 1) - s.packet.packetCount; -sampleRate = s.packet.packetCount / time; -fprintf('\nrecv packet = %d, lost packet = %d, sample rate = %.3f Hz\n', s.packet.packetCount, lostPacket, sampleRate); +totalPacket = s.packet.sequenceNum - firstSequenceNum + 1; +lostPacket = totalPacket - s.packet.packetCount; +sampleRate = s.packet.packetCount / systic; +fprintf('\nrecv packet = %d, lost packet = %d, sampleRate = %d Hz\n', s.packet.packetCount, lostPacket, fix(sampleRate + 0.5)); s.close();