2016-01-11 22:21:54 +01:00
|
|
|
<!--
|
|
|
|
Copyright 2016 IBM Corp.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="rpi-unicorn">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-png"><i class="fa fa-picture-o"></i> Background</label>
|
|
|
|
<input type="text" id="node-input-png" placeholder="8 x 8 pixel png file or rrr,ggg,bbb">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-bright"><i class="fa fa-sun-o"></i> Brightness</label>
|
|
|
|
<input type="text" id="node-input-bright" placeholder="0 to 100, default 20" style="width:150px;"> %
|
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
|
|
<input type="text" id="node-input-name">
|
|
|
|
</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="rpi-unicorn">
|
|
|
|
<p>Raspberry Pi Unicorn HAT Node</p>
|
|
|
|
<p>The background of the array can be configured using an 8x8 pixel sized
|
|
|
|
png image, or by specifying a single colour using an r,g,b triple.</p>
|
|
|
|
<p>A pixel is set by <b>msg.payload</b> with a CSV string <i>x,y,r,g,b</i> .
|
|
|
|
If x or y are set to * then the complete row or column can be set.</p>
|
|
|
|
<p>The background can be set to a colour by setting msg.payload to an r,g,b triple.</p>
|
2016-01-12 23:53:24 +01:00
|
|
|
<p>Any msg with a <b>msg.topic</b> identifies a 'sprite' pixel, which can then
|
|
|
|
be moved independently. A 'sprite' can be a single pixel or a complete row.</p>
|
2016-01-11 22:21:54 +01:00
|
|
|
<p>Setting msg.payload to 0 will delete the sprite from the list.</p>
|
|
|
|
<p>Setting msg.payload to "CLS" will clear the display to off and delete any sprites.</p>
|
|
|
|
<p>Setting msg.payload to "DEL" will delete any sprites, and leave the background.</p>
|
|
|
|
<p>The brightness may be set by setting msg.payload to <i>brightness,nn</i>, where nn is 0 to 100.</p>
|
|
|
|
<p>The rotation may be set by setting msg.payload to <i>rotate,rr</i>, where rr is 0, 90, 180 or 270.</p>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('rpi-unicorn',{
|
|
|
|
category: 'Raspberry Pi',
|
|
|
|
label: 'Raspberry Pi',
|
|
|
|
color:"#c6dbef",
|
|
|
|
defaults: {
|
|
|
|
name: { value:"" },
|
|
|
|
png: { value:"" },
|
|
|
|
bright: { value:"" }
|
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
|
|
|
icon: "rpi.png",
|
|
|
|
align: "right",
|
|
|
|
label: function() {
|
|
|
|
return this.name||"unicorn hat";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|