mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
25d7d668ef
* mraa-gpio-led: add led This patch introduces LED node in GPIO category. Signed-off-by: zengchao <chao.zeng@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> * mraa-gpio-ain: add iot2050 board Add IOT2050 board in list of possible boards. Signed-off-by: zengchao <chao.zeng@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> * mraa-gpio-dout: add iot2050 board Add IOT2050 board into list of possible boards. Signed-off-by: zengchao <chao.zeng@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> * mraa-gpio-pwm: add iot2050 board Add IOT2050 board into list of possible boards. Signed-off-by: zengchao <chao.zeng@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> * mraa-gpio: clean up on close for ain, pwm, dout Required as nodejs will only lazily delete the node objects, and we may race with the next user requesting the resources. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> * mraa-gpio-din: add USER button Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: zengchao <chao.zeng@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> Co-authored-by: Jan Kiszka <jan.kiszka@siemens.com>
110 lines
4.6 KiB
HTML
110 lines
4.6 KiB
HTML
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('mraa-gpio-din',{
|
|
category: 'GPIO',
|
|
color: '#a6bbcf',
|
|
paletteLabel: 'digital',
|
|
defaults: {
|
|
name: {value:""},
|
|
pin: {value:"", required: true},
|
|
interrupt: {value:"", required: true},
|
|
mode: {value:"", required: true},
|
|
initial: {value: false}
|
|
},
|
|
inputs:0,
|
|
outputs:1,
|
|
icon: "arrow.png",
|
|
label: function() {
|
|
return this.name||"D"+this.pin;
|
|
},
|
|
labelStyle: function() {
|
|
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 === 25) { t = "IOT2050"; }
|
|
$('#type-tip').text(t);
|
|
$('#node-input-pin').val(pinnow);
|
|
});
|
|
$.getJSON('mraa-version/'+this.id,function(data) {
|
|
$('#ver-tip').text(data);
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script type="text/x-red" data-template-name="mraa-gpio-din">
|
|
<div class="form-row">
|
|
<label for="node-input-pin"><i class="fa fa-circle"></i> Pin</label>
|
|
<select type="text" id="node-input-pin" style="width: 250px;">
|
|
<option value='' disabled selected style='display:none;'><span data-i18n="rpi-gpio.label.selectpin"></span></option>
|
|
<option value="0">D0</option>
|
|
<option value="1">D1</option>
|
|
<option value="2">D2</option>
|
|
<option value="3">D3</option>
|
|
<option value="4">D4</option>
|
|
<option value="5">D5</option>
|
|
<option value="6">D6</option>
|
|
<option value="7">D7</option>
|
|
<option value="8">D8</option>
|
|
<option value="9">D9</option>
|
|
<option value="10">D10</option>
|
|
<option value="11">D11</option>
|
|
<option value="12">D12</option>
|
|
<option value="13">D13</option>
|
|
<option value="14">D14</option>
|
|
<option value="15">D15</option>
|
|
<option value="16">D16</option>
|
|
<option value="17">D17</option>
|
|
<option value="18">D18</option>
|
|
<option value="19">D19</option>
|
|
<option value="20">USER button</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa-level-up"></i> Mode</label>
|
|
<select type="text" id="node-input-mode" style="width: 250px;">
|
|
<option value='' disabled selected style='display:none;'>select mode</option>
|
|
<option value="0">Strong </option>
|
|
<option value="1">Pull-up </option>
|
|
<option value="2">Pull-down </option>
|
|
<option value="3">Hiz </option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa-level-up"></i> Interrupt</label>
|
|
<select type="text" id="node-input-interrupt" style="width: 250px;">
|
|
<option value='' disabled selected style='display:none;'>select interrupt</option>
|
|
<option value="r">Rising </option>
|
|
<option value="f">Falling </option>
|
|
<option value="b">Both </option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row" id="node-initial-tick">
|
|
<label> </label>
|
|
<input type="checkbox" id="node-input-initial" style="display: inline-block; width: auto; vertical-align: top;">
|
|
<label for="node-input-initial" style="width: 70%;">Send initial message with level of pin.</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name" style="width: 250px;">
|
|
</div>
|
|
<div class="form-tips">Board : <span id="type-tip">n/a</span><br/>mraa version : <span id="ver-tip">n/a</span></div>
|
|
</script>
|
|
|
|
<script type="text/x-red" data-help-name="mraa-gpio-din">
|
|
<p>A digital input pin for an Intel Galileo/Edison/Siemens IOT2050 board.</p>
|
|
<p>The <code>msg.payload</code> contains the value (0 or 1), and <code>msg.topic</code>
|
|
contains "{the_board_name}/D{the pin number}".</p>
|
|
</script>
|