const char *
This commit is contained in:
parent
fb5772da17
commit
f27d46c2bd
@ -34,7 +34,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
if (rt_atomic_load(&now_direction) != 2)
|
||||
rt_atomic_store(&now_direction, 0);
|
||||
|
||||
rt_strncpy(str,"forward\n",10);
|
||||
const char *str ="forward\n";
|
||||
// rt_strncpy(str,"forward\n",10);
|
||||
// *str = ;
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
|
||||
@ -46,7 +47,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
if (rt_atomic_load(&now_direction) != 3)
|
||||
rt_atomic_store(&now_direction, 1);
|
||||
// *str = "left\n";
|
||||
rt_strncpy(str,"left\n",10);
|
||||
const char *str = "left\n";
|
||||
// rt_strncpy(str,"left\n",10);
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
|
||||
@ -55,8 +57,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 0)
|
||||
rt_atomic_store(&now_direction, 2);
|
||||
// *str= "back\n";
|
||||
rt_strncpy(str,"back\n",10);
|
||||
const char *str = "back\n";
|
||||
// rt_strncpy(str,"back\n",10);
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
|
||||
@ -65,8 +67,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 1)
|
||||
rt_atomic_store(&now_direction, 3);
|
||||
rt_strncpy(str,"right\n",10);
|
||||
// *str = "right\n";
|
||||
// rt_strncpy(str,"right\n",10);
|
||||
const char *str = "right\n";
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
|
||||
@ -84,8 +86,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
// 确认(暂停、页面冻结)
|
||||
if (repeat == 0 && (rt_strcmp(tmp, "73") == 0||rt_strcmp(tmp, "FF") == 0))
|
||||
{
|
||||
*str = "OK\n";
|
||||
rt_strncpy(str,"OK\n",10);
|
||||
const char *str = "OK\n";
|
||||
// rt_strncpy(str,"OK\n",10);
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
if (page_chosen == 4&& page_stop == 0)
|
||||
{
|
||||
|
@ -468,7 +468,7 @@ void serial_init(void)
|
||||
rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);
|
||||
// /* 设置接收回调函数 */
|
||||
rt_device_set_rx_indicate(serial, uart_input);
|
||||
char str[] = "hello RTT\r\n";
|
||||
const char *str = "hello RTT\r\n";
|
||||
/* 发送字符串 */
|
||||
rt_device_write(serial, 0, str, (sizeof(str) - 1));
|
||||
/* 创建 serial 线程 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user