├── .clang-format ├── .gitignore ├── LICENSE ├── assets ├── image-20221018233328391.png ├── image-20221018233819623.png └── image-20221109200656.jpg ├── c906_app ├── Makefile ├── audio_recording │ ├── bouffalo.mk │ └── main.c ├── blai_mnist_demo │ ├── bl808_npu_guide.md │ ├── bouffalo.mk │ ├── font1608.c │ └── main.c ├── build.sh ├── camera_bypass_lcd │ ├── bouffalo.mk │ └── main.c ├── camera_dump │ ├── bouffalo.mk │ └── main.c ├── camera_streaming_through_wifi │ ├── bouffalo.mk │ ├── main.c │ └── main.py ├── cli_demo │ ├── bouffalo.mk │ ├── flash_cmd.c │ ├── gpio_cmd.c │ ├── main.c │ └── mdl_cmd.c ├── flash_demo │ ├── bouffalo.mk │ ├── flash_cmd.c │ └── main.c ├── gpio_demo │ ├── bouffalo.mk │ └── main.c ├── hello_world │ ├── bouffalo.mk │ └── main.c ├── i2c_touch │ ├── bouffalo.mk │ ├── cst816x_reg.h │ └── main.c ├── image_processing_demo │ ├── bouffalo.mk │ ├── font1608.c │ └── main.c ├── lfs_demo │ ├── bouffalo.mk │ ├── flash_cmd.c │ └── main.c ├── lvgl_demo │ ├── bouffalo.mk │ └── main.c ├── pikascript_demo │ ├── bouffalo.mk │ ├── main.c │ ├── pika_config.h │ └── pikascript │ │ ├── BL808.pyi │ │ ├── PikaDebug.pyi │ │ ├── PikaObj.pyi │ │ ├── PikaStdData.pyi │ │ ├── PikaStdDevice.pyi │ │ ├── PikaStdLib.pyi │ │ ├── PikaStdTask.pyi │ │ ├── main.py │ │ ├── pikaPackage.exe │ │ ├── pika_lvgl.pyi │ │ ├── pikascript-api │ │ ├── BL808.h │ │ ├── BL808_GPIO.h │ │ ├── BL808_Time.h │ │ ├── PikaDebug.h │ │ ├── PikaDebug_Debuger.h │ │ ├── PikaMain.h │ │ ├── PikaStdData.h │ │ ├── PikaStdData_ByteArray.h │ │ ├── PikaStdData_Dict.h │ │ ├── PikaStdData_FILEIO.h │ │ ├── PikaStdData_List.h │ │ ├── PikaStdData_String.h │ │ ├── PikaStdData_Tuple.h │ │ ├── PikaStdData_Utils.h │ │ ├── PikaStdData_dict_items.h │ │ ├── PikaStdData_dict_keys.h │ │ ├── PikaStdDevice.h │ │ ├── PikaStdDevice_ADC.h │ │ ├── PikaStdDevice_BaseDev.h │ │ ├── PikaStdDevice_CAN.h │ │ ├── PikaStdDevice_GPIO.h │ │ ├── PikaStdDevice_IIC.h │ │ ├── PikaStdDevice_PWM.h │ │ ├── PikaStdDevice_SPI.h │ │ ├── PikaStdDevice_Time.h │ │ ├── PikaStdDevice_UART.h │ │ ├── PikaStdLib.h │ │ ├── PikaStdLib_MemChecker.h │ │ ├── PikaStdLib_RangeObj.h │ │ ├── PikaStdLib_StringObj.h │ │ ├── PikaStdLib_SysObj.h │ │ ├── PikaStdTask.h │ │ ├── PikaStdTask_Task.h │ │ ├── __asset_pikaModules_py_a.c │ │ ├── __pikaBinding.c │ │ ├── main.py.o │ │ ├── pikaModules.py.a │ │ ├── pikaScript.c │ │ ├── pikaScript.h │ │ ├── pika_lvgl.h │ │ ├── pika_lvgl_ALIGN.h │ │ ├── pika_lvgl_ANIM.h │ │ ├── pika_lvgl_EVENT.h │ │ ├── pika_lvgl_FLEX_ALIGN.h │ │ ├── pika_lvgl_FLEX_FLOW.h │ │ ├── pika_lvgl_LAYOUT_FLEX.h │ │ ├── pika_lvgl_OPA.h │ │ ├── pika_lvgl_PALETTE.h │ │ ├── pika_lvgl_SIZE.h │ │ ├── pika_lvgl_STATE.h │ │ ├── pika_lvgl_TEXT_DECOR.h │ │ ├── pika_lvgl_arc.h │ │ ├── pika_lvgl_bar.h │ │ ├── pika_lvgl_btn.h │ │ ├── pika_lvgl_checkbox.h │ │ ├── pika_lvgl_dropdown.h │ │ ├── pika_lvgl_flag_t.h │ │ ├── pika_lvgl_img.h │ │ ├── pika_lvgl_img_dsc_t.h │ │ ├── pika_lvgl_indev_t.h │ │ ├── pika_lvgl_label.h │ │ ├── pika_lvgl_lv_color_t.h │ │ ├── pika_lvgl_lv_event.h │ │ ├── pika_lvgl_lv_obj.h │ │ ├── pika_lvgl_lv_timer_t.h │ │ ├── pika_lvgl_obj.h │ │ ├── pika_lvgl_point_t.h │ │ ├── pika_lvgl_roller.h │ │ ├── pika_lvgl_slider.h │ │ ├── pika_lvgl_style_t.h │ │ ├── pika_lvgl_switch.h │ │ ├── pika_lvgl_table.h │ │ └── pika_lvgl_textarea.h │ │ ├── pikascript-core │ │ ├── BaseObj.c │ │ ├── BaseObj.h │ │ ├── CMakeLists.txt │ │ ├── PikaCompiler.c │ │ ├── PikaCompiler.h │ │ ├── PikaObj.c │ │ ├── PikaObj.h │ │ ├── PikaParser.c │ │ ├── PikaParser.h │ │ ├── PikaPlatform.c │ │ ├── PikaPlatform.h │ │ ├── PikaVM.c │ │ ├── PikaVM.h │ │ ├── PikaVersion.h │ │ ├── README.md │ │ ├── TinyObj.c │ │ ├── TinyObj.h │ │ ├── __instruction_def.h │ │ ├── __instruction_table.cfg │ │ ├── __pika_ooc.h │ │ ├── dataArg.c │ │ ├── dataArg.h │ │ ├── dataArgs.c │ │ ├── dataArgs.h │ │ ├── dataLink.c │ │ ├── dataLink.h │ │ ├── dataLinkNode.c │ │ ├── dataLinkNode.h │ │ ├── dataMemory.c │ │ ├── dataMemory.h │ │ ├── dataQueue.c │ │ ├── dataQueue.h │ │ ├── dataQueueObj.c │ │ ├── dataQueueObj.h │ │ ├── dataStack.c │ │ ├── dataStack.h │ │ ├── dataString.c │ │ ├── dataString.h │ │ ├── dataStrs.c │ │ ├── dataStrs.h │ │ └── pika_config_valid.h │ │ ├── pikascript-lib │ │ ├── BL808 │ │ │ ├── BL808_GPIO.c │ │ │ └── BL808_Time.c │ │ ├── PikaStdDevice │ │ │ ├── PikaStdDevice_ADC.c │ │ │ ├── PikaStdDevice_BaseDev.c │ │ │ ├── PikaStdDevice_CAN.c │ │ │ ├── PikaStdDevice_GPIO.c │ │ │ ├── PikaStdDevice_IIC.c │ │ │ ├── PikaStdDevice_PWM.c │ │ │ ├── PikaStdDevice_SPI.c │ │ │ ├── PikaStdDevice_Time.c │ │ │ └── PikaStdDevice_UART.c │ │ ├── PikaStdLib │ │ │ ├── PikaDebuger_Debuger.c │ │ │ ├── PikaStdData_ByteArray.c │ │ │ ├── PikaStdData_Dict.c │ │ │ ├── PikaStdData_FILEIO.c │ │ │ ├── PikaStdData_List.c │ │ │ ├── PikaStdData_String.c │ │ │ ├── PikaStdData_String_Util.h │ │ │ ├── PikaStdData_Tuple.c │ │ │ ├── PikaStdData_Utils.c │ │ │ ├── PikaStdLib_MemChecker.c │ │ │ ├── PikaStdLib_RangeObj.c │ │ │ ├── PikaStdLib_StringObj.c │ │ │ ├── PikaStdLib_SysObj.c │ │ │ └── PikaStdTask_Task.c │ │ └── pika_lvgl │ │ │ ├── pika_lv_point_t.c │ │ │ ├── pika_lv_timer_t.c │ │ │ ├── pika_lv_wegit.c │ │ │ ├── pika_lvgl.c │ │ │ ├── pika_lvgl_indev_t.c │ │ │ ├── pika_lvgl_lv_event.c │ │ │ ├── pika_lvgl_lv_obj.c │ │ │ └── pika_lvgl_lv_style_t.c │ │ ├── requestment.txt │ │ └── rust-msc-latest-win10.exe ├── proj_config.mk ├── pwm_demo │ ├── bouffalo.mk │ └── main.c ├── spi_lcd │ ├── bouffalo.mk │ └── main.c ├── tinymaix_mnist_demo │ ├── arch_cpu.h │ ├── bouffalo.mk │ ├── font1608.c │ ├── font3216.c │ ├── main.c │ ├── mnist_resnet_f.h │ ├── mnist_valid_q.h │ ├── model_util.h │ ├── tinymaix.h │ ├── tm_layers.c │ ├── tm_model.c │ ├── tm_port.h │ └── tm_stat.c ├── tom_and_jerry_classification_demo │ ├── bouffalo.mk │ ├── font1608.c │ ├── main.c │ └── readme.md └── uvc_demo │ ├── bouffalo.mk │ └── main.c ├── e907_app ├── Makefile ├── build.sh ├── firmware │ ├── bouffalo.mk │ ├── genromap │ └── main.c └── proj_config.mk ├── partition └── partition_cfg_16M_m1sdock.toml └── readme.md /.clang-format: -------------------------------------------------------------------------------- 1 | # Language: None, Cpp, Java, JavaScript, ObjC, Proto, TableGen, TextProto 2 | Language: Cpp 3 | BasedOnStyle: Google 4 | 5 | IndentWidth: 4 6 | 7 | ColumnLimit: 120 8 | 9 | BreakBeforeBraces: Custom 10 | 11 | BraceWrapping: 12 | AfterFunction: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | **/build_out/** 3 | M1s_BL808_SDK -------------------------------------------------------------------------------- /assets/image-20221018233328391.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/assets/image-20221018233328391.png -------------------------------------------------------------------------------- /assets/image-20221018233819623.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/assets/image-20221018233819623.png -------------------------------------------------------------------------------- /assets/image-20221109200656.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/assets/image-20221109200656.jpg -------------------------------------------------------------------------------- /c906_app/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME ?= c906_demo 7 | PROJECT_PATH = $(abspath .) 8 | PROJECT_BOARD := evb 9 | export PROJECT_PATH PROJECT_BOARD 10 | 11 | -include ./proj_config.mk 12 | 13 | ifeq ($(origin BL_SDK_PATH), undefined) 14 | $(error BL_SDK_PATH not found, please enter: export BL_SDK_PATH={sdk_path}) 15 | endif 16 | 17 | INCLUDE_COMPONENTS += bl808_c906_freertos bl808 bl808_std newlibc hosal freetype yloop cli utils 18 | INCLUDE_COMPONENTS += blai_nn blai_npu_encoder 19 | INCLUDE_COMPONENTS += bl_mm venc_device venc_framework 20 | INCLUDE_COMPONENTS += freertos_posix 21 | INCLUDE_COMPONENTS += blog 22 | INCLUDE_COMPONENTS += vfs lvgl lwip 23 | INCLUDE_COMPONENTS += blfdt romfs fatfs sdh_helper 24 | INCLUDE_COMPONENTS += bl808_ring bl808_xram bl_os_adapter 25 | INCLUDE_COMPONENTS += dsp2 bl_mm venc_device venc_framework dsp2_cli_demo mjpeg_sender_bl808 sensor rtsp_server 26 | 27 | COMPONENTS_SIPEEED := 28 | COMPONENTS_SIPEEED += m1s_start 29 | COMPONENTS_SIPEEED += m1s_model_runner 30 | COMPONENTS_SIPEEED += m1s_tools 31 | COMPONENTS_SIPEEED += lfs m1s_lfs_c906 32 | COMPONENTS_SIPEEED += m1s_common_xram m1s_c906_xram 33 | INCLUDE_COMPONENTS += $(COMPONENTS_SIPEEED) 34 | INCLUDE_COMPONENTS += $(PROJECT_NAME) 35 | 36 | CFLAGS += -DROMFS_STATIC_ROOTADDR=0x582f0000 37 | 38 | include $(BL_SDK_PATH)/make_scripts_riscv/project_common.mk 39 | -------------------------------------------------------------------------------- /c906_app/audio_recording/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/audio_recording/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* FreeRTOS */ 6 | #include 7 | #include 8 | 9 | #include "m1s_c906_xram_audio.h" 10 | 11 | #define AUDIO_BUFF_SIZE (4096) 12 | 13 | void main() 14 | { 15 | printf("Audio init..\r\n"); 16 | uint16_t *buff = pvPortMalloc(AUDIO_BUFF_SIZE * 2); 17 | assert(buff); 18 | m1s_xram_audio_init(buff, AUDIO_BUFF_SIZE * 2); 19 | 20 | uint16_t *rec_buff; 21 | uint32_t rec_buff_size; 22 | while (1) { 23 | if (0 == m1s_xram_audio_get(&rec_buff, &rec_buff_size) && rec_buff_size > 0) { 24 | for (int i = 0; i < rec_buff_size >> 1; i++) { 25 | if (i % 256 == 0) printf("\r\n"); 26 | printf("%d, ", rec_buff[i]); 27 | } 28 | m1s_xram_audio_pop(); 29 | } 30 | vTaskDelay(1); 31 | } 32 | m1s_xram_audio_deinit(); 33 | } -------------------------------------------------------------------------------- /c906_app/blai_mnist_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) -------------------------------------------------------------------------------- /c906_app/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PROJECT_NAME=$1 3 | 4 | make CONFIG_CHIP_NAME=BL808 CPU_ID=D0 -j16 PROJECT_NAME=$PROJECT_NAME 5 | cp build_out/$PROJECT_NAME.bin build_out/d0fw.bin 6 | exit $? 7 | -------------------------------------------------------------------------------- /c906_app/camera_bypass_lcd/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/camera_bypass_lcd/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* lcd */ 9 | #include 10 | 11 | /* bl808 c906 std driver */ 12 | #include 13 | #include 14 | 15 | /* bl808 c906 hosal driver */ 16 | #include 17 | 18 | /* sipeed utils */ 19 | #include 20 | 21 | #include "m1s_c906_xram_pwm.h" 22 | 23 | #define PWM_PORT (0) 24 | #define PWM_PIN (11) 25 | 26 | void backlight_init(void) 27 | { 28 | m1s_xram_pwm_init(PWM_PORT, PWM_PIN, 2000, 25); 29 | m1s_xram_pwm_start(PWM_PORT, PWM_PIN); 30 | } 31 | 32 | static uint16_t draw_buf[280 * 240]; 33 | 34 | void main() 35 | { 36 | backlight_init(); 37 | st7789v_spi_init(); 38 | st7789v_spi_set_dir(1, 0); 39 | if (0 != bl_cam_mipi_rgb565_init()) { 40 | printf("bl cam init failed!\r\n"); 41 | return; 42 | } 43 | 44 | uint16_t *picture = NULL; 45 | uint32_t length = 0, loop_cnt = 0; 46 | while (1) { 47 | // 1. snap camera frame 48 | uint64_t curr_cnt = CPU_Get_MTimer_US(); 49 | while (0 != bl_cam_mipi_rgb565_frame_get((uint8_t **)&picture, &length)) { 50 | vTaskDelay(1); 51 | } 52 | printf("[%8u]get mipi rgb565 frame 0x%08x size %ubytes cost %fms ", loop_cnt, (uint32_t)picture, length, (float)(CPU_Get_MTimer_US() - curr_cnt) / 1000); 53 | 54 | // 2. draw camera frame to lcd 55 | BilinearInterpolation_RGB565(picture, 400, 300, draw_buf, 280, 240); 56 | curr_cnt = CPU_Get_MTimer_US(); 57 | for (int i = 0; i < 280 * 240; i++) { 58 | draw_buf[i] = __builtin_bswap16(draw_buf[i]); 59 | } 60 | st7789v_spi_draw_picture_nonblocking(0, 0, 279, 239, draw_buf); 61 | printf("and lcd_flush cost %fms\r\n", (float)(CPU_Get_MTimer_US() - curr_cnt) / 1000); 62 | 63 | // 3. camera frame pop 64 | bl_cam_mipi_rgb565_frame_pop(); 65 | vTaskDelay(1); 66 | loop_cnt++; 67 | } 68 | bl_cam_mipi_rgb565_deinit(); 69 | } -------------------------------------------------------------------------------- /c906_app/camera_dump/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/camera_dump/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* bl808 c906 std driver */ 9 | #include 10 | 11 | /* bl808 c906 hosal driver */ 12 | #include 13 | 14 | void main() 15 | { 16 | while (0 != bl_cam_mipi_rgb565_init()) { 17 | printf("bl cam init fail!\r\n"); 18 | vTaskDelay(pdMS_TO_TICKS(5)); 19 | } 20 | 21 | uint8_t *picture = NULL; 22 | uint32_t length = 0; 23 | for (int i = 0; i < 6; i++) { 24 | uint64_t curr_cnt = CPU_Get_MTimer_US(); 25 | while (0 != bl_cam_mipi_rgb565_frame_get(&picture, &length)) { 26 | } 27 | printf("get mipi rgb565 frame %p size %ubytes cost %fms\r\n", picture, length, 28 | (double)(CPU_Get_MTimer_US() - curr_cnt) / 1000); 29 | printf("dump binary memory picture%02d.bin 0x%08x 0x%08x length:%d\r\n", i, (uint32_t)picture, 30 | (uint32_t)picture + length, length); 31 | bl_cam_mipi_rgb565_frame_pop(); 32 | vTaskDelay(5); 33 | } 34 | bl_cam_mipi_rgb565_deinit(); 35 | } -------------------------------------------------------------------------------- /c906_app/camera_streaming_through_wifi/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/camera_streaming_through_wifi/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* bl808 c906 std driver */ 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | void main() 15 | { 16 | vTaskDelay(1); 17 | bl_cam_mipi_mjpeg_init(); 18 | 19 | m1s_xram_wifi_init(); 20 | m1s_xram_wifi_connect("liuxo_desktop", "12345678"); 21 | m1s_xram_wifi_upload_stream("10.42.0.1", 8888); 22 | } -------------------------------------------------------------------------------- /c906_app/camera_streaming_through_wifi/main.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import numpy as np 3 | import cv2 as cv 4 | 5 | 6 | if __name__ == '__main__': 7 | # 创建tcp服务端套接字 8 | # 参数同客户端配置一致,这里不再重复 9 | tcp_server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 10 | 11 | # 设置端口号复用,让程序退出端口号立即释放,否则的话在30秒-2分钟之内这个端口是不会被释放的,这是TCP的为了保证传输可靠性的机制。 12 | tcp_server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) 13 | 14 | # 给客户端绑定端口号,客户端需要知道服务器的端口号才能进行建立连接。IP地址不用设置,默认就为本机的IP地址。 15 | tcp_server.bind(("", 8888)) 16 | 17 | # 设置监听 18 | # 128:最大等待建立连接的个数, 提示: 目前是单任务的服务端,同一时刻只能服务与一个客户端,后续使用多任务能够让服务端同时服务与多个客户端 19 | # 不需要让客户端进行等待建立连接 20 | # listen后的这个套接字只负责接收客户端连接请求,不能收发消息,收发消息使用返回的这个新套接字tcp_client来完成 21 | tcp_server.listen(128) 22 | 23 | # 等待客户端建立连接的请求, 只有客户端和服务端建立连接成功代码才会解阻塞,代码才能继续往下执行 24 | # 1. 专门和客户端通信的套接字: tcp_client 25 | # 2. 客户端的ip地址和端口号: tcp_client_address 26 | tcp_client, tcp_client_address = tcp_server.accept() 27 | 28 | # 代码执行到此说明连接建立成功 29 | print("客户端的ip地址和端口号:", tcp_client_address) 30 | 31 | while True: 32 | # 接收客户端发送的数据, 这次接收数据的最大字节数是4 33 | recv_data = tcp_client.recv(4) 34 | mjpeg_len = int.from_bytes(recv_data, 'little') 35 | print("recv len: ", mjpeg_len) 36 | tcp_client.send(recv_data) 37 | recv_data_mjpeg = b'' 38 | remained_bytes = mjpeg_len 39 | while remained_bytes > 0: 40 | recv_data_mjpeg += tcp_client.recv(remained_bytes) 41 | remained_bytes = mjpeg_len - len(recv_data_mjpeg) 42 | print("recv stream success") 43 | if recv_data_mjpeg[:2] != b'\xff\xd8' \ 44 | or recv_data_mjpeg[-2:] != b'\xff\xd9': 45 | continue 46 | mjpeg_data = np.frombuffer(recv_data_mjpeg, 'uint8') 47 | img = cv.imdecode(mjpeg_data, cv.IMREAD_COLOR) 48 | cv.imshow('stream', img) 49 | if cv.waitKey(1) == 'q': 50 | exit(0) 51 | 52 | # 关闭服务与客户端的套接字, 终止和客户端通信的服务 53 | tcp_client.close() 54 | 55 | # 关闭服务端的套接字, 终止和客户端提供建立连接请求的服务 但是正常来说服务器的套接字是不需要关闭的,因为服务器需要一直运行。 56 | # tcp_server.close() 57 | -------------------------------------------------------------------------------- /c906_app/cli_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/cli_demo/flash_cmd.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | /* aos */ 6 | #include 7 | 8 | /* utils */ 9 | #include 10 | #include 11 | 12 | /* bl808 c906 std driver */ 13 | #include 14 | 15 | #include "m1s_c906_xram_flash.h" 16 | 17 | void cmd_c906_flash(char *buf, int len, int argc, char **argv) 18 | { 19 | uint32_t o = 0, a = 0, l = 0; 20 | uint8_t op = 0; 21 | int ret = -1; 22 | 23 | int opt; 24 | getopt_env_t getopt_env; 25 | utils_getopt_init(&getopt_env, 0); 26 | // put ':' in the starting of the string so that program can distinguish 27 | // between '?' and ':' 28 | while ((opt = utils_getopt(&getopt_env, argc, argv, ":rweo:a:l:")) != -1) { 29 | switch (opt) { 30 | case 'r': 31 | case 'w': 32 | case 'e': 33 | op = opt; 34 | break; 35 | // printf("option: %c\r\n", opt); 36 | break; 37 | case 'o': 38 | case 'a': 39 | case 'l': 40 | // printf("optarg: %s\r\n", getopt_env.optarg); 41 | if ('o' == opt) { 42 | o = strtol(getopt_env.optarg, NULL, 0); 43 | } else if ('a' == opt) { 44 | a = strtol(getopt_env.optarg, NULL, 0); 45 | } else if ('l' == opt) { 46 | l = strtol(getopt_env.optarg, NULL, 0); 47 | } 48 | break; 49 | case ':': 50 | // printf("%s: %c requires an argument\r\n", *argv, getopt_env.optopt); 51 | break; 52 | case '?': 53 | // printf("unknow option: %c\r\n", getopt_env.optopt); 54 | break; 55 | } 56 | } 57 | // optind is for the extra arguments which are not parsed 58 | for (; getopt_env.optind < argc; getopt_env.optind++) { 59 | printf("extra arguments: %s\r\n", argv[getopt_env.optind]); 60 | } 61 | 62 | switch (op) { 63 | case 'r': 64 | ret = m1s_xram_flash_read(o, a, l); 65 | break; 66 | case 'w': 67 | ret = m1s_xram_flash_write(o, a, l); 68 | break; 69 | case 'e': 70 | ret = m1s_xram_flash_erase(o, l); 71 | break; 72 | default: 73 | printf("no changed, select \r\n"); 74 | break; 75 | } 76 | if (0 != ret) { 77 | printf("flash operation error\r\n"); 78 | } 79 | } -------------------------------------------------------------------------------- /c906_app/cli_demo/gpio_cmd.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | /* aos */ 6 | #include 7 | 8 | /* utils */ 9 | #include 10 | #include 11 | 12 | /* bl808 c906 std driver */ 13 | #include 14 | 15 | void cmd_c906_gpio(char *buf, int len, int argc, char **argv) { 16 | int gpio_pin = -1; 17 | int gpio_state = -1; 18 | 19 | int opt; 20 | getopt_env_t getopt_env; 21 | utils_getopt_init(&getopt_env, 0); 22 | // put ':' in the starting of the string so that program can distinguish 23 | // between '?' and ':' 24 | while ((opt = utils_getopt(&getopt_env, argc, argv, ":p:s:")) != -1) { 25 | switch (opt) { 26 | case 'i': 27 | // printf("option: %c\r\n", opt); 28 | break; 29 | case 'p': 30 | case 's': 31 | // printf("optarg: %s\r\n", getopt_env.optarg); 32 | if ('p' == opt) { 33 | gpio_pin = atoi(getopt_env.optarg); 34 | } else if ('s' == opt) { 35 | gpio_state = atoi(getopt_env.optarg); 36 | } 37 | break; 38 | case ':': 39 | // printf("%s: %c requires an argument\r\n", *argv, getopt_env.optopt); 40 | break; 41 | case '?': 42 | // printf("unknow option: %c\r\n", getopt_env.optopt); 43 | break; 44 | } 45 | } 46 | // optind is for the extra arguments which are not parsed 47 | for (; getopt_env.optind < argc; getopt_env.optind++) { 48 | printf("extra arguments: %s\r\n", argv[getopt_env.optind]); 49 | } 50 | 51 | if (gpio_pin == -1) return; 52 | GLB_GPIO_Cfg_Type cfg; 53 | cfg.drive = 0; 54 | cfg.smtCtrl = 1; 55 | cfg.gpioFun = GPIO_FUN_GPIO; 56 | cfg.outputMode = 0; 57 | cfg.pullType = GPIO_PULL_NONE; 58 | cfg.gpioPin = gpio_pin; 59 | 60 | cfg.gpioMode = gpio_state == -1 ? GPIO_MODE_INPUT : GPIO_MODE_OUTPUT; 61 | GLB_GPIO_Init(&cfg); 62 | if (gpio_state == -1) { 63 | printf("gpio_%d=%d\r\n", gpio_pin, GLB_GPIO_Read(gpio_pin)); 64 | } else { 65 | GLB_GPIO_Write(gpio_pin, !!gpio_state); 66 | } 67 | } -------------------------------------------------------------------------------- /c906_app/cli_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* FreeRTOS */ 4 | #include 5 | #include 6 | 7 | /* aos */ 8 | #include 9 | 10 | /* fs */ 11 | #include 12 | 13 | /* RISCV */ 14 | #include 15 | 16 | extern void cmd_c906_gpio(char *buf, int len, int argc, char **argv); 17 | extern void cmd_c906_mdl(char *buf, int len, int argc, char **argv); 18 | extern void cmd_c906_flash(char *buf, int len, int argc, char **argv); 19 | const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { 20 | {"gpio", "c906 gpio command", cmd_c906_gpio}, 21 | {"mdl", "c906 npu model command", cmd_c906_mdl}, 22 | {"flash", "c906 flash command", cmd_c906_flash}, 23 | }; 24 | 25 | void main() 26 | { 27 | romfs_register(); 28 | } -------------------------------------------------------------------------------- /c906_app/flash_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/flash_demo/flash_cmd.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | /* aos */ 6 | #include 7 | 8 | /* utils */ 9 | #include 10 | #include 11 | 12 | /* bl808 c906 std driver */ 13 | #include 14 | 15 | #include "m1s_c906_xram_flash.h" 16 | 17 | void cmd_c906_flash(char *buf, int len, int argc, char **argv) 18 | { 19 | uint32_t o = 0, a = 0, l = 0; 20 | uint8_t op = 0; 21 | int ret = -1; 22 | 23 | int opt; 24 | getopt_env_t getopt_env; 25 | utils_getopt_init(&getopt_env, 0); 26 | // put ':' in the starting of the string so that program can distinguish 27 | // between '?' and ':' 28 | while ((opt = utils_getopt(&getopt_env, argc, argv, ":rweo:a:l:")) != -1) { 29 | switch (opt) { 30 | case 'r': 31 | case 'w': 32 | case 'e': 33 | op = opt; 34 | break; 35 | // printf("option: %c\r\n", opt); 36 | break; 37 | case 'o': 38 | case 'a': 39 | case 'l': 40 | // printf("optarg: %s\r\n", getopt_env.optarg); 41 | if ('o' == opt) { 42 | o = strtol(getopt_env.optarg, NULL, 0); 43 | } else if ('a' == opt) { 44 | a = strtol(getopt_env.optarg, NULL, 0); 45 | } else if ('l' == opt) { 46 | l = strtol(getopt_env.optarg, NULL, 0); 47 | } 48 | break; 49 | case ':': 50 | // printf("%s: %c requires an argument\r\n", *argv, getopt_env.optopt); 51 | break; 52 | case '?': 53 | // printf("unknow option: %c\r\n", getopt_env.optopt); 54 | break; 55 | } 56 | } 57 | // optind is for the extra arguments which are not parsed 58 | for (; getopt_env.optind < argc; getopt_env.optind++) { 59 | printf("extra arguments: %s\r\n", argv[getopt_env.optind]); 60 | } 61 | 62 | switch (op) { 63 | case 'r': 64 | ret = m1s_xram_flash_read(o, a, l); 65 | break; 66 | case 'w': 67 | ret = m1s_xram_flash_write(o, a, l); 68 | break; 69 | case 'e': 70 | ret = m1s_xram_flash_erase(o, l); 71 | break; 72 | default: 73 | printf("no changed, select \r\n"); 74 | break; 75 | } 76 | if (0 != ret) { 77 | printf("flash operation error\r\n"); 78 | } 79 | } -------------------------------------------------------------------------------- /c906_app/flash_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* aos */ 9 | #include 10 | 11 | #include "m1s_c906_xram_flash.h" 12 | // partion media 13 | #define MEDIA_OFFSET_IN_FLASH (0x300000) 14 | #define MEDIA_OFFSET_IN_XIP (0x582f0000) 15 | 16 | extern void cmd_c906_flash(char *buf, int len, int argc, char **argv); 17 | const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { 18 | {"flash", "c906 flash command", cmd_c906_flash}, 19 | }; 20 | 21 | static inline void log_hex(uint32_t *a, uint32_t l) 22 | { 23 | l /= 4; 24 | for (uint32_t i = 0; i < l; i++) { 25 | if ((i & 0x3) == 0) printf("%08x:", (uint32_t)&a[i]); 26 | printf(" %08x", a[i]); 27 | if ((i & 0x3) == 0x3) printf("\r\n"); 28 | } 29 | if (l & 0x3) printf("\r\n"); 30 | } 31 | 32 | #define LOGDATA() \ 33 | do { \ 34 | printf("ram:\r\n"); \ 35 | log_hex(addr, length); \ 36 | printf("\r\n"); \ 37 | } while (0) 38 | 39 | #define MODRAM() \ 40 | do { \ 41 | for (uint32_t i = 0; i < length / 4; i++) addr[i] = rand(); \ 42 | } while (0) 43 | 44 | #define CLRRAM() \ 45 | do { \ 46 | for (uint32_t i = 0; i < length / 4; i++) addr[i] = 0; \ 47 | } while (0) 48 | 49 | void main() 50 | { 51 | vTaskDelay(500); 52 | srand(CPU_Get_MTimer_Counter()); 53 | uint32_t offset = MEDIA_OFFSET_IN_FLASH; 54 | uint32_t addr[32]; 55 | uint32_t length = sizeof(addr); 56 | printf("xip:\r\n"); 57 | log_hex(MEDIA_OFFSET_IN_XIP, length); 58 | 59 | printf("[flash] read\r\n"); 60 | CLRRAM(); 61 | m1s_xram_flash_read(offset, addr, length); 62 | LOGDATA(); 63 | 64 | printf("[flash] erase\r\n"); 65 | m1s_xram_flash_erase(offset, length); 66 | 67 | printf("[flash] read\r\n"); 68 | CLRRAM(); 69 | m1s_xram_flash_read(offset, addr, length); 70 | LOGDATA(); 71 | 72 | printf("[ram] modified\r\n"); 73 | MODRAM(); 74 | LOGDATA(); 75 | 76 | printf("[flash] write\r\n"); 77 | m1s_xram_flash_write(offset, addr, length); 78 | 79 | printf("[flash] read\r\n"); 80 | CLRRAM(); 81 | m1s_xram_flash_read(offset, addr, length); 82 | LOGDATA(); 83 | } -------------------------------------------------------------------------------- /c906_app/gpio_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/gpio_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* bl808 c906 std driver */ 9 | #include 10 | 11 | #define PIN_LED (8) 12 | #define PIN_BTN1 (22) 13 | #define PIN_BTN2 (23) 14 | 15 | void main() 16 | { 17 | GLB_GPIO_Cfg_Type cfg; 18 | cfg.drive = 0; 19 | cfg.smtCtrl = 1; 20 | cfg.gpioFun = GPIO_FUN_GPIO; 21 | cfg.outputMode = 0; 22 | cfg.pullType = GPIO_PULL_NONE; 23 | 24 | cfg.gpioPin = PIN_LED; 25 | cfg.gpioMode = GPIO_MODE_OUTPUT; 26 | GLB_GPIO_Init(&cfg); 27 | 28 | cfg.gpioPin = PIN_BTN1; 29 | cfg.gpioMode = GPIO_MODE_INPUT; 30 | GLB_GPIO_Init(&cfg); 31 | 32 | cfg.gpioPin = PIN_BTN2; 33 | cfg.gpioMode = GPIO_MODE_INPUT; 34 | GLB_GPIO_Init(&cfg); 35 | 36 | for (bool gpio_state = false;;) { 37 | GLB_GPIO_Write(PIN_LED, !gpio_state); 38 | bool btn1_pressed = !GLB_GPIO_Read(PIN_BTN1); 39 | bool btn2_pressed = !GLB_GPIO_Read(PIN_BTN2); 40 | if (btn1_pressed && btn2_pressed) { 41 | printf("btn1 and btn2 are pressed, led blink during 500ms\r\n"); 42 | gpio_state ^= true; 43 | vTaskDelay(pdMS_TO_TICKS(490)); 44 | } else if (btn1_pressed) { 45 | printf("btn1 is pressed, led always turn on\r\n"); 46 | gpio_state = true; 47 | } else if (btn2_pressed) { 48 | printf("btn2 is pressed, led always turn off\r\n"); 49 | gpio_state = false; 50 | } else { 51 | gpio_state = gpio_state; 52 | } 53 | vTaskDelay(pdMS_TO_TICKS(10)); 54 | } 55 | } -------------------------------------------------------------------------------- /c906_app/hello_world/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/hello_world/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* FreeRTOS */ 4 | #include 5 | #include 6 | 7 | void main() 8 | { 9 | while (1) { 10 | printf("hello, world!\r\n"); 11 | vTaskDelay(1000); 12 | } 13 | } -------------------------------------------------------------------------------- /c906_app/i2c_touch/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/i2c_touch/cst816x_reg.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* clang-format off */ 4 | #define CST816X_DEV_ADDR 0x15 5 | 6 | #define CST816X_REG_GESTUREID 0x01 7 | #define CST816X_REG_FINGERNUM 0x02 8 | // xxxx.... STATUS 9 | // ....xxxx XposH 10 | #define CST816X_REG_XPOSH 0x03 11 | #define CST816X_REG_XPOSL 0x04 12 | // ....xxxx YposH 13 | #define CST816X_REG_YPOSH 0x05 14 | #define CST816X_REG_YPOSL 0x06 15 | 16 | #define CST816X_REG_CHIPID 0xA7 17 | #define CST816X_REG_PROJID 0xA8 18 | #define CST816X_REG_FWVERSION 0xA9 19 | #define CST816X_REG_FACTORYID 0xAA 20 | 21 | // 0x03 -> sleep and disable wake up 22 | #define CST816X_REG_SLEEPMODE 0xE5 23 | // ......x. EnFatRst 24 | // .......x En2FRst 25 | #define CST816X_REG_ERRRESETCTL 0xEA 26 | #define CST816X_REG_LONGPRESSTICK 0xEB 27 | 28 | /* 0x01 CST816X_REG_GESTUREID */ 29 | #define CST816X_REG_GESTUREID_NONE 0x00 30 | #define CST816X_REG_GESTUREID_SWIPE_UP 0x01 31 | #define CST816X_REG_GESTUREID_SWIPE_DOWN 0x02 32 | #define CST816X_REG_GESTUREID_SWIPE_LEFT 0x03 33 | #define CST816X_REG_GESTUREID_SWIPE_RIGHT 0x04 34 | #define CST816X_REG_GESTUREID_CLICK 0x05 35 | #define CST816X_REG_GESTUREID_DOUBLE_CLICK 0x0b 36 | #define CST816X_REG_GESTUREID_LONG_PRESS 0x0c 37 | 38 | /* 0x02 CST816X_REG_FINGERNUM */ 39 | #define CST816X_REG_FINGERNUM_NONE 0x00 40 | #define CST816X_REG_FINGERNUM_ONE 0x01 41 | 42 | /* 0x03 CST816X_REG_XPOSH xxxx.... STATUS */ 43 | #define CST816X_REG_STATUS_FIRST_PRESS 0x0 44 | #define CST816X_REG_STATUS_LONG_PRESS 0x8 45 | #define CST816X_REG_STATUS_LIFTUP 0x4 46 | /* clang-format on */ 47 | -------------------------------------------------------------------------------- /c906_app/i2c_touch/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* FreeRTOS */ 6 | #include 7 | #include 8 | 9 | /* bl808 c906 std driver */ 10 | #include 11 | #include 12 | 13 | static void cst816x_gpio_init(uint8_t i2c_scl_pin, uint8_t i2c_sda_pin, uint8_t cts_rst_pin, uint8_t cts_int_pin) 14 | { 15 | GLB_GPIO_Cfg_Type cfg; 16 | cfg.pullType = GPIO_PULL_UP; 17 | cfg.drive = 0; 18 | cfg.smtCtrl = 1; 19 | 20 | cfg.gpioMode = GPIO_MODE_AF; 21 | cfg.gpioFun = GPIO_FUN_I2C2; 22 | cfg.gpioPin = i2c_scl_pin; 23 | GLB_GPIO_Init(&cfg); 24 | cfg.gpioPin = i2c_sda_pin; 25 | GLB_GPIO_Init(&cfg); 26 | 27 | cfg.outputMode = GPIO_OUTPUT_VALUE_MODE; 28 | cfg.gpioMode = GPIO_MODE_OUTPUT; 29 | cfg.gpioFun = GPIO_FUN_GPIO; 30 | cfg.gpioPin = cts_rst_pin; 31 | GLB_GPIO_Init(&cfg); 32 | 33 | cfg.gpioMode = GPIO_MODE_INPUT; 34 | cfg.gpioFun = GPIO_FUN_GPIO; 35 | cfg.gpioPin = cts_int_pin; 36 | GLB_GPIO_Init(&cfg); 37 | } 38 | 39 | #include "cst816x_reg.h" 40 | 41 | #define PIN_CTP_RST (24) 42 | #define PIN_CTP_INT (32) 43 | 44 | #define PIN_CTP_SCK (6) 45 | #define PIN_CTP_SDA (7) 46 | 47 | void main() 48 | { 49 | cst816x_gpio_init(PIN_CTP_SCK, PIN_CTP_SDA, PIN_CTP_RST, PIN_CTP_INT); 50 | uint8_t buf[6]; 51 | I2C_Transfer_Cfg cfg; 52 | cfg.slaveAddr10Bit = false; 53 | cfg.stopEveryByte = false; 54 | cfg.slaveAddr = CST816X_DEV_ADDR; 55 | cfg.clk = 40000; 56 | 57 | cfg.subAddr = CST816X_REG_CHIPID; 58 | cfg.subAddrSize = 1; 59 | cfg.dataSize = 4; 60 | cfg.data = buf; 61 | /* hardware reset cst816x */ 62 | GLB_GPIO_Write(PIN_CTP_RST, 0); 63 | vTaskDelay(pdMS_TO_TICKS(10)); 64 | GLB_GPIO_Write(PIN_CTP_RST, 1); 65 | vTaskDelay(pdMS_TO_TICKS(100)); 66 | if (SUCCESS == I2C_MasterReceiveBlocking(I2C0_MM_ID, &cfg)) { 67 | uint8_t chip_id = buf[0]; 68 | uint8_t proj_id = buf[1]; 69 | uint8_t fw_ver = buf[2]; 70 | uint8_t factory_id = buf[3]; 71 | printf( 72 | "[cst816x]\r\n" 73 | "\tchip_id: %d\r\n" 74 | "\tproj_id: %d\r\n" 75 | "\tfw_ver: %d\r\n" 76 | "\tfactory_id: %d\r\n" 77 | "\r\n", 78 | chip_id, proj_id, fw_ver, factory_id); 79 | } else { 80 | printf("timeout?\r\n"); 81 | } 82 | 83 | cfg.subAddr = CST816X_REG_GESTUREID; 84 | cfg.subAddrSize = 1; 85 | cfg.dataSize = 6; 86 | cfg.data = buf; 87 | for (bool ctp_active_flag = false;;) { 88 | if (!GLB_GPIO_Read(PIN_CTP_INT)) { 89 | ctp_active_flag = true; 90 | } 91 | if (ctp_active_flag && SUCCESS == I2C_MasterReceiveBlocking(I2C0_MM_ID, &cfg)) { 92 | uint8_t status = buf[2] >> 4; 93 | uint16_t pos_x = buf[2] & 0x0F; 94 | pos_x = (pos_x << 8) | buf[3]; 95 | uint16_t pos_y = buf[4] & 0x0F; 96 | pos_y = (pos_y << 8) | buf[5]; 97 | printf("pos: (%-3u, %-3u)[%u]\r\n", pos_x, pos_y, status); 98 | } else { 99 | ctp_active_flag = false; 100 | } 101 | vTaskDelay(pdMS_TO_TICKS(8)); 102 | } 103 | } -------------------------------------------------------------------------------- /c906_app/image_processing_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/lfs_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/lfs_demo/flash_cmd.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | /* aos */ 6 | #include 7 | 8 | /* utils */ 9 | #include 10 | #include 11 | 12 | /* bl808 c906 std driver */ 13 | #include 14 | 15 | #include "m1s_c906_xram_flash.h" 16 | 17 | void cmd_c906_flash(char *buf, int len, int argc, char **argv) 18 | { 19 | uint32_t o = 0, a = 0, l = 0; 20 | uint8_t op = 0; 21 | int ret = -1; 22 | 23 | int opt; 24 | getopt_env_t getopt_env; 25 | utils_getopt_init(&getopt_env, 0); 26 | // put ':' in the starting of the string so that program can distinguish 27 | // between '?' and ':' 28 | while ((opt = utils_getopt(&getopt_env, argc, argv, ":rweo:a:l:")) != -1) { 29 | switch (opt) { 30 | case 'r': 31 | case 'w': 32 | case 'e': 33 | op = opt; 34 | break; 35 | // printf("option: %c\r\n", opt); 36 | break; 37 | case 'o': 38 | case 'a': 39 | case 'l': 40 | // printf("optarg: %s\r\n", getopt_env.optarg); 41 | if ('o' == opt) { 42 | o = strtol(getopt_env.optarg, NULL, 0); 43 | } else if ('a' == opt) { 44 | a = strtol(getopt_env.optarg, NULL, 0); 45 | } else if ('l' == opt) { 46 | l = strtol(getopt_env.optarg, NULL, 0); 47 | } 48 | break; 49 | case ':': 50 | // printf("%s: %c requires an argument\r\n", *argv, getopt_env.optopt); 51 | break; 52 | case '?': 53 | // printf("unknow option: %c\r\n", getopt_env.optopt); 54 | break; 55 | } 56 | } 57 | // optind is for the extra arguments which are not parsed 58 | for (; getopt_env.optind < argc; getopt_env.optind++) { 59 | printf("extra arguments: %s\r\n", argv[getopt_env.optind]); 60 | } 61 | 62 | switch (op) { 63 | case 'r': 64 | ret = m1s_xram_flash_read(o, a, l); 65 | break; 66 | case 'w': 67 | ret = m1s_xram_flash_write(o, a, l); 68 | break; 69 | case 'e': 70 | ret = m1s_xram_flash_erase(o, l); 71 | break; 72 | default: 73 | printf("no changed, select \r\n"); 74 | break; 75 | } 76 | if (0 != ret) { 77 | printf("flash operation error\r\n"); 78 | } 79 | } -------------------------------------------------------------------------------- /c906_app/lfs_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* FreeRTOS */ 6 | #include 7 | #include 8 | 9 | /* aos */ 10 | #include 11 | #include 12 | #include 13 | 14 | /* RISCV */ 15 | #include 16 | 17 | /* m1s_lfs_c906 */ 18 | #include 19 | 20 | extern void cmd_c906_flash(char *buf, int len, int argc, char **argv); 21 | const static struct cli_command cmds_user[] STATIC_CLI_CMD_ATTRIBUTE = { 22 | {"flash", "c906 flash command", cmd_c906_flash}, 23 | }; 24 | 25 | void main() 26 | { 27 | lfs_register(); 28 | 29 | int fd = -1; 30 | int ret = -1; 31 | #define FILE_NAME "/lfs/boot_count" 32 | // read current count 33 | uint32_t boot_count = 0; 34 | if ((fd = aos_open(FILE_NAME, O_RDWR | O_CREAT)) < 0) { 35 | printf("%s not found!\r\n", FILE_NAME); 36 | return; 37 | } 38 | ret = aos_read(fd, &boot_count, sizeof(boot_count)); 39 | if (ret < 0) { 40 | printf("read error %d\r\n", ret); 41 | return; 42 | } 43 | // update boot count 44 | boot_count += 1; 45 | ret = aos_lseek(fd, 0, SEEK_SET); 46 | if (ret != 0) { 47 | printf("lseek error %d\r\n", ret); 48 | return; 49 | } 50 | ret = aos_write(fd, &boot_count, sizeof(boot_count)); 51 | if (ret < 0) { 52 | printf("write error %d\r\n", ret); 53 | return; 54 | } 55 | aos_close(fd); 56 | 57 | // print the boot count 58 | printf("boot_count: %d\r\n", boot_count); 59 | 60 | lfs_unregister(); 61 | } -------------------------------------------------------------------------------- /c906_app/lvgl_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/lvgl_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* bl808 c906 std driver */ 9 | #include 10 | 11 | #include "demos/lv_demos.h" 12 | #include "lv_port_disp.h" 13 | #include "lv_port_indev.h" 14 | #include "lvgl.h" 15 | 16 | static void lvgl_task(void *param) 17 | { 18 | while (1) { 19 | lv_task_handler(); 20 | vTaskDelay(1); 21 | } 22 | vTaskDelete(NULL); 23 | } 24 | 25 | void main() 26 | { 27 | lv_init(); 28 | lv_port_disp_init(); 29 | lv_port_indev_init(); 30 | lv_demo_benchmark(); 31 | lv_task_handler(); 32 | 33 | xTaskCreate(lvgl_task, (char *)"lvgl task", 512, NULL, 15, NULL); 34 | } -------------------------------------------------------------------------------- /c906_app/pikascript_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS += . \ 2 | pikascript/pikascript-core \ 3 | pikascript/pikascript-api \ 4 | 5 | COMPONENT_SRCS := 6 | 7 | CFLAGS += -DPIKASCRIPT -DPIKA_CONFIG_ENABLE -DCONFIG_SYS_VFS_ENABLE=1 \ 8 | -DLFS_YES_TRACE 9 | 10 | COMPONENT_OBJS := $(patsubst %.c,%.o, $(COMPONENT_SRCS)) 11 | 12 | COMPONENT_SRCDIRS := . \ 13 | pikascript/pikascript-core \ 14 | pikascript/pikascript-api \ 15 | pikascript/pikascript-lib/pika_lvgl \ 16 | pikascript/pikascript-lib/PikaStdLib \ 17 | pikascript/pikascript-lib/PikaStdDevice \ 18 | pikascript/pikascript-lib/BL808 19 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "lv_conf.h" 9 | #include "lvgl.h" 10 | #include "pikaScript.h" 11 | 12 | #include "lv_port_disp.h" 13 | #include "lv_port_indev.h" 14 | 15 | volatile PikaObj* root = NULL; 16 | static volatile char rxbuff[1024 * 10]; 17 | static volatile int rxsize = 0; 18 | static volatile int rxbusy = 0; 19 | static void console_cb_read_pika(int fd, void* param) { 20 | while (rxbusy) { 21 | vTaskDelay(pdMS_TO_TICKS(1)); 22 | } 23 | rxbusy = 1; 24 | char buff[1024]; 25 | int sz = aos_read(fd, buff, sizeof(buff)); 26 | memcpy((void*)(rxbuff + rxsize), buff, sz); 27 | rxsize += sz; 28 | rxbusy = 0; 29 | } 30 | 31 | char __platform_getchar(void) { 32 | char c = 0; 33 | while (rxbusy || rxsize == 0) { 34 | vTaskDelay(pdMS_TO_TICKS(1)); 35 | } 36 | rxbusy = 1; 37 | c = rxbuff[0]; 38 | memmove(rxbuff, rxbuff + 1, rxsize - 1); 39 | rxsize--; 40 | rxbusy = 0; 41 | return c; 42 | } 43 | 44 | /* file API */ 45 | FILE* __platform_fopen(const char* filename, const char* modes) { 46 | return fopen(filename, modes); 47 | } 48 | 49 | int __platform_fclose(FILE* stream) { 50 | return fclose(stream); 51 | } 52 | 53 | size_t __platform_fwrite(const void* ptr, size_t size, size_t n, FILE* stream) { 54 | return fwrite(ptr, size, n, stream); 55 | } 56 | 57 | size_t __platform_fread(void* ptr, size_t size, size_t n, FILE* stream) { 58 | return fread(ptr, size, n, stream); 59 | } 60 | 61 | int __platform_fseek(FILE* stream, long offset, int whence) { 62 | return fseek(stream, offset, whence); 63 | } 64 | 65 | long __platform_ftell(FILE* stream) { 66 | return ftell(stream); 67 | } 68 | 69 | static void lvgl_task(void* param) { 70 | while (1) { 71 | lv_task_handler(); 72 | vTaskDelay(1); 73 | } 74 | vTaskDelete(NULL); 75 | } 76 | 77 | static void pika_REPL_task(void* param) { 78 | pikaScriptShell(root); 79 | while (1) { 80 | vTaskDelay(pdMS_TO_TICKS(1)); 81 | } 82 | } 83 | 84 | void main(void) { 85 | lv_init(); 86 | lv_port_disp_init(); 87 | printf("[ Info] In PikaSciprt Demo...\r\n"); 88 | root = pikaScriptInit(); 89 | int fd_console = 3; // aos_open("/dev/ttyS0", 0); 90 | aos_cancel_poll_read_fd(fd_console, 0, NULL); 91 | aos_poll_read_fd(fd_console, console_cb_read_pika, (void*)0x12345678); 92 | lv_task_handler(); 93 | xTaskCreate(lvgl_task, (char*)"lvdl task", 512, NULL, 15, NULL); 94 | xTaskCreate(pika_REPL_task, (char*)"pika REPL", 4096, NULL, 15, NULL); 95 | } 96 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pika_config.h: -------------------------------------------------------------------------------- 1 | #define __platform_printf printf 2 | #define PIKA_OPTIMIZE PIKA_OPTIMIZE_SPEED 3 | #define PIKA_SHELL_SAVE_FILE_ENABLE 1 4 | #define PIKA_SHELL_SAVE_FILE_NAME "/lfs/boot.py" -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/BL808.pyi: -------------------------------------------------------------------------------- 1 | import PikaStdDevice 2 | 3 | 4 | class GPIO(PikaStdDevice.GPIO): 5 | def platformHigh(self): ... 6 | 7 | def platformLow(self): ... 8 | 9 | def platformEnable(self): ... 10 | 11 | def platformDisable(self): ... 12 | 13 | def platformSetMode(self): ... 14 | 15 | def platformRead(self): ... 16 | 17 | class Time(PikaStdDevice.Time): 18 | def sleep_s(self, s: int): ... 19 | 20 | def sleep_ms(self, ms: int): ... 21 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/PikaDebug.pyi: -------------------------------------------------------------------------------- 1 | class Debuger: 2 | def __init__(self): 3 | pass 4 | 5 | def set_trace(self): 6 | pass 7 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/PikaObj.pyi: -------------------------------------------------------------------------------- 1 | class TinyObj: 2 | ... 3 | 4 | 5 | class BaseObj(TinyObj): 6 | ... 7 | 8 | 9 | class pointer: 10 | ... 11 | 12 | 13 | class any: 14 | ... 15 | 16 | 17 | class int64: 18 | ... 19 | 20 | 21 | def printNoEnd(val: any): ... 22 | def abstractmethod(fn): ... 23 | def PIKA_C_MACRO_IF(fn): ... 24 | def PIKA_C_MACRO_IFDEF(fn): ... 25 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/PikaStdLib.pyi: -------------------------------------------------------------------------------- 1 | from PikaObj import * 2 | 3 | 4 | class MemChecker: 5 | def max(self): ... 6 | def now(self): ... 7 | 8 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 9 | def getMax(self) -> float: ... 10 | 11 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 12 | def getNow(self) -> float: ... 13 | 14 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 15 | def resetMax(self): ... 16 | 17 | 18 | class SysObj: 19 | @staticmethod 20 | def int(arg: any) -> int: ... 21 | 22 | @staticmethod 23 | def float(arg: any) -> float: ... 24 | 25 | @staticmethod 26 | def str(arg: any) -> str: ... 27 | 28 | @staticmethod 29 | def iter(arg: any) -> any: ... 30 | 31 | @staticmethod 32 | def range(*ax) -> any: ... 33 | 34 | @staticmethod 35 | def print(*val, **ops): ... 36 | 37 | @staticmethod 38 | def __setitem__(obj: any, key: any, val: any) -> any: ... 39 | 40 | @staticmethod 41 | def __getitem__(obj: any, key: any) -> any: ... 42 | 43 | @staticmethod 44 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 45 | def type(arg: any) -> any: ... 46 | 47 | @staticmethod 48 | @PIKA_C_MACRO_IF("PIKA_BUILTIN_STRUCT_ENABLE") 49 | def __slice__(obj: any, start: any, end: any, step: int) -> any: ... 50 | 51 | @staticmethod 52 | def len(arg: any) -> int: ... 53 | 54 | @staticmethod 55 | @PIKA_C_MACRO_IF("PIKA_BUILTIN_STRUCT_ENABLE") 56 | def list(*val) -> any: ... 57 | 58 | @staticmethod 59 | @PIKA_C_MACRO_IF("PIKA_BUILTIN_STRUCT_ENABLE") 60 | def dict(*val) -> any: ... 61 | 62 | @staticmethod 63 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 64 | def hex(val: int) -> str: ... 65 | 66 | @staticmethod 67 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 68 | def ord(val: str) -> int: ... 69 | 70 | @staticmethod 71 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 72 | def chr(val: int) -> str: ... 73 | 74 | @staticmethod 75 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 76 | def bytes(val: any) -> bytes: ... 77 | 78 | @staticmethod 79 | @PIKA_C_MACRO_IF("PIKA_SYNTAX_FORMAT_ENABLE") 80 | def cformat(fmt: str, *var) -> str: ... 81 | 82 | @staticmethod 83 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 84 | def id(obj: any) -> int: ... 85 | 86 | @staticmethod 87 | @PIKA_C_MACRO_IF("PIKA_FILEIO_ENABLE") 88 | def open(path: str, mode: str) -> object: ... 89 | 90 | @staticmethod 91 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 92 | def dir(obj: object) -> list: ... 93 | 94 | @staticmethod 95 | @PIKA_C_MACRO_IF("PIKA_EXEC_ENABLE") 96 | def exec(code: str): ... 97 | 98 | @staticmethod 99 | @PIKA_C_MACRO_IF("PIKA_EXEC_ENABLE") 100 | def eval(code: str) -> any: ... 101 | 102 | @staticmethod 103 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 104 | def getattr(obj: object, name: str) -> any: ... 105 | 106 | @staticmethod 107 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 108 | def setattr(obj: object, name: str, val: any): ... 109 | 110 | @staticmethod 111 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 112 | def hasattr(obj: object, name: str) -> int: ... 113 | 114 | @staticmethod 115 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 116 | def exit(): ... 117 | 118 | @staticmethod 119 | @PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE") 120 | def input(*info) -> str: ... 121 | 122 | 123 | @PIKA_C_MACRO_IF("0") 124 | class RangeObj: 125 | def __next__(self) -> any: ... 126 | 127 | 128 | @PIKA_C_MACRO_IF("0") 129 | class StringObj: 130 | def __next__(self) -> any: ... 131 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/PikaStdTask.pyi: -------------------------------------------------------------------------------- 1 | import PikaStdData 2 | import PikaStdLib 3 | 4 | 5 | class Task(PikaStdLib.SysObj): 6 | calls = PikaStdData.List() 7 | 8 | def __init__(self): 9 | pass 10 | 11 | # regist a function to be called always 12 | def call_always(self, fun_todo: any): 13 | pass 14 | 15 | # regist a function to be called when fun_when() return 'True' 16 | def call_when(self, fun_todo: any, fun_when: any): 17 | pass 18 | 19 | # regist a function to be called periodically 20 | def call_period_ms(self, fun_todo: any, period_ms: int): 21 | pass 22 | 23 | # run all registed function once 24 | def run_once(self): 25 | pass 26 | 27 | # run all registed function forever 28 | def run_forever(self): 29 | pass 30 | 31 | # run all registed function until time is up 32 | def run_until_ms(self, until_ms: int): 33 | pass 34 | 35 | # need be overried to supply the system tick 36 | def platformGetTick(self): 37 | pass 38 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/main.py: -------------------------------------------------------------------------------- 1 | from PikaStdLib import MemChecker as mem 2 | import pika_lvgl as lv 3 | import BL808 4 | print('mem used max') 5 | mem.max() 6 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikaPackage.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/c906_app/pikascript_demo/pikascript/pikaPackage.exe -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/BL808.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __BL808__H 13 | #define __BL808__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_BL808(Args *args); 19 | 20 | Arg* BL808_GPIO(PikaObj *self); 21 | Arg* BL808_Time(PikaObj *self); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/BL808_GPIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __BL808_GPIO__H 13 | #define __BL808_GPIO__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_BL808_GPIO(Args *args); 19 | 20 | void BL808_GPIO_platformDisable(PikaObj *self); 21 | void BL808_GPIO_platformEnable(PikaObj *self); 22 | void BL808_GPIO_platformHigh(PikaObj *self); 23 | void BL808_GPIO_platformLow(PikaObj *self); 24 | void BL808_GPIO_platformRead(PikaObj *self); 25 | void BL808_GPIO_platformSetMode(PikaObj *self); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/BL808_Time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __BL808_Time__H 13 | #define __BL808_Time__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_BL808_Time(Args *args); 19 | 20 | void BL808_Time_sleep_ms(PikaObj *self, int ms); 21 | void BL808_Time_sleep_s(PikaObj *self, int s); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaDebug__H 13 | #define __PikaDebug__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaDebug(Args *args); 19 | 20 | Arg* PikaDebug_Debuger(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaDebug_Debuger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaDebug_Debuger__H 13 | #define __PikaDebug_Debuger__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaDebug_Debuger(Args *args); 19 | 20 | void PikaDebug_Debuger___init__(PikaObj *self); 21 | void PikaDebug_Debuger_set_trace(PikaObj *self); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaMain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaMain__H 13 | #define __PikaMain__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaMain(Args *args); 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData__H 13 | #define __PikaStdData__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData(Args *args); 19 | 20 | Arg* PikaStdData_ByteArray(PikaObj *self); 21 | Arg* PikaStdData_Dict(PikaObj *self); 22 | Arg* PikaStdData_FILEIO(PikaObj *self); 23 | Arg* PikaStdData_List(PikaObj *self); 24 | Arg* PikaStdData_String(PikaObj *self); 25 | Arg* PikaStdData_Tuple(PikaObj *self); 26 | Arg* PikaStdData_Utils(PikaObj *self); 27 | Arg* PikaStdData_dict_items(PikaObj *self); 28 | Arg* PikaStdData_dict_keys(PikaObj *self); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_ByteArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_ByteArray__H 13 | #define __PikaStdData_ByteArray__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_ByteArray(Args *args); 19 | 20 | int PikaStdData_ByteArray___getitem__(PikaObj *self, int __key); 21 | void PikaStdData_ByteArray___init__(PikaObj *self, Arg* bytes); 22 | Arg* PikaStdData_ByteArray___iter__(PikaObj *self); 23 | Arg* PikaStdData_ByteArray___next__(PikaObj *self); 24 | void PikaStdData_ByteArray___setitem__(PikaObj *self, int __key, int __val); 25 | char* PikaStdData_ByteArray___str__(PikaObj *self); 26 | char* PikaStdData_ByteArray_decode(PikaObj *self); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_Dict.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_Dict__H 13 | #define __PikaStdData_Dict__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_Dict(Args *args); 19 | 20 | int PikaStdData_Dict___contains__(PikaObj *self, Arg* val); 21 | void PikaStdData_Dict___del__(PikaObj *self); 22 | Arg* PikaStdData_Dict___getitem__(PikaObj *self, Arg* __key); 23 | void PikaStdData_Dict___init__(PikaObj *self); 24 | Arg* PikaStdData_Dict___iter__(PikaObj *self); 25 | int PikaStdData_Dict___len__(PikaObj *self); 26 | Arg* PikaStdData_Dict___next__(PikaObj *self); 27 | void PikaStdData_Dict___setitem__(PikaObj *self, Arg* __key, Arg* __val); 28 | char* PikaStdData_Dict___str__(PikaObj *self); 29 | Arg* PikaStdData_Dict_get(PikaObj *self, char* key); 30 | PikaObj* PikaStdData_Dict_items(PikaObj *self); 31 | PikaObj* PikaStdData_Dict_keys(PikaObj *self); 32 | void PikaStdData_Dict_remove(PikaObj *self, char* key); 33 | void PikaStdData_Dict_set(PikaObj *self, char* key, Arg* arg); 34 | void PikaStdData_Dict_update(PikaObj *self, PikaObj* other); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_FILEIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_FILEIO__H 13 | #define __PikaStdData_FILEIO__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_FILEIO(Args *args); 19 | 20 | void PikaStdData_FILEIO_close(PikaObj *self); 21 | int PikaStdData_FILEIO_init(PikaObj *self, char* path, char* mode); 22 | Arg* PikaStdData_FILEIO_read(PikaObj *self, int size); 23 | char* PikaStdData_FILEIO_readline(PikaObj *self); 24 | PikaObj* PikaStdData_FILEIO_readlines(PikaObj *self); 25 | int PikaStdData_FILEIO_seek(PikaObj *self, int offset, PikaTuple* fromwhere); 26 | int PikaStdData_FILEIO_tell(PikaObj *self); 27 | int PikaStdData_FILEIO_write(PikaObj *self, Arg* s); 28 | void PikaStdData_FILEIO_writelines(PikaObj *self, PikaObj* lines); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_List.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_List__H 13 | #define __PikaStdData_List__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_List(Args *args); 19 | 20 | PikaObj* PikaStdData_List___add__(PikaObj *self, PikaObj* others); 21 | void PikaStdData_List___init__(PikaObj *self); 22 | void PikaStdData_List___setitem__(PikaObj *self, Arg* __key, Arg* __val); 23 | char* PikaStdData_List___str__(PikaObj *self); 24 | void PikaStdData_List_append(PikaObj *self, Arg* arg); 25 | void PikaStdData_List_insert(PikaObj *self, int i, Arg* arg); 26 | Arg* PikaStdData_List_pop(PikaObj *self); 27 | void PikaStdData_List_remove(PikaObj *self, Arg* val); 28 | void PikaStdData_List_reverse(PikaObj *self); 29 | void PikaStdData_List_set(PikaObj *self, int i, Arg* arg); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_String.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_String__H 13 | #define __PikaStdData_String__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_String(Args *args); 19 | 20 | Arg* PikaStdData_String___getitem__(PikaObj *self, Arg* __key); 21 | void PikaStdData_String___init__(PikaObj *self, char* s); 22 | Arg* PikaStdData_String___iter__(PikaObj *self); 23 | int PikaStdData_String___len__(PikaObj *self); 24 | Arg* PikaStdData_String___next__(PikaObj *self); 25 | void PikaStdData_String___setitem__(PikaObj *self, Arg* __key, Arg* __val); 26 | char* PikaStdData_String___str__(PikaObj *self); 27 | Arg* PikaStdData_String_encode(PikaObj *self, PikaTuple* encoding); 28 | int PikaStdData_String_endswith(PikaObj *self, char* suffix); 29 | char* PikaStdData_String_get(PikaObj *self); 30 | int PikaStdData_String_isalnum(PikaObj *self); 31 | int PikaStdData_String_isalpha(PikaObj *self); 32 | int PikaStdData_String_isdigit(PikaObj *self); 33 | int PikaStdData_String_islower(PikaObj *self); 34 | int PikaStdData_String_isspace(PikaObj *self); 35 | char* PikaStdData_String_replace(PikaObj *self, char* old, char* new); 36 | void PikaStdData_String_set(PikaObj *self, char* s); 37 | PikaObj* PikaStdData_String_split(PikaObj *self, char* s); 38 | int PikaStdData_String_startswith(PikaObj *self, char* prefix); 39 | char* PikaStdData_String_strip(PikaObj *self, PikaTuple* chrs); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_Tuple.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_Tuple__H 13 | #define __PikaStdData_Tuple__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_Tuple(Args *args); 19 | 20 | int PikaStdData_Tuple___contains__(PikaObj *self, Arg* val); 21 | void PikaStdData_Tuple___del__(PikaObj *self); 22 | Arg* PikaStdData_Tuple___getitem__(PikaObj *self, Arg* __key); 23 | void PikaStdData_Tuple___init__(PikaObj *self); 24 | Arg* PikaStdData_Tuple___iter__(PikaObj *self); 25 | int PikaStdData_Tuple___len__(PikaObj *self); 26 | Arg* PikaStdData_Tuple___next__(PikaObj *self); 27 | char* PikaStdData_Tuple___str__(PikaObj *self); 28 | Arg* PikaStdData_Tuple_get(PikaObj *self, int i); 29 | int PikaStdData_Tuple_len(PikaObj *self); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_Utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_Utils__H 13 | #define __PikaStdData_Utils__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_Utils(Args *args); 19 | 20 | Arg* PikaStdData_Utils_int_to_bytes(PikaObj *self, int val); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_dict_items.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_dict_items__H 13 | #define __PikaStdData_dict_items__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_dict_items(Args *args); 19 | 20 | Arg* PikaStdData_dict_items___iter__(PikaObj *self); 21 | int PikaStdData_dict_items___len__(PikaObj *self); 22 | Arg* PikaStdData_dict_items___next__(PikaObj *self); 23 | char* PikaStdData_dict_items___str__(PikaObj *self); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdData_dict_keys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdData_dict_keys__H 13 | #define __PikaStdData_dict_keys__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdData_dict_keys(Args *args); 19 | 20 | Arg* PikaStdData_dict_keys___iter__(PikaObj *self); 21 | int PikaStdData_dict_keys___len__(PikaObj *self); 22 | Arg* PikaStdData_dict_keys___next__(PikaObj *self); 23 | char* PikaStdData_dict_keys___str__(PikaObj *self); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice__H 13 | #define __PikaStdDevice__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice(Args *args); 19 | 20 | Arg* PikaStdDevice_ADC(PikaObj *self); 21 | Arg* PikaStdDevice_BaseDev(PikaObj *self); 22 | Arg* PikaStdDevice_CAN(PikaObj *self); 23 | Arg* PikaStdDevice_GPIO(PikaObj *self); 24 | Arg* PikaStdDevice_IIC(PikaObj *self); 25 | Arg* PikaStdDevice_PWM(PikaObj *self); 26 | Arg* PikaStdDevice_SPI(PikaObj *self); 27 | Arg* PikaStdDevice_Time(PikaObj *self); 28 | Arg* PikaStdDevice_UART(PikaObj *self); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_ADC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_ADC__H 13 | #define __PikaStdDevice_ADC__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_ADC(Args *args); 19 | 20 | void PikaStdDevice_ADC___init__(PikaObj *self); 21 | void PikaStdDevice_ADC_disable(PikaObj *self); 22 | void PikaStdDevice_ADC_enable(PikaObj *self); 23 | void PikaStdDevice_ADC_platformDisable(PikaObj *self); 24 | void PikaStdDevice_ADC_platformEnable(PikaObj *self); 25 | void PikaStdDevice_ADC_platformRead(PikaObj *self); 26 | pika_float PikaStdDevice_ADC_read(PikaObj *self); 27 | void PikaStdDevice_ADC_setPin(PikaObj *self, char* pin); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_BaseDev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_BaseDev__H 13 | #define __PikaStdDevice_BaseDev__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_BaseDev(Args *args); 19 | 20 | void PikaStdDevice_BaseDev_addEventCallBack(PikaObj *self, Arg* eventCallback); 21 | void PikaStdDevice_BaseDev_platformGetEventId(PikaObj *self); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_CAN.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_CAN__H 13 | #define __PikaStdDevice_CAN__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_CAN(Args *args); 19 | 20 | void PikaStdDevice_CAN___init__(PikaObj *self); 21 | void PikaStdDevice_CAN_addFilter(PikaObj *self, int id, int ide, int rtr, int mode, int mask, int hdr); 22 | void PikaStdDevice_CAN_disable(PikaObj *self); 23 | void PikaStdDevice_CAN_enable(PikaObj *self); 24 | void PikaStdDevice_CAN_platformDisable(PikaObj *self); 25 | void PikaStdDevice_CAN_platformEnable(PikaObj *self); 26 | void PikaStdDevice_CAN_platformRead(PikaObj *self); 27 | void PikaStdDevice_CAN_platformReadBytes(PikaObj *self); 28 | void PikaStdDevice_CAN_platformWrite(PikaObj *self); 29 | void PikaStdDevice_CAN_platformWriteBytes(PikaObj *self); 30 | char* PikaStdDevice_CAN_read(PikaObj *self, int length); 31 | Arg* PikaStdDevice_CAN_readBytes(PikaObj *self, int length); 32 | void PikaStdDevice_CAN_setBaudRate(PikaObj *self, int baudRate); 33 | void PikaStdDevice_CAN_setId(PikaObj *self, int id); 34 | void PikaStdDevice_CAN_setMode(PikaObj *self, char* mode); 35 | void PikaStdDevice_CAN_setName(PikaObj *self, char* name); 36 | void PikaStdDevice_CAN_write(PikaObj *self, char* data); 37 | void PikaStdDevice_CAN_writeBytes(PikaObj *self, uint8_t* data, int length); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_GPIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_GPIO__H 13 | #define __PikaStdDevice_GPIO__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_GPIO(Args *args); 19 | 20 | void PikaStdDevice_GPIO___init__(PikaObj *self); 21 | void PikaStdDevice_GPIO_disable(PikaObj *self); 22 | void PikaStdDevice_GPIO_enable(PikaObj *self); 23 | int PikaStdDevice_GPIO_getId(PikaObj *self); 24 | char* PikaStdDevice_GPIO_getMode(PikaObj *self); 25 | char* PikaStdDevice_GPIO_getPin(PikaObj *self); 26 | void PikaStdDevice_GPIO_high(PikaObj *self); 27 | void PikaStdDevice_GPIO_low(PikaObj *self); 28 | void PikaStdDevice_GPIO_platformDisable(PikaObj *self); 29 | void PikaStdDevice_GPIO_platformEnable(PikaObj *self); 30 | void PikaStdDevice_GPIO_platformHigh(PikaObj *self); 31 | void PikaStdDevice_GPIO_platformLow(PikaObj *self); 32 | void PikaStdDevice_GPIO_platformRead(PikaObj *self); 33 | void PikaStdDevice_GPIO_platformSetMode(PikaObj *self); 34 | int PikaStdDevice_GPIO_read(PikaObj *self); 35 | void PikaStdDevice_GPIO_setId(PikaObj *self, int id); 36 | void PikaStdDevice_GPIO_setMode(PikaObj *self, char* mode); 37 | void PikaStdDevice_GPIO_setPin(PikaObj *self, char* pinName); 38 | void PikaStdDevice_GPIO_setPull(PikaObj *self, char* pull); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_IIC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_IIC__H 13 | #define __PikaStdDevice_IIC__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_IIC(Args *args); 19 | 20 | void PikaStdDevice_IIC___init__(PikaObj *self); 21 | void PikaStdDevice_IIC_disable(PikaObj *self); 22 | void PikaStdDevice_IIC_enable(PikaObj *self); 23 | void PikaStdDevice_IIC_platformDisable(PikaObj *self); 24 | void PikaStdDevice_IIC_platformEnable(PikaObj *self); 25 | void PikaStdDevice_IIC_platformRead(PikaObj *self); 26 | void PikaStdDevice_IIC_platformReadBytes(PikaObj *self); 27 | void PikaStdDevice_IIC_platformWrite(PikaObj *self); 28 | void PikaStdDevice_IIC_platformWriteBytes(PikaObj *self); 29 | char* PikaStdDevice_IIC_read(PikaObj *self, int addr, int length); 30 | Arg* PikaStdDevice_IIC_readBytes(PikaObj *self, int addr, int length); 31 | void PikaStdDevice_IIC_setDeviceAddr(PikaObj *self, int addr); 32 | void PikaStdDevice_IIC_setPinSCL(PikaObj *self, char* pin); 33 | void PikaStdDevice_IIC_setPinSDA(PikaObj *self, char* pin); 34 | void PikaStdDevice_IIC_write(PikaObj *self, int addr, char* data); 35 | void PikaStdDevice_IIC_writeBytes(PikaObj *self, int addr, uint8_t* data, int length); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_PWM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_PWM__H 13 | #define __PikaStdDevice_PWM__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_PWM(Args *args); 19 | 20 | void PikaStdDevice_PWM___init__(PikaObj *self); 21 | void PikaStdDevice_PWM_disable(PikaObj *self); 22 | void PikaStdDevice_PWM_enable(PikaObj *self); 23 | int PikaStdDevice_PWM_getChannel(PikaObj *self); 24 | pika_float PikaStdDevice_PWM_getDuty(PikaObj *self); 25 | int PikaStdDevice_PWM_getFrequency(PikaObj *self); 26 | char* PikaStdDevice_PWM_getName(PikaObj *self); 27 | void PikaStdDevice_PWM_platformDisable(PikaObj *self); 28 | void PikaStdDevice_PWM_platformEnable(PikaObj *self); 29 | void PikaStdDevice_PWM_platformSetDuty(PikaObj *self); 30 | void PikaStdDevice_PWM_platformSetFrequency(PikaObj *self); 31 | void PikaStdDevice_PWM_setChannel(PikaObj *self, int ch); 32 | void PikaStdDevice_PWM_setDuty(PikaObj *self, pika_float duty); 33 | void PikaStdDevice_PWM_setFreq(PikaObj *self, int freq); 34 | void PikaStdDevice_PWM_setFrequency(PikaObj *self, int freq); 35 | void PikaStdDevice_PWM_setName(PikaObj *self, char* name); 36 | void PikaStdDevice_PWM_setPin(PikaObj *self, char* pin); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_SPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_SPI__H 13 | #define __PikaStdDevice_SPI__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_SPI(Args *args); 19 | 20 | void PikaStdDevice_SPI___init__(PikaObj *self); 21 | void PikaStdDevice_SPI_disable(PikaObj *self); 22 | void PikaStdDevice_SPI_enable(PikaObj *self); 23 | void PikaStdDevice_SPI_platformDisable(PikaObj *self); 24 | void PikaStdDevice_SPI_platformEnable(PikaObj *self); 25 | void PikaStdDevice_SPI_platformRead(PikaObj *self); 26 | void PikaStdDevice_SPI_platformReadBytes(PikaObj *self); 27 | void PikaStdDevice_SPI_platformWrite(PikaObj *self); 28 | void PikaStdDevice_SPI_platformWriteBytes(PikaObj *self); 29 | char* PikaStdDevice_SPI_read(PikaObj *self, int length); 30 | Arg* PikaStdDevice_SPI_readBytes(PikaObj *self, int length); 31 | void PikaStdDevice_SPI_setBaudRate(PikaObj *self, int baudRate); 32 | void PikaStdDevice_SPI_setId(PikaObj *self, int id); 33 | void PikaStdDevice_SPI_setName(PikaObj *self, char* name); 34 | void PikaStdDevice_SPI_setPhase(PikaObj *self, int phase); 35 | void PikaStdDevice_SPI_setPinMISO(PikaObj *self, char* pin); 36 | void PikaStdDevice_SPI_setPinMOSI(PikaObj *self, char* pin); 37 | void PikaStdDevice_SPI_setPinSCK(PikaObj *self, char* pin); 38 | void PikaStdDevice_SPI_setPolarity(PikaObj *self, int polarity); 39 | void PikaStdDevice_SPI_write(PikaObj *self, char* data); 40 | void PikaStdDevice_SPI_writeBytes(PikaObj *self, uint8_t* data, int length); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_Time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_Time__H 13 | #define __PikaStdDevice_Time__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_Time(Args *args); 19 | 20 | void PikaStdDevice_Time___init__(PikaObj *self); 21 | void PikaStdDevice_Time_asctime(PikaObj *self); 22 | void PikaStdDevice_Time_ctime(PikaObj *self, pika_float unix_time); 23 | void PikaStdDevice_Time_gmtime(PikaObj *self, pika_float unix_time); 24 | void PikaStdDevice_Time_localtime(PikaObj *self, pika_float unix_time); 25 | int PikaStdDevice_Time_mktime(PikaObj *self); 26 | void PikaStdDevice_Time_platformGetTick(PikaObj *self); 27 | void PikaStdDevice_Time_sleep(PikaObj *self, pika_float s); 28 | void PikaStdDevice_Time_sleep_ms(PikaObj *self, int ms); 29 | void PikaStdDevice_Time_sleep_s(PikaObj *self, int s); 30 | pika_float PikaStdDevice_Time_time(PikaObj *self); 31 | int PikaStdDevice_Time_time_ns(PikaObj *self); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdDevice_UART.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdDevice_UART__H 13 | #define __PikaStdDevice_UART__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdDevice_UART(Args *args); 19 | 20 | void PikaStdDevice_UART___init__(PikaObj *self); 21 | void PikaStdDevice_UART_disable(PikaObj *self); 22 | void PikaStdDevice_UART_enable(PikaObj *self); 23 | void PikaStdDevice_UART_platformDisable(PikaObj *self); 24 | void PikaStdDevice_UART_platformEnable(PikaObj *self); 25 | void PikaStdDevice_UART_platformRead(PikaObj *self); 26 | void PikaStdDevice_UART_platformReadBytes(PikaObj *self); 27 | void PikaStdDevice_UART_platformWrite(PikaObj *self); 28 | void PikaStdDevice_UART_platformWriteBytes(PikaObj *self); 29 | char* PikaStdDevice_UART_read(PikaObj *self, int length); 30 | Arg* PikaStdDevice_UART_readBytes(PikaObj *self, int length); 31 | void PikaStdDevice_UART_setBaudRate(PikaObj *self, int baudRate); 32 | void PikaStdDevice_UART_setId(PikaObj *self, int id); 33 | void PikaStdDevice_UART_write(PikaObj *self, char* data); 34 | void PikaStdDevice_UART_writeBytes(PikaObj *self, uint8_t* data, int length); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdLib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdLib__H 13 | #define __PikaStdLib__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdLib(Args *args); 19 | 20 | Arg* PikaStdLib_MemChecker(PikaObj *self); 21 | Arg* PikaStdLib_RangeObj(PikaObj *self); 22 | Arg* PikaStdLib_StringObj(PikaObj *self); 23 | Arg* PikaStdLib_SysObj(PikaObj *self); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdLib_MemChecker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdLib_MemChecker__H 13 | #define __PikaStdLib_MemChecker__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdLib_MemChecker(Args *args); 19 | 20 | pika_float PikaStdLib_MemChecker_getMax(PikaObj *self); 21 | pika_float PikaStdLib_MemChecker_getNow(PikaObj *self); 22 | void PikaStdLib_MemChecker_max(PikaObj *self); 23 | void PikaStdLib_MemChecker_now(PikaObj *self); 24 | void PikaStdLib_MemChecker_resetMax(PikaObj *self); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdLib_RangeObj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdLib_RangeObj__H 13 | #define __PikaStdLib_RangeObj__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdLib_RangeObj(Args *args); 19 | 20 | Arg* PikaStdLib_RangeObj___next__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdLib_StringObj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdLib_StringObj__H 13 | #define __PikaStdLib_StringObj__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdLib_StringObj(Args *args); 19 | 20 | Arg* PikaStdLib_StringObj___next__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdLib_SysObj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdLib_SysObj__H 13 | #define __PikaStdLib_SysObj__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdLib_SysObj(Args *args); 19 | 20 | Arg* PikaStdLib_SysObj___getitem__(PikaObj *self, Arg* obj, Arg* key); 21 | Arg* PikaStdLib_SysObj___setitem__(PikaObj *self, Arg* obj, Arg* key, Arg* val); 22 | Arg* PikaStdLib_SysObj___slice__(PikaObj *self, Arg* obj, Arg* start, Arg* end, int step); 23 | Arg* PikaStdLib_SysObj_bytes(PikaObj *self, Arg* val); 24 | char* PikaStdLib_SysObj_cformat(PikaObj *self, char* fmt, PikaTuple* var); 25 | char* PikaStdLib_SysObj_chr(PikaObj *self, int val); 26 | Arg* PikaStdLib_SysObj_dict(PikaObj *self, PikaTuple* val); 27 | PikaObj* PikaStdLib_SysObj_dir(PikaObj *self, PikaObj* obj); 28 | Arg* PikaStdLib_SysObj_eval(PikaObj *self, char* code); 29 | void PikaStdLib_SysObj_exec(PikaObj *self, char* code); 30 | void PikaStdLib_SysObj_exit(PikaObj *self); 31 | pika_float PikaStdLib_SysObj_float(PikaObj *self, Arg* arg); 32 | Arg* PikaStdLib_SysObj_getattr(PikaObj *self, PikaObj* obj, char* name); 33 | int PikaStdLib_SysObj_hasattr(PikaObj *self, PikaObj* obj, char* name); 34 | char* PikaStdLib_SysObj_hex(PikaObj *self, int val); 35 | int PikaStdLib_SysObj_id(PikaObj *self, Arg* obj); 36 | char* PikaStdLib_SysObj_input(PikaObj *self, PikaTuple* info); 37 | int PikaStdLib_SysObj_int(PikaObj *self, Arg* arg); 38 | Arg* PikaStdLib_SysObj_iter(PikaObj *self, Arg* arg); 39 | int PikaStdLib_SysObj_len(PikaObj *self, Arg* arg); 40 | Arg* PikaStdLib_SysObj_list(PikaObj *self, PikaTuple* val); 41 | PikaObj* PikaStdLib_SysObj_open(PikaObj *self, char* path, char* mode); 42 | int PikaStdLib_SysObj_ord(PikaObj *self, char* val); 43 | void PikaStdLib_SysObj_print(PikaObj *self, PikaTuple* val, PikaDict* ops); 44 | Arg* PikaStdLib_SysObj_range(PikaObj *self, PikaTuple* ax); 45 | void PikaStdLib_SysObj_setattr(PikaObj *self, PikaObj* obj, char* name, Arg* val); 46 | char* PikaStdLib_SysObj_str(PikaObj *self, Arg* arg); 47 | Arg* PikaStdLib_SysObj_type(PikaObj *self, Arg* arg); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdTask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdTask__H 13 | #define __PikaStdTask__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdTask(Args *args); 19 | 20 | Arg* PikaStdTask_Task(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/PikaStdTask_Task.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __PikaStdTask_Task__H 13 | #define __PikaStdTask_Task__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_PikaStdTask_Task(Args *args); 19 | 20 | void PikaStdTask_Task___init__(PikaObj *self); 21 | void PikaStdTask_Task_call_always(PikaObj *self, Arg* fun_todo); 22 | void PikaStdTask_Task_call_period_ms(PikaObj *self, Arg* fun_todo, int period_ms); 23 | void PikaStdTask_Task_call_when(PikaObj *self, Arg* fun_todo, Arg* fun_when); 24 | void PikaStdTask_Task_platformGetTick(PikaObj *self); 25 | void PikaStdTask_Task_run_forever(PikaObj *self); 26 | void PikaStdTask_Task_run_once(PikaObj *self); 27 | void PikaStdTask_Task_run_until_ms(PikaObj *self, int until_ms); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/__asset_pikaModules_py_a.c: -------------------------------------------------------------------------------- 1 | #include "PikaPlatform.h" 2 | /* warning: auto generated file, please do not modify */ 3 | PIKA_BYTECODE_ALIGN const unsigned char pikaModules_py_a[] = { 4 | 0x7f, 0x70, 0x79, 0x61, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 7 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 8 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 9 | 0x88, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x96, 0x01, 0x00, 10 | 0x00, 0x81, 0x0c, 0x00, 0x00, 0x04, 0x22, 0x00, 0x00, 0x96, 0x26, 0x00, 11 | 0x00, 0x81, 0x26, 0x00, 0x00, 0x04, 0x30, 0x00, 0x00, 0x96, 0x33, 0x00, 12 | 0x10, 0x83, 0x39, 0x00, 0x00, 0x02, 0x46, 0x00, 0x00, 0x82, 0x4c, 0x00, 13 | 0x54, 0x00, 0x00, 0x00, 0x00, 0x50, 0x69, 0x6b, 0x61, 0x53, 0x74, 0x64, 14 | 0x4c, 0x69, 0x62, 0x00, 0x50, 0x69, 0x6b, 0x61, 0x53, 0x74, 0x64, 0x4c, 15 | 0x69, 0x62, 0x2e, 0x4d, 0x65, 0x6d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 16 | 0x72, 0x00, 0x6d, 0x65, 0x6d, 0x00, 0x70, 0x69, 0x6b, 0x61, 0x5f, 0x6c, 17 | 0x76, 0x67, 0x6c, 0x00, 0x6c, 0x76, 0x00, 0x42, 0x4c, 0x38, 0x30, 0x38, 18 | 0x00, 0x6d, 0x65, 0x6d, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x6d, 0x61, 19 | 0x78, 0x00, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x00, 0x6d, 0x65, 0x6d, 0x2e, 20 | 0x6d, 0x61, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 21 | }; 22 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/main.py.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/c906_app/pikascript_demo/pikascript/pikascript-api/main.py.o -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pikaModules.py.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/c906_app/pikascript_demo/pikascript/pikascript-api/pikaModules.py.a -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pikaScript.c: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #include "PikaMain.h" 13 | #include 14 | #include 15 | 16 | volatile PikaObj *__pikaMain; 17 | PikaObj *pikaScriptInit(void){ 18 | __platform_printf("======[pikascript packages installed]======\r\n"); 19 | pks_printVersion(); 20 | __platform_printf("PikaStdDevice==v1.11.2\r\n"); 21 | __platform_printf("PikaStdLib==latest\r\n"); 22 | __platform_printf("pika_lvgl==v0.4.0\r\n"); 23 | __platform_printf("===========================================\r\n"); 24 | PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain); 25 | __pikaMain = pikaMain; 26 | extern unsigned char pikaModules_py_a[]; 27 | obj_linkLibrary(pikaMain, pikaModules_py_a); 28 | #if PIKA_INIT_STRING_ENABLE 29 | obj_run(pikaMain, 30 | "from PikaStdLib import MemChecker as mem\n" 31 | "import pika_lvgl as lv\n" 32 | "import BL808\n" 33 | "print('mem used max')\n" 34 | "mem.max()\n" 35 | "\n"); 36 | #else 37 | obj_runModule((PikaObj*)pikaMain, "main"); 38 | #endif 39 | return pikaMain; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pikaScript.h: -------------------------------------------------------------------------------- 1 | /* ******************************** */ 2 | /* Warning! Don't modify this file! */ 3 | /* ******************************** */ 4 | #ifndef __pikaScript__H 5 | #define __pikaScript__H 6 | #include 7 | #include 8 | #include "PikaObj.h" 9 | #include "PikaMain.h" 10 | 11 | PikaObj * pikaScriptInit(void); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl__H 13 | #define __pika_lvgl__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl(Args *args); 19 | 20 | Arg* pika_lvgl_ALIGN(PikaObj *self); 21 | Arg* pika_lvgl_ANIM(PikaObj *self); 22 | Arg* pika_lvgl_EVENT(PikaObj *self); 23 | Arg* pika_lvgl_FLEX_ALIGN(PikaObj *self); 24 | Arg* pika_lvgl_FLEX_FLOW(PikaObj *self); 25 | Arg* pika_lvgl_LAYOUT_FLEX(PikaObj *self); 26 | Arg* pika_lvgl_OPA(PikaObj *self); 27 | Arg* pika_lvgl_PALETTE(PikaObj *self); 28 | Arg* pika_lvgl_SIZE(PikaObj *self); 29 | Arg* pika_lvgl_STATE(PikaObj *self); 30 | Arg* pika_lvgl_TEXT_DECOR(PikaObj *self); 31 | void pika_lvgl___init__(PikaObj *self); 32 | Arg* pika_lvgl_arc(PikaObj *self); 33 | Arg* pika_lvgl_bar(PikaObj *self); 34 | Arg* pika_lvgl_btn(PikaObj *self); 35 | Arg* pika_lvgl_checkbox(PikaObj *self); 36 | Arg* pika_lvgl_dropdown(PikaObj *self); 37 | Arg* pika_lvgl_flag_t(PikaObj *self); 38 | Arg* pika_lvgl_img(PikaObj *self); 39 | Arg* pika_lvgl_img_dsc_t(PikaObj *self); 40 | PikaObj* pika_lvgl_indev_get_act(PikaObj *self); 41 | Arg* pika_lvgl_indev_t(PikaObj *self); 42 | Arg* pika_lvgl_label(PikaObj *self); 43 | PikaObj* pika_lvgl_lv_color_hex(PikaObj *self, int64_t hex); 44 | Arg* pika_lvgl_lv_color_t(PikaObj *self); 45 | Arg* pika_lvgl_lv_event(PikaObj *self); 46 | Arg* pika_lvgl_lv_obj(PikaObj *self); 47 | Arg* pika_lvgl_lv_timer_t(PikaObj *self); 48 | Arg* pika_lvgl_obj(PikaObj *self); 49 | PikaObj* pika_lvgl_palette_lighten(PikaObj *self, int p, int lvl); 50 | PikaObj* pika_lvgl_palette_main(PikaObj *self, int p); 51 | int pika_lvgl_pct(PikaObj *self, int x); 52 | Arg* pika_lvgl_point_t(PikaObj *self); 53 | Arg* pika_lvgl_roller(PikaObj *self); 54 | PikaObj* pika_lvgl_scr_act(PikaObj *self); 55 | Arg* pika_lvgl_slider(PikaObj *self); 56 | Arg* pika_lvgl_style_t(PikaObj *self); 57 | Arg* pika_lvgl_switch(PikaObj *self); 58 | Arg* pika_lvgl_table(PikaObj *self); 59 | Arg* pika_lvgl_textarea(PikaObj *self); 60 | PikaObj* pika_lvgl_timer_create_basic(PikaObj *self); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_ALIGN.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_ALIGN__H 13 | #define __pika_lvgl_ALIGN__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_ALIGN(Args *args); 19 | 20 | void pika_lvgl_ALIGN___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_ANIM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_ANIM__H 13 | #define __pika_lvgl_ANIM__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_ANIM(Args *args); 19 | 20 | void pika_lvgl_ANIM___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_EVENT.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_EVENT__H 13 | #define __pika_lvgl_EVENT__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_EVENT(Args *args); 19 | 20 | void pika_lvgl_EVENT___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_FLEX_ALIGN.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_FLEX_ALIGN__H 13 | #define __pika_lvgl_FLEX_ALIGN__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_FLEX_ALIGN(Args *args); 19 | 20 | void pika_lvgl_FLEX_ALIGN___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_FLEX_FLOW.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_FLEX_FLOW__H 13 | #define __pika_lvgl_FLEX_FLOW__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_FLEX_FLOW(Args *args); 19 | 20 | void pika_lvgl_FLEX_FLOW___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_LAYOUT_FLEX.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_LAYOUT_FLEX__H 13 | #define __pika_lvgl_LAYOUT_FLEX__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_LAYOUT_FLEX(Args *args); 19 | 20 | void pika_lvgl_LAYOUT_FLEX___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_OPA.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_OPA__H 13 | #define __pika_lvgl_OPA__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_OPA(Args *args); 19 | 20 | void pika_lvgl_OPA___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_PALETTE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_PALETTE__H 13 | #define __pika_lvgl_PALETTE__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_PALETTE(Args *args); 19 | 20 | void pika_lvgl_PALETTE___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_SIZE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_SIZE__H 13 | #define __pika_lvgl_SIZE__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_SIZE(Args *args); 19 | 20 | void pika_lvgl_SIZE___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_STATE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_STATE__H 13 | #define __pika_lvgl_STATE__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_STATE(Args *args); 19 | 20 | void pika_lvgl_STATE___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_TEXT_DECOR.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_TEXT_DECOR__H 13 | #define __pika_lvgl_TEXT_DECOR__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_TEXT_DECOR(Args *args); 19 | 20 | void pika_lvgl_TEXT_DECOR___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_arc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_arc__H 13 | #define __pika_lvgl_arc__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_arc(Args *args); 19 | 20 | void pika_lvgl_arc___init__(PikaObj *self, PikaObj* parent); 21 | int pika_lvgl_arc_get_angle_end(PikaObj *self); 22 | int pika_lvgl_arc_get_angle_start(PikaObj *self); 23 | int pika_lvgl_arc_get_bg_angle_end(PikaObj *self); 24 | int pika_lvgl_arc_get_bg_angle_start(PikaObj *self); 25 | int pika_lvgl_arc_get_max_value(PikaObj *self); 26 | int pika_lvgl_arc_get_min_value(PikaObj *self); 27 | int pika_lvgl_arc_get_mode(PikaObj *self); 28 | int pika_lvgl_arc_get_value(PikaObj *self); 29 | void pika_lvgl_arc_set_angles(PikaObj *self, int start, int end); 30 | void pika_lvgl_arc_set_bg_angles(PikaObj *self, int start, int end); 31 | void pika_lvgl_arc_set_bg_end_angle(PikaObj *self, int angle); 32 | void pika_lvgl_arc_set_bg_start_angle(PikaObj *self, int start); 33 | void pika_lvgl_arc_set_change_rate(PikaObj *self, int rate); 34 | void pika_lvgl_arc_set_end_angle(PikaObj *self, int angle); 35 | void pika_lvgl_arc_set_mode(PikaObj *self, int mode); 36 | void pika_lvgl_arc_set_range(PikaObj *self, int min, int max); 37 | void pika_lvgl_arc_set_rotation(PikaObj *self, int rotation); 38 | void pika_lvgl_arc_set_start_angle(PikaObj *self, int start); 39 | void pika_lvgl_arc_set_value(PikaObj *self, int value); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_bar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_bar__H 13 | #define __pika_lvgl_bar__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_bar(Args *args); 19 | 20 | void pika_lvgl_bar___init__(PikaObj *self, PikaObj* parent); 21 | int pika_lvgl_bar_get_max_value(PikaObj *self); 22 | int pika_lvgl_bar_get_min_value(PikaObj *self); 23 | int pika_lvgl_bar_get_mode(PikaObj *self); 24 | int pika_lvgl_bar_get_start_value(PikaObj *self); 25 | int pika_lvgl_bar_get_value(PikaObj *self); 26 | void pika_lvgl_bar_set_mode(PikaObj *self, int mode); 27 | void pika_lvgl_bar_set_range(PikaObj *self, int min, int max); 28 | void pika_lvgl_bar_set_start_value(PikaObj *self, int start_value, int anim); 29 | void pika_lvgl_bar_set_value(PikaObj *self, int value, int anim); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_btn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_btn__H 13 | #define __pika_lvgl_btn__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_btn(Args *args); 19 | 20 | void pika_lvgl_btn___init__(PikaObj *self, PikaObj* parent); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_checkbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_checkbox__H 13 | #define __pika_lvgl_checkbox__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_checkbox(Args *args); 19 | 20 | void pika_lvgl_checkbox___init__(PikaObj *self, PikaObj* parent); 21 | char* pika_lvgl_checkbox_get_text(PikaObj *self); 22 | void pika_lvgl_checkbox_set_text(PikaObj *self, char* txt); 23 | void pika_lvgl_checkbox_set_text_static(PikaObj *self, char* txt); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_dropdown.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_dropdown__H 13 | #define __pika_lvgl_dropdown__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_dropdown(Args *args); 19 | 20 | void pika_lvgl_dropdown___init__(PikaObj *self, PikaObj* parent); 21 | void pika_lvgl_dropdown_add_option(PikaObj *self, char* option, int pos); 22 | void pika_lvgl_dropdown_clear_options(PikaObj *self); 23 | void pika_lvgl_dropdown_close(PikaObj *self); 24 | int pika_lvgl_dropdown_get_dir(PikaObj *self); 25 | int pika_lvgl_dropdown_get_option_cnt(PikaObj *self); 26 | int pika_lvgl_dropdown_get_option_index(PikaObj *self, char* option); 27 | char* pika_lvgl_dropdown_get_options(PikaObj *self); 28 | int pika_lvgl_dropdown_get_selected(PikaObj *self); 29 | int pika_lvgl_dropdown_get_selected_highlight(PikaObj *self); 30 | char* pika_lvgl_dropdown_get_selected_str(PikaObj *self); 31 | char* pika_lvgl_dropdown_get_symbol(PikaObj *self); 32 | char* pika_lvgl_dropdown_get_text(PikaObj *self); 33 | int pika_lvgl_dropdown_is_open(PikaObj *self); 34 | void pika_lvgl_dropdown_open(PikaObj *self); 35 | void pika_lvgl_dropdown_set_dir(PikaObj *self, int dir); 36 | void pika_lvgl_dropdown_set_options(PikaObj *self, char* options); 37 | void pika_lvgl_dropdown_set_selected(PikaObj *self, int sel_opt); 38 | void pika_lvgl_dropdown_set_selected_hightlight(PikaObj *self, int en); 39 | void pika_lvgl_dropdown_set_symbol(PikaObj *self, char* symbol); 40 | void pika_lvgl_dropdown_set_text(PikaObj *self, char* txt); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_flag_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_flag_t__H 13 | #define __pika_lvgl_flag_t__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_flag_t(Args *args); 19 | 20 | void pika_lvgl_flag_t___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_img.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_img__H 13 | #define __pika_lvgl_img__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_img(Args *args); 19 | 20 | void pika_lvgl_img___init__(PikaObj *self, PikaObj* parent); 21 | int pika_lvgl_img_get_angle(PikaObj *self); 22 | int pika_lvgl_img_get_antialias(PikaObj *self); 23 | int pika_lvgl_img_get_offset_x(PikaObj *self); 24 | int pika_lvgl_img_get_offset_y(PikaObj *self); 25 | int pika_lvgl_img_get_size_mode(PikaObj *self); 26 | PikaObj* pika_lvgl_img_get_src(PikaObj *self); 27 | int pika_lvgl_img_get_zoom(PikaObj *self); 28 | void pika_lvgl_img_set_angle(PikaObj *self, int angle); 29 | void pika_lvgl_img_set_antialias(PikaObj *self, int antialias); 30 | void pika_lvgl_img_set_offset_x(PikaObj *self, int x); 31 | void pika_lvgl_img_set_offset_y(PikaObj *self, int y); 32 | void pika_lvgl_img_set_pivot(PikaObj *self, int x, int y); 33 | void pika_lvgl_img_set_size_mode(PikaObj *self, int mode); 34 | void pika_lvgl_img_set_src(PikaObj *self, PikaObj* src); 35 | void pika_lvgl_img_set_zoom(PikaObj *self, int zoom); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_img_dsc_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_img_dsc_t__H 13 | #define __pika_lvgl_img_dsc_t__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_img_dsc_t(Args *args); 19 | 20 | void pika_lvgl_img_dsc_t___init__(PikaObj *self, PikaObj* dsc_dict); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_indev_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_indev_t__H 13 | #define __pika_lvgl_indev_t__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_indev_t(Args *args); 19 | 20 | void pika_lvgl_indev_t_get_vect(PikaObj *self, PikaObj* point); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_label.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_label__H 13 | #define __pika_lvgl_label__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_label(Args *args); 19 | 20 | void pika_lvgl_label___init__(PikaObj *self, PikaObj* parent); 21 | void pika_lvgl_label_set_long_mode(PikaObj *self, int mode); 22 | void pika_lvgl_label_set_recolor(PikaObj *self, int en); 23 | void pika_lvgl_label_set_style_text_align(PikaObj *self, int value, int selector); 24 | void pika_lvgl_label_set_text(PikaObj *self, char* txt); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_lv_color_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_lv_color_t__H 13 | #define __pika_lvgl_lv_color_t__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_lv_color_t(Args *args); 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_lv_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_lv_event__H 13 | #define __pika_lvgl_lv_event__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_lv_event(Args *args); 19 | 20 | int pika_lvgl_lv_event_get_code(PikaObj *self); 21 | PikaObj* pika_lvgl_lv_event_get_target(PikaObj *self); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_lv_timer_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_lv_timer_t__H 13 | #define __pika_lvgl_lv_timer_t__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_lv_timer_t(Args *args); 19 | 20 | void pika_lvgl_lv_timer_t__del(PikaObj *self); 21 | void pika_lvgl_lv_timer_t_set_cb(PikaObj *self, Arg* cb); 22 | void pika_lvgl_lv_timer_t_set_period(PikaObj *self, int period); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_obj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_obj__H 13 | #define __pika_lvgl_obj__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_obj(Args *args); 19 | 20 | void pika_lvgl_obj___init__(PikaObj *self, PikaTuple* parent); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_point_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_point_t__H 13 | #define __pika_lvgl_point_t__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_point_t(Args *args); 19 | 20 | void pika_lvgl_point_t___init__(PikaObj *self); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_roller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_roller__H 13 | #define __pika_lvgl_roller__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_roller(Args *args); 19 | 20 | void pika_lvgl_roller___init__(PikaObj *self, PikaObj* parent); 21 | void pika_lvgl_roller_set_options(PikaObj *self, char* options, int mode); 22 | void pika_lvgl_roller_set_visible_row_count(PikaObj *self, int row_cnt); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_slider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_slider__H 13 | #define __pika_lvgl_slider__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_slider(Args *args); 19 | 20 | void pika_lvgl_slider___init__(PikaObj *self, PikaObj* parent); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_switch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_switch__H 13 | #define __pika_lvgl_switch__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_switch(Args *args); 19 | 20 | void pika_lvgl_switch___init__(PikaObj *self, PikaObj* parent); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_table__H 13 | #define __pika_lvgl_table__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_table(Args *args); 19 | 20 | void pika_lvgl_table___init__(PikaObj *self, PikaObj* parent); 21 | void pika_lvgl_table_set_cell_value(PikaObj *self, int row, int col, char* txt); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-api/pika_lvgl_textarea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * [Warning!] This file is auto-generated by pika compiler. 3 | * Do not edit it manually. 4 | * The source code is *.pyi file. 5 | * More details: 6 | * English Doc: 7 | * https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 8 | * Chinese Doc: 9 | * https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html 10 | */ 11 | 12 | #ifndef __pika_lvgl_textarea__H 13 | #define __pika_lvgl_textarea__H 14 | #include 15 | #include 16 | #include "PikaObj.h" 17 | 18 | PikaObj *New_pika_lvgl_textarea(Args *args); 19 | 20 | void pika_lvgl_textarea___init__(PikaObj *self, PikaObj* parent); 21 | void pika_lvgl_textarea_set_one_line(PikaObj *self, int en); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/BaseObj.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #include "BaseObj.h" 29 | #include "PikaObj.h" 30 | #include "TinyObj.h" 31 | #include "dataMemory.h" 32 | #include "dataString.h" 33 | #include "dataStrs.h" 34 | 35 | extern const NativeProperty TinyObjNativeProp; 36 | const NativeProperty BaseObjNativeProp = {.super = &TinyObjNativeProp, 37 | .methodGroup = NULL, 38 | .methodGroupCount = 0}; 39 | 40 | PikaObj* New_BaseObj(Args* args) { 41 | PikaObj* self = New_TinyObj(args); 42 | return self; 43 | } 44 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/BaseObj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef _PikaObj_baseObj__H 29 | #define _PikaObj_baseObj__H 30 | #include "PikaObj.h" 31 | #include "PikaVM.h" 32 | #include "TinyObj.h" 33 | #include "dataMemory.h" 34 | 35 | PikaObj* New_BaseObj(Args* args); 36 | void Baseobj_print(PikaObj* self, Args* args); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #设置 BINARY 为项目名IndexProject 2 | set(BINARY ${CMAKE_PROJECT_NAME}) 3 | 4 | file(GLOB_RECURSE SOURCES LIST_DIRECTORIES true *.h *.c) 5 | set(SOURCES ${SOURCES}) 6 | 7 | add_library(${BINARY}-core 8 | STATIC 9 | ${SOURCES}) 10 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/PikaCompiler.h: -------------------------------------------------------------------------------- 1 | #ifndef __PIKA_COMPILER__H 2 | #define __PIKA_COMPILER__H 3 | #include "PikaObj.h" 4 | #include "stdint.h" 5 | 6 | PIKA_RES pikaCompileFile(char* input_file_name); 7 | PIKA_RES pikaCompileFileWithOutputName(char* output_file_name, 8 | char* input_file_name); 9 | PIKA_RES pikaCompile(char* output_file_name, char* py_lines); 10 | 11 | LibObj* New_LibObj(Args* args); 12 | void LibObj_deinit(LibObj* self); 13 | void LibObj_dynamicLink(LibObj* self, char* module_name, uint8_t* bytecode); 14 | int LibObj_staticLink(LibObj* self, 15 | char* module_name, 16 | uint8_t* bytecode, 17 | size_t size); 18 | int LibObj_staticLinkFile(LibObj* self, char* input_file_name); 19 | void LibObj_listModules(LibObj* self); 20 | int LibObj_saveLibraryFile(LibObj* self, char* output_file_name); 21 | int LibObj_loadLibraryFile(LibObj* self, char* input_file_name); 22 | int Lib_loadLibraryFileToArray(char* origin_file_name, char* pikascript_root); 23 | PikaMaker* New_PikaMaker(void); 24 | void pikaMaker_setPWD(PikaMaker* self, char* pwd); 25 | PIKA_RES pikaMaker_compileModule(PikaMaker* self, char* module_name); 26 | int pikaMaker_getDependencies(PikaMaker* self, char* module_name); 27 | void pikaMaker_printStates(PikaMaker* self); 28 | char* pikaMaker_getFirstNocompiled(PikaMaker* self); 29 | PIKA_RES pikaMaker_compileModuleWithDepends(PikaMaker* self, char* module_name); 30 | PIKA_RES pikaMaker_linkCompiledModulesFullPath(PikaMaker* self, char* lib_path); 31 | PIKA_RES pikaMaker_linkCompiledModules(PikaMaker* self, char* lib_name); 32 | int LibObj_loadLibrary(LibObj* self, uint8_t* library_bytes); 33 | 34 | #define LIB_VERSION_NUMBER 2 35 | #define LIB_INFO_BLOCK_SIZE 32 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/PikaVersion.h: -------------------------------------------------------------------------------- 1 | #define PIKA_VERSION_MAJOR 1 2 | #define PIKA_VERSION_MINOR 11 3 | #define PIKA_VERSION_MICRO 5 4 | 5 | #define PIKA_EDIT_TIME "2022/10/24 12:20:33" 6 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/README.md: -------------------------------------------------------------------------------- 1 | # PikaScript 运行时内核 2 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/TinyObj.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #include "PikaObj.h" 29 | 30 | const NativeProperty TinyObjNativeProp = {.super = NULL, 31 | .methodGroup = NULL, 32 | .methodGroupCount = 0}; 33 | 34 | PikaObj* New_TinyObj(Args* args) { 35 | PikaObj* self = New_PikaObj(); 36 | return self; 37 | } 38 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/TinyObj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __TYNYOBJ__H 29 | #define __TYNYOBJ__H 30 | #include "PikaObj.h" 31 | PikaObj* New_TinyObj(Args* args); 32 | #endif 33 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/__instruction_def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 GorgonMeducer ?? embedded_zhuoran@hotmail.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #undef def_ins 29 | 30 | #if defined(__INS_ENUM) 31 | #define def_ins(__INS_NAME) __INS_NAME, 32 | #endif 33 | 34 | #if defined(__INS_TABLE) 35 | #define def_ins(__INS_NAME) [__INS_NAME] = &VM_instruction_handler_##__INS_NAME, 36 | #endif 37 | 38 | #if defined(__INS_COMPIRE) 39 | #define def_ins(__INS_NAME) \ 40 | if (0 == strncmp(ins_str, "" #__INS_NAME "", 3)) { \ 41 | return __INS_NAME; \ 42 | } 43 | #endif 44 | 45 | #if defined(__INS_GET_INS_STR) 46 | #define def_ins(__INS_NAME) \ 47 | if (__INS_NAME == instructUnit_getInstruct(self)){ \ 48 | return ""#__INS_NAME""; \ 49 | } 50 | #endif 51 | 52 | #undef __INS_ENUM 53 | #undef __INS_TABLE 54 | #undef __INS_COMPIRE 55 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/__instruction_table.cfg: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 GorgonMeducer ?? embedded_zhuoran@hotmail.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #include "__instruction_def.h" 29 | 30 | //! just append ins to the end, insert ins would brake the pre-compiled 31 | //! bytecode. 32 | 33 | /* none */ 34 | def_ins(NON) 35 | /* get referance */ 36 | def_ins(REF) 37 | /* run function */ 38 | def_ins(RUN) 39 | /* string */ 40 | def_ins(STR) 41 | /* output */ 42 | def_ins(OUT) 43 | /* number */ 44 | def_ins(NUM) 45 | /* jump */ 46 | def_ins(JMP) 47 | /* jump qual zero */ 48 | def_ins(JEZ) 49 | /* operator */ 50 | def_ins(OPT) 51 | /* define */ 52 | def_ins(DEF) 53 | /* return */ 54 | def_ins(RET) 55 | /* not equal */ 56 | def_ins(NEL) 57 | /* delete */ 58 | def_ins(DEL) 59 | /* exist */ 60 | def_ins(EST) 61 | /* break */ 62 | def_ins(BRK) 63 | /* continue */ 64 | def_ins(CTN) 65 | /* global */ 66 | def_ins(GLB) 67 | /* run as */ 68 | def_ins(RAS) 69 | /* new */ 70 | def_ins(NEW) 71 | /* class */ 72 | def_ins(CLS) 73 | /* bytes */ 74 | def_ins(BYT) 75 | /* list */ 76 | def_ins(LST) 77 | /* import */ 78 | def_ins(IMP) 79 | /* try */ 80 | def_ins(TRY) 81 | /* not try */ 82 | def_ins(NTR) 83 | /* raise */ 84 | def_ins(RIS) 85 | /* get error code */ 86 | def_ins(GER) 87 | /* set error code */ 88 | def_ins(SER) 89 | /* dict */ 90 | def_ins(DCT) 91 | /* slice */ 92 | def_ins(SLC) 93 | /* assert */ 94 | def_ins(ASS) 95 | /* expect */ 96 | def_ins(EXP) 97 | /* jump no zero */ 98 | def_ins(JNZ) 99 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/__pika_ooc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon ?? liang6516@outlook.com 8 | * Copyright (c) 2021 Gorgon Meducer ?? embedded_zhuoran@hotmail.com 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, and to permit persons to whom the Software is 15 | * furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included in 18 | * all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | * SOFTWARE. 27 | */ 28 | 29 | #ifndef __PIKA_OOC_H__ 30 | #define __PIKA_OOC_H__ 31 | #if PIKA_PLOOC_ENABLE 32 | #include "../pikascript-lib/PLOOC/plooc_class.h" 33 | #else 34 | #define private_member(X) X 35 | #endif 36 | #endif 37 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataLink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef _link2__H 29 | #define _link2__H 30 | #include "dataLinkNode.h" 31 | #include "dataMemory.h" 32 | 33 | enum LINK_IS_DEINIT_SELF { 34 | LINK_IS_DEINIT_SELF_ENABLE, 35 | LINK_IS_DEINIT_SELF_DISABLE, 36 | }; 37 | 38 | typedef struct Link Link; 39 | struct Link{ 40 | LinkNode* firstNode; 41 | }; 42 | 43 | void link_deinit(Link* self); 44 | void link_deinit_stack(Link* self); 45 | void link_init(Link* self, void* args); 46 | void link_addNode(Link* self, void* content); 47 | void link_removeNode(Link* self, void* content); 48 | void link_removeNode_notDeinitNode(Link* self, void* content); 49 | LinkNode* link_getNode(Link* self, int64_t id); 50 | int32_t link_getSize(Link* self); 51 | Link* New_link(void* args); 52 | #endif 53 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataLinkNode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #include "dataLinkNode.h" 29 | #include "dataArg.h" 30 | #include "dataMemory.h" 31 | 32 | void linkNode_deinit(LinkNode* self) { 33 | arg_deinit((Arg*)self); 34 | } 35 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataLinkNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef _linkNode__H 29 | #define _linkNode__H 30 | 31 | #include "dataMemory.h" 32 | 33 | typedef struct LinkNode LinkNode; 34 | struct LinkNode { 35 | void* __rsvd; 36 | }; 37 | 38 | void linkNode_deinit(LinkNode* self); 39 | void linkNode_init(LinkNode* self, void* args); 40 | 41 | LinkNode* New_linkNode(void* args); 42 | #endif 43 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataMemory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __MEMORY_H__ 29 | #define __MEMORY_H__ 30 | 31 | #include "PikaPlatform.h" 32 | #include "PikaVersion.h" 33 | 34 | /*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition 35 | */ 36 | #if defined(__DATA_MEMORY_CLASS_IMPLEMENT__) 37 | #define __PLOOC_CLASS_IMPLEMENT__ 38 | #endif 39 | #include "__pika_ooc.h" 40 | 41 | typedef struct { 42 | uint32_t heapUsed; 43 | uint32_t heapUsedMax; 44 | #if PIKA_ARG_CACHE_ENABLE 45 | uint8_t* cache_pool[PIKA_ARG_CACHE_POOL_SIZE]; 46 | uint32_t cache_pool_top; 47 | #endif 48 | uint32_t alloc_times; 49 | uint32_t alloc_times_cache; 50 | } PikaMemInfo; 51 | 52 | typedef uint8_t* BitMap; 53 | 54 | /* clang-format off */ 55 | typedef struct Pool Pool; 56 | struct Pool{ 57 | private_member( 58 | BitMap bitmap; 59 | uint8_t* mem; 60 | uint8_t aline; 61 | uint32_t size; 62 | uint32_t first_free_block; 63 | uint32_t purl_free_block_start; 64 | PIKA_BOOL inited; 65 | ) 66 | }; 67 | /* clang-format on */ 68 | 69 | #define aline_by(size, aline) \ 70 | (((size) == 0) ? 0 : (((size)-1) / (aline) + 1) * (aline)) 71 | 72 | void pikaFree(void* mem, uint32_t size); 73 | void* pikaMalloc(uint32_t size); 74 | uint32_t pikaMemNow(void); 75 | uint32_t pikaMemMax(void); 76 | void pikaMemMaxReset(void); 77 | 78 | BitMap bitmap_init(uint32_t size); 79 | void bitmap_set(BitMap bitmap, uint32_t index, uint8_t bit); 80 | uint8_t bitmap_get(BitMap bitmap, uint32_t index); 81 | uint8_t bitmap_getByte(BitMap bitmap, uint32_t index); 82 | void bitmap_deinit(BitMap bitmap); 83 | 84 | void mem_pool_deinit(void); 85 | void mem_pool_init(void); 86 | 87 | #define mem_align(_size) ((((_size) + 4 - 1) & ~(4 - 1))) 88 | 89 | #undef __DATA_MEMORY_CLASS_IMPLEMENT__ 90 | #endif 91 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataQueue.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #include "dataQueue.h" 29 | #include "PikaPlatform.h" 30 | #include "dataArgs.h" 31 | 32 | void queue_init(Queue* queue) { 33 | args_setInt(queue, "__t", 0); 34 | args_setInt(queue, "__b", 0); 35 | } 36 | 37 | Queue* New_queue(void) { 38 | Args* args = New_args(NULL); 39 | queue_init(args); 40 | return (Queue*)args; 41 | } 42 | 43 | int32_t queue_deinit(Queue* queue) { 44 | Args* args = queue; 45 | args_deinit(args); 46 | return 0; 47 | } 48 | 49 | int32_t queue_pushArg(Queue* queue, Arg* arg) { 50 | Args* args = queue; 51 | uint64_t top = args_getInt(args, "__t"); 52 | /* add top */ 53 | args_setInt(args, "__t", top + 1); 54 | char buff[11]; 55 | arg = arg_setName(arg, fast_itoa(buff, top)); 56 | return args_setArg(args, arg); 57 | } 58 | 59 | Arg* __queue_popArg_noRmoveArg(Queue* queue) { 60 | Args* args = queue; 61 | uint64_t top = args_getInt(args, "__t"); 62 | uint64_t bottom = args_getInt(args, "__b"); 63 | if (top - bottom < 1) { 64 | return NULL; 65 | } 66 | /* add bottom */ 67 | args_setInt(args, "__b", bottom + 1); 68 | char buff[11]; 69 | Arg* res = args_getArg(args, fast_itoa(buff, bottom)); 70 | /* not deinit arg to keep str buff */ 71 | return res; 72 | } 73 | 74 | int32_t queue_pushInt(Queue* queue, int val) { 75 | return queue_pushArg(queue, arg_newInt(val)); 76 | } 77 | 78 | int64_t queue_popInt(Queue* queue) { 79 | return arg_getInt(__queue_popArg_noRmoveArg(queue)); 80 | } 81 | 82 | int32_t queue_pushFloat(Queue* queue, pika_float val) { 83 | return queue_pushArg(queue, arg_newFloat(val)); 84 | } 85 | 86 | pika_float queue_popFloat(Queue* queue) { 87 | return arg_getFloat(__queue_popArg_noRmoveArg(queue)); 88 | } 89 | 90 | int32_t queue_pushStr(Queue* queue, char* str) { 91 | return queue_pushArg(queue, arg_newStr(str)); 92 | } 93 | 94 | char* queue_popStr(Queue* queue) { 95 | return arg_getStr(__queue_popArg_noRmoveArg(queue)); 96 | } 97 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __DATA_QUEUE__H 29 | #define __DATA_QUEUE__H 30 | #include "dataArgs.h" 31 | 32 | typedef Args Queue; 33 | Queue* New_queue(void); 34 | 35 | int32_t queue_deinit(Queue* queue); 36 | int32_t queue_pushInt(Queue* queue, int val); 37 | int32_t queue_pushFloat(Queue* queue, pika_float val); 38 | int32_t queue_pushStr(Queue* queue, char* str); 39 | int32_t queue_pushArg(Queue* queue, Arg* arg); 40 | char* fast_itoa(char* buf, uint32_t val); 41 | 42 | int64_t queue_popInt(Queue* queue); 43 | pika_float queue_popFloat(Queue* queue); 44 | char* queue_popStr(Queue* queue); 45 | Arg* queue_popArg(Queue* queue); 46 | Arg* queue_popArg_notDeinitArg(Queue* queue); 47 | int32_t queue_deinit_stack(Queue* queue); 48 | void queue_init(Queue* queue); 49 | #endif 50 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataQueueObj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __DATA_QUEUE_OBJ__H 29 | #define __DATA_QUEUE_OBJ__H 30 | #include "PikaObj.h" 31 | typedef PikaObj QueueObj; 32 | 33 | QueueObj* New_queueObj(void); 34 | int32_t queueObj_init(QueueObj* self); 35 | 36 | int32_t queueObj_pushInt(QueueObj* self, int val); 37 | int32_t queueObj_pushFloat(QueueObj* self, pika_float val); 38 | int32_t queueObj_pushStr(QueueObj* self, char* str); 39 | int32_t queueObj_pushObj(QueueObj* self, char* className); 40 | 41 | int64_t queueObj_popInt(QueueObj* self); 42 | pika_float queueObj_popFloat(QueueObj* self); 43 | char* queueObj_popStr(QueueObj* self); 44 | PikaObj* queueObj_popObj(QueueObj* self); 45 | 46 | PikaObj* queueObj_getCurrentObj(QueueObj* self); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __DATA_STACK__H 29 | #define __DATA_STACK__H 30 | #include "dataArgs.h" 31 | 32 | typedef struct Stack_t { 33 | Arg* stack_pyload; 34 | Arg* stack_size_array; 35 | uint8_t* sp; 36 | int32_t* sp_size; 37 | int32_t top; 38 | size_t stack_totle_size; 39 | } Stack; 40 | 41 | int32_t stack_deinit(Stack* stack); 42 | 43 | int32_t stack_pushStr(Stack* stack, char* str); 44 | char* stack_popStr(Stack* stack, char* outBuff); 45 | int32_t stack_pushArg(Stack* stack, Arg* arg); 46 | Arg* stack_popArg_alloc(Stack* stack); 47 | Arg* stack_popArg(Stack* stack, Arg* arg_dict); 48 | int32_t stack_getTop(Stack* stack); 49 | int32_t stack_init(Stack* stack); 50 | int32_t stack_popSize(Stack* stack); 51 | void stack_pushSize(Stack* stack, int32_t size); 52 | void stack_reset(Stack* stack); 53 | #endif 54 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataString.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __MY_TEST_TOOLS_H 29 | #define __MY_TEST_TOOLS_H 30 | #include "PikaPlatform.h" 31 | 32 | /* size */ 33 | size_t strGetSize(char* pData); 34 | /* append */ 35 | char* strAppend(char* strOut, char* pData); 36 | char* strAppend_unlimited(char* strOut, char* pData); 37 | char* strAppendWithSize(char* strOut, char* pData, int32_t Size); 38 | /* cut */ 39 | char* strCut(char* strOut, char* strIn, char startSign, char endSign); 40 | /* pika_assert */ 41 | int32_t strIsStartWith(char* str, char* strStart); 42 | int32_t strEqu(char* str1, char* str2); 43 | /* delete */ 44 | char* strDeleteEnter(char* str); 45 | char* strDeleteChar(char* strOut, char* strIn, char ch); 46 | /* prefix */ 47 | char* strRemovePrefix(char* inputStr, char* prefix, char* outputStr); 48 | /* token */ 49 | int32_t strGetToken(char* string, char** argv, char sign); 50 | char* strPopFirstToken(char** strIn, char sign); 51 | int32_t strCountSign(char* strIn, char sign); 52 | int32_t strGetTokenNum(char* strIn, char sign); 53 | char* strGetFirstToken(char* strOut, char* strIn, char sign); 54 | char* strGetLastToken(char* strOut, char* strIn, char sign); 55 | char* strClear(char* str); 56 | int32_t strIsContain(char* str, char ch); 57 | char* strCopy(char* strBuff, char* strIn); 58 | char* strGetLastLine(char* strOut, char* strIn); 59 | char* strPointToLastToken(char* strIn, char sign); 60 | char* strGetLine(char* strOut, char* strIn); 61 | int32_t strGetLineSize(char* str); 62 | char* strPopLastToken(char* strIn, char sign); 63 | char* strGetLastLine(char* strOut, char* strIn); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-core/dataStrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PikaScript project. 3 | * http://github.com/pikastech/pikascript 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | #ifndef __STR_ARGS__H 29 | #define __STR_ARGS__H 30 | #include "dataArgs.h" 31 | Args* New_strBuff(void); 32 | char* strsGetFirstToken(Args* buffs, char* strIn, char sign); 33 | char* strsGetLastToken(Args* buffs, char* arg_Path, char sign); 34 | char* strsPopToken(Args* buffs, char** tokens, char sign); 35 | char* strsCopy(Args* buffs, char* source); 36 | char* strsDeleteChar(Args* buff, char* strIn, char ch); 37 | char* strsCut(Args* buffs, char* strIn, char startSign, char endSign); 38 | char* strsRemovePrefix(Args* buffs, char* inputStr, char* prefix); 39 | char* strsAppend(Args* buffs, char* strOrigin, char* strAppend); 40 | char* strsFormat(Args* buffs, uint16_t buffSize, const char* fmt, ...); 41 | char* strsGetDirectStr(Args* buffs, char* argPath); 42 | Arg* arg_strAppend(Arg* arg_in, char* str_to_append); 43 | char* strsReplace(Args* buffs, char* orig, char* rep, char* with); 44 | char* strsGetLine(Args* buffs, char* code); 45 | void strsDeinit(Args* buffs); 46 | char* strsCacheArg(Args* buffs_p, Arg* arg); 47 | char* strsReturnOut(Args* buffs, Args* outbuffs, char* str); 48 | #endif 49 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/BL808/BL808_GPIO.c: -------------------------------------------------------------------------------- 1 | #include "BL808_GPIO.h" 2 | #include 3 | #include 4 | 5 | void BL808_GPIO_platformDisable(PikaObj* self) {} 6 | 7 | uint32_t getPinMode(char* mode) { 8 | if (strEqu(mode, "out")) { 9 | return GPIO_MODE_OUTPUT; 10 | } 11 | if (strEqu(mode, "in")) { 12 | return GPIO_MODE_INPUT; 13 | } 14 | return NULL; 15 | } 16 | 17 | uint32_t getPinNum(char* pin) { 18 | /* xx */ 19 | char* pin_num = pin + 1; 20 | int pin_num_int = atoi(pin_num); 21 | return pin_num_int; 22 | } 23 | 24 | void BL808_GPIO_platformEnable(PikaObj* self) { 25 | /* Pxx */ 26 | char* pin = obj_getStr(self, "pin"); 27 | char* mode = obj_getStr(self, "mode"); 28 | printf("[ Info]: pin: %s, mode: %s, enable...\r\n", pin, mode); 29 | // char *pull = obj_getStr(self, "pull"); 30 | 31 | GLB_GPIO_Cfg_Type cfg; 32 | cfg.drive = 0; 33 | cfg.smtCtrl = 1; 34 | cfg.gpioFun = GPIO_FUN_GPIO; 35 | cfg.outputMode = 0; 36 | cfg.pullType = GPIO_PULL_NONE; 37 | 38 | cfg.gpioPin = getPinNum(pin); 39 | cfg.gpioMode = getPinMode(mode); 40 | GLB_GPIO_Init(&cfg); 41 | } 42 | 43 | void BL808_GPIO_platformHigh(PikaObj* self) { 44 | char* pin = obj_getStr(self, "pin"); 45 | printf("[ Info]: pin: %s set high...\r\n", pin); 46 | GLB_GPIO_Write(getPinNum(pin), true); 47 | } 48 | 49 | void BL808_GPIO_platformLow(PikaObj* self) { 50 | char* pin = obj_getStr(self, "pin"); 51 | printf("[ Info]: pin: %s set low...\r\n", pin); 52 | GLB_GPIO_Write(getPinNum(pin), false); 53 | } 54 | 55 | void BL808_GPIO_platformRead(PikaObj* self) { 56 | char* pin = obj_getStr(self, "pin"); 57 | obj_setInt(self, "readBuff", GLB_GPIO_Read(getPinNum(pin))); 58 | } 59 | 60 | void BL808_GPIO_platformSetMode(PikaObj* self) { 61 | char* pin = obj_getStr(self, "pin"); 62 | char* mode = obj_getStr(self, "mode"); 63 | 64 | GLB_GPIO_Cfg_Type cfg; 65 | cfg.drive = 0; 66 | cfg.smtCtrl = 1; 67 | cfg.gpioFun = GPIO_FUN_GPIO; 68 | cfg.outputMode = 0; 69 | cfg.pullType = GPIO_PULL_NONE; 70 | 71 | cfg.gpioPin = getPinNum(pin); 72 | cfg.gpioMode = getPinMode(mode); 73 | GLB_GPIO_Init(&cfg); 74 | } 75 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/BL808/BL808_Time.c: -------------------------------------------------------------------------------- 1 | #include "BL808_Time.h" 2 | #include 3 | #include 4 | 5 | void BL808_Time_sleep_ms(PikaObj* self, int ms) { 6 | vTaskDelay(pdMS_TO_TICKS(ms)); 7 | } 8 | 9 | void BL808_Time_sleep_s(PikaObj* self, int s) { 10 | vTaskDelay(pdMS_TO_TICKS(1000 * s)); 11 | } 12 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_ADC.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_ADC.h" 2 | #include "BaseObj.h" 3 | 4 | void PikaStdDevice_ADC_enable(PikaObj* self) { 5 | obj_runNativeMethod(self, "platformEnable", NULL); 6 | } 7 | 8 | void PikaStdDevice_ADC_disable(PikaObj* self) { 9 | obj_runNativeMethod(self, "platformDisable", NULL); 10 | } 11 | 12 | void PikaStdDevice_ADC_init(PikaObj* self) { 13 | obj_setStr(self, "pin", "PA0"); 14 | } 15 | 16 | void PikaStdDevice_ADC___init__(PikaObj* self) { 17 | PikaStdDevice_ADC_init(self); 18 | } 19 | 20 | double PikaStdDevice_ADC_read(PikaObj* self) { 21 | obj_runNativeMethod(self, "platformRead", NULL); 22 | return obj_getFloat(self, "val"); 23 | } 24 | 25 | void PikaStdDevice_ADC_setPin(PikaObj* self, char* pin) { 26 | obj_setStr(self, "pin", pin); 27 | } 28 | 29 | void PikaStdDevice_ADC_platformEnable(PikaObj* self) { 30 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 31 | } 32 | 33 | void PikaStdDevice_ADC_platformDisable(PikaObj* self) { 34 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 35 | } 36 | 37 | void PikaStdDevice_ADC_platformRead(PikaObj* self) { 38 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 39 | } 40 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_BaseDev.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_BaseDev.h" 2 | #include "BaseObj.h" 3 | #include "PikaObj.h" 4 | #include "dataStrs.h" 5 | 6 | #if !(PIKASCRIPT_VERSION_NUM >= PIKASCRIPT_VERSION_TO_NUM(1, 10, 4)) 7 | #error "require pikascript kernal version >= v1.10.4" 8 | #endif 9 | 10 | PikaEventListener* g_pika_device_event_listener; 11 | 12 | void PikaStdDevice_BaseDev_addEventCallBack(PikaObj* self, Arg* eventCallBack) { 13 | #if PIKA_EVENT_ENABLE 14 | obj_setArg(self, "eventCallBack", eventCallBack); 15 | /* init event_listener for the first time */ 16 | if (NULL == g_pika_device_event_listener) { 17 | pks_eventLisener_init(&g_pika_device_event_listener); 18 | } 19 | if (PIKA_RES_OK != obj_runNativeMethod(self, "platformGetEventId", NULL)) { 20 | obj_setErrorCode(self, 1); 21 | __platform_printf("Error: Method %s no found.\r\n", 22 | "platformGetEventId"); 23 | } 24 | uint32_t eventId = obj_getInt(self, "eventId"); 25 | pks_eventLicener_registEvent(g_pika_device_event_listener, eventId, self); 26 | #else 27 | obj_setErrorCode(self, 1); 28 | obj_setSysOut(self, "[error] PIKA_EVENT_ENABLE is disabled."); 29 | #endif 30 | } 31 | 32 | void PikaStdDevice_BaseDev_platformGetEventId(PikaObj* self) { 33 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 34 | } 35 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_CAN.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_CAN.h" 2 | 3 | void PikaStdDevice_CAN___init__(PikaObj* self) {} 4 | 5 | void PikaStdDevice_CAN_addFilter(PikaObj* self, 6 | int hdr, 7 | int id, 8 | int ide, 9 | int mask, 10 | int mode, 11 | int rtr) { 12 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 13 | } 14 | 15 | void PikaStdDevice_CAN_disable(PikaObj* self) { 16 | obj_runNativeMethod(self, "platformDisable", NULL); 17 | } 18 | 19 | void PikaStdDevice_CAN_enable(PikaObj* self) { 20 | obj_runNativeMethod(self, "platformEnable", NULL); 21 | } 22 | 23 | void PikaStdDevice_CAN_setId(PikaObj* self, int id) { 24 | obj_setInt(self, "id", id); 25 | } 26 | 27 | void PikaStdDevice_CAN_setMode(PikaObj* self, char* mode) { 28 | obj_setStr(self, "mode", mode); 29 | } 30 | 31 | void PikaStdDevice_CAN_setName(PikaObj* self, char* name) { 32 | obj_setStr(self, "name", name); 33 | } 34 | 35 | void PikaStdDevice_CAN_setBaudRate(PikaObj* self, int baudRate) { 36 | obj_setInt(self, "baudRate", baudRate); 37 | } 38 | 39 | char* PikaStdDevice_CAN_read(PikaObj* self, int length) { 40 | obj_setInt(self, "length", length); 41 | obj_runNativeMethod(self, "platformRead", NULL); 42 | return obj_getStr(self, "readData"); 43 | } 44 | 45 | Arg* PikaStdDevice_CAN_readBytes(PikaObj *self, int length){ 46 | obj_setInt(self, "length", length); 47 | obj_runNativeMethod(self, "platformReadBytes", NULL); 48 | return arg_copy(obj_getArg(self, "readData")); 49 | } 50 | 51 | void PikaStdDevice_CAN_write(PikaObj* self, char* data) { 52 | obj_setStr(self, "writeData", data); 53 | obj_runNativeMethod(self, "platformWrite", NULL); 54 | } 55 | 56 | void PikaStdDevice_CAN_writeBytes(PikaObj *self, uint8_t* data, int length){ 57 | obj_setBytes(self, "writeData", data, length); 58 | obj_runNativeMethod(self, "platformWriteBytes", NULL); 59 | } 60 | 61 | void PikaStdDevice_CAN_platformDisable(PikaObj* self) { 62 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 63 | } 64 | 65 | void PikaStdDevice_CAN_platformEnable(PikaObj* self) { 66 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 67 | } 68 | 69 | void PikaStdDevice_CAN_platformRead(PikaObj* self) { 70 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 71 | } 72 | 73 | void PikaStdDevice_CAN_platformWrite(PikaObj* self) { 74 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 75 | } 76 | 77 | void PikaStdDevice_CAN_platformReadBytes(PikaObj *self){ 78 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 79 | } 80 | 81 | void PikaStdDevice_CAN_platformWriteBytes(PikaObj *self){ 82 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 83 | } 84 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_IIC.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_IIC.h" 2 | #include "BaseObj.h" 3 | #include "PikaObj.h" 4 | void PikaStdDevice_IIC_init(PikaObj* self) { 5 | obj_setInt(self, "deviceAddr", 0); 6 | obj_setStr(self, "SCLpin", "PA0"); 7 | obj_setStr(self, "SDApin", "PA1"); 8 | } 9 | 10 | void PikaStdDevice_IIC___init__(PikaObj* self) { 11 | PikaStdDevice_IIC_init(self); 12 | } 13 | 14 | void PikaStdDevice_IIC_enable(PikaObj* self) { 15 | obj_runNativeMethod(self, "platformEnable", NULL); 16 | } 17 | 18 | void PikaStdDevice_IIC_disable(PikaObj* self) { 19 | obj_runNativeMethod(self, "platformDisable", NULL); 20 | } 21 | 22 | void PikaStdDevice_IIC_setDeviceAddr(PikaObj* self, int addr) { 23 | obj_setInt(self, "deviceAddr", addr); 24 | } 25 | 26 | void PikaStdDevice_IIC_setPinSCL(PikaObj* self, char* pin) { 27 | obj_setStr(self, "SCLpin", pin); 28 | } 29 | 30 | void PikaStdDevice_IIC_setPinSDA(PikaObj* self, char* pin) { 31 | obj_setStr(self, "SDApin", pin); 32 | } 33 | 34 | void PikaStdDevice_IIC_write(PikaObj* self, int addr, char* data) { 35 | obj_setStr(self, "writeData", data); 36 | obj_setInt(self, "writeAddr", addr); 37 | obj_runNativeMethod(self, "platformWrite", NULL); 38 | } 39 | 40 | void PikaStdDevice_IIC_writeBytes(PikaObj* self, 41 | int addr, 42 | uint8_t* data, 43 | int length) { 44 | obj_setBytes(self, "writeData", data, length); 45 | obj_setInt(self, "writeAddr", addr); 46 | obj_runNativeMethod(self, "platformWriteBytes", NULL); 47 | } 48 | 49 | char* PikaStdDevice_IIC_read(PikaObj* self, int addr, int length) { 50 | obj_setInt(self, "length", length); 51 | obj_setInt(self, "readAddr", addr); 52 | obj_runNativeMethod(self, "platformRead", NULL); 53 | return obj_getStr(self, "readData"); 54 | } 55 | 56 | Arg* PikaStdDevice_IIC_readBytes(PikaObj* self, int addr, int length) { 57 | obj_setInt(self, "length", length); 58 | obj_setInt(self, "readAddr", addr); 59 | obj_runNativeMethod(self, "platformReadBytes", NULL); 60 | return arg_copy(obj_getArg(self, "readData")); 61 | } 62 | 63 | void PikaStdDevice_IIC_platformWrite(PikaObj* self) { 64 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 65 | } 66 | 67 | void PikaStdDevice_IIC_platformEnable(PikaObj* self) { 68 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 69 | } 70 | 71 | void PikaStdDevice_IIC_platformDisable(PikaObj* self) { 72 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 73 | } 74 | 75 | void PikaStdDevice_IIC_platformRead(PikaObj* self) { 76 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 77 | } 78 | 79 | void PikaStdDevice_IIC_platformReadBytes(PikaObj* self) { 80 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 81 | } 82 | 83 | void PikaStdDevice_IIC_platformWriteBytes(PikaObj* self) { 84 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 85 | } 86 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_PWM.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_PWM.h" 2 | #include "BaseObj.h" 3 | 4 | void PikaStdDevice_PWM_init(PikaObj* self) { 5 | obj_setStr(self, "pin", "none"); 6 | obj_setStr(self, "name", "none"); 7 | obj_setInt(self, "freq", 1000); 8 | obj_setInt(self, "ch", 0); 9 | obj_setFloat(self, "duty", 0.5f); 10 | } 11 | 12 | void PikaStdDevice_PWM___init__(PikaObj* self) { 13 | PikaStdDevice_PWM_init(self); 14 | } 15 | 16 | void PikaStdDevice_PWM_setPin(PikaObj* self, char* pin) { 17 | obj_setStr(self, "pin", pin); 18 | } 19 | 20 | void PikaStdDevice_PWM_setFrequency(PikaObj* self, int freq) { 21 | obj_setInt(self, "freq", freq); 22 | obj_runNativeMethod(self, "platformSetFrequency",NULL); 23 | } 24 | 25 | void PikaStdDevice_PWM_setDuty(PikaObj* self, double duty) { 26 | obj_setFloat(self, "duty", duty); 27 | obj_runNativeMethod(self, "platformSetDuty",NULL); 28 | } 29 | 30 | void PikaStdDevice_PWM_enable(PikaObj* self) { 31 | obj_runNativeMethod(self, "platformEnable",NULL); 32 | } 33 | 34 | void PikaStdDevice_PWM_disable(PikaObj *self){ 35 | obj_runNativeMethod(self, "platformDisable",NULL); 36 | } 37 | 38 | double PikaStdDevice_PWM_getDuty(PikaObj* self) { 39 | return obj_getFloat(self, "duty"); 40 | } 41 | 42 | int PikaStdDevice_PWM_getFrequency(PikaObj* self) { 43 | return obj_getInt(self, "freq"); 44 | } 45 | 46 | void PikaStdDevice_PWM_platformEnable(PikaObj* self) { 47 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 48 | } 49 | void PikaStdDevice_PWM_platformSetDuty(PikaObj* self) { 50 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 51 | } 52 | void PikaStdDevice_PWM_platformSetFrequency(PikaObj* self) { 53 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 54 | } 55 | 56 | void PikaStdDevice_PWM_platformDisable(PikaObj *self){ 57 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 58 | } 59 | 60 | char* PikaStdDevice_PWM_getName(PikaObj* self) { 61 | return obj_getStr(self, "name"); 62 | } 63 | 64 | void PikaStdDevice_PWM_setName(PikaObj* self, char* name) { 65 | obj_setStr(self, "name", name); 66 | } 67 | 68 | void PikaStdDevice_PWM_setChannel(PikaObj* self, int ch) { 69 | obj_setInt(self, "ch", ch); 70 | } 71 | 72 | int PikaStdDevice_PWM_getChannel(PikaObj* self) { 73 | return obj_getInt(self, "ch"); 74 | } 75 | 76 | void PikaStdDevice_PWM_setFreq(PikaObj* self, int freq) { 77 | PikaStdDevice_PWM_setFrequency(self, freq); 78 | } 79 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_SPI.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_SPI.h" 2 | #include "BaseObj.h" 3 | #include "PikaObj.h" 4 | void PikaStdDevice_SPI___init__(PikaObj* self) { 5 | obj_setInt(self, "baudRate", 1000); 6 | obj_setInt(self, "id", 0); 7 | obj_setStr(self, "name", "none"); 8 | obj_setInt(self, "phase", 0); 9 | obj_setStr(self, "MISOpin", "none"); 10 | obj_setStr(self, "MOSIpin", "none"); 11 | obj_setStr(self, "SCKpin", "none"); 12 | obj_setInt(self, "polarity", 0); 13 | } 14 | 15 | void PikaStdDevice_SPI_disable(PikaObj* self) { 16 | obj_runNativeMethod(self, "platformDisable", NULL); 17 | } 18 | 19 | void PikaStdDevice_SPI_enable(PikaObj* self) { 20 | obj_runNativeMethod(self, "platformEnable", NULL); 21 | } 22 | 23 | void PikaStdDevice_SPI_write(PikaObj* self, char* data) { 24 | obj_setStr(self, "writeData", data); 25 | obj_runNativeMethod(self, "platformWrite", NULL); 26 | } 27 | 28 | void PikaStdDevice_SPI_writeBytes(PikaObj* self, uint8_t* data, int length) { 29 | obj_setBytes(self, "writeData", data, length); 30 | obj_runNativeMethod(self, "platformWriteBytes", NULL); 31 | } 32 | 33 | char* PikaStdDevice_SPI_read(PikaObj* self, int length) { 34 | obj_setInt(self, "length", length); 35 | obj_runNativeMethod(self, "platformRead", NULL); 36 | return obj_getStr(self, "readData"); 37 | } 38 | 39 | Arg* PikaStdDevice_SPI_readBytes(PikaObj* self, int length) { 40 | obj_setInt(self, "length", length); 41 | obj_runNativeMethod(self, "platformReadBytes", NULL); 42 | return arg_copy(obj_getArg(self, "readData")); 43 | } 44 | 45 | void PikaStdDevice_SPI_setBaudRate(PikaObj* self, int baudRate) { 46 | obj_setInt(self, "baudRate", baudRate); 47 | } 48 | 49 | void PikaStdDevice_SPI_setId(PikaObj* self, int id) { 50 | obj_setInt(self, "id", id); 51 | } 52 | 53 | void PikaStdDevice_SPI_setName(PikaObj* self, char* name) { 54 | obj_setStr(self, "name", name); 55 | } 56 | 57 | void PikaStdDevice_SPI_setPhase(PikaObj* self, int phase) { 58 | obj_setInt(self, "phase", phase); 59 | } 60 | 61 | void PikaStdDevice_SPI_setPinMISO(PikaObj* self, char* pin) { 62 | obj_setStr(self, "MISOpin", pin); 63 | } 64 | 65 | void PikaStdDevice_SPI_setPinMOSI(PikaObj* self, char* pin) { 66 | obj_setStr(self, "MOSIpin", pin); 67 | } 68 | 69 | void PikaStdDevice_SPI_setPinSCK(PikaObj* self, char* pin) { 70 | obj_setStr(self, "SCKpin", pin); 71 | } 72 | 73 | void PikaStdDevice_SPI_setPolarity(PikaObj* self, int polarity) { 74 | obj_setInt(self, "polarity", polarity); 75 | } 76 | 77 | void PikaStdDevice_SPI_platformDisable(PikaObj* self) { 78 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 79 | } 80 | 81 | void PikaStdDevice_SPI_platformEnable(PikaObj* self) { 82 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 83 | } 84 | 85 | void PikaStdDevice_SPI_platformWrite(PikaObj* self) { 86 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 87 | } 88 | 89 | void PikaStdDevice_SPI_platformRead(PikaObj* self) { 90 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 91 | } 92 | 93 | void PikaStdDevice_SPI_platformWriteBytes(PikaObj* self) { 94 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 95 | } 96 | 97 | void PikaStdDevice_SPI_platformReadBytes(PikaObj* self) { 98 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 99 | } 100 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdDevice/PikaStdDevice_UART.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdDevice_UART.h" 2 | #include "BaseObj.h" 3 | 4 | void PikaStdDevice_UART_enable(PikaObj* self) { 5 | obj_runNativeMethod(self, "platformEnable", NULL); 6 | } 7 | 8 | void PikaStdDevice_UART_disable(PikaObj *self){ 9 | obj_runNativeMethod(self, "platformDisable", NULL); 10 | } 11 | 12 | void PikaStdDevice_UART_init(PikaObj* self) { 13 | obj_setInt(self, "baudRate", 115200); 14 | obj_setInt(self, "id", 1); 15 | obj_setStr(self, "readBuff", ""); 16 | } 17 | 18 | void PikaStdDevice_UART___init__(PikaObj* self) { 19 | PikaStdDevice_UART_init(self); 20 | } 21 | 22 | char* PikaStdDevice_UART_read(PikaObj* self, int length) { 23 | obj_setInt(self, "length", length); 24 | obj_runNativeMethod(self, "platformRead", NULL); 25 | return obj_getStr(self, "readData"); 26 | } 27 | 28 | Arg* PikaStdDevice_UART_readBytes(PikaObj *self, int length){ 29 | obj_setInt(self, "length", length); 30 | obj_runNativeMethod(self, "platformReadBytes", NULL); 31 | return arg_copy(obj_getArg(self, "readData")); 32 | } 33 | 34 | void PikaStdDevice_UART_setBaudRate(PikaObj* self, int baudRate) { 35 | obj_setInt(self, "baudRate", baudRate); 36 | } 37 | void PikaStdDevice_UART_setId(PikaObj* self, int id) { 38 | obj_setInt(self, "id", id); 39 | } 40 | void PikaStdDevice_UART_write(PikaObj* self, char* data) { 41 | obj_setStr(self, "writeData", data); 42 | obj_runNativeMethod(self, "platformWrite", NULL); 43 | } 44 | 45 | void PikaStdDevice_UART_writeBytes(PikaObj *self, uint8_t* data, int length){ 46 | obj_setBytes(self, "writeData", data, length); 47 | obj_runNativeMethod(self, "platformWriteBytes", NULL); 48 | } 49 | 50 | void PikaStdDevice_UART_platformEnable(PikaObj* self) { 51 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 52 | } 53 | void PikaStdDevice_UART_platformRead(PikaObj* self) { 54 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 55 | } 56 | void PikaStdDevice_UART_platformWrite(PikaObj* self) { 57 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 58 | } 59 | 60 | void PikaStdDevice_UART_platformDisable(PikaObj *self){ 61 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 62 | } 63 | 64 | void PikaStdDevice_UART_platformReadBytes(PikaObj *self){ 65 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 66 | } 67 | 68 | void PikaStdDevice_UART_platformWriteBytes(PikaObj *self){ 69 | ABSTRACT_METHOD_NEED_OVERRIDE_ERROR(); 70 | } 71 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaDebuger_Debuger.c: -------------------------------------------------------------------------------- 1 | #include "PikaVM.h" 2 | #include "dataStrs.h" 3 | 4 | extern volatile PikaObj* __pikaMain; 5 | static enum shell_state __obj_shellLineHandler_debug( 6 | PikaObj* self, 7 | char* input_line, 8 | struct ShellConfig* config) { 9 | /* continue */ 10 | if (strEqu("c", input_line)) { 11 | return SHELL_STATE_EXIT; 12 | } 13 | /* next */ 14 | if (strEqu("n", input_line)) { 15 | return SHELL_STATE_EXIT; 16 | } 17 | /* launch shell */ 18 | if (strEqu("sh", input_line)) { 19 | /* exit pika shell */ 20 | pikaScriptShell((PikaObj*)__pikaMain); 21 | return SHELL_STATE_CONTINUE; 22 | } 23 | /* quit */ 24 | if (strEqu("q", input_line)) { 25 | obj_setInt(self, "enable", 0); 26 | return SHELL_STATE_EXIT; 27 | } 28 | /* print */ 29 | if (strIsStartWith(input_line, "p ")) { 30 | char* path = input_line + 2; 31 | Arg* asm_buff = arg_newStr("B0\n1 REF "); 32 | asm_buff = arg_strAppend(asm_buff, path); 33 | asm_buff = arg_strAppend(asm_buff, "\n0 RUN print\n"); 34 | pikaVM_runAsm((PikaObj*)__pikaMain, arg_getStr(asm_buff)); 35 | arg_deinit(asm_buff); 36 | return SHELL_STATE_CONTINUE; 37 | } 38 | obj_run((PikaObj*)__pikaMain, input_line); 39 | return SHELL_STATE_CONTINUE; 40 | } 41 | 42 | void PikaDebug_Debuger___init__(PikaObj* self) { 43 | /* global enable contral */ 44 | obj_setInt(self, "enable", 1); 45 | } 46 | 47 | void PikaDebug_Debuger_set_trace(PikaObj* self) { 48 | if (!obj_getInt(self, "enable")) { 49 | return; 50 | } 51 | struct ShellConfig cfg = { 52 | .prefix = "(pika-debug) ", 53 | .handler = __obj_shellLineHandler_debug, 54 | }; 55 | obj_shellLineProcess(self, &cfg); 56 | } 57 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdData_ByteArray.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdData_ByteArray.h" 2 | 3 | void PikaStdData_ByteArray___init__(PikaObj* self, Arg* bytes) { 4 | obj_setArg(self, "raw", bytes); 5 | } 6 | 7 | Arg* PikaStdData_ByteArray___iter__(PikaObj* self) { 8 | obj_setInt(self, "__iter_i", 0); 9 | return arg_newRef(self); 10 | } 11 | 12 | Arg* PikaStdData_ByteArray___next__(PikaObj* self) { 13 | int __iter_i = args_getInt(self->list, "__iter_i"); 14 | uint8_t* data = obj_getBytes(self, "raw"); 15 | uint16_t len = obj_getBytesSize(self, "raw"); 16 | Arg* res = NULL; 17 | char char_buff[] = " "; 18 | if (__iter_i < len) { 19 | char_buff[0] = data[__iter_i]; 20 | res = arg_newInt(char_buff[0]); 21 | } else { 22 | return arg_newNull(); 23 | } 24 | args_setInt(self->list, "__iter_i", __iter_i + 1); 25 | return res; 26 | } 27 | 28 | int PikaStdData_ByteArray___getitem__(PikaObj* self, int __key) { 29 | uint8_t* data = obj_getBytes(self, "raw"); 30 | uint16_t len = obj_getBytesSize(self, "raw"); 31 | if (__key < len) { 32 | return data[__key]; 33 | } else { 34 | return 0; 35 | } 36 | } 37 | 38 | void PikaStdData_ByteArray___setitem__(PikaObj* self, int __key, int __val) { 39 | uint8_t* data = obj_getBytes(self, "raw"); 40 | uint16_t len = obj_getBytesSize(self, "raw"); 41 | if (__key < len) { 42 | data[__key] = __val; 43 | } 44 | } 45 | 46 | char* PikaStdData_ByteArray___str__(PikaObj* self) { 47 | uint8_t* data = obj_getBytes(self, "raw"); 48 | uint16_t len = obj_getBytesSize(self, "raw"); 49 | Arg* str_arg = arg_newStr(""); 50 | str_arg = arg_strAppend(str_arg, "bytearray(b'"); 51 | for (int i = 0; i < len; i++) { 52 | char u8_str[] = "\\x00"; 53 | uint8_t u8 = data[i]; 54 | __platform_sprintf(u8_str, "\\x%02x", u8); 55 | str_arg = arg_strAppend(str_arg, u8_str); 56 | } 57 | str_arg = arg_strAppend(str_arg, "')"); 58 | obj_removeArg(self, "_buf"); 59 | obj_setStr(self, "_buf", arg_getStr(str_arg)); 60 | arg_deinit(str_arg); 61 | return obj_getStr(self, "_buf"); 62 | } 63 | 64 | char* PikaStdData_ByteArray_decode(PikaObj* self) { 65 | uint8_t* data = obj_getBytes(self, "raw"); 66 | Arg* str_arg = arg_newStr((char*)data); 67 | obj_removeArg(self, "_buf"); 68 | obj_setStr(self, "_buf", arg_getStr(str_arg)); 69 | arg_deinit(str_arg); 70 | return obj_getStr(self, "_buf"); 71 | } 72 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdData_List.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdData_List.h" 2 | #include "BaseObj.h" 3 | #include "PikaObj.h" 4 | #include "PikaStdData_Tuple.h" 5 | #include "dataStrs.h" 6 | 7 | void PikaStdData_List_append(PikaObj* self, Arg* arg) { 8 | __vm_List_append(self, arg); 9 | } 10 | 11 | void PikaStdData_List_set(PikaObj* self, int i, Arg* arg) { 12 | PikaList* list = obj_getPtr(self, "list"); 13 | if (PIKA_RES_OK != list_setArg(list, i, arg)) { 14 | obj_setErrorCode(self, 1); 15 | obj_setSysOut(self, "Error: index exceeded lengh of list."); 16 | } 17 | } 18 | 19 | void PikaStdData_List___setitem__(PikaObj* self, Arg* __key, Arg* __val) { 20 | PikaStdData_List_set(self, obj_getInt(self, "__key"), 21 | obj_getArg(self, "__val")); 22 | } 23 | 24 | void PikaStdData_List___init__(PikaObj* self) { 25 | __vm_List___init__(self); 26 | } 27 | 28 | char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg); 29 | char* PikaStdData_List___str__(PikaObj* self) { 30 | Arg* str_arg = arg_newStr("["); 31 | PikaList* list = obj_getPtr(self, "list"); 32 | 33 | int i = 0; 34 | while (PIKA_TRUE) { 35 | Arg* item = list_getArg(list, i); 36 | if (NULL == item) { 37 | break; 38 | } 39 | if (i != 0) { 40 | str_arg = arg_strAppend(str_arg, ", "); 41 | } 42 | char* item_str = PikaStdLib_SysObj_str(self, item); 43 | if (arg_getType(item) == ARG_TYPE_STRING) { 44 | str_arg = arg_strAppend(str_arg, "'"); 45 | } 46 | str_arg = arg_strAppend(str_arg, item_str); 47 | if (arg_getType(item) == ARG_TYPE_STRING) { 48 | str_arg = arg_strAppend(str_arg, "'"); 49 | } 50 | i++; 51 | } 52 | 53 | str_arg = arg_strAppend(str_arg, "]"); 54 | obj_setStr(self, "_buf", arg_getStr(str_arg)); 55 | arg_deinit(str_arg); 56 | return obj_getStr(self, "_buf"); 57 | } 58 | 59 | void PikaStdData_List_reverse(PikaObj* self) { 60 | PikaList* list = obj_getPtr(self, "list"); 61 | list_reverse(list); 62 | } 63 | 64 | PikaObj* PikaStdData_List___add__(PikaObj* self, PikaObj* others) { 65 | PikaObj* res = newNormalObj(New_PikaStdData_List); 66 | PikaStdData_List___init__(res); 67 | PikaList* list_res = obj_getPtr(res, "list"); 68 | PikaList* list1 = obj_getPtr(self, "list"); 69 | PikaList* list2 = obj_getPtr(others, "list"); 70 | for (size_t i = 0; i < list_getSize(list1); i++) { 71 | Arg* arg = list_getArg(list1, i); 72 | list_append(list_res, arg); 73 | } 74 | for (size_t i = 0; i < list_getSize(list2); i++) { 75 | Arg* arg = list_getArg(list2, i); 76 | list_append(list_res, arg); 77 | } 78 | return res; 79 | } 80 | 81 | void PikaStdData_List_insert(PikaObj *self, int i, Arg* arg){ 82 | PikaList* list = obj_getPtr(self, "list"); 83 | if (PIKA_RES_OK != list_insert(list, i, arg)) { 84 | obj_setErrorCode(self, 1); 85 | obj_setSysOut(self, "Error: index exceeded lengh of list."); 86 | } 87 | } 88 | 89 | Arg* PikaStdData_List_pop(PikaObj *self){ 90 | PikaList* list = obj_getPtr(self, "list"); 91 | return list_pop(list); 92 | } 93 | 94 | void PikaStdData_List_remove(PikaObj *self, Arg* val){ 95 | PikaList* list = obj_getPtr(self, "list"); 96 | list_remove(list, val); 97 | } 98 | 99 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdData_String_Util.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if PIKA_STRING_UTF8_ENABLE 4 | 5 | int _valid_utf8(const char *string, int length); 6 | int _utf8_get(const char *string, int length, int at, char *out_buf); 7 | int _utf8_get_offset(const char *string, int length, int at, int *out_char_len); 8 | int _utf8_strlen(const char *string, int length); 9 | int __str_repl(PikaObj *self, char *str, int str_len, int repl_at, int repl_len, char *val, int val_len); 10 | 11 | int __utf8_to_utf32_LE_withBOM(const char *utf8, int len, char *out_buf); 12 | int __utf8_to_utf32_LE_noBOM(const char *utf8, int len, char *out_buf); 13 | int __utf8_to_utf32_LE_noBOM_get_size(const char *utf8, int len); 14 | 15 | int __utf8_to_utf16_LE_withBOM(const char *utf8, int len, char *out_buf); 16 | int __utf8_to_utf16_LE_noBOM(const char *utf8, int len, char *out_buf); 17 | int __utf8_to_utf16_LE_noBOM_get_size(const char *utf8, int len); 18 | Arg* _str_encode(char*str, char*encoding); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdData_Tuple.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdData_Tuple.h" 2 | #include "PikaVM.h" 3 | #include "dataStrs.h" 4 | 5 | int PikaStdData_Tuple_len(PikaObj* self) { 6 | PikaList* list = obj_getPtr(self, "list"); 7 | return list_getSize(list); 8 | } 9 | 10 | Arg* PikaStdData_Tuple_get(PikaObj* self, int i) { 11 | PikaList* list = obj_getPtr(self, "list"); 12 | return arg_copy(list_getArg(list, i)); 13 | } 14 | 15 | void PikaStdData_Tuple___init__(PikaObj* self) { 16 | __vm_List___init__(self); 17 | } 18 | 19 | Arg* PikaStdData_Tuple___iter__(PikaObj* self) { 20 | obj_setInt(self, "__iter_i", 0); 21 | return arg_newRef(self); 22 | } 23 | 24 | Arg* PikaStdData_Tuple___next__(PikaObj* self) { 25 | int __iter_i = args_getInt(self->list, "__iter_i"); 26 | Arg* res = PikaStdData_Tuple_get(self, __iter_i); 27 | if (NULL == res) { 28 | return arg_newNull(); 29 | } 30 | args_setInt(self->list, "__iter_i", __iter_i + 1); 31 | return res; 32 | } 33 | 34 | Arg* PikaStdData_Tuple___getitem__(PikaObj* self, Arg* __key) { 35 | return PikaStdData_Tuple_get(self, obj_getInt(self, "__key")); 36 | } 37 | 38 | void PikaStdData_Tuple___del__(PikaObj* self) { 39 | Args* list = obj_getPtr(self, "list"); 40 | args_deinit(list); 41 | } 42 | 43 | char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg); 44 | char* PikaStdData_Tuple___str__(PikaObj* self) { 45 | Arg* str_arg = arg_newStr("("); 46 | PikaList* list = obj_getPtr(self, "list"); 47 | 48 | int i = 0; 49 | while (PIKA_TRUE) { 50 | Arg* item = list_getArg(list, i); 51 | if (NULL == item) { 52 | break; 53 | } 54 | if (i != 0) { 55 | str_arg = arg_strAppend(str_arg, ", "); 56 | } 57 | char* item_str = PikaStdLib_SysObj_str(self, item); 58 | if (arg_getType(item) == ARG_TYPE_STRING) { 59 | str_arg = arg_strAppend(str_arg, "'"); 60 | } 61 | str_arg = arg_strAppend(str_arg, item_str); 62 | if (arg_getType(item) == ARG_TYPE_STRING) { 63 | str_arg = arg_strAppend(str_arg, "'"); 64 | } 65 | i++; 66 | } 67 | 68 | str_arg = arg_strAppend(str_arg, ")"); 69 | obj_setStr(self, "_buf", arg_getStr(str_arg)); 70 | arg_deinit(str_arg); 71 | return obj_getStr(self, "_buf"); 72 | } 73 | 74 | int PikaStdData_Tuple___len__(PikaObj* self) { 75 | return PikaStdData_Tuple_len(self); 76 | } 77 | 78 | int PikaStdData_Tuple___contains__(PikaObj* self, Arg* val) { 79 | PikaList* list = obj_getPtr(self, "list"); 80 | for (size_t i = 0; i < list_getSize(list); i++) { 81 | Arg* arg = list_getArg(list, i); 82 | if (arg_isEqual(arg, val)) { 83 | return 1; 84 | } 85 | } 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdData_Utils.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdData_Utils.h" 2 | #include "dataStrs.h" 3 | 4 | Arg* PikaStdData_Utils_int_to_bytes(PikaObj* self, int val) { 5 | if (val > 0xFF) { 6 | obj_setErrorCode(self, 1); 7 | __platform_printf( 8 | "OverflowError: cannot convert value larger than 0xFF to " 9 | "bytes\r\n"); 10 | return arg_newNull(); 11 | } 12 | uint8_t val_bytes = (uint8_t)val; 13 | return arg_newBytes(&val_bytes, 1); 14 | } 15 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_MemChecker.c: -------------------------------------------------------------------------------- 1 | #include "PikaStdLib_MemChecker.h" 2 | #include "BaseObj.h" 3 | #include "dataStrs.h" 4 | 5 | void PikaStdLib_MemChecker_max(PikaObj* self) { 6 | __platform_printf("%0.2f kB\r\n", pikaMemMax() / 1024.0); 7 | } 8 | 9 | void PikaStdLib_MemChecker_now(PikaObj* self) { 10 | __platform_printf("%0.2f kB\r\n", pikaMemNow() / 1024.0); 11 | } 12 | 13 | void PikaStdLib_MemChecker_resetMax(PikaObj* self) { 14 | pikaMemMaxReset(); 15 | } 16 | 17 | pika_float PikaStdLib_MemChecker_getMax(PikaObj* self) { 18 | return pikaMemMax() / 1024.0; 19 | } 20 | 21 | pika_float PikaStdLib_MemChecker_getNow(PikaObj* self) { 22 | return pikaMemNow() / 1024.0; 23 | } 24 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_RangeObj.c: -------------------------------------------------------------------------------- 1 | #include "PikaObj.h" 2 | 3 | Arg* PikaStdLib_RangeObj___next__(PikaObj* self) { 4 | RangeData* _ = (RangeData*)args_getStruct(self->list, "_"); 5 | int end = _->end; 6 | int step = _->step; 7 | /* exit */ 8 | if (_->i >= end) { 9 | return arg_newNull(); 10 | } 11 | Arg* res = arg_newInt(_->i); 12 | _->i += step; 13 | return res; 14 | } 15 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/PikaStdLib/PikaStdLib_StringObj.c: -------------------------------------------------------------------------------- 1 | #include "PikaObj.h" 2 | 3 | Arg* PikaStdLib_StringObj___next__(PikaObj* self) { 4 | return arg_newNull(); 5 | } 6 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/pika_lvgl/pika_lv_point_t.c: -------------------------------------------------------------------------------- 1 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 2 | #include "lvgl.h" 3 | #else 4 | #include "../../lvgl.h" 5 | #endif 6 | 7 | #ifdef PIKASCRIPT 8 | 9 | #include "pika_lvgl_point_t.h" 10 | 11 | void pika_lvgl_point_t___init__(PikaObj* self) { 12 | lv_point_t lv_point = {0}; 13 | args_setStruct(self->list, "lv_point_struct", lv_point); 14 | obj_setPtr(self, "lv_point", args_getStruct(self->list, "lv_point_struct")); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/pika_lvgl/pika_lv_timer_t.c: -------------------------------------------------------------------------------- 1 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 2 | #include "lvgl.h" 3 | #else 4 | #include "../../lvgl.h" 5 | #endif 6 | 7 | #ifdef PIKASCRIPT 8 | 9 | #include "pika_lvgl_lv_timer_t.h" 10 | 11 | PikaEventListener* g_pika_lv_timer_event_listener; 12 | void __pika_timer_cb(lv_timer_t* timer) { 13 | PikaObj* eventHandleObj = pks_eventLisener_getEventHandleObj( 14 | g_pika_lv_timer_event_listener, (uint32_t)timer); 15 | obj_newDirectObj(eventHandleObj, "timer", New_pika_lvgl_lv_timer_t); 16 | obj_setPtr(obj_getPtr(eventHandleObj, "timer"), "lv_timer", timer); 17 | obj_run(eventHandleObj, "eventCallBack(timer)"); 18 | } 19 | 20 | void pika_lvgl_lv_timer_t_set_period(PikaObj* self, int period) { 21 | lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer"); 22 | lv_timer_set_period(lv_timer, period); 23 | } 24 | 25 | void pika_lvgl_lv_timer_t_set_cb(PikaObj* self, Arg* cb) { 26 | lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer"); 27 | lv_timer_set_cb(lv_timer, __pika_timer_cb); 28 | 29 | obj_setArg(self, "eventCallBack", cb); 30 | /* init event_listener for the first time */ 31 | if (NULL == g_pika_lv_timer_event_listener) { 32 | pks_eventLisener_init(&g_pika_lv_timer_event_listener); 33 | } 34 | pks_eventLicener_registEvent(g_pika_lv_timer_event_listener, 35 | (uint32_t)lv_timer, self); 36 | 37 | } 38 | 39 | void pika_lvgl_lv_timer_t__del(PikaObj* self) { 40 | lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer"); 41 | lv_timer_del(lv_timer); 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/pika_lvgl/pika_lvgl_indev_t.c: -------------------------------------------------------------------------------- 1 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 2 | #include "lvgl.h" 3 | #else 4 | #include "../../lvgl.h" 5 | #endif 6 | 7 | #ifdef PIKASCRIPT 8 | 9 | #include "pika_lvgl_indev_t.h" 10 | 11 | void pika_lvgl_indev_t_get_vect(PikaObj* self, PikaObj* point) { 12 | lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev"); 13 | lv_point_t* lv_point = obj_getPtr(point, "lv_point"); 14 | lv_indev_get_vect(lv_indev, lv_point); 15 | obj_setInt(point, "x", lv_point->x); 16 | obj_setInt(point, "y", lv_point->y); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/pikascript-lib/pika_lvgl/pika_lvgl_lv_event.c: -------------------------------------------------------------------------------- 1 | #if defined(LV_LVGL_H_INCLUDE_SIMPLE) 2 | #include "lvgl.h" 3 | #else 4 | #include "../../lvgl.h" 5 | #endif 6 | 7 | #ifdef PIKASCRIPT 8 | 9 | #include "pika_lvgl_lv_event.h" 10 | 11 | int pika_lvgl_lv_event_get_code(PikaObj *self){ 12 | lv_event_t *lv_event = obj_getPtr(self, "lv_event"); 13 | return lv_event_get_code(lv_event); 14 | } 15 | 16 | PikaObj *New_pika_lvgl_lv_obj(Args *args); 17 | PikaObj* pika_lvgl_lv_event_get_target(PikaObj *self){ 18 | lv_event_t *lv_event = obj_getPtr(self, "lv_event"); 19 | lv_obj_t* lv_obj = lv_event_get_target(lv_event); 20 | PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj); 21 | obj_setPtr(new_obj, "lv_obj", lv_obj); 22 | return new_obj; 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/requestment.txt: -------------------------------------------------------------------------------- 1 | pikascript-core==latest 2 | PikaStdLib==latest 3 | pika_lvgl==v0.4.0 4 | PikaStdDevice==v1.11.2 -------------------------------------------------------------------------------- /c906_app/pikascript_demo/pikascript/rust-msc-latest-win10.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/c906_app/pikascript_demo/pikascript/rust-msc-latest-win10.exe -------------------------------------------------------------------------------- /c906_app/proj_config.mk: -------------------------------------------------------------------------------- 1 | # 2 | #compiler flag config domain 3 | # 4 | #CONFIG_TOOLPREFIX := 5 | #CONFIG_OPTIMIZATION_LEVEL_RELEASE := 1 6 | #CONFIG_M4_SOFTFP := 1 7 | 8 | # 9 | #board config domain 10 | # 11 | CONFIG_BOARD_FLASH_SIZE := 2 12 | 13 | #firmware config domain 14 | # 15 | 16 | #set CONFIG_ENABLE_ACP to 1 to enable ACP, set to 0 or comment this line to disable 17 | #CONFIG_ENABLE_ACP:=1 18 | CONFIG_BL_IOT_FW_AP:=1 19 | CONFIG_BL_IOT_FW_AMPDU:=0 20 | CONFIG_BL_IOT_FW_AMSDU:=0 21 | CONFIG_BL_IOT_FW_P2P:=0 22 | CONFIG_ENABLE_PSM_RAM:=1 23 | #CONFIG_ENABLE_CAMERA:=1 24 | #CONFIG_ENABLE_BLSYNC:=1 25 | #CONFIG_ENABLE_VFS_SPI:=1 26 | CONFIG_ENABLE_VFS_ROMFS:=1 27 | CONFIG_ENABLE_DBG_UARTID_0:=1 28 | 29 | CONFIG_ENABLE_ETHMAC:=0 30 | CONFIG_ENABLE_YUV_CAM:=1 31 | CONFIG_CPU_C906:=1 32 | # set easyflash env psm size, only support 4K、8K、16K options 33 | CONFIG_ENABLE_PSM_EF_SIZE:=16K 34 | 35 | CONFIG_FREERTOS_TICKLESS_MODE:=0 36 | 37 | CONFIG_BT:=0 38 | CONFIG_BT_CENTRAL:=1 39 | CONFIG_BT_OBSERVER:=1 40 | CONFIG_BT_PERIPHERAL:=1 41 | CONFIG_BT_STACK_CLI:=1 42 | #CONFIG_BT_MESH := 1 43 | CONFIG_BLE_STACK_DBG_PRINT := 1 44 | CONFIG_BT_STACK_PTS := 0 45 | ifeq ($(CONFIG_BT_MESH),1) 46 | CONFIG_BT_MESH_PB_ADV := 1 47 | CONFIG_BT_MESH_PB_GATT := 1 48 | CONFIG_BT_MESH_FRIEND := 1 49 | CONFIG_BT_MESH_LOW_POWER := 1 50 | CONFIG_BT_MESH_PROXY := 1 51 | CONFIG_BT_MESH_GATT_PROXY := 1 52 | endif 53 | 54 | #blog enable components format :=blog_testc cli vfs helper 55 | LOG_ENABLED_COMPONENTS:=blog_testc hosal loopset looprt bloop 56 | -------------------------------------------------------------------------------- /c906_app/pwm_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/pwm_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | #include "m1s_c906_xram_pwm.h" 9 | 10 | #define PWM_PORT (0) 11 | #define PWM_PIN (8) 12 | 13 | void main() 14 | { 15 | m1s_xram_pwm_init(PWM_PORT, PWM_PIN, 2000, 50); 16 | m1s_xram_pwm_start(PWM_PORT, PWM_PIN); 17 | 18 | /* 频率不变,占空比循环递增 */ 19 | uint8_t duty = 50; 20 | for (int i = 0; i < 10; i++) { 21 | duty = (duty >= 100) ? 0 : (duty + 10); 22 | m1s_xram_pwm_set_duty(PWM_PORT, PWM_PIN, 2000, duty); 23 | vTaskDelay(1000); 24 | } 25 | 26 | /* 占空比不变,频率循环递增 */ 27 | uint32_t freq = 0; 28 | for (int i = 0; i < 10; i++) { 29 | freq = freq >= 1 * 1000 * 1000 ? 0 : freq + 1 * 1000 * 100; 30 | m1s_xram_pwm_deinit(PWM_PORT); 31 | m1s_xram_pwm_init(PWM_PORT, PWM_PIN, freq, 50); 32 | m1s_xram_pwm_start(PWM_PORT, PWM_PIN); 33 | vTaskDelay(1000); 34 | } 35 | 36 | /* 暂停/启动pwm */ 37 | for (int i = 0; i < 2; i++) { 38 | m1s_xram_pwm_stop(PWM_PORT, PWM_PIN); 39 | vTaskDelay(1000); 40 | m1s_xram_pwm_start(PWM_PORT, PWM_PIN); 41 | vTaskDelay(1000); 42 | } 43 | } -------------------------------------------------------------------------------- /c906_app/spi_lcd/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/spi_lcd/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* lcd */ 9 | #include 10 | 11 | /* bl808 c906 std driver */ 12 | #include 13 | 14 | #include "m1s_c906_xram_pwm.h" 15 | 16 | void main() 17 | { 18 | st7789v_spi_init(); 19 | 20 | #define PWM_PORT (0) 21 | #define PWM_PIN (11) 22 | m1s_xram_pwm_init(PWM_PORT, PWM_PIN, 2000, 25); 23 | m1s_xram_pwm_start(PWM_PORT, PWM_PIN); 24 | 25 | while (1) 26 | { 27 | /* 测试:循环切换多个颜色 */ 28 | #define WHITE 0xFFFF 29 | #define BLACK 0x0000 30 | #define BLUE 0x001F 31 | #define RED 0xF800 32 | #define GREEN 0x07E0 33 | #define YELLOW 0xFFE0 34 | const uint16_t rgb565_list[] = 35 | {WHITE, BLACK, BLUE, RED, GREEN, YELLOW}; 36 | 37 | for (int i = 0; i < sizeof(rgb565_list) / sizeof(rgb565_list[0]); i ++) 38 | { 39 | uint64_t curr_cnt = CPU_Get_MTimer_US(); 40 | st7789v_spi_clear(rgb565_list[i]); 41 | printf("lcd:%f fps\r\n", (double)1000000 / (CPU_Get_MTimer_US() - curr_cnt)); 42 | vTaskDelay(1000); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /c906_app/tinymaix_mnist_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/tinymaix_mnist_demo/model_util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | /* sipeed utils */ 7 | #include 8 | 9 | /* sipeed tinymaix */ 10 | #include "tinymaix.h" 11 | 12 | #if TM_MDL_TYPE == TM_MDL_INT8 13 | #include "mnist_valid_q.h" 14 | #elif TM_MDL_TYPE == TM_MDL_FP32 15 | #include "mnist_resnet_f.h" 16 | #endif 17 | 18 | typedef struct { 19 | uint8_t *output; 20 | float output_scale; 21 | int output_zero_point; 22 | uint32_t output_size; 23 | } model_out_t; 24 | 25 | typedef void (*model_out_cb_t)(model_out_t *out, void *arg); 26 | 27 | static model_out_t out = { 28 | .output = NULL, 29 | .output_scale = 0, 30 | .output_zero_point = 0, 31 | .output_size = 0, 32 | }; 33 | 34 | static tm_err_t layer_cb(tm_mdl_t *mdl, tml_head_t *lh) 35 | { 36 | out.output_scale = lh->out_s; 37 | out.output_zero_point = lh->out_zp; 38 | 39 | // dump middle result 40 | int h = lh->out_dims[1]; 41 | int w = lh->out_dims[2]; 42 | int ch = lh->out_dims[3]; 43 | mtype_t *output = TML_GET_OUTPUT(mdl, lh); 44 | 45 | #if 0 46 | TM_PRINTF("Layer %d callback ========\n", mdl->layer_i); 47 | for (int y = 0; y < h; y++) { 48 | TM_PRINTF("["); 49 | for (int x = 0; x < w; x++) { 50 | TM_PRINTF("["); 51 | for (int c = 0; c < ch; c++) { 52 | #if TM_MDL_TYPE == TM_MDL_FP32 53 | TM_PRINTF("%.3f,", output[(y * w + x) * ch + c]); 54 | #else 55 | TM_PRINTF("%.3f,", TML_DEQUANT(lh, output[(y * w + x) * ch + c])); 56 | #endif 57 | } 58 | TM_PRINTF("],"); 59 | } 60 | TM_PRINTF("],\r\n"); 61 | } 62 | TM_PRINTF("\r\n"); 63 | #endif 64 | return TM_OK; 65 | } 66 | 67 | static void *load_model(const char *model_path) { return NULL; } 68 | 69 | static void model_forward(void *const model, void *input, uint32_t output_size, model_out_cb_t cb, void *cb_arg) 70 | { 71 | TM_DBGT_INIT(); 72 | TM_PRINTF("mnist demo\n"); 73 | 74 | tm_mdl_t _model; 75 | tm_mdl_t *mdl = &_model; 76 | 77 | tm_mat_t in_uint8 = {3, 28, 28, 1, {(mtype_t *)input}}; 78 | 79 | tm_mat_t in = {3, 28, 28, 1, {NULL}}; 80 | tm_mat_t outs[1]; 81 | tm_err_t res; 82 | 83 | tm_stat((tm_mdlbin_t *)mdl_data); 84 | 85 | res = tm_load(mdl, mdl_data, NULL, layer_cb, &in); 86 | if (res != TM_OK) { 87 | TM_PRINTF("tm model load err %d\n", res); 88 | return NULL; 89 | } 90 | 91 | #if (TM_MDL_TYPE == TM_MDL_INT8) || (TM_MDL_TYPE == TM_MDL_INT16) 92 | res = tm_preprocess(mdl, TMPP_UINT2INT, &in_uint8, &in); 93 | #else 94 | res = tm_preprocess(mdl, TMPP_UINT2FP01, &in_uint8, &in); 95 | #endif 96 | TM_DBGT_START(); 97 | res = tm_run(mdl, &in, outs); 98 | TM_DBGT("tm_run"); 99 | if (res != TM_OK) { 100 | TM_PRINTF("tm run error: %d\n", res); 101 | return; 102 | } 103 | 104 | printf("dims:%u, h:%u, w:%u, c:%u\r\n", outs[0].dims, outs[0].h, outs[0].w, outs[0].c); 105 | out.output_size = outs->dims * outs->h * outs->w * outs->c; 106 | out.output = (uint8_t *)outs->data; 107 | csi_dcache_clean_range((uint64_t *)&out, sizeof(out)); 108 | cb(&out, cb_arg); 109 | } 110 | -------------------------------------------------------------------------------- /c906_app/tom_and_jerry_classification_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) -------------------------------------------------------------------------------- /c906_app/tom_and_jerry_classification_demo/readme.md: -------------------------------------------------------------------------------- 1 | # 0.Introduce 2 | 3 | A model for Tom&Jerry classfication based on mobilenetv2 is built on MaixHub. 4 | 5 | # 1.Get Started 6 | 7 | ```shell 8 | cd c906_app 9 | ./build.sh tom_and_jerry_classification_demo 10 | # then generated `build_out/d0fw.bin` 11 | ``` 12 | 13 | Darg-n-drop it to M1sDock, and then reset the board. 14 | 15 | A nearly 8MB removable Udisk besed on onboard flash will appear, and then visit [model on MaixHub](https://maixhub.com/model/zoo/127) and press download to fetch the model named `*.blai` or `*.sblai` (encrypted). After that, mkdir `models` on this Udisk, and place model file into it with new name `tj.blai`. 16 | 17 | ```shell 18 | └── models 19 | └── tj.blai 20 | ``` 21 | 22 | Final reset, it will work well. 23 | 24 | # 2.Furthermore 25 | 26 | more details are available here, take a look at `main.c` and you can learn how to deploy another model from MaixHub. 27 | 28 | # 4.Need Help 29 | 30 | please post an issue on our github repository if meet any problems. -------------------------------------------------------------------------------- /c906_app/uvc_demo/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /c906_app/uvc_demo/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* FreeRTOS */ 5 | #include 6 | #include 7 | 8 | /* bl808 c906 std driver */ 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | void main() 15 | { 16 | vTaskDelay(1); 17 | bl_cam_mipi_mjpeg_init(); 18 | m1s_xram_usb_cam_init(); 19 | } -------------------------------------------------------------------------------- /e907_app/Makefile: -------------------------------------------------------------------------------- 1 | 2 | PROJECT_NAME ?= main 3 | PROJECT_PATH := $(abspath .) 4 | PROJECT_BOARD := evb 5 | export PROJECT_PATH PROJECT_BOARD 6 | 7 | -include ./proj_config.mk 8 | 9 | ifeq ($(origin BL_SDK_PATH), undefined) 10 | $(error BL_SDK_PATH not found, please enter: export BL_SDK_PATH={sdk_path}) 11 | endif 12 | 13 | COMPONENTS_BLSYS := blog 14 | COMPONENTS_VFS := 15 | COMPONENTS_DEMO_CLI := bl808_wlan_cli_demo 16 | COMPONENTS_AMP := bl808_xram bl808_ring bl808_net remote_net_manager bl808_user_xram bl808_peri_e907 17 | 18 | # wifi module 19 | COMPONENTS_NETWORK := lwip lwip_dhcpd dns_server netutils mbedtls_lts 20 | COMPONENTS_NETWORK += wifi wifi_manager blcrypto_suite wpa_supplicant wifi_hosal wifi_bt_coex 21 | COMPONENTS_NETWORK += bl606p_phyrf 22 | COMPONENTS_NETWORK += bl_os_adapter 23 | 24 | INCLUDE_COMPONENTS += freertos_e907 hal_drv vfs yloop cli utils newlibc blmtd easyflash4 freertos_e907_helper coredump 25 | INCLUDE_COMPONENTS += startup_bl808 26 | INCLUDE_COMPONENTS += bl808_e907_std 27 | INCLUDE_COMPONENTS += hosal blfdt bl808_audio 28 | INCLUDE_COMPONENTS += romfs usb_stack 29 | INCLUDE_COMPONENTS += fatfs sdh_helper 30 | 31 | COMPONENTS_SIPEEED := 32 | COMPONENTS_SIPEEED += m1s_boot_d0 33 | COMPONENTS_SIPEEED += lfs m1s_lfs_e907 34 | COMPONENTS_SIPEEED += m1s_e907_xram m1s_common_xram m1s_msc 35 | INCLUDE_COMPONENTS += $(COMPONENTS_SIPEEED) 36 | 37 | ifeq ($(CONFIG_COMPONENT_BUGKILLER_ENABLE),1) 38 | INCLUDE_COMPONENTS += bugkiller_freertos 39 | endif 40 | 41 | INCLUDE_COMPONENTS += $(COMPONENTS_BLSYS) 42 | INCLUDE_COMPONENTS += $(COMPONENTS_VFS) 43 | INCLUDE_COMPONENTS += $(COMPONENTS_DEMO_CLI) 44 | INCLUDE_COMPONENTS += $(COMPONENTS_AMP) 45 | INCLUDE_COMPONENTS += $(COMPONENTS_NETWORK) 46 | INCLUDE_COMPONENTS += $(PROJECT_NAME) 47 | 48 | include $(BL_SDK_PATH)/make_scripts_riscv/project_common.mk 49 | -------------------------------------------------------------------------------- /e907_app/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PROJECT_NAME=$1 4 | make CONFIG_CHIP_NAME=BL808 CPU_ID=M0 CONFIG_BTBLE_STACK=0 CONFIG_BT_BREDR=1 CONFIG_BLE_TP_SERVER=0 -j PROJECT_NAME=$PROJECT_NAME 5 | exit $? 6 | -------------------------------------------------------------------------------- /e907_app/firmware/bouffalo.mk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sipeed/M1s_BL808_example/4581c2417d047e5598ab338fbaabff987c3fc9e9/e907_app/firmware/bouffalo.mk -------------------------------------------------------------------------------- /e907_app/firmware/genromap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | make CONFIG_CHIP_NAME=BL808 CPU_ID=M0 CONFIG_BTBLE_STACK=0 CONFIG_BT_BREDR=1 CONFIG_BLE_TP_SERVER=0 -j 3 | exit $? 4 | -------------------------------------------------------------------------------- /e907_app/proj_config.mk: -------------------------------------------------------------------------------- 1 | # 2 | #compiler flag config domain 3 | # 4 | 5 | # 6 | #board config domain 7 | # 8 | CONFIG_BOARD_FLASH_SIZE := 8 9 | 10 | #firmware config domain 11 | # 12 | 13 | #set CONFIG_ENABLE_ACP to 1 to enable ACP, set to 0 or comment this line to disable 14 | #CONFIG_ENABLE_ACP:=1 15 | CONFIG_BL_IOT_FW_AP:=1 16 | CONFIG_BL_IOT_FW_AMPDU:=0 17 | CONFIG_BL_IOT_FW_AMSDU:=0 18 | CONFIG_BL_IOT_FW_P2P:=0 19 | CONFIG_ENABLE_PSM_RAM:=0 20 | CONFIG_ENABLE_VFS_ROMFS:=1 21 | 22 | # set easyflash env psm size, only support 4K/8K/16K options 23 | CONFIG_ENABLE_PSM_EF_SIZE:=16K 24 | 25 | CONFIG_FREERTOS_TICKLESS_MODE:=0 26 | CONFIG_PHY_CLI:=1 27 | CONFIG_WIFI:=1 28 | CONFIG_PHY_FPGA:=0 29 | CONFIG_PHY_BZ_ONLY:=0 30 | CONFIG_PHY_CLI_SUPPORT_SRAM:=0 31 | 32 | CONFIG_USE_STD_DRIVER:=1 33 | CONFIG_BLE_HOST_DISABLE:=0 34 | CONFIG_DBG_RUN_ON_FPGA:=0 35 | CONFIG_DISABLE_PRINT:=0 36 | CONFIG_BLE_USE_MAC2:=0 37 | CONFIG_PHY_ANT2:=0 38 | CONFIG_CPU_E907:=1 39 | CONF_ENABLE_COREDUMP:=1 40 | 41 | LOG_ENABLED_COMPONENTS:=hosal 42 | CONFIG_COMPONENT_BUGKILLER_ENABLE:=1 43 | CONFIG_USB_CAM_ENABLE:= 1 44 | CONFIG_USB_HIGHSPEED_ENABLE:= 1 45 | 46 | #EXTRA_LDFLAGS += --specs=nano.specs 47 | CFLAGS += -DBFLB_USE_HAL_DRIVER -DCPU_M0 -DARCH_RISCV -DSYS_USER_VFS_ROMFS_ENABLE 48 | 49 | -------------------------------------------------------------------------------- /partition/partition_cfg_16M_m1sdock.toml: -------------------------------------------------------------------------------- 1 | [pt_table] 2 | #partition table is 4K in size 3 | address0 = 0xE000 4 | address1 = 0xF000 5 | # If version is 2, It will use dynamic mode. 6 | version = 2 7 | 8 | [[pt_entry]] 9 | type = 16 10 | name = "Boot2" 11 | device = 0 12 | address0 = 0 13 | size0 = 0xE000 14 | address1 = 0 15 | size1 = 0 16 | # compressed image must set len,normal image can left it to 0 17 | len = 0 18 | # If header is 1, it will add the header. 19 | header = 1 20 | 21 | [[pt_entry]] 22 | type = 0 23 | name = "FW" 24 | device = 0 25 | address0 = 0x10000 26 | size0 = 0xF0000 27 | address1 = 0 28 | size1 = 0 29 | # compressed image must set len,normal image can left it to 0 30 | len = 0 31 | # If header is 1, it will add the header. 32 | header = 1 33 | 34 | [[pt_entry]] 35 | type = 2 36 | name = "D0FW" 37 | device = 0 38 | address0 = 0x100000 39 | size0 = 0x200000 40 | address1 = 0 41 | size1 = 0 42 | # compressed image must set len,normal image can left it to 0 43 | len = 0 44 | # If header is 1, it will add the header. 45 | header = 1 46 | 47 | [[pt_entry]] 48 | type = 5 49 | name = "media" 50 | device = 0 51 | address0 = 0x300000 52 | size0 = 0xC00000 53 | address1 = 0 54 | size1 = 0 55 | # compressed image must set len,normal image can left it to 0 56 | len = 0 57 | # If header is 1, it will add the header. 58 | header = 1 59 | 60 | [[pt_entry]] 61 | type = 11 62 | name = "unused" 63 | device = 0 64 | address0 = 0xF00000 65 | size0 = 0x100000 66 | address1 = 0 67 | size1 = 0 68 | # compressed image must set len,normal image can left it to 0 69 | len = 0 70 | # If header is 1, it will add the header. 71 | header = 1 72 | 73 | [[pt_entry]] 74 | type = 8 75 | # It shows Dts in DevCube 76 | name = "factory" 77 | device = 0 78 | address0 = 0x910000 79 | size0 = 0 80 | address1 = 0 81 | size1 = 0 82 | # compressed image must set len,normal image can left it to 0 83 | len = 0 84 | # If header is 1, it will add the header. 85 | header = 1 86 | --------------------------------------------------------------------------------