From d24ce91593f5f64a6be88a85bb69ce8a61098af4 Mon Sep 17 00:00:00 2001 From: vsfos Date: Wed, 22 Dec 2021 01:00:40 +0800 Subject: [PATCH] add vsf port and update PikaVSF_GPIO --- README.md | 2 +- package/PikaVSF/PikaVSF_GPIO.c | 25 +++++++++++++++++++++++++ port/vsf/main.py | 4 ++++ port/vsf/requestment.txt | 4 ++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 port/vsf/main.py create mode 100644 port/vsf/requestment.txt diff --git a/README.md b/README.md index d1c4b7c27..1fbeb669c 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ CH340 is deployed to support USB to serial with Type-C USB, support download pyt |OS|port|GPIO|TIME| |---|---|---|---| |rt-thread|√|√|√| -|vsfOS| |√|√| +|vsf|√|√| | |OS|port|Google Test|Banch Mark| |---|---|---|---| diff --git a/package/PikaVSF/PikaVSF_GPIO.c b/package/PikaVSF/PikaVSF_GPIO.c index 70b75ad58..ba4ef50b2 100644 --- a/package/PikaVSF/PikaVSF_GPIO.c +++ b/package/PikaVSF/PikaVSF_GPIO.c @@ -7,7 +7,32 @@ #if __PIKA_VSF_GPIO == ENABLED static int __vsf_gpio_pin_get(char *pin) { + char ch_port, ch_pin; int hw_port = 0, hw_pin = 0; + + ch_port = *pin++; + VSF_ASSERT(ch_port == 'P'); + + ch_port = *pin++; + if ((ch_port >= 'A') && (ch_port <= 'Z')) { + hw_port = ch_port - 'A'; + } else if ((ch_port >= '0') && (ch_port <= '9')) { + hw_port = ch_port - '0'; + } else { + VSF_ASSERT(false); + } + + if (*pin == '.') { + pin++; + } + + while ((ch_pin = *pin++) != NULL) { + if (!((ch_pin >= '0') && (ch_pin <= '9'))) { + break; + } + hw_pin *= 10; + hw_pin += ch_pin - '0'; + } return vsf_hw_io_mapper_pin(hw_port, hw_pin); } #endif diff --git a/port/vsf/main.py b/port/vsf/main.py new file mode 100644 index 000000000..fd084d322 --- /dev/null +++ b/port/vsf/main.py @@ -0,0 +1,4 @@ +import PikaStdLib +import PikaVSF + +print('python startup...') diff --git a/port/vsf/requestment.txt b/port/vsf/requestment.txt new file mode 100644 index 000000000..975579460 --- /dev/null +++ b/port/vsf/requestment.txt @@ -0,0 +1,4 @@ +pikascript-core==latest +PikaStdLib==latest +PikaStdDevice==latest +PikaVSF==latest \ No newline at end of file