From 46c6fb4013cb5201ba0a28294f5b893f0565de54 Mon Sep 17 00:00:00 2001 From: Li Hua Qian Date: Wed, 12 Apr 2023 13:11:27 +0800 Subject: [PATCH 1/7] mraa: Add support for the new IOT2050-SM variant For mraa, the main difference between the new variant and the rest is the tailoring down of the Arduino interface. Signed-off-by: Li Hua Qian --- .../board-conf-tools/board-bootup-conf.py | 6 +- ...pport-for-the-new-IOT2050-SM-variant.patch | 143 ++++++++++++++++++ recipes-app/mraa/mraa_2.2.0+git.bb | 1 + 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 recipes-app/mraa/files/0004-iot2050-Add-support-for-the-new-IOT2050-SM-variant.patch diff --git a/recipes-app/board-conf-tools/files/board-conf-tools/board-bootup-conf.py b/recipes-app/board-conf-tools/files/board-conf-tools/board-bootup-conf.py index ad978be5b..71e032f02 100755 --- a/recipes-app/board-conf-tools/files/board-conf-tools/board-bootup-conf.py +++ b/recipes-app/board-conf-tools/files/board-conf-tools/board-bootup-conf.py @@ -67,10 +67,14 @@ def initExternalSerialMode(): subprocess.call("switchserialmode -m " + initMode + terminateOpt, shell=True) +def getBoardModel(): + return subprocess.check_output('grep -a -o -P "IOT2050[\w\s]+" /proc/device-tree/model', + shell=True).lstrip().rstrip().decode('utf-8') def main(): initExternalSerialMode() - initAruinoPins() + if "IOT2050 Advanced SM" != getBoardModel(): + initAruinoPins() if __name__ == '__main__': diff --git a/recipes-app/mraa/files/0004-iot2050-Add-support-for-the-new-IOT2050-SM-variant.patch b/recipes-app/mraa/files/0004-iot2050-Add-support-for-the-new-IOT2050-SM-variant.patch new file mode 100644 index 000000000..607295873 --- /dev/null +++ b/recipes-app/mraa/files/0004-iot2050-Add-support-for-the-new-IOT2050-SM-variant.patch @@ -0,0 +1,143 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Li Hua Qian +Date: Wed, 19 Apr 2023 11:54:37 +0800 +Subject: [PATCH] iot2050: Add support for the new IOT2050-SM variant + +IOT2050-SM board was added to IOT2050 series. In contrast to existing +variants, the IOT2050-SM board comes without an Arduino interface. + +Signed-off-by: Li Hua Qian +--- + api/mraa/types.h | 1 + + include/arm/siemens/iot2050.h | 4 +++ + src/arm/arm.c | 5 +++ + src/arm/siemens/iot2050.c | 65 +++++++++++++++++++++++++++++++++++ + 4 files changed, 75 insertions(+) + +diff --git a/api/mraa/types.h b/api/mraa/types.h +index 8c9a30639450..1c1dd330a3c5 100644 +--- a/api/mraa/types.h ++++ b/api/mraa/types.h +@@ -69,6 +69,7 @@ typedef enum { + MRAA_UPXTREME = 24, /**< The UPXTREME Board */ + MRAA_INTEL_ILK = 25, /**< Intel Learning Kit */ + MRAA_SIEMENS_IOT2050 = 26, /**< Siemens IOT2050 board */ ++ MRAA_SIEMENS_IOT2050_SM = 27, /**< Siemens IOT2050-SM board */ + // USB platform extenders start at 256 + MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */ + +diff --git a/include/arm/siemens/iot2050.h b/include/arm/siemens/iot2050.h +index 76df024e7759..e7991862d6b4 100644 +--- a/include/arm/siemens/iot2050.h ++++ b/include/arm/siemens/iot2050.h +@@ -31,10 +31,14 @@ extern "C" { + + #define PLATFORM_NAME "SIMATIC IOT2050" + #define MRAA_IOT2050_PINCOUNT 21 ++#define MRAA_IOT2050_SM_PINCOUNT 1 + + mraa_board_t * + mraa_siemens_iot2050(); + ++mraa_board_t * ++ mraa_siemens_iot2050_sm(); ++ + #ifdef __cplusplus + } + #endif +diff --git a/src/arm/arm.c b/src/arm/arm.c +index 0a44d0f6399d..50b3d4d5d22e 100644 +--- a/src/arm/arm.c ++++ b/src/arm/arm.c +@@ -99,6 +99,8 @@ mraa_arm_platform() + platform_type = MRAA_RASPBERRY_PI; + else if (mraa_file_contains("/proc/device-tree/model", "ADLINK ARM, LEC-PX30")) + platform_type = MRAA_ADLINK_IPI; ++ else if (mraa_file_contains("/proc/device-tree/model", "SIMATIC IOT2050 Advanced SM")) ++ platform_type = MRAA_SIEMENS_IOT2050_SM; + else if (mraa_file_contains("/proc/device-tree/model", "SIMATIC IOT2050")) + platform_type = MRAA_SIEMENS_IOT2050; + } +@@ -130,6 +132,9 @@ mraa_arm_platform() + case MRAA_SIEMENS_IOT2050: + plat = mraa_siemens_iot2050(); + break; ++ case MRAA_SIEMENS_IOT2050_SM: ++ plat = mraa_siemens_iot2050_sm(); ++ break; + default: + plat = NULL; + syslog(LOG_ERR, "Unknown Platform, currently not supported by MRAA"); +diff --git a/src/arm/siemens/iot2050.c b/src/arm/siemens/iot2050.c +index c741875a2376..ace9a0790090 100644 +--- a/src/arm/siemens/iot2050.c ++++ b/src/arm/siemens/iot2050.c +@@ -1787,3 +1787,68 @@ error: + free(b); + return NULL; + } ++ ++mraa_board_t* ++mraa_siemens_iot2050_sm() ++{ ++ int pin_index = 0; ++ unsigned wkup_gpio0_chip, wkup_gpio0_base; ++ unsigned line_offset; ++ mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t)); ++ ++ if (NULL == b) { ++ goto error_board; ++ } ++ ++ if (mraa_find_gpio_line_by_name("wkup_gpio0-base", &wkup_gpio0_chip, &line_offset) < 0 || line_offset != 0) { ++ goto error; ++ } ++ wkup_gpio0_base = mraa_get_chip_base_by_number(wkup_gpio0_chip); ++ if (wkup_gpio0_base < 0) { ++ goto error; ++ } ++ ++ b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t)); ++ if (b->adv_func == NULL) { ++ goto error; ++ } ++ b->platform_name = PLATFORM_NAME; ++ b->phy_pin_count = MRAA_IOT2050_SM_PINCOUNT; ++ b->pins = (mraa_pininfo_t*) calloc(MRAA_IOT2050_SM_PINCOUNT, sizeof(mraa_pininfo_t)); ++ if (b->pins == NULL) { ++ free(b->adv_func); ++ goto error; ++ } ++ ++ /* USER BUTTON */ ++ iot2050_setup_pins(b, pin_index, "USER", ++ (mraa_pincapabilities_t) { ++ .valid = 1, ++ .gpio = 1, ++ .pwm = 0, ++ .fast_gpio = 0, ++ .spi = 0, ++ .i2c = 0, ++ .aio = 0, ++ .uart = 0}, ++ (regmux_info_t) { ++ .group = -1, ++ .index = -1, ++ .pinmap = wkup_gpio0_base+25, ++ .mode = {} ++ }); ++ iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 25, -1, -1, NULL, 0); ++ ++ /* LED */ ++ iot2050_setup_led(b, "user-led1-green"); ++ iot2050_setup_led(b, "user-led1-red"); ++ iot2050_setup_led(b, "user-led2-green"); ++ iot2050_setup_led(b, "user-led2-red"); ++ ++ return b; ++error: ++ free(b); ++error_board: ++ syslog(LOG_CRIT, "iot2050: Platform failed to initialise"); ++ return NULL; ++} diff --git a/recipes-app/mraa/mraa_2.2.0+git.bb b/recipes-app/mraa/mraa_2.2.0+git.bb index b78fffe8d..cd5fd8d08 100644 --- a/recipes-app/mraa/mraa_2.2.0+git.bb +++ b/recipes-app/mraa/mraa_2.2.0+git.bb @@ -15,6 +15,7 @@ SRC_URI += "git://github.com/eclipse/mraa.git;protocol=https;branch=master \ file://0001-gpio-Fix-JS-binding-regarding-interrupt-injections.patch \ file://0002-common-increase-pin-name-size.patch \ file://0003-iot2050-add-debugfs-pinmux-support.patch \ + file://0004-iot2050-Add-support-for-the-new-IOT2050-SM-variant.patch \ file://rules" SRCREV = "8b1c54934e80edc2d36abac9d9c96fe1e01cb669" From 07a8b4aba0a1ea77f07ac5139592317e123443f2 Mon Sep 17 00:00:00 2001 From: chao zeng Date: Fri, 5 May 2023 08:59:42 +0800 Subject: [PATCH 2/7] node-red-gpio: Add support for IOT2050 SM The Arduino interfaces are tailored down on the new variant, so for the node-red, only the USER button and the USERn LEDs are kept, all other nodes are removed from the pallete. Meanwhile some bug fixes are introduced as well, notably: -. din: Make D14-D19 IOT2050 only, fix some ui errors. -. dout: Add D14-D19 for IOT2050 -. led: Make it IOT2050 only, fix ui label. Also the baseline is bumped up to the latest upstream version 0.4.0 Signed-off-by: chao zeng Signed-off-by: Baocheng Su --- ...-gpio-Change-text-x-red-to-text-html.patch | 133 ++++++ ...a-gpio-Pass-settings-from-js-to-html.patch | 395 ++++++++++++++++++ ...a-gpio-din-Make-D14-D19-IOT2050-only.patch | 40 ++ ...-din-Fix-the-for-attribute-of-lables.patch | 36 ++ ...aa-gpio-dout-Add-D14-D19-for-IOT2050.patch | 71 ++++ ...mraa-gpio-Make-led-node-IOT2050-only.patch | 102 +++++ ...pio-Fix-led-label-in-the-flow-editor.patch | 40 ++ ...mraa-gpio-Add-support-for-IOT2050-SM.patch | 349 ++++++++++++++++ ...t-pin-options-according-to-board-typ.patch | 60 +++ ....3.0+git.bb => node-red-gpio_0.4.0+git.bb} | 14 +- 10 files changed, 1238 insertions(+), 2 deletions(-) create mode 100644 recipes-app/node-red-gpio/files/0001-mraa-gpio-Change-text-x-red-to-text-html.patch create mode 100644 recipes-app/node-red-gpio/files/0002-mraa-gpio-Pass-settings-from-js-to-html.patch create mode 100644 recipes-app/node-red-gpio/files/0003-mraa-gpio-din-Make-D14-D19-IOT2050-only.patch create mode 100644 recipes-app/node-red-gpio/files/0004-mraa-gpio-din-Fix-the-for-attribute-of-lables.patch create mode 100644 recipes-app/node-red-gpio/files/0005-mraa-gpio-dout-Add-D14-D19-for-IOT2050.patch create mode 100644 recipes-app/node-red-gpio/files/0006-mraa-gpio-Make-led-node-IOT2050-only.patch create mode 100644 recipes-app/node-red-gpio/files/0007-mraa-gpio-Fix-led-label-in-the-flow-editor.patch create mode 100644 recipes-app/node-red-gpio/files/0008-mraa-gpio-Add-support-for-IOT2050-SM.patch create mode 100644 recipes-app/node-red-gpio/files/0009-mraa-gpio-pwm-Set-pin-options-according-to-board-typ.patch rename recipes-app/node-red-gpio/{node-red-gpio_0.3.0+git.bb => node-red-gpio_0.4.0+git.bb} (51%) diff --git a/recipes-app/node-red-gpio/files/0001-mraa-gpio-Change-text-x-red-to-text-html.patch b/recipes-app/node-red-gpio/files/0001-mraa-gpio-Change-text-x-red-to-text-html.patch new file mode 100644 index 000000000..e8c5fbb64 --- /dev/null +++ b/recipes-app/node-red-gpio/files/0001-mraa-gpio-Change-text-x-red-to-text-html.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Baocheng Su +Date: Wed, 27 Dec 2023 15:06:42 +0800 +Subject: [PATCH] mraa-gpio: Change text/x-red to text/html + +Arrording to latest document [1]: + +The + +- + +- + +- + +- + +- + +- +diff --git a/hardware/intel/mraa-gpio-led.html b/hardware/intel/mraa-gpio-led.html +index 985774fa2d7e..c0b9eb2504c5 100644 +--- a/hardware/intel/mraa-gpio-led.html ++++ b/hardware/intel/mraa-gpio-led.html +@@ -52,7 +52,7 @@ + }); + + +- + +- +diff --git a/hardware/intel/mraa-gpio-pwm.html b/hardware/intel/mraa-gpio-pwm.html +index c1d078bc449c..ad60d90d0841 100644 +--- a/hardware/intel/mraa-gpio-pwm.html ++++ b/hardware/intel/mraa-gpio-pwm.html +@@ -56,7 +56,7 @@ + }); + + +- + +- +diff --git a/hardware/intel/mraa-gpio-ain.js b/hardware/intel/mraa-gpio-ain.js +index 6867db4df6a1..8d3b19bc53e6 100644 +--- a/hardware/intel/mraa-gpio-ain.js ++++ b/hardware/intel/mraa-gpio-ain.js +@@ -1,6 +1,7 @@ + + module.exports = function(RED) { + var m = require('mraa'); ++ var mraaContext = require('./mraa-context'); + + function gpioAin(n) { + RED.nodes.createNode(this, n); +@@ -28,5 +29,16 @@ module.exports = function(RED) { + node.x.close(); + }); + } +- RED.nodes.registerType("mraa-gpio-ain", gpioAin); ++ RED.nodes.registerType("mraa-gpio-ain", gpioAin, { ++ settings: { ++ mraaGpioAinBoardType: { ++ value: mraaContext.getPlatformTypeStr(), ++ exportable: true ++ }, ++ mraaGpioAinMraaVersion: { ++ value: mraaContext.getVersion(), ++ exportable: true ++ } ++ } ++ }); + } +diff --git a/hardware/intel/mraa-gpio-din.html b/hardware/intel/mraa-gpio-din.html +index 9300a051fafc..c7fb92e0e9b4 100644 +--- a/hardware/intel/mraa-gpio-din.html ++++ b/hardware/intel/mraa-gpio-din.html +@@ -21,27 +21,12 @@ + return this.name?"node_label_italic":""; + }, + oneditprepare: function() { +- var pinnow = this.pin; +- $.getJSON('mraa-gpio/'+this.id,function(data) { +- var t = "unknown"; +- if (data === 0) { t = "Galileo v1"; } +- if (data === 1) { t = "Galileo v2"; } +- if (data === 2) { t = "Edison Fab C"; } +- if (data === 3) { t = "DE3813 Baytrail"; } +- if (data === 4) { t = "Minnow Max"; } +- if (data === 5) { t = "Raspberry Pi"; } +- if (data === 6) { t = "Beaglebone"; } +- if (data === 7) { t = "Banana"; } +- if (data === 26) { t = "IOT2050"; } +- $('#type-tip').text(t); +- if (data === 26) { +- $('#node-input-pin').append($("").attr("value",20).text("USER button")); +- } +- $('#node-input-pin').val(pinnow); +- }); +- $.getJSON('mraa-version/'+this.id,function(data) { +- $('#ver-tip').text(data); +- }); ++ if (RED.settings.mraaGpioDinBoardType === "IOT2050") { ++ $('#node-input-pin').append($("").attr("value", 20).text("USER button")); ++ } ++ $('#node-input-pin').val(this.pin); ++ $('#type-tip').text(RED.settings.mraaGpioDinBoardType); ++ $('#ver-tip').text(RED.settings.mraaGpioDinMraaVersion); + } + }); + +diff --git a/hardware/intel/mraa-gpio-din.js b/hardware/intel/mraa-gpio-din.js +index cfb79612d65c..738db578521c 100644 +--- a/hardware/intel/mraa-gpio-din.js ++++ b/hardware/intel/mraa-gpio-din.js +@@ -1,6 +1,7 @@ + + module.exports = function(RED) { + var m = require('mraa'); ++ var mraaContext = require('./mraa-context'); + //console.log("BOARD :",m.getPlatformName()); + + function gpioDin(n) { +@@ -71,5 +72,16 @@ module.exports = function(RED) { + node.x.close(); + }); + } +- RED.nodes.registerType("mraa-gpio-din", gpioDin); ++ RED.nodes.registerType("mraa-gpio-din", gpioDin, { ++ settings: { ++ mraaGpioDinBoardType: { ++ value: mraaContext.getPlatformTypeStr(), ++ exportable: true ++ }, ++ mraaGpioDinMraaVersion: { ++ value: mraaContext.getVersion(), ++ exportable: true ++ } ++ } ++ }); + } +diff --git a/hardware/intel/mraa-gpio-dout.html b/hardware/intel/mraa-gpio-dout.html +index 5021024aef4c..8b6e961d5dd2 100644 +--- a/hardware/intel/mraa-gpio-dout.html ++++ b/hardware/intel/mraa-gpio-dout.html +@@ -25,27 +25,12 @@ + return this.name?"node_label_italic":""; + }, + oneditprepare: function() { +- var pinnow = this.pin; +- $.getJSON('mraa-gpio/'+this.id,function(data) { +- var t = "unknown"; +- if (data === 0) { t = "Galileo v1"; } +- if (data === 1) { t = "Galileo v2"; } +- if (data === 2) { t = "Edison Fab C"; } +- if (data === 3) { t = "DE3813 Baytrail"; } +- if (data === 4) { t = "Minnow Max"; } +- if (data === 5) { t = "Raspberry Pi"; } +- if (data === 6) { t = "Beaglebone"; } +- if (data === 7) { t = "Banana"; } +- if (data === 26) { t = "IOT2050"; } +- $('#btype').text(t); +- if (data === 0) { +- $('#node-input-pin').append($("").attr("value",14).text("LED - Galileo v1")); +- } +- $('#node-input-pin').val(pinnow); +- }); +- $.getJSON('mraa-version/'+this.id,function(data) { +- $('#ver-tip').text(data); +- }); ++ if (RED.settings.mraaGpioDoutBoardType === 'Galileo v1') { ++ $('#node-input-pin').append($("").attr("value",14).text("LED - Galileo v1")); ++ } ++ $('#node-input-pin').val(this.pin); ++ $('#btype').text(RED.settings.mraaGpioDoutBoardType); ++ $('#ver-tip').text(RED.settings.mraaGpioDoutMraaVersion); + + var setstate = function () { + if ($('#node-input-set').is(":checked")) { +diff --git a/hardware/intel/mraa-gpio-dout.js b/hardware/intel/mraa-gpio-dout.js +index 6bb833d3a721..3af1c3b85f8e 100644 +--- a/hardware/intel/mraa-gpio-dout.js ++++ b/hardware/intel/mraa-gpio-dout.js +@@ -1,6 +1,7 @@ + + module.exports = function(RED) { + var m = require('mraa'); ++ var mraaContext = require('./mraa-context'); + + function gpioDout(n) { + RED.nodes.createNode(this, n); +@@ -32,13 +33,16 @@ module.exports = function(RED) { + node.p.close(); + }); + } +- RED.nodes.registerType("mraa-gpio-dout", gpioDout); +- +- RED.httpAdmin.get('/mraa-gpio/:id', RED.auth.needsPermission('mraa-gpio.read'), function(req,res) { +- res.json(m.getPlatformType()); +- }); +- +- RED.httpAdmin.get('/mraa-version/:id', RED.auth.needsPermission('mraa-version.read'), function(req,res) { +- res.json(m.getVersion()); ++ RED.nodes.registerType("mraa-gpio-dout", gpioDout, { ++ settings: { ++ mraaGpioDoutBoardType: { ++ value: mraaContext.getPlatformTypeStr(), ++ exportable: true ++ }, ++ mraaGpioDoutMraaVersion: { ++ value: mraaContext.getVersion(), ++ exportable: true ++ } ++ } + }); + } +diff --git a/hardware/intel/mraa-gpio-led.html b/hardware/intel/mraa-gpio-led.html +index c0b9eb2504c5..fdbc0f63788f 100644 +--- a/hardware/intel/mraa-gpio-led.html ++++ b/hardware/intel/mraa-gpio-led.html +@@ -20,24 +20,9 @@ + return this.name?"node_label_italic":""; + }, + oneditprepare: function() { +- var pinnow = this.pin; +- $.getJSON('mraa-gpio/'+this.id,function(data) { +- var t = "unknown"; +- if (data === 0) { t = "Galileo v1"; } +- if (data === 1) { t = "Galileo v2"; } +- if (data === 2) { t = "Edison Fab C"; } +- if (data === 3) { t = "DE3813 Baytrail"; } +- if (data === 4) { t = "Minnow Max"; } +- if (data === 5) { t = "Raspberry Pi"; } +- if (data === 6) { t = "Beaglebone"; } +- if (data === 7) { t = "Banana"; } +- if (data === 26) { t = "IOT2050"; } +- $('#btype').text(t); +- $('#node-input-pin').val(pinnow); +- }); +- $.getJSON('mraa-version/'+this.id,function(data) { +- $('#ver-tip').text(data); +- }); ++ $('#node-input-pin').val(this.pin); ++ $('#btype').text(RED.settings.mraaGpioLedBoardType); ++ $('#ver-tip').text(RED.settings.mraaGpioLedMraaVersion); + + var setstate = function () { + if ($('#node-input-set').is(":checked")) { +diff --git a/hardware/intel/mraa-gpio-led.js b/hardware/intel/mraa-gpio-led.js +index d9a4ce0819e5..57e682efc0ce 100644 +--- a/hardware/intel/mraa-gpio-led.js ++++ b/hardware/intel/mraa-gpio-led.js +@@ -1,5 +1,7 @@ + module.exports = function(RED) { + var m = require('mraa'); ++ var mraaContext = require('./mraa-context'); ++ + function LEDNode(n) { + RED.nodes.createNode(this, n); + this.pin = Number(n.pin); +@@ -74,13 +76,16 @@ module.exports = function(RED) { + } + }); + } +- RED.nodes.registerType("mraa-gpio-led", LEDNode); +- +- RED.httpAdmin.get('/mraa-gpio/:id', RED.auth.needsPermission('mraa-gpio.read'), function(req,res) { +- res.json(m.getPlatformType()); +- }); +- +- RED.httpAdmin.get('/mraa-version/:id', RED.auth.needsPermission('mraa-version.read'), function(req,res) { +- res.json(m.getVersion()); ++ RED.nodes.registerType("mraa-gpio-led", LEDNode, { ++ settings: { ++ mraaGpioLedBoardType: { ++ value: mraaContext.getPlatformTypeStr(), ++ exportable: true ++ }, ++ mraaGpioLedMraaVersion: { ++ value: mraaContext.getVersion(), ++ exportable: true ++ } ++ } + }); + } +diff --git a/hardware/intel/mraa-gpio-pwm.html b/hardware/intel/mraa-gpio-pwm.html +index ad60d90d0841..1ed91397cf4f 100644 +--- a/hardware/intel/mraa-gpio-pwm.html ++++ b/hardware/intel/mraa-gpio-pwm.html +@@ -24,24 +24,9 @@ + return this.name?"node_label_italic":""; + }, + oneditprepare: function() { +- var pinnow = this.pin; +- $.getJSON('mraa-gpio/'+this.id,function(data) { +- var t = "unknown"; +- if (data === 0) { t = "Galileo v1"; } +- if (data === 1) { t = "Galileo v2"; } +- if (data === 2) { t = "Edison Fab C"; } +- if (data === 3) { t = "DE3813 Baytrail"; } +- if (data === 4) { t = "Minnow Max"; } +- if (data === 5) { t = "Raspberry Pi"; } +- if (data === 6) { t = "Beaglebone"; } +- if (data === 7) { t = "Banana"; } +- if (data === 26) { t = "IOT2050"; } +- $('#type-tip').text(t); +- $('#node-input-pin').val(pinnow); +- }); +- $.getJSON('mraa-version/'+this.id,function(data) { +- $('#ver-tip').text(data); +- }); ++ $('#node-input-pin').val(this.pin); ++ $('#type-tip').text(RED.settings.mraaGpioPwmBoardType); ++ $('#ver-tip').text(RED.settings.mraaGpioPwmMraaVersion); + + var setstate = function () { + if ($('#node-input-set').is(":checked")) { +diff --git a/hardware/intel/mraa-gpio-pwm.js b/hardware/intel/mraa-gpio-pwm.js +index 6a2469f27b81..5f7714a95ba2 100644 +--- a/hardware/intel/mraa-gpio-pwm.js ++++ b/hardware/intel/mraa-gpio-pwm.js +@@ -1,6 +1,7 @@ + + module.exports = function(RED) { + var m = require('mraa'); ++ var mraaContext = require('./mraa-context'); + + function gpioPWM(n) { + RED.nodes.createNode(this, n); +@@ -24,13 +25,16 @@ module.exports = function(RED) { + node.p.close(); + }); + } +- RED.nodes.registerType("mraa-gpio-pwm", gpioPWM); +- +- RED.httpAdmin.get('/mraa-gpio/:id', RED.auth.needsPermission('mraa-gpio.read'), function(req,res) { +- res.json(m.getPlatformType()); +- }); +- +- RED.httpAdmin.get('/mraa-version/:id', RED.auth.needsPermission('mraa-version.read'), function(req,res) { +- res.json(m.getVersion()); ++ RED.nodes.registerType("mraa-gpio-pwm", gpioPWM, { ++ settings: { ++ mraaGpioPwmBoardType: { ++ value: mraaContext.getPlatformTypeStr(), ++ exportable: true ++ }, ++ mraaGpioPwmMraaVersion: { ++ value: mraaContext.getVersion(), ++ exportable: true ++ } ++ } + }); + } diff --git a/recipes-app/node-red-gpio/files/0003-mraa-gpio-din-Make-D14-D19-IOT2050-only.patch b/recipes-app/node-red-gpio/files/0003-mraa-gpio-din-Make-D14-D19-IOT2050-only.patch new file mode 100644 index 000000000..7632d6094 --- /dev/null +++ b/recipes-app/node-red-gpio/files/0003-mraa-gpio-din-Make-D14-D19-IOT2050-only.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Baocheng Su +Date: Thu, 28 Dec 2023 09:56:02 +0800 +Subject: [PATCH] mraa-gpio: din: Make D14-D19 IOT2050 only + +Pins D14-D19 are IOT2050 only. + +Fixes: 25d7d668ef11 ("Add IOT2050 board into mraa Intel nodes (#940)") +Signed-off-by: Baocheng Su +--- + hardware/intel/mraa-gpio-din.html | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/hardware/intel/mraa-gpio-din.html b/hardware/intel/mraa-gpio-din.html +index c7fb92e0e9b4..a22cb05b3617 100644 +--- a/hardware/intel/mraa-gpio-din.html ++++ b/hardware/intel/mraa-gpio-din.html +@@ -22,6 +22,9 @@ + }, + oneditprepare: function() { + if (RED.settings.mraaGpioDinBoardType === "IOT2050") { ++ for (let i = 14; i <= 19; i++) { ++ $('#node-input-pin').append($("").attr("value", i).text("D" + i)); ++ } + $('#node-input-pin').append($("").attr("value", 20).text("USER button")); + } + $('#node-input-pin').val(this.pin); +@@ -50,12 +53,6 @@ + + + +- +- +- +- +- +- + + +
diff --git a/recipes-app/node-red-gpio/files/0004-mraa-gpio-din-Fix-the-for-attribute-of-lables.patch b/recipes-app/node-red-gpio/files/0004-mraa-gpio-din-Fix-the-for-attribute-of-lables.patch new file mode 100644 index 000000000..065bb8180 --- /dev/null +++ b/recipes-app/node-red-gpio/files/0004-mraa-gpio-din-Fix-the-for-attribute-of-lables.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Baocheng Su +Date: Thu, 28 Dec 2023 09:59:51 +0800 +Subject: [PATCH] mraa-gpio: din: Fix the 'for' attribute of lables + +Seems no significant impact on the UI, however it's against the +html standard. + +Fixes: 983dafff137f ("mraa gpio din features (#929)") +Signed-off-by: Baocheng Su +--- + hardware/intel/mraa-gpio-din.html | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hardware/intel/mraa-gpio-din.html b/hardware/intel/mraa-gpio-din.html +index a22cb05b3617..225aa47690d3 100644 +--- a/hardware/intel/mraa-gpio-din.html ++++ b/hardware/intel/mraa-gpio-din.html +@@ -56,7 +56,7 @@ + +
+
+- ++ + +
+
+- ++ +