mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
update package info
This commit is contained in:
parent
2943280672
commit
ac5cc47b25
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 lyon the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "pikaPlatform.h"
|
||||
|
||||
/* sprintf support */
|
||||
int __platform_sprintf(char* buff, char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int res = rt_vsprintf(buff, fmt, args);
|
||||
va_end(args);
|
||||
return res;
|
||||
}
|
||||
int __platform_vsprintf(char* buff, char* fmt, va_list args){
|
||||
return rt_vsprintf(buff, fmt, args);
|
||||
}
|
||||
int __platform_vsnprintf(char* buff, size_t size, const char* fmt, va_list args){
|
||||
return rt_vsnprintf(buff, size, fmt, args);
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 lyon the first version
|
||||
*/
|
||||
#ifndef PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_
|
||||
#define PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_
|
||||
#include <rtthread.h>
|
||||
|
||||
|
||||
#endif /* PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ */
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-07 lyon the first version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <pikaScript.h>
|
||||
|
||||
#define SAMPLE_UART_NAME RT_CONSOLE_DEVICE_NAME /* 串口设备名称 */
|
||||
static rt_device_t serial; /* 串口设备句柄 */
|
||||
static struct rt_semaphore rx_sem; /* 用于接收消息的信号量 */
|
||||
|
||||
#define RX_Buff_SIZE 256
|
||||
char rxBuff[RX_Buff_SIZE] = { 0 };
|
||||
Args *rxArgs;
|
||||
uint8_t isRxOk = 0;
|
||||
PikaObj *pikaMain;
|
||||
|
||||
void rx_single_line_handle(char *line) {
|
||||
rt_kprintf("\r\n");
|
||||
obj_run(pikaMain, line);
|
||||
rt_kprintf(">>>");
|
||||
}
|
||||
|
||||
/* 接收数据回调函数 */
|
||||
static rt_err_t uart_input_callback(rt_device_t dev, rt_size_t size) {
|
||||
/* 串口接收到数据后产生中断,调用此回调函数,然后发送接收信号量 */
|
||||
char inputChar;
|
||||
rt_device_read(serial, -1, &inputChar, 1);
|
||||
rt_device_write(serial, 0, &inputChar, 1);
|
||||
if (inputChar == '\b'){
|
||||
rt_device_write(serial, 0, " ", 1);
|
||||
rt_device_write(serial, 0, &inputChar, 1);
|
||||
uint32_t size = strGetSize(rxBuff);
|
||||
rxBuff[size - 1] = 0;
|
||||
return RT_EOK;
|
||||
}
|
||||
if (inputChar != '\r' && inputChar != '\n') {
|
||||
strAppendWithSize(rxBuff, &inputChar, 1);
|
||||
}
|
||||
if (inputChar == '\r') {
|
||||
isRxOk = 1;
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static void clearBuff(char *buff, uint32_t size) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
buff[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void uart_init() {
|
||||
serial = rt_device_find(SAMPLE_UART_NAME);
|
||||
|
||||
/* 以中断接收及轮询发送模式打开串口设备 */
|
||||
rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);
|
||||
|
||||
/* 初始化信号量 */
|
||||
rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
|
||||
|
||||
/* 设置接收回调函数 */
|
||||
rt_device_set_rx_indicate(serial, uart_input_callback);
|
||||
}
|
||||
|
||||
static int rt_pika_main(void)
|
||||
{
|
||||
uart_init();
|
||||
pikaMain = pikaScriptInit();
|
||||
clearBuff(rxBuff, RX_Buff_SIZE);
|
||||
rt_kprintf(">>>");
|
||||
while (1) {
|
||||
if (isRxOk) {
|
||||
isRxOk = 0;
|
||||
rx_single_line_handle(rxBuff);
|
||||
clearBuff(rxBuff, RX_Buff_SIZE);
|
||||
}
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(rt_pika_main);
|
@ -172,7 +172,7 @@ releases = [
|
||||
]
|
||||
|
||||
[[packages]]
|
||||
name = "RTthreadBooter"
|
||||
name = "rtthread"
|
||||
releases = [
|
||||
"v1.0.0 132e970dc8e67245f1a6271f5ca97813050b2812",
|
||||
"v1.0.0 294328067257b0be99ecb116cf0be8390a7226ed",
|
||||
]
|
||||
|
@ -1,3 +1,3 @@
|
||||
pikascript-core==v1.2.7
|
||||
PikaStdLib==v1.2.3
|
||||
RTthreadBooter==v1.0.0
|
||||
rtthread==v1.0.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user