diff --git a/NSPE/Example/TIMER/TIMER2_timebase/main.c b/NSPE/Example/TIMER/TIMER2_timebase/main.c index ea077a5..2881683 100644 --- a/NSPE/Example/TIMER/TIMER2_timebase/main.c +++ b/NSPE/Example/TIMER/TIMER2_timebase/main.c @@ -1,34 +1,34 @@ /*! \file main.c \brief TIMER2 oc timebase demo for gd32w51x - + \version 2021-10-30, V1.0.0, firmware for GD32W51x */ /* Copyright (c) 2021, GigaDevice Semiconductor Inc. - Redistribution and use in source and binary forms, with or without modification, + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, this + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -61,7 +61,7 @@ void nvic_config(void) void timer_config(void) { /* ---------------------------------------------------------------------------- - TIMER2 Configuration: + TIMER2 Configuration: TIMER2CLK = SystemCoreClock/9000 = 20KHz. TIMER2 configuration is timing mode, and the timing is 0.2s(4000/20000 = 0.2s). ---------------------------------------------------------------------------- */ diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/main.c b/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/main.c index c578b3a..2cb7be0 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/main.c +++ b/NSPE/WIFI_IOT/bsp/drivers/0_Project/IAR_for_Stm8/Uart_PingPong/main.c @@ -59,7 +59,7 @@ static BSP_BTN_EVENT_t BTN_Event; int ebyte_main( void ) { /* 板载硬件资源 初始化 */ -// Ebyte_BSP_Init(); + Ebyte_BSP_Init(); /* (可选) 串口中断接收FIFO 可根据需要自行处理 */ // Ebyte_FIFO_Init( &hfifo, EBYTE_FIFO_SIZE ); /* EBYTE 无线模块初始化 */ 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 a03fe32..37d4def 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 @@ -22,6 +22,7 @@ #include "board.h" #include "ebyte_port.h" #include "ebyte_conf.h" +#include "gd32w51x_gpio.h" #include "platform_def.h" BSP_BTN_FIFO_t BSP_BTN_FIFO; @@ -45,11 +46,13 @@ void Ebyte_BSP_HSI_Init(void) 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_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_GP5, BSP_GPIO_PIN_E48_GP5, GPIO_Mode_In_PU_No_IT ); + rcu_periph_clock_enable(BSP_GPIO_RCU_E48_GPIO); + + gpio_mode_set( BSP_GPIO_PORT_E48_GP0, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_GP0); + gpio_mode_set( BSP_GPIO_PORT_E48_NIRQ, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_NIRQ); + gpio_mode_set( BSP_GPIO_PORT_E48_GP3, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_GP3); + gpio_mode_set( BSP_GPIO_PORT_E48_GP4, GPIO_MODE_INPUT, GPIO_PUPD_NONE, BSP_GPIO_PIN_E48_GP4); + gpio_mode_set( BSP_GPIO_PORT_E48_GP5, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_GP5); } /* ! * @brief 初始化所有IO @@ -58,15 +61,19 @@ void Ebyte_BSP_E48xGPIO_Init(void) */ void Ebyte_BSP_GPIO_Init(void) { -// /* 无线模块状态控制 */ -// 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 ); -// + /* 无线模块状态控制 */ + Ebyte_BSP_E48xGPIO_Init(); + + /* LED */ + rcu_periph_clock_enable(BSP_GPIO_RCU_E48_LED); + gpio_mode_set( BSP_GPIO_PORT_LED_1, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_LED_1 ); + gpio_mode_set( BSP_GPIO_PORT_LED_2, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_LED_2 ); + gpio_output_options_set(BSP_GPIO_PORT_LED_1, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, BSP_GPIO_PIN_LED_1); + gpio_output_options_set(BSP_GPIO_PORT_LED_2, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, BSP_GPIO_PIN_LED_2); + + /* Button */ + rcu_periph_clock_enable(BSP_GPIO_RCU_E48_BUTTON); + gpio_mode_set( BSP_GPIO_PORT_BUTTON_1, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_BUTTON_1); // GPIO_Init( BSP_GPIO_PORT_BUTTON_2, BSP_GPIO_PIN_BUTTON_2, GPIO_Mode_In_PU_No_IT ); } @@ -107,26 +114,30 @@ void Ebyte_BSP_ThreeLinesSPI_Init() */ 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 + spi_parameter_struct spi_init_struct; + + /* 时钟 */ + rcu_periph_clock_enable(BSP_RF_SPI_CLOCK); + + /* GPIO */ + rcu_periph_clock_enable(BSP_GPIO_RCU_E48_SPI); + gpio_mode_set(BSP_GPIO_PORT_SPI_NSS, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_SPI_NSS); //片选 CS + gpio_output_options_set(BSP_GPIO_PORT_SPI_NSS, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, BSP_GPIO_PIN_SPI_NSS); // 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_FirstBit_MSB, //从高位开始传输 -// SPI_BaudRatePrescaler_8, //16M/2 SCK速率 -// SPI_Mode_Master, //主机模式 -// 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 ); + + /* 参数配置 */ + spi_init_struct.trans_mode = SPI_TRANSMODE_FULLDUPLEX; + spi_init_struct.device_mode = SPI_MASTER; //主机模式 + spi_init_struct.frame_size = SPI_FRAMESIZE_8BIT; + spi_init_struct.clock_polarity_phase = SPI_CK_PL_LOW_PH_1EDGE; // Mode0 {CPOL=0, CPHA=0} + spi_init_struct.nss = SPI_NSS_SOFT; //软件控制从机CS片选 + spi_init_struct.prescale = SPI_PSC_8; //16M/2 SCK速率 + spi_init_struct.endian = SPI_ENDIAN_MSB; //从高位开始传输 + spi_init(BSP_RF_SPI, &spi_init_struct); + + /* 使能 */ + /* SPI enable */ + spi_enable(BSP_RF_SPI); } /* ! @@ -154,18 +165,35 @@ uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data ) */ void Ebyte_BSP_TIMER_Init( void ) { -// /* 时钟 */ -// 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); + timer_parameter_struct timer_initpara; + /** + TIMER2 Configuration: + TIMER2CLK = SystemCoreClock/180 = 1MHz. + TIMER2 configuration is timing mode, and the timing is 1ms(1000/1 = 1ms). + */ + + /* enable the peripherals clock */ + rcu_timer_clock_prescaler_config(RCU_TIMER_PSC_MUL4); + rcu_periph_clock_enable(BSP_RF_TIMER); + + /* deinit a TIMER */ + timer_deinit(BSP_RF_TIMER); + /* initialize TIMER init parameter struct */ + timer_struct_para_init(&timer_initpara); + /* TIMER2 configuration */ + timer_initpara.prescaler = 179; + timer_initpara.alignedmode = TIMER_COUNTER_EDGE; + timer_initpara.counterdirection = TIMER_COUNTER_UP; + timer_initpara.period = 1000; + timer_initpara.clockdivision = TIMER_CKDIV_DIV1; + timer_init(BSP_RF_TIMER, &timer_initpara); + + /* clear interrupt bit */ + timer_interrupt_flag_clear(BSP_RF_TIMER, TIMER_INT_FLAG_UP); + /* enable the TIMER interrupt */ + timer_interrupt_enable(BSP_RF_TIMER, TIMER_INT_UP); + /* enable a TIMER */ + timer_enable(BSP_RF_TIMER); } /* ! @@ -181,13 +209,13 @@ void Ebyte_BSP_TIMER_Init( void ) void Ebyte_BSP_Init( void ) { /* 时钟 初始化 */ - Ebyte_BSP_HSI_Init(); +// Ebyte_BSP_HSI_Init(); /* IO 初始化 */ Ebyte_BSP_GPIO_Init(); /* 串口 初始化 */ - Ebyte_BSP_UART_Init(); +// Ebyte_BSP_UART_Init(); /* SPI接口 初始化 */ Ebyte_BSP_SPI_Init(); @@ -276,8 +304,8 @@ uint8_t Ebyte_BSP_ReadButton( BSP_BUTTON_t btn ) 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; + case BSP_BUTTON_1: result = gpio_input_bit_get( 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; } 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 e14e5ef..f6b8ca6 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 @@ -28,31 +28,35 @@ #include "board_mini_printf.h" /* 引脚配置 LED */ -#define BSP_GPIO_PORT_LED_1 GPIOC +#define BSP_GPIO_RCU_E48_LED RCU_GPIOB +#define BSP_GPIO_PORT_LED_1 GPIOB #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_PORT_LED_2 GPIOA +#define BSP_GPIO_PIN_LED_2 GPIO_PIN_15 /* 引脚配置 按键 */ +#define BSP_GPIO_RCU_E48_BUTTON RCU_GPIOA #define BSP_GPIO_PORT_BUTTON_1 GPIOA -#define BSP_GPIO_PIN_BUTTON_1 GPIO_PIN_4 +#define BSP_GPIO_PIN_BUTTON_1 GPIO_PIN_2 -#define BSP_GPIO_PORT_BUTTON_2 GPIOA -#define BSP_GPIO_PIN_BUTTON_2 GPIO_PIN_5 +//#define BSP_GPIO_PORT_BUTTON_2 GPIOA +//#define BSP_GPIO_PIN_BUTTON_2 GPIO_PIN_5 /* 引脚配置 SPI通信接口 */ +#define BSP_GPIO_RCU_E48_SPI RCU_GPIOB + #define BSP_GPIO_PORT_SPI_NSS GPIOB -#define BSP_GPIO_PIN_SPI_NSS GPIO_PIN_4 +#define BSP_GPIO_PIN_SPI_NSS GPIO_PIN_12 -#define BSP_GPIO_PORT_SPI_MOSI GPIOB -#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_PORT_SPI_SCK GPIOB -#define BSP_GPIO_PIN_SPI_SCK GPIO_PIN_5 +//#define BSP_GPIO_PORT_SPI_MOSI GPIOB +//#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_PORT_SPI_SCK GPIOB +//#define BSP_GPIO_PIN_SPI_SCK GPIO_PIN_5 /* 引脚配置 通信串口 */ #define BSP_GPIO_PORT_UART_TX GPIOA @@ -65,25 +69,29 @@ /* E48 */ +#define BSP_GPIO_RCU_E48_GPIO RCU_GPIOC + #define BSP_GPIO_PORT_E48_GP0 GPIOC -#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_GP0 GPIO_PIN_0 +#define BSP_GPIO_PORT_E48_NIRQ GPIOC +#define BSP_GPIO_PIN_E48_NIRQ GPIO_PIN_1 #define BSP_GPIO_PORT_E48_GP3 GPIOC #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_4 #define BSP_GPIO_PORT_E48_GP5 GPIOC -#define BSP_GPIO_PIN_E48_GP5 GPIO_PIN_2 - - +#define BSP_GPIO_PIN_E48_GP5 GPIO_PIN_5 /* 参数配置 SPI */ #define BSP_RF_SPI SPI1 -#define BSP_RF_SPI_CLOCK CLK_Peripheral_SPI1 +#define BSP_RF_SPI_CLOCK RCU_SPI1 #define Ebyte_BSP_RfSpiSelected() gpio_bit_write( BSP_GPIO_PORT_SPI_NSS , BSP_GPIO_PIN_SPI_NSS, RESET ) #define Ebyte_BSP_RfSpiUnselected() gpio_bit_write( BSP_GPIO_PORT_SPI_NSS , BSP_GPIO_PIN_SPI_NSS, SET ) +/* 配置 Timer */ +#define BSP_RF_TIMER TIMER2 +#define BSP_RF_TIMER_RCU RCU_TIMER2 + /* 参数配置 无线模块控制IO */ ///* E07 */ diff --git a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_button.c b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_button.c index e4472e3..f88371c 100755 --- a/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_button.c +++ b/NSPE/WIFI_IOT/bsp/drivers/2_Ebyte_Board_Support/E15-EVB02/board_button.c @@ -1,19 +1,19 @@ /** ********************************************************************************** * @file board_button.c - * @brief 通用 按键队列驱动库 - * @author JiangHeng - * @date 2021-05-06 - * @version 1.0.0 + * @brief 通用 按键队列驱动库 + * @author JiangHeng + * @date 2021-05-06 + * @version 1.0.0 ********************************************************************************** - * @copyright BSD License - * 成都亿佰特电子科技有限公司 - * ______ ____ __ __ _______ ______ + * @copyright BSD License + * 成都亿佰特电子科技有限公司 + * ______ ____ __ __ _______ ______ * | ____| | _ \ \ \ / / |__ __| | ____| - * | |__ | |_) | \ \_/ / | | | |__ - * | __| | _ < \ / | | | __| - * | |____ | |_) | | | | | | |____ - * |______| |____/ |_| |_| |______| + * | |__ | |_) | \ \_/ / | | | |__ + * | __| | _ < \ / | | | __| + * | |____ | |_) | | | | | | |____ + * |______| |____/ |_| |_| |______| * ********************************************************************************** */ @@ -22,7 +22,7 @@ /* ! * @brief 按键队列初始化 - * + * * @param fifo 指向按键事件队列结构体的指针 */ void Ebyte_BTN_FIFO_Init(BSP_BTN_FIFO_t *fifo) @@ -33,8 +33,8 @@ void Ebyte_BTN_FIFO_Init(BSP_BTN_FIFO_t *fifo) } /* ! - * @brief 按键队列入队 - * + * @brief 按键队列入队 + * * @param fifo 指向按键事件队列结构体的指针 * @param event 按键的事件 主要为各按键的短按/长按 * @return 0:正常 1:队列溢出 @@ -49,12 +49,12 @@ uint8_t Ebyte_BTN_FIFO_Push(BSP_BTN_FIFO_t *fifo, BSP_BTN_EVENT_t event) if(fifo->fifoLen > BSP_BTN_FIFO_LENGTH) { fifo->fifoLen = BSP_BTN_FIFO_LENGTH;//入队长度不再增加 - return 1; + return 1; } - + /* 正常入队 */ fifo->buff[fifo->fifoWrite] = event; - + /* 如果入队位置已经到了队尾 */ if(++fifo->fifoWrite >= BSP_BTN_FIFO_LENGTH) { @@ -67,7 +67,7 @@ uint8_t Ebyte_BTN_FIFO_Push(BSP_BTN_FIFO_t *fifo, BSP_BTN_EVENT_t event) /* ! * @brief 按键队列出队 - * + * * @param fifo 指向按键事件队列结构体的指针 * @param event 按键的事件 主要为各按键的短按/长按 * @return 0:正常 1:队列为空 @@ -79,7 +79,7 @@ uint8_t Ebyte_BTN_FIFO_Pop(BSP_BTN_FIFO_t *fifo, BSP_BTN_EVENT_t *event) { return 1; } - + /* 入队数据长度自减 */ fifo->fifoLen--;