From e1549ed7f3c911db12101c498b1d56fe8fe41b05 Mon Sep 17 00:00:00 2001 From: gaoyang3513 Date: Mon, 22 Jul 2024 23:29:57 +0800 Subject: [PATCH] =?UTF-8?q?[Bak]=20=E5=A4=87=E4=BB=BD=20=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E7=A7=BB=E6=A4=8D=2023.07.22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Uart_PingPong/ebyte/ebyte_core.h | 31 ++-- .../Uart_PingPong/ebyte/ebyte_port.h | 2 +- .../2_Ebyte_Board_Support/E15-EVB02/board.c | 162 +++++++++--------- .../2_Ebyte_Board_Support/E15-EVB02/board.h | 100 +++++------ .../E15-EVB02/board_mini_printf.c | 66 +++---- .../E48xMx/radio.h | 1 + .../E48xMx/radio_hal.h | 2 +- .../E48xMx/radio_phy.h | 9 +- .../E48xMx/radio_spi.h | 3 +- .../inc/stm8l15x.h | 36 ++-- .../inc/stm8l15x_usart.h | 82 ++++----- .../stm8l15x_conf.h | 12 +- 12 files changed, 253 insertions(+), 253 deletions(-) diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_core.h b/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_core.h index c4d1df2..4578134 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_core.h +++ b/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_core.h @@ -1,24 +1,25 @@ /** ********************************************************************************** * @file ebyte_core.h - * @brief EBYTE驱动库的上层API封装层 帮助客户抽象底层逻辑 - * @details 详情请参见 https://www.ebyte.com/ - * @author JiangHeng - * @date 2021-05-13 - * @version 1.0.0 + * @brief EBYTE驱动库的上层API封装层 帮助客户抽象底层逻辑 + * @details 详情请参见 https://www.ebyte.com/ + * @author JiangHeng + * @date 2021-05-13 + * @version 1.0.0 ********************************************************************************** - * @copyright BSD License - * 成都亿佰特电子科技有限公司 - * ______ ____ __ __ _______ ______ + * @copyright BSD License + * 成都亿佰特电子科技有限公司 + * ______ ____ __ __ _______ ______ * | ____| | _ \ \ \ / / |__ __| | ____| - * | |__ | |_) | \ \_/ / | | | |__ - * | __| | _ < \ / | | | __| - * | |____ | |_) | | | | | | |____ - * |______| |____/ |_| |_| |______| + * | |__ | |_) | \ \_/ / | | | |__ + * | __| | _ < \ / | | | __| + * | |____ | |_) | | | | | | |____ + * |______| |____/ |_| |_| |______| * ********************************************************************************** */ +#include #include "ebyte_conf.h" #if defined(EBYTE_E48_433M20S)||defined(EBYTE_E48_900M20S) @@ -31,13 +32,13 @@ typedef struct { void ( *Init )( void ); void ( *Send )( uint8e_t *buffer, uint8e_t size , uint32e_t timeout); - void ( *EnterSleepMode )( uint8e_t command); - void ( *EnterReceiveMode )( uint32e_t timeout ); + void ( *EnterSleepMode )( uint8e_t command); + void ( *EnterReceiveMode )( uint32e_t timeout ); void ( *StartPollTask)( void ); void ( *InterruptTrigger)( void ); uint32e_t ( *GetName ) (void ); uint8e_t ( *GetDriverVersion ) (void ); -}Ebyte_RF_t; +}Ebyte_RF_t; extern const Ebyte_RF_t Ebyte_RF; diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_port.h b/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_port.h index 1ba9e60..0d20871 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_port.h +++ b/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/ebyte/ebyte_port.h @@ -1,5 +1,5 @@ #include "ebyte_conf.h" -#include "stm8l15x.h" +//#include "stm8l15x.h" //typedef unsigned char uint8e_t; //typedef unsigned short uint16e_t; //typedef unsigned long uint32e_t; diff --git a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.c b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.c index aaa8fb8..104578f 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.c +++ b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.c @@ -1,20 +1,20 @@ /** ********************************************************************************** * @file board.c - * @brief E15-EVB02 板级软件驱动层 - * @details 详情请参见 https://www.ebyte.com/ - * @author JiangHeng - * @date 2021-05-06 - * @version 1.0.0 + * @brief E15-EVB02 板级软件驱动层 + * @details 详情请参见 https://www.ebyte.com/ + * @author JiangHeng + * @date 2021-05-06 + * @version 1.0.0 ********************************************************************************** - * @copyright BSD License - * 成都亿佰特电子科技有限公司 - * ______ ____ __ __ _______ ______ + * @copyright BSD License + * 成都亿佰特电子科技有限公司 + * ______ ____ __ __ _______ ______ * | ____| | _ \ \ \ / / |__ __| | ____| - * | |__ | |_) | \ \_/ / | | | |__ - * | __| | _ < \ / | | | __| - * | |____ | |_) | | | | | | |____ - * |______| |____/ |_| |_| |______| + * | |__ | |_) | \ \_/ / | | | |__ + * | __| | _ < \ / | | | __| + * | |____ | |_) | | | | | | |____ + * |______| |____/ |_| |_| |______| * ********************************************************************************** */ @@ -22,8 +22,8 @@ #include "board.h" #include "ebyte_conf.h" -BSP_BTN_FIFO_t BSP_BTN_FIFO; - +BSP_BTN_FIFO_t BSP_BTN_FIFO; + /*!< @brief 辅助延时计算 用于定时器中断 递减 */ volatile uint32_t Ebyte_TimerDelayCounter = 0; @@ -33,70 +33,64 @@ volatile uint32_t Ebyte_TimerDelayCounter = 0; */ void Ebyte_BSP_HSI_Init(void) { - /* 内部 16M HSI 时钟 */ + /* 内部 16M HSI 时钟 */ CLK_SYSCLKSourceConfig( CLK_SYSCLKSource_HSI ); - + /* 1分频 16M/1 */ CLK_SYSCLKDivConfig( CLK_SYSCLKDiv_1 ); } - - - - - - void Ebyte_BSP_E48xGPIO_Init(void) { -// GPIO_Init( BSP_GPIO_PORT_E48_GP0, BSP_GPIO_PIN_E48_GP0, GPIO_Mode_In_PU_No_IT ); +// GPIO_Init( BSP_GPIO_PORT_E48_GP0, BSP_GPIO_PIN_E48_GP0, GPIO_Mode_In_PU_No_IT ); GPIO_Init( BSP_GPIO_PORT_E48_NIRQ, BSP_GPIO_PIN_E48_NIRQ, GPIO_Mode_In_PU_No_IT ); GPIO_Init( BSP_GPIO_PORT_E48_GP3, BSP_GPIO_PIN_E48_GP3, GPIO_Mode_In_PU_No_IT ); - GPIO_Init( BSP_GPIO_PORT_E48_GP4, BSP_GPIO_PIN_E48_GP4, GPIO_Mode_In_FL_No_IT ); + GPIO_Init( BSP_GPIO_PORT_E48_GP4, BSP_GPIO_PIN_E48_GP4, GPIO_Mode_In_FL_No_IT ); GPIO_Init( BSP_GPIO_PORT_E48_GP5, BSP_GPIO_PIN_E48_GP5, GPIO_Mode_In_PU_No_IT ); } /* ! * @brief 初始化所有IO - * - * @note 目标硬件: EBYTE E15-EVB02 + * + * @note 目标硬件: EBYTE E15-EVB02 */ void Ebyte_BSP_GPIO_Init(void) { - /* 无线模块状态控制 */ - Ebyte_BSP_E48xGPIO_Init(); + /* 无线模块状态控制 */ + Ebyte_BSP_E48xGPIO_Init(); /* LED */ GPIO_Init( BSP_GPIO_PORT_LED_1, BSP_GPIO_PIN_LED_1, GPIO_Mode_Out_PP_Low_Slow ); - GPIO_Init( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2, GPIO_Mode_Out_PP_Low_Slow ); - - /* 按键 */ - GPIO_Init( BSP_GPIO_PORT_BUTTON_1, BSP_GPIO_PIN_BUTTON_1, GPIO_Mode_In_PU_No_IT ); + GPIO_Init( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2, GPIO_Mode_Out_PP_Low_Slow ); - GPIO_Init( BSP_GPIO_PORT_BUTTON_2, BSP_GPIO_PIN_BUTTON_2, GPIO_Mode_In_PU_No_IT ); + /* 按键 */ + GPIO_Init( BSP_GPIO_PORT_BUTTON_1, BSP_GPIO_PIN_BUTTON_1, GPIO_Mode_In_PU_No_IT ); + + GPIO_Init( BSP_GPIO_PORT_BUTTON_2, BSP_GPIO_PIN_BUTTON_2, GPIO_Mode_In_PU_No_IT ); } /* ! * @brief 通信串口初始化 - * + * * @note 请注意,不同的MCU可能无需端口映射 */ void Ebyte_BSP_UART_Init( void ) { /* 时钟 */ CLK_PeripheralClockConfig( BSP_USER_UART_CLOCK, ENABLE); - + /* GPIO */ GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_UART_TX, BSP_GPIO_PIN_UART_TX, ENABLE ); GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_UART_RX, BSP_GPIO_PIN_UART_RX, ENABLE ); /* 端口重映射 */ - SYSCFG_REMAPPinConfig( REMAP_Pin_USART1TxRxPortA, ENABLE ); - + SYSCFG_REMAPPinConfig( REMAP_Pin_USART1TxRxPortA, ENABLE ); + /* 基础参数配置 E15-EVB02默认波特率9600 8N1 */ USART_Init( BSP_USER_UART, BSP_USER_UART_BAUDRATE, USART_WordLength_8b, USART_StopBits_1, BSP_USER_UART_PARITY, (USART_Mode_TypeDef)(USART_Mode_Rx | USART_Mode_Tx ));//允许接收和发送 - + /* 打开接收中断 */; USART_ITConfig( BSP_USER_UART, USART_IT_RXNE, ENABLE ); - + /* 串口 使能 */ USART_Cmd( BSP_USER_UART, ENABLE); } @@ -113,38 +107,38 @@ void Ebyte_BSP_SPI_Init( void ) { /* 时钟 */ CLK_PeripheralClockConfig( CLK_Peripheral_SPI1, ENABLE); - + /* GPIO */ GPIO_Init( BSP_GPIO_PORT_SPI_NSS, BSP_GPIO_PIN_SPI_NSS, GPIO_Mode_Out_PP_High_Slow); //片选 CS - GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_SPI_SCK, BSP_GPIO_PIN_SPI_MOSI | BSP_GPIO_PIN_SPI_MISO | BSP_GPIO_PIN_SPI_SCK, ENABLE); // MOSI MISO SCK - + GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_SPI_SCK, BSP_GPIO_PIN_SPI_MOSI | BSP_GPIO_PIN_SPI_MISO | BSP_GPIO_PIN_SPI_SCK, ENABLE); // MOSI MISO SCK + /* 参数配置 */ - SPI_Init( BSP_RF_SPI, + SPI_Init( BSP_RF_SPI, SPI_FirstBit_MSB, //从高位开始传输 SPI_BaudRatePrescaler_8, //16M/2 SCK速率 SPI_Mode_Master, //主机模式 - SPI_CPOL_Low, //根据 CPOL=0 + SPI_CPOL_Low, //根据 CPOL=0 SPI_CPHA_1Edge, //根据 CPHA=0 第一个时钟边沿采样数据 SPI_Direction_2Lines_FullDuplex, //全双工 SPI_NSS_Soft, //软件控制从机CS片选 0x07); //CRC参数 - + /* 使能 */ SPI_Cmd( BSP_RF_SPI, ENABLE ); } /* ! * @brief RF模块SPI通信收/发函数 - * - * @param data 发送数据 - * @return 接收数据 + * + * @param data 发送数据 + * @return 接收数据 * @note stm8l SPI库函数中的SPI_SendData()/SPI_ReceiveData() 不能直接使用 */ uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data ) { BSP_RF_SPI->DR = data; while ((BSP_RF_SPI->SR & SPI_FLAG_TXE) == RESET); - + while ((BSP_RF_SPI->SR & SPI_FLAG_RXNE) == RESET); return BSP_RF_SPI->DR; } @@ -154,27 +148,27 @@ uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data ) * * @note 使用了TIM3产生1ms周期性中断 * TIM3的主时钟为HSI 16MHz, 128分频即为 16 MHz / 128 = 125 000 Hz - * 目标定时1ms 计数周期即为 ( 0.001 x 125000 - 1) = 124 + * 目标定时1ms 计数周期即为 ( 0.001 x 125000 - 1) = 124 */ void Ebyte_BSP_TIMER_Init( void ) { /* 时钟 */ - CLK_PeripheralClockConfig( CLK_Peripheral_TIM3, ENABLE); - + CLK_PeripheralClockConfig( CLK_Peripheral_TIM3, ENABLE); + /* 参数 */ TIM3_TimeBaseInit( TIM3_Prescaler_128 , TIM3_CounterMode_Up, 124); - + /* 允许中断 */ TIM3_ClearFlag(TIM3_FLAG_Update); TIM3_ITConfig(TIM3_IT_Update, ENABLE); - + /* 使能 */ TIM3_Cmd(ENABLE); -} +} /* ! * @brief E15-EVB02 板载资源初始化 - * + * * @note 内部时钟HSI x 16MHz * 用户通信串口 x USART1 * 无线模块通信接口 x SPI1 @@ -186,39 +180,39 @@ void Ebyte_BSP_Init( void ) { /* 时钟 初始化 */ Ebyte_BSP_HSI_Init(); - + /* IO 初始化 */ Ebyte_BSP_GPIO_Init(); - + /* 串口 初始化 */ Ebyte_BSP_UART_Init(); - + /* SPI接口 初始化 */ Ebyte_BSP_SPI_Init(); - + /* 定时器 初始化 */ Ebyte_BSP_TIMER_Init(); - + /* 按键事件队列 初始化 */ Ebyte_BTN_FIFO_Init( &BSP_BTN_FIFO ); - - - + + + } /* ! * @brief 控制LED 开/关/翻转 - * + * * @param LEDx 板载两颗发光二极管 * @arg BSP_LED_1 : LED1 - * @arg BSP_LED_2 : LED2 - * + * @arg BSP_LED_2 : LED2 + * * @param ctl 开 / 关 * @arg OFF : 关 - * @arg ON : 开 - * @arg TOGGLE : 翻转 + * @arg ON : 开 + * @arg TOGGLE : 翻转 */ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl) { @@ -229,7 +223,7 @@ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl) case BSP_LED_1 : GPIO_ToggleBits( BSP_GPIO_PORT_LED_1, BSP_GPIO_PIN_LED_1); break; case BSP_LED_2 : GPIO_ToggleBits( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2); break; default: break; - } + } } else { @@ -238,7 +232,7 @@ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl) case BSP_LED_1 : GPIO_WriteBit( BSP_GPIO_PORT_LED_1, BSP_GPIO_PIN_LED_1, (BitAction)ctl); break; case BSP_LED_2 : GPIO_WriteBit( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2, (BitAction)ctl); break; default: break; - } + } } } @@ -246,13 +240,13 @@ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl) /* ! * @brief 基于定时器的毫秒延时函数 - * + * * @param nTime 单位:毫秒 */ void Ebyte_BSP_DelayMs( volatile uint32_t nTime ) { Ebyte_TimerDelayCounter = nTime; - + while( Ebyte_TimerDelayCounter !=0 ); } @@ -262,8 +256,8 @@ void Ebyte_BSP_DelayMs( volatile uint32_t nTime ) void Ebyte_BSP_TimerDecrement(void) { - - if( Ebyte_TimerDelayCounter != 0 ) + + if( Ebyte_TimerDelayCounter != 0 ) { Ebyte_TimerDelayCounter--; } @@ -272,24 +266,24 @@ void Ebyte_BSP_TimerDecrement(void) /* ! * @brief 读取按键状态 - * + * * @param btn 对应的按键编号 - * @arg BSP_BUTTON_1 :按键1 + * @arg BSP_BUTTON_1 :按键1 * @arg BSP_BUTTON_2 :按键2 - * @return 0:按键被按下 非0:按键未按下 + * @return 0:按键被按下 非0:按键未按下 * @note 板载按键未按下时 IO处于上拉状态 即为1;按下后IO接地 即为0 */ uint8_t Ebyte_BSP_ReadButton( BSP_BUTTON_t btn ) { BitStatus result = RESET; - + switch ( btn ) { case BSP_BUTTON_1: result = GPIO_ReadInputDataBit( BSP_GPIO_PORT_BUTTON_1 , BSP_GPIO_PIN_BUTTON_1); break; case BSP_BUTTON_2: result = GPIO_ReadInputDataBit( BSP_GPIO_PORT_BUTTON_2 , BSP_GPIO_PIN_BUTTON_2); break; default : break; } - + return result; } @@ -299,13 +293,13 @@ uint8_t Ebyte_BSP_ReadButton( BSP_BUTTON_t btn ) */ void Ebyte_BSP_UartTransmit( uint8_t *buffer , uint16_t length ) { - + uint8_t i; - + for( i = 0; i < length; i++ ) { - while ( USART_GetFlagStatus( USART1, USART_FLAG_TXE ) == RESET ); + while ( USART_GetFlagStatus( USART1, USART_FLAG_TBE ) == RESET ); USART_SendData8( USART1, *buffer++ ); - } + } } diff --git a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.h b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.h index 44439c4..59ce610 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.h +++ b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board.h @@ -1,75 +1,77 @@ /** ********************************************************************************** * @file board.h - * @brief E15-EVB02 板级软件驱动层 - * @details 详情请参见 https://www.ebyte.com/ - * @author JiangHeng - * @date 2021-05-06 - * @version 1.0.0 + * @brief E15-EVB02 板级软件驱动层 + * @details 详情请参见 https://www.ebyte.com/ + * @author JiangHeng + * @date 2021-05-06 + * @version 1.0.0 ********************************************************************************** - * @copyright BSD License - * 成都亿佰特电子科技有限公司 - * ______ ____ __ __ _______ ______ + * @copyright BSD License + * 成都亿佰特电子科技有限公司 + * ______ ____ __ __ _______ ______ * | ____| | _ \ \ \ / / |__ __| | ____| - * | |__ | |_) | \ \_/ / | | | |__ - * | __| | _ < \ / | | | __| - * | |____ | |_) | | | | | | |____ - * |______| |____/ |_| |_| |______| + * | |__ | |_) | \ \_/ / | | | |__ + * | __| | _ < \ / | | | __| + * | |____ | |_) | | | | | | |____ + * |______| |____/ |_| |_| |______| * ********************************************************************************** */ -#include "stm8l15x_conf.h" +#include +//#include "stm8l15x_conf.h" +#include "gd32w51x.h" #include "board_mini_printf.h" /* 引脚配置 LED */ #define BSP_GPIO_PORT_LED_1 GPIOC -#define BSP_GPIO_PIN_LED_1 GPIO_Pin_6 +#define BSP_GPIO_PIN_LED_1 GPIO_PIN_6 #define BSP_GPIO_PORT_LED_2 GPIOC -#define BSP_GPIO_PIN_LED_2 GPIO_Pin_5 +#define BSP_GPIO_PIN_LED_2 GPIO_PIN_5 /* 引脚配置 按键 */ #define BSP_GPIO_PORT_BUTTON_1 GPIOA -#define BSP_GPIO_PIN_BUTTON_1 GPIO_Pin_4 +#define BSP_GPIO_PIN_BUTTON_1 GPIO_PIN_4 #define BSP_GPIO_PORT_BUTTON_2 GPIOA -#define BSP_GPIO_PIN_BUTTON_2 GPIO_Pin_5 +#define BSP_GPIO_PIN_BUTTON_2 GPIO_PIN_5 /* 引脚配置 SPI通信接口 */ #define BSP_GPIO_PORT_SPI_NSS GPIOB -#define BSP_GPIO_PIN_SPI_NSS GPIO_Pin_4 +#define BSP_GPIO_PIN_SPI_NSS GPIO_PIN_4 #define BSP_GPIO_PORT_SPI_MOSI GPIOB -#define BSP_GPIO_PIN_SPI_MOSI GPIO_Pin_6 +#define BSP_GPIO_PIN_SPI_MOSI GPIO_PIN_6 #define BSP_GPIO_PORT_SPI_MISO GPIOB -#define BSP_GPIO_PIN_SPI_MISO GPIO_Pin_7 +#define BSP_GPIO_PIN_SPI_MISO GPIO_PIN_7 #define BSP_GPIO_PORT_SPI_SCK GPIOB -#define BSP_GPIO_PIN_SPI_SCK GPIO_Pin_5 +#define BSP_GPIO_PIN_SPI_SCK GPIO_PIN_5 /* 引脚配置 通信串口 */ #define BSP_GPIO_PORT_UART_TX GPIOA -#define BSP_GPIO_PIN_UART_TX GPIO_Pin_2 +#define BSP_GPIO_PIN_UART_TX GPIO_PIN_2 #define BSP_GPIO_PORT_UART_RX GPIOA -#define BSP_GPIO_PIN_UART_RX GPIO_Pin_3 +#define BSP_GPIO_PIN_UART_RX GPIO_PIN_3 /* 引脚配置 EBYTE无线模块控制 */ /* E48 */ #define BSP_GPIO_PORT_E48_GP0 GPIOC -#define BSP_GPIO_PIN_E48_GP0 GPIO_Pin_1 +#define BSP_GPIO_PIN_E48_GP0 GPIO_PIN_1 #define BSP_GPIO_PORT_E48_NIRQ GPIOD -#define BSP_GPIO_PIN_E48_NIRQ GPIO_Pin_4 +#define BSP_GPIO_PIN_E48_NIRQ GPIO_PIN_4 #define BSP_GPIO_PORT_E48_GP3 GPIOC -#define BSP_GPIO_PIN_E48_GP3 GPIO_Pin_3 +#define BSP_GPIO_PIN_E48_GP3 GPIO_PIN_3 #define BSP_GPIO_PORT_E48_GP4 GPIOC -#define BSP_GPIO_PIN_E48_GP4 GPIO_Pin_1 +#define BSP_GPIO_PIN_E48_GP4 GPIO_PIN_1 #define BSP_GPIO_PORT_E48_GP5 GPIOC -#define BSP_GPIO_PIN_E48_GP5 GPIO_Pin_2 +#define BSP_GPIO_PIN_E48_GP5 GPIO_PIN_2 @@ -92,22 +94,22 @@ #define Ebyte_BSP_E10SdnIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E10_SDN , BSP_GPIO_PIN_E10_SDN, RESET ) #define Ebyte_BSP_E10SdnIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E10_SDN , BSP_GPIO_PIN_E10_SDN, SET ) /* E49 */ -#define Ebyte_BSP_E49Dio1IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO1 , BSP_GPIO_PIN_E49_DIO1) -#define Ebyte_BSP_E49Dio2IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO2 , BSP_GPIO_PIN_E49_DIO2) -#define Ebyte_BSP_E49FcsbIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, RESET ) -#define Ebyte_BSP_E49FcsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, SET ) +#define Ebyte_BSP_E49Dio1IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO1 , BSP_GPIO_PIN_E49_DIO1) +#define Ebyte_BSP_E49Dio2IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO2 , BSP_GPIO_PIN_E49_DIO2) +#define Ebyte_BSP_E49FcsbIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, RESET ) +#define Ebyte_BSP_E49FcsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, SET ) #define Ebyte_BSP_E49CsbIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_CSB , BSP_GPIO_PIN_E49_CSB, RESET ) -#define Ebyte_BSP_E49CsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_CSB , BSP_GPIO_PIN_E49_CSB, SET ) -#define Ebyte_BSP_E49SlckIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, RESET ) -#define Ebyte_BSP_E49SlckIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, SET ) -#define Ebyte_BSP_E49SdioIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, RESET ) -#define Ebyte_BSP_E49SdioIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, SET ) +#define Ebyte_BSP_E49CsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_CSB , BSP_GPIO_PIN_E49_CSB, SET ) +#define Ebyte_BSP_E49SlckIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, RESET ) +#define Ebyte_BSP_E49SlckIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, SET ) +#define Ebyte_BSP_E49SdioIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, RESET ) +#define Ebyte_BSP_E49SdioIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, SET ) #define Ebyte_BSP_E49SdioIoOutput() GPIO_Init( BSP_GPIO_PORT_E49_SDIO, BSP_GPIO_PIN_E49_SDIO, GPIO_Mode_Out_PP_High_Fast ) #define Ebyte_BSP_E49SdioIoInput() GPIO_Init( BSP_GPIO_PORT_E49_SDIO, BSP_GPIO_PIN_E49_SDIO, GPIO_Mode_In_FL_No_IT ) -#define Ebyte_BSP_E49SdioIoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO) +#define Ebyte_BSP_E49SdioIoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO) /* E48 */ -#define Ebyte_BSP_E48GPIO4Read() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E48_GP4 , BSP_GPIO_PIN_E48_GP4) +#define Ebyte_BSP_E48GPIO4Read() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E48_GP4 , BSP_GPIO_PIN_E48_GP4) /* 全局中断 */ #define Ebyte_BSP_GlobalIntEnable() __enable_interrupt() @@ -117,7 +119,7 @@ #define BSP_USER_UART USART1 #define BSP_USER_UART_CLOCK CLK_Peripheral_USART1 #define BSP_USER_UART_BAUDRATE 9600 //波特率 -#define BSP_USER_UART_PARITY USART_Parity_No //USART_Parity_No:无校验 USART_Parity_Even:奇校验 USART_Parity_Odd:偶校验 +#define BSP_USER_UART_PARITY USART_Parity_No //USART_Parity_No:无校验 USART_Parity_Even:奇校验 USART_Parity_Odd:偶校验 #define BSP_USER_UART_IRQ USART1_RX_IRQn //中断类型 #define BSP_USER_UART_IRQ_LEVEL ITC_PriorityLevel_2 //优先级 @@ -126,14 +128,14 @@ #define BSP_BTN_FIFO_LENGTH 16 /* 参数配置 调试打印信息 关闭打印需要注释掉宏定义 EBYTE_DEBUG */ -#define EBYTE_DEBUG - +#define EBYTE_DEBUG + #ifdef EBYTE_DEBUG -#define DEBUG(format, ...) mprintf(format, ##__VA_ARGS__) +#define DEBUG(format, ...) mprintf(format, ##__VA_ARGS__) #else -#define DEBUG(...) +#define DEBUG(...) #endif - + typedef enum { BSP_LED_1 = 0, BSP_LED_2 } BSP_LED_t; typedef enum { OFF = 0, ON , TOGGLE} BSP_LED_Ctl_t; typedef enum { UART_8N1 = 0, UART_8O1, UART_8E1 } BSP_UART_Parity_t; @@ -141,10 +143,10 @@ typedef enum { UART_8N1 = 0, UART_8O1, UART_8E1 } BSP_UART_Parity_t; typedef enum { BSP_BUTTON_1 = 0, BSP_BUTTON_2 } BSP_BUTTON_t; typedef enum { - BTN_1_SHORT, //按键1 短按 - BTN_1_LONG, //按键1 长按 - BTN_2_SHORT, //按键2 短按 - BTN_2_LONG, //按键2 长按 + BTN_1_SHORT, //按键1 短按 + BTN_1_LONG, //按键1 长按 + BTN_2_SHORT, //按键2 短按 + BTN_2_LONG, //按键2 长按 }BSP_BTN_EVENT_t; typedef struct diff --git a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_mini_printf.c b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_mini_printf.c index 905dc2c..52f75ad 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_mini_printf.c +++ b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_mini_printf.c @@ -1,10 +1,10 @@ #include "stdarg.h" -#include "stm8l15x_usart.h" +//#include "stm8l15x_usart.h" #include "board_mini_printf.h" /* ! * @brief 目标硬件串口通信接口 - * + * * @param data 写入的数据 1 Byte */ static void send_uart_data(uint8_t data) @@ -12,7 +12,7 @@ static void send_uart_data(uint8_t data) while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); USART_SendData8(USART1,data); } - + /* 功能:将int型数据转为2,8,10,16进制字符串 参数:value --- 输入的int整型数 @@ -57,7 +57,7 @@ static char *sky_itoa(int value, char *str, unsigned int radix) } return str; } - + /* 功能:将double型数据转为字符串 参数:value --- 输入的double浮点数 @@ -98,7 +98,7 @@ static void sky_ftoa(double value, char *str, unsigned int eps) if (eps < 1 || eps > 4) { eps = 4; } - + //精度问题,防止输入1.2输出1.19等情况 double pp = 0.1; for (j = 0; j <= eps; j++) { @@ -126,25 +126,25 @@ static void sky_ftoa(double value, char *str, unsigned int eps) } str[i] = '\0'; } - - + + void mprintf(char * Data, ...) { const char *s; - int d; + int d; char buf[16]; uint8_t txdata; va_list ap; va_start(ap, Data); - while ( * Data != 0 ) { - if ( * Data == 0x5c ) { + while ( * Data != 0 ) { + if ( * Data == 0x5c ) { switch ( *++Data ) { - case 'r': + case 'r': txdata = 0x0d; send_uart_data(txdata); Data ++; break; - case 'n': + case 'n': txdata = 0x0a; send_uart_data(txdata); Data ++; @@ -152,46 +152,46 @@ void mprintf(char * Data, ...) default: Data ++; break; - } - } else if ( * Data == '%') { - switch ( *++Data ) { - case 's': + } + } else if ( * Data == '%') { + switch ( *++Data ) { + case 's': s = va_arg(ap, const char *); for ( ; *s; s++) { send_uart_data(*((uint8_t *)s)); - } - Data++; + } + Data++; break; - case 'd': - d = va_arg(ap, int); - sky_itoa(d, buf, 10); + case 'd': + d = va_arg(ap, int); + sky_itoa(d, buf, 10); for (s = buf; *s; s++) { send_uart_data(*((uint8_t *)s)); - } - Data++; + } + Data++; break; case 'x': { - d = va_arg(ap, int); - sky_itoa(d, buf, 16); + d = va_arg(ap, int); + sky_itoa(d, buf, 16); for (s = buf; *s; s++) { send_uart_data(*((uint8_t *)s)); - } - Data++; + } + Data++; break; } case 'f': { - double num = va_arg(ap, double); + double num = va_arg(ap, double); sky_ftoa(num, buf, 4); for (s = buf; *s; s++) { send_uart_data(*((uint8_t *)s)); - } - Data++; + } + Data++; break; } default: - Data++; - break; - } + Data++; + break; + } } else { send_uart_data(*((uint8_t *)Data)); Data++; diff --git a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio.h b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio.h index bd38a19..729ef67 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio.h +++ b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio.h @@ -4,6 +4,7 @@ #define __RADIO_H +#include #include "radio_phy.h" #include "radio_mac.h" #include "CMT2310A_def.h" diff --git a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_hal.h b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_hal.h index c4f8f05..de349b6 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_hal.h +++ b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_hal.h @@ -4,7 +4,7 @@ #define __RADIO_HAL_H -#include "stm8l15x.h" +//#include "stm8l15x.h" #include "ebyte_port.h" diff --git a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_phy.h b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_phy.h index e6fe564..976352d 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_phy.h +++ b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_phy.h @@ -1,7 +1,8 @@ #ifndef __RADIO_PHY_H #define __RADIO_PHY_H -#include "stm8l15x.h" +//#include "stm8l15x.h" +#include "gd32w51x.h" #include "radio_hal.h" #include "CMT2310A_def.h" #include "CMT2310A_reg.h" @@ -47,12 +48,12 @@ extern void vRadioFifoGetStatus( FIFO_STATUS_FLG* fifo_status ); extern void vRadioClearTxFifo( void ); extern void vRadioClearRxFifo( void ); extern void vRadioManualResetTxFifoPointer( void ); - + extern void vRadioInterruptSoucreCfg( INT_SRC_CFG* int_src_ctrl ); extern void vRadioInterruptSoucreFlag( INT_SRC_FLG* int_src_flag ); extern void vRadioInterruptSoucreClear( INT_SRC_CLR* int_src_clr ); - - + + extern void vRadioConfigPageReg( byte page_sel, uint8_t const reg_ptr[], uint8_t reg_len ); extern void vRadioReadPageReg( byte page_sel, uint8_t reg_ptr[], uint8_t reg_len ); extern boolean_t bRadioIsExist( void ); diff --git a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_spi.h b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_spi.h index 3660ca0..7a39ada 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_spi.h +++ b/NSPE/WIFI_IOT/bsp/drivers/3_Ebyte_WirelessModule_Drivers/E48xMx/radio_spi.h @@ -2,7 +2,8 @@ #define __RADIO_SPI_H -#include "stm8l15x.h" +//#include "stm8l15x.h" +#include "gd32w51x.h" #include "ebyte_port.h" extern void vSpiMasterInit( void ); diff --git a/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x.h b/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x.h index 94c056d..ac0049f 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x.h +++ b/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x.h @@ -14,13 +14,13 @@ * * http://www.st.com/software_license_agreement_liberty_v2 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * - ****************************************************************************** + ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ @@ -29,7 +29,7 @@ /** @addtogroup STM8L15x_StdPeriph_Driver * @{ - */ + */ /* Uncomment the line below according to the target STM8L15x device used in your application */ @@ -47,7 +47,7 @@ devices, you can define the device in your toolchain compiler preprocessor. - Low density STM8L15x devices are STM8L151C3, STM8L151K3, STM8L151G3, STM8L151F3, - STM8L151C2, STM8L151K2, STM8L151G2 and STM8L151F2 microcontrollers where the + STM8L151C2, STM8L151K2, STM8L151G2 and STM8L151F2 microcontrollers where the Flash memory density ranges between 4 and 8 Kbytes. - Medium density STM8L15x devices are STM8L151C4, STM8L151C6, STM8L152C4, STM8L152C6, STM8L151K4, STM8L151K6, STM8L152K4, STM8L152K6, STM8L151G4, @@ -57,16 +57,16 @@ the Flash memory density is fixed and equal to 32 Kbytes and a wider range of peripheral than the medium density devices. - High density STM8L15x devices are STM8L151x8, STM8L152x8, STM8L162R8 and STM8L162M8 - microcontrollers where the Flash memory density is fixed and equal to 64 Kbytes with + microcontrollers where the Flash memory density is fixed and equal to 64 Kbytes with the same peripheral set than Medium Density Plus devices. - Value line low density STM8L05xx devices are STM8L051x3 microcontrollers with 8-KB Flash - - Value line medium density STM8L05xx devices are STM8L052x6 microcontrollers + - Value line medium density STM8L05xx devices are STM8L052x6 microcontrollers with 32-KB Flash - Value line high density STM8L05xx devices: STM8L052x8 microcontrollers with 64-KB Flash - - Medium density STM8AL31xx/STM8AL3Lxx devices: STM8AL3168, STM8AL3166, - STM8AL3148,STM8AL3146, STM8AL3138, STM8AL3136, STM8AL3L68, STM8AL3L66, + - Medium density STM8AL31xx/STM8AL3Lxx devices: STM8AL3168, STM8AL3166, + STM8AL3148,STM8AL3146, STM8AL3138, STM8AL3136, STM8AL3L68, STM8AL3L66, STM8AL3L48, STM8AL3L46 microcontrollers with 8-KB, 16-KB or 32-KB Flash */ @@ -93,7 +93,7 @@ /* Comment the line below if you will not use the peripherals drivers. In this case, these drivers will not be included and the application code will be based on direct access to peripherals registers */ - #define USE_STDPERIPH_DRIVER +// #define USE_STDPERIPH_DRIVER #endif /** @@ -116,7 +116,7 @@ /** * @brief Definition of Device on-chip RC oscillator frequencies */ -#if !defined HSI_VALUE +#if !defined HSI_VALUE #define HSI_VALUE ((uint32_t)16000000) /*!< Typical Value of the HSI in Hz */ #endif /* HSI_VALUE */ @@ -143,7 +143,7 @@ #elif defined (STM8L15X_HD) || defined (STM8L05X_HD_VL) /*!< Used with memory Models for code higher than 64K */ #define MEMCPY fmemcpy - #endif /* STM8L15X_MD or STM8L15X_MDP or STM8L05X_MD_VL or STM8AL31_L_MD*/ + #endif /* STM8L15X_MD or STM8L15X_MDP or STM8L05X_MD_VL or STM8AL31_L_MD*/ #else /*_IAR_*/ #define FAR __far #define NEAR __near @@ -182,15 +182,15 @@ defined (STM8L05X_LD_VL) || defined (STM8L05X_MD_VL) || defined (STM8AL31_L_MD) #else /*_IAR_*/ #define IN_RAM(a) __ramfunc a #endif /* _COSMIC_ */ -#else +#else #define IN_RAM(a) a #endif /* RAM_EXECUTION */ /*!< [31:16] STM8L15X Standard Peripheral Library main version */ -#define __STM8L15X_STDPERIPH_VERSION_MAIN ((uint8_t)0x01) /*!< [31:24] main version */ +#define __STM8L15X_STDPERIPH_VERSION_MAIN ((uint8_t)0x01) /*!< [31:24] main version */ #define __STM8L15X_STDPERIPH_VERSION_SUB1 ((uint8_t)0x06) /*!< [23:16] sub1 version */ #define __STM8L15X_STDPERIPH_VERSION_SUB2 ((uint8_t)0x00) /*!< [15:8] sub2 version */ -#define __STM8L15X_STDPERIPH_VERSION_RC ((uint8_t)0x00) /*!< [7:0] release candidate */ +#define __STM8L15X_STDPERIPH_VERSION_RC ((uint8_t)0x00) /*!< [7:0] release candidate */ #define __STM8L15X_STDPERIPH_VERSION ( (__STM8L15X_STDPERIPH_VERSION_MAIN << 24)\ |(__STM8L15X_STDPERIPH_VERSION_SUB1 << 16)\ |(__STM8L15X_STDPERIPH_VERSION_SUB2 << 8)\ @@ -2889,7 +2889,7 @@ AES_TypeDef; #define CFG ((CFG_TypeDef *) CFG_BASE) #define OPT ((OPT_TypeDef *) OPT_BASE) -#ifdef USE_STDPERIPH_DRIVER +#ifdef USE_STDPERIPH_DRIVER #include "stm8l15x_conf.h" #endif @@ -2950,7 +2950,7 @@ AES_TypeDef; __interrupt void (a)( void ) #define INTERRUPT_HANDLER_TRAP(a) \ _Pragma( VECTOR_ID( 1 ) ) \ - __interrupt void (a) (void) + __interrupt void (a) (void) #endif /* _IAR_ */ /*============================== Interrupt Handler declaration ========================*/ @@ -2959,7 +2959,7 @@ AES_TypeDef; #elif defined(_IAR_) #define INTERRUPT __interrupt #endif /* _COSMIC_ */ - + /*============================== Handling bits ====================================*/ /*----------------------------------------------------------------------------- Method : I diff --git a/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x_usart.h b/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x_usart.h index 0751c91..4d50b72 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x_usart.h +++ b/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/inc/stm8l15x_usart.h @@ -14,13 +14,13 @@ * * http://www.st.com/software_license_agreement_liberty_v2 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * - ****************************************************************************** + ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ @@ -28,16 +28,16 @@ #define __STM8L15x_USART_H /* Includes ------------------------------------------------------------------*/ -#include "stm8l15x.h" -#include "stm8l15x_clk.h" +//#include "stm8l15x.h" +//#include "stm8l15x_clk.h" /** @addtogroup STM8L15x_StdPeriph_Driver * @{ */ /** @addtogroup USART * @{ - */ - + */ + /* Exported types ------------------------------------------------------------*/ /** @defgroup USART_Exported_Types @@ -47,8 +47,8 @@ /** @defgroup USART_Flags * @{ */ -typedef enum -{ +typedef enum +{ USART_FLAG_TXE = (uint16_t)0x0080, /*!< Transmit Data Register Empty flag */ USART_FLAG_TC = (uint16_t)0x0040, /*!< Transmission Complete flag */ USART_FLAG_RXNE = (uint16_t)0x0020, /*!< Read Data Register Not Empty flag */ @@ -70,9 +70,9 @@ typedef enum ((Flag) == USART_FLAG_FE) || \ ((Flag) == USART_FLAG_PE) || \ ((Flag) == USART_FLAG_SBK)) - + #define IS_USART_CLEAR_FLAG(Flag) (((Flag) == USART_FLAG_TC)) - + /** * @} */ @@ -80,7 +80,7 @@ typedef enum /** @defgroup USART_Interrupts * @{ */ - + /** * @brief USART Interrupt definition * USART_IT possible values @@ -89,8 +89,8 @@ typedef enum * Y: Flag position * Z: Register index */ -typedef enum -{ +typedef enum +{ USART_IT_TXE = (uint16_t)0x0277, /*!< Transmit interrupt */ USART_IT_TC = (uint16_t)0x0266, /*!< Transmission Complete interrupt */ USART_IT_RXNE = (uint16_t)0x0255, /*!< Receive interrupt */ @@ -123,7 +123,7 @@ typedef enum /** * @} */ - + /** @defgroup USART_Wakeup_Modes * @{ */ @@ -138,7 +138,7 @@ typedef enum /** * @} */ - + /** @defgroup USART_Stop_Bits * @{ */ @@ -155,7 +155,7 @@ typedef enum /** * @} */ - + /** @defgroup USART_Parity * @{ */ @@ -172,8 +172,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_Lin_Break_Detection_Length + +/** @defgroup USART_Lin_Break_Detection_Length * @{ */ typedef enum @@ -185,8 +185,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_Word_Length + +/** @defgroup USART_Word_Length * @{ */ typedef enum @@ -197,12 +197,12 @@ typedef enum #define IS_USART_WORDLENGTH(WordLength) (((WordLength) == USART_WordLength_8b) || \ ((WordLength) == USART_WordLength_9b)) - + /** * @} */ - -/** @defgroup USART_Mode + +/** @defgroup USART_Mode * @{ */ typedef enum @@ -215,8 +215,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_DMA_Requests + +/** @defgroup USART_DMA_Requests * @{ */ typedef enum @@ -229,8 +229,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_IrDA_Mode + +/** @defgroup USART_IrDA_Mode * @{ */ typedef enum @@ -244,8 +244,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_Clock + +/** @defgroup USART_Clock * @{ */ typedef enum @@ -258,8 +258,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_Clock_Polarity + +/** @defgroup USART_Clock_Polarity * @{ */ typedef enum @@ -272,8 +272,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_Clock_Phase + +/** @defgroup USART_Clock_Phase * @{ */ typedef enum @@ -286,8 +286,8 @@ typedef enum /** * @} */ - -/** @defgroup USART_LastBit + +/** @defgroup USART_LastBit * @{ */ typedef enum @@ -305,7 +305,7 @@ typedef enum /** * @} */ - + /* Exported constants --------------------------------------------------------*/ /* Exported macros -----------------------------------------------------------*/ /** @defgroupUSART_Exported_Macros @@ -325,8 +325,8 @@ typedef enum */ /* Exported functions ------------------------------------------------------- */ - -/* Function used to set the USART configuration to the default reset state ***/ + +/* Function used to set the USART configuration to the default reset state ***/ void USART_DeInit(USART_TypeDef* USARTx); /* Initialization and Configuration functions *********************************/ @@ -340,7 +340,7 @@ void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_SetPrescaler(USART_TypeDef* USARTx, uint8_t USART_Prescaler); void USART_SendBreak(USART_TypeDef* USARTx); -/* Data transfers functions ***************************************************/ +/* Data transfers functions ***************************************************/ void USART_SendData8(USART_TypeDef* USARTx, uint8_t Data); void USART_SendData9(USART_TypeDef* USARTx, uint16_t Data); uint8_t USART_ReceiveData8(USART_TypeDef* USARTx); @@ -382,7 +382,7 @@ void USART_ClearITPendingBit(USART_TypeDef* USARTx, USART_IT_TypeDef USART_IT); /** * @} */ - + /** * @} */ diff --git a/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/stm8l15x_conf.h b/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/stm8l15x_conf.h index 3eb9396..8b8700a 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/stm8l15x_conf.h +++ b/NSPE/WIFI_IOT/bsp/drivers/4_STM8_L15x_StdPeriph_Drivers/stm8l15x_conf.h @@ -13,14 +13,14 @@ * * http://www.st.com/software_license_agreement_liberty_v2 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** - */ + */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM8L15x_CONF_H @@ -61,9 +61,9 @@ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ -/* Uncomment the line below to expanse the "assert_param" macro in the +/* Uncomment the line below to expanse the "assert_param" macro in the Standard Peripheral Library drivers code */ -/* #define USE_FULL_ASSERT (1) */ +/* #define USE_FULL_ASSERT (1) */ /* Exported macro ------------------------------------------------------------*/ #ifdef USE_FULL_ASSERT @@ -72,7 +72,7 @@ * @brief The assert_param macro is used for function's parameters check. * @param expr: If expr is false, it calls assert_failed function * which reports the name of the source file and the source - * line number of the call that failed. + * line number of the call that failed. * If expr is true, it returns no value. * @retval : None */