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)
|
if (rt_atomic_load(&now_direction) != 2)
|
||||||
rt_atomic_store(&now_direction, 0);
|
rt_atomic_store(&now_direction, 0);
|
||||||
|
|
||||||
rt_strncpy(str,"forward\n",10);
|
const char *str ="forward\n";
|
||||||
|
// rt_strncpy(str,"forward\n",10);
|
||||||
// *str = ;
|
// *str = ;
|
||||||
rt_device_write(serial, 0, str, rt_strlen(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)
|
if (rt_atomic_load(&now_direction) != 3)
|
||||||
rt_atomic_store(&now_direction, 1);
|
rt_atomic_store(&now_direction, 1);
|
||||||
// *str = "left\n";
|
// *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));
|
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)
|
if (rt_atomic_load(&now_direction) != 0)
|
||||||
rt_atomic_store(&now_direction, 2);
|
rt_atomic_store(&now_direction, 2);
|
||||||
// *str= "back\n";
|
const char *str = "back\n";
|
||||||
rt_strncpy(str,"back\n",10);
|
// rt_strncpy(str,"back\n",10);
|
||||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
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)
|
if (rt_atomic_load(&now_direction) != 1)
|
||||||
rt_atomic_store(&now_direction, 3);
|
rt_atomic_store(&now_direction, 3);
|
||||||
rt_strncpy(str,"right\n",10);
|
// rt_strncpy(str,"right\n",10);
|
||||||
// *str = "right\n";
|
const char *str = "right\n";
|
||||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
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))
|
if (repeat == 0 && (rt_strcmp(tmp, "73") == 0||rt_strcmp(tmp, "FF") == 0))
|
||||||
{
|
{
|
||||||
*str = "OK\n";
|
const char *str = "OK\n";
|
||||||
rt_strncpy(str,"OK\n",10);
|
// rt_strncpy(str,"OK\n",10);
|
||||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||||
if (page_chosen == 4&& page_stop == 0)
|
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_open(serial, RT_DEVICE_FLAG_INT_RX);
|
||||||
// /* 设置接收回调函数 */
|
// /* 设置接收回调函数 */
|
||||||
rt_device_set_rx_indicate(serial, uart_input);
|
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));
|
rt_device_write(serial, 0, str, (sizeof(str) - 1));
|
||||||
/* 创建 serial 线程 */
|
/* 创建 serial 线程 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user