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>
This commit is contained in:
Ivan Mikhaylov 2022-08-01 11:49:27 -04:00
parent d1bd7347ab
commit 92cabd3b65
2 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<script type="text/javascript">
RED.nodes.registerType('mraa-gpio-ain',{
category: 'Intel gpio',
category: 'GPIO',
color: '#a6bbcf',
paletteLabel: 'analogue',
defaults: {
@ -27,6 +27,7 @@
if (data === 5) { t = "Raspberry Pi"; }
if (data === 6) { t = "Beaglebone"; }
if (data === 7) { t = "Banana"; }
if (data === 25) { t = "IOT2050"; }
$('#btype').text(t);
$('#node-input-pin').val(pinnow);
});
@ -62,7 +63,7 @@
</script>
<script type="text/x-red" data-help-name="mraa-gpio-ain">
<p>An analogue input pin for an Intel Galileo or Edison board that is read every <i>interval</i> milliseconds.</p>
<p>An analogue input pin for a board that is read every <i>interval</i> milliseconds.</p>
<p>The <code>msg.payload</code> will contain the value, and <code>msg.topic</code>
contains "{the_board_name}/A{the pin number}".</p>
<p>The value is only sent if it is different from the previously read value.</p>

View File

@ -11,6 +11,10 @@ module.exports = function(RED) {
var node = this;
var msg = { topic:node.board+"/A"+node.pin };
var old = -99999;
// ADC set to 12 for IOT2050
if (this.board === "SIMATIC IOT2050") {
node.x.setBit(12);
}
this.timer = setInterval(function() {
msg.payload = node.x.read();
if (msg.payload !== old) {