1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Limit Pi GPIO to dedicated GPIO pins

to avoid clashes with internal drivers (e.g. I2C, SPI, AMA0 etc)
This commit is contained in:
Dave Conway-Jones 2016-06-13 14:23:19 +01:00
parent 09b069c129
commit 8fe07e0f07
2 changed files with 59 additions and 59 deletions

View File

@ -19,23 +19,23 @@
<label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="rpi-gpio.label.gpiopin"></span></label> <label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="rpi-gpio.label.gpiopin"></span></label>
<select type="text" id="node-input-pin" style="width: 250px;"> <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='' disabled selected style='display:none;'><span data-i18n="rpi-gpio.label.selectpin"></span></option>
<option value="3">3 - SDA1 - BCM2</option> <!-- <option value="3">Pin 3 - SDA1 - BCM2</option> -->
<option value="5">5 - SCL1 - BCM3</option> <!-- <option value="5">Pin 5 - SCL1 - BCM3</option> -->
<option value="7">7 - GPIO7 - BCM4</option> <option value="7">Pin 7 - GPIO4</option>
<option value="8">8 - TxD - BCM14</option> <!-- <option value="8">Pin 8 - TxD - BCM14</option> -->
<option value="10">10 - RxD - BCM15</option> <!-- <option value="10">Pin 10 - RxD - BCM15</option> -->
<option value="11">11 - GPIO0 - BCM17</option> <option value="11">Pin 11 - GPIO17</option>
<option value="12">12 - GPIO1 - BCM18</option> <option value="12">Pin 12 - GPIO18</option>
<option value="13">13 - GPIO2 - BCM27</option> <option value="13">Pin 13 - GPIO27</option>
<option value="15">15 - GPIO3 - BCM22</option> <option value="15">Pin 15 - GPIO22</option>
<option value="16">16 - GPIO4 - BCM23</option> <option value="16">Pin 16 - GPIO23</option>
<option value="18">18 - GPIO5 - BCM24</option> <option value="18">Pin 18 - GPIO24</option>
<option value="19">19 - MOSI - BCM10</option> <!-- <option value="19">Pin 19 - MOSI - BCM10</option> -->
<option value="21">21 - MISO - BCM9</option> <!-- <option value="21">Pin 21 - MISO - BCM9</option> -->
<option value="22">22 - GPIO6 - BCM25</option> <option value="22">Pin 22 - GPIO25</option>
<option value="23">23 - SCLK - BCM11</option> <!-- <option value="23">Pin 23 - SCLK - BCM11</option> -->
<option value="24">24 - CE0 - BCM8</option> <!-- <option value="24">Pin 24 - CE0 - BCM8</option> -->
<option value="26">26 - CE1 - BCM7</option> <!-- <option value="26">Pin 26 - CE1 - BCM7</option> -->
</select> </select>
&nbsp;<span id="pitype"></span> &nbsp;<span id="pitype"></span>
</div> </div>
@ -109,17 +109,17 @@
$.getJSON('rpi-gpio/'+this.id,function(data) { $.getJSON('rpi-gpio/'+this.id,function(data) {
$('#pitype').text(data.type); $('#pitype').text(data.type);
if ((data.type !== "Model B") && (data.type !== "Model A")) { if ((data.type !== "Model B") && (data.type !== "Model A")) {
$('#node-input-pin').append($("<option></option>").attr("value",27).text("27 - SDA0 - BCM0")); //$('#node-input-pin').append($("<option></option>").attr("value",27).text("Pin 27 - SDA0 - BCM0"));
$('#node-input-pin').append($("<option></option>").attr("value",28).text("28 - SCL0 - BCM1")); //$('#node-input-pin').append($("<option></option>").attr("value",28).text("Pin 28 - SCL0 - BCM1"));
$('#node-input-pin').append($("<option></option>").attr("value",29).text("29 - GPIO21 - BCM5")); $('#node-input-pin').append($("<option></option>").attr("value",29).text("Pin 29 - GPIO5"));
$('#node-input-pin').append($("<option></option>").attr("value",31).text("31 - GPIO22 - BCM6")); $('#node-input-pin').append($("<option></option>").attr("value",31).text("Pin 31 - GPIO6"));
$('#node-input-pin').append($("<option></option>").attr("value",32).text("32 - GPIO26 - BCM12")); $('#node-input-pin').append($("<option></option>").attr("value",32).text("Pin 32 - GPIO12"));
$('#node-input-pin').append($("<option></option>").attr("value",33).text("33 - GPIO23 - BCM13")); $('#node-input-pin').append($("<option></option>").attr("value",33).text("Pin 33 - GPIO13"));
$('#node-input-pin').append($("<option></option>").attr("value",35).text("35 - GPIO24 - BCM19")); $('#node-input-pin').append($("<option></option>").attr("value",35).text("Pin 35 - GPIO19"));
$('#node-input-pin').append($("<option></option>").attr("value",36).text("36 - GPIO27 - BCM16")); $('#node-input-pin').append($("<option></option>").attr("value",36).text("Pin 36 - GPIO16"));
$('#node-input-pin').append($("<option></option>").attr("value",37).text("37 - GPIO25 - BCM26")); $('#node-input-pin').append($("<option></option>").attr("value",37).text("Pin 37 - GPIO26"));
$('#node-input-pin').append($("<option></option>").attr("value",38).text("38 - GPIO28 - BCM20")); $('#node-input-pin').append($("<option></option>").attr("value",38).text("Pin 38 - GPIO20"));
$('#node-input-pin').append($("<option></option>").attr("value",40).text("40 - GPIO29 - BCM21")); $('#node-input-pin').append($("<option></option>").attr("value",40).text("Pin 40 - GPIO21"));
$('#node-input-pin').val(pinnow); $('#node-input-pin').val(pinnow);
} }
}); });
@ -154,23 +154,23 @@
<label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="rpi-gpio.label.gpiopin"></span></label> <label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="rpi-gpio.label.gpiopin"></span></label>
<select type="text" id="node-input-pin" style="width: 250px;"> <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='' disabled selected style='display:none;'><span data-i18n="rpi-gpio.label.selectpin"></span></option>
<option value="3">3 - SDA1 - BCM2</option> <!-- <option value="3">Pin 3 - SDA1 - BCM2</option> -->
<option value="5">5 - SCL1 - BCM3</option> <!-- <option value="5">Pin 5 - SCL1 - BCM3</option> -->
<option value="7">7 - GPIO7 - BCM4</option> <option value="7">Pin 7 - GPIO4</option>
<option value="8">8 - TxD - BCM14</option> <!-- <option value="8">Pin 8 - TxD - BCM14</option> -->
<option value="10">10 - RxD - BCM15</option> <!-- <option value="10">Pin 10 - RxD - BCM15</option> -->
<option value="11">11 - GPIO0 - BCM17</option> <option value="11">Pin 11 - GPIO17</option>
<option value="12">12 - GPIO1 - BCM18</option> <option value="12">Pin 12 - GPIO18</option>
<option value="13">13 - GPIO2 - BCM27</option> <option value="13">Pin 13 - GPIO27</option>
<option value="15">15 - GPIO3 - BCM22</option> <option value="15">Pin 15 - GPIO22</option>
<option value="16">16 - GPIO4 - BCM23</option> <option value="16">Pin 16 - GPIO23</option>
<option value="18">18 - GPIO5 - BCM24</option> <option value="18">Pin 18 - GPIO24</option>
<option value="19">19 - MOSI - BCM10</option> <!-- <option value="19">Pin 19 - MOSI - BCM10</option> -->
<option value="21">21 - MISO - BCM9</option> <!-- <option value="21">Pin 21 - MISO - BCM9</option> -->
<option value="22">22 - GPIO6 - BCM25</option> <option value="22">Pin 22 - GPIO25</option>
<option value="23">23 - SCLK - BCM11</option> <!-- <option value="23">Pin 23 - SCLK - BCM11</option> -->
<option value="24">24 - CE0 - BCM8</option> <!-- <option value="24">Pin 24 - CE0 - BCM8</option> -->
<option value="26">26 - CE1 - BCM7</option> <!-- <option value="26">Pin 26 - CE1 - BCM7</option> -->
</select> </select>
&nbsp;<span id="pitype"></span> &nbsp;<span id="pitype"></span>
</div> </div>
@ -255,17 +255,17 @@
$.getJSON('rpi-gpio/'+this.id,function(data) { $.getJSON('rpi-gpio/'+this.id,function(data) {
$('#pitype').text(data.type); $('#pitype').text(data.type);
if ((data.type !== "Model B") && (data.type !== "Model A")) { if ((data.type !== "Model B") && (data.type !== "Model A")) {
$('#node-input-pin').append($("<option></option>").attr("value",27).text("27 - SDA0 - BCM0")); //$('#node-input-pin').append($("<option></option>").attr("value",27).text("Pin 27 - SDA0 - BCM0"));
$('#node-input-pin').append($("<option></option>").attr("value",28).text("28 - SCL0 - BCM1")); //$('#node-input-pin').append($("<option></option>").attr("value",28).text("Pin 28 - SCL0 - BCM1"));
$('#node-input-pin').append($("<option></option>").attr("value",29).text("29 - GPIO21 - BCM5")); $('#node-input-pin').append($("<option></option>").attr("value",29).text("Pin 29 - GPIO5"));
$('#node-input-pin').append($("<option></option>").attr("value",31).text("31 - GPIO22 - BCM6")); $('#node-input-pin').append($("<option></option>").attr("value",31).text("Pin 31 - GPIO6"));
$('#node-input-pin').append($("<option></option>").attr("value",32).text("32 - GPIO26 - BCM12")); $('#node-input-pin').append($("<option></option>").attr("value",32).text("Pin 32 - GPIO12"));
$('#node-input-pin').append($("<option></option>").attr("value",33).text("33 - GPIO23 - BCM13")); $('#node-input-pin').append($("<option></option>").attr("value",33).text("Pin 33 - GPIO13"));
$('#node-input-pin').append($("<option></option>").attr("value",35).text("35 - GPIO24 - BCM19")); $('#node-input-pin').append($("<option></option>").attr("value",35).text("Pin 35 - GPIO19"));
$('#node-input-pin').append($("<option></option>").attr("value",36).text("36 - GPIO27 - BCM16")); $('#node-input-pin').append($("<option></option>").attr("value",36).text("Pin 36 - GPIO16"));
$('#node-input-pin').append($("<option></option>").attr("value",37).text("37 - GPIO25 - BCM26")); $('#node-input-pin').append($("<option></option>").attr("value",37).text("Pin 37 - GPIO26"));
$('#node-input-pin').append($("<option></option>").attr("value",38).text("38 - GPIO28 - BCM20")); $('#node-input-pin').append($("<option></option>").attr("value",38).text("Pin 38 - GPIO20"));
$('#node-input-pin').append($("<option></option>").attr("value",40).text("40 - GPIO29 - BCM21")); $('#node-input-pin').append($("<option></option>").attr("value",40).text("Pin 40 - GPIO21"));
$('#node-input-pin').val(pinnow); $('#node-input-pin').val(pinnow);
} }
}); });
@ -400,7 +400,7 @@
outputs:1, outputs:1,
icon: "rpi.png", icon: "rpi.png",
label: function() { label: function() {
return this.name||this._("rpi-gpio.label.pikeyboard");; return this.name || this._("rpi-gpio.label.pikeyboard");
}, },
labelStyle: function() { labelStyle: function() {
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";

View File

@ -609,7 +609,7 @@
}, },
"rpi-gpio": { "rpi-gpio": {
"label": { "label": {
"gpiopin": "GPIO Pin", "gpiopin": "GPIO",
"selectpin": "select pin", "selectpin": "select pin",
"resistor": "Resistor?", "resistor": "Resistor?",
"readinitial": "Read initial state of pin on deploy/restart?", "readinitial": "Read initial state of pin on deploy/restart?",