[Mod] 暂存,LED、fscan非中断
This commit is contained in:
@ -589,7 +589,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>Bsp</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
||||
@ -46,6 +46,8 @@ OF SUCH DAMAGE.
|
||||
#include "main.h"
|
||||
#include "wifi_version.h"
|
||||
#include "nspe_region.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#ifdef CONFIG_FATFS_SUPPORT
|
||||
#include "fatfs.h"
|
||||
#endif
|
||||
@ -91,13 +93,12 @@ static int32_t led_init(void)
|
||||
|
||||
void led_task(void *p_arg)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
||||
while (1) {
|
||||
gd_eval_led_toggle(LED1);
|
||||
sys_ms_sleep(200);
|
||||
gd_eval_led_toggle(LED2);
|
||||
sys_ms_sleep(200);
|
||||
gd_eval_led_toggle(LED3);
|
||||
gd_eval_led_toggle(((int32_t)(count % 12) - 6) < 0 ? count % 3 : (2 - count % 3));
|
||||
sys_ms_sleep(200);
|
||||
count++;
|
||||
}
|
||||
|
||||
sys_task_delete(NULL);
|
||||
@ -124,6 +125,11 @@ __WEAK void app_init(void)
|
||||
void start_task(void *p_arg)
|
||||
{
|
||||
(void)p_arg;
|
||||
#if defined (CONFIG_GY3513)
|
||||
size_t len;
|
||||
uint8_t read_buf[2000];
|
||||
const char *filename;
|
||||
#endif // CONFIG_GY3513
|
||||
|
||||
sys_reset_flag_check();
|
||||
sys_os_misc_init();
|
||||
@ -134,12 +140,33 @@ void start_task(void *p_arg)
|
||||
rcu_periph_clock_enable(RCU_CRC);
|
||||
fatfs_mk_mount();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CONSOLE_ENABLE
|
||||
console_init();
|
||||
#else
|
||||
app_init();
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_GY3513)
|
||||
#if 0
|
||||
printf("reading input from file... ");
|
||||
fflush(stdout);
|
||||
|
||||
filename = "Test.txt";
|
||||
LWIP_ASSERT("invalid filename", filename != NULL);
|
||||
f = fopen(filename, "rb");
|
||||
LWIP_ASSERT("open failed", f != NULL);
|
||||
len = fread(pktbuf, 1, sizeof(pktbuf), f);
|
||||
len = fwrite(pktbuf, 1, sizeof(pktbuf), f);
|
||||
fclose(f);
|
||||
printf("testing file: \"%s\"...\r\n", filename);
|
||||
#else
|
||||
fprintf(stdout, "What is your name?\r\n");
|
||||
fscanf(stdin, "%s", read_buf);
|
||||
fprintf(stdout, "\nHello, %s\r\n", read_buf);
|
||||
#endif
|
||||
#endif // CONFIG_GY3513
|
||||
|
||||
sys_task_delete(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ OF SUCH DAMAGE.
|
||||
#include <ctype.h>
|
||||
#include "app_cfg.h"
|
||||
#include "bsp_inc.h"
|
||||
#include "gd32w51x_usart.h"
|
||||
#include "uart.h"
|
||||
#include "malloc.h"
|
||||
#include "wifi_netlink.h"
|
||||
@ -46,6 +47,7 @@ char uart_buf[UART_BUFFER_SIZE];
|
||||
int index = 0;
|
||||
|
||||
#if defined(__ARMCC_VERSION)
|
||||
//#if 1
|
||||
/* retarget the C library printf function to the USART */
|
||||
int fputc(int ch, FILE *f)
|
||||
{
|
||||
@ -54,6 +56,12 @@ int fputc(int ch, FILE *f)
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
int fgetc(FILE *f)
|
||||
{
|
||||
while(RESET == usart_flag_get(LOG_UART, USART_FLAG_RBNE));
|
||||
return usart_data_receive(LOG_UART);
|
||||
}
|
||||
#elif defined(__ICCARM__)
|
||||
int putchar(int ch)
|
||||
{
|
||||
@ -126,7 +134,7 @@ void usart_config(uint32_t usart_periph)
|
||||
usart_baudrate_set(usart_periph, 115200);
|
||||
usart_receive_config(usart_periph, USART_RECEIVE_ENABLE);
|
||||
usart_transmit_config(usart_periph, USART_TRANSMIT_ENABLE);
|
||||
usart_interrupt_enable(usart_periph, USART_INT_RBNE);
|
||||
//usart_interrupt_enable(usart_periph, USART_INT_RBNE);
|
||||
usart_enable(usart_periph);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user