mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Neopixel <o> cmd
This commit is contained in:
parent
03d8d5f93d
commit
d3d6cc97fb
|
@ -72,7 +72,7 @@ Once a new OPCODE is decided upon, update this list.
|
||||||
M, Write DCC packet
|
M, Write DCC packet
|
||||||
n, Reserved for SensorCam
|
n, Reserved for SensorCam
|
||||||
N, Reserved for Sensorcam
|
N, Reserved for Sensorcam
|
||||||
o,
|
o, Neopixel driver (see also IO_NeoPixel.h)
|
||||||
O, Output broadcast
|
O, Output broadcast
|
||||||
p, Broadcast power state
|
p, Broadcast power state
|
||||||
P, Write DCC packet
|
P, Write DCC packet
|
||||||
|
@ -394,6 +394,33 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifndef IO_NO_HAL
|
||||||
|
case 'o': // Neopixel pin manipulation
|
||||||
|
if (p[0]==0) break;
|
||||||
|
{
|
||||||
|
VPIN vpin=p[0]>0 ? p[0]:-p[0];
|
||||||
|
bool setON=p[0]>0;
|
||||||
|
if (params==1) { // <o [-]vpin>
|
||||||
|
IODevice::write(vpin,setON);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (params==2) { // <o [-]vpin count>
|
||||||
|
for (auto pix=vpin;pix<=vpin+p[1];pix++) IODevice::write(pix,setON);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (params==4 || params==5) { // <z [-]vpin r g b [count]>
|
||||||
|
uint16_t colourcode=((p[1] & 0x1F)<<11) |
|
||||||
|
((p[2] & 0x1F)<<6) |
|
||||||
|
((p[3] & 0x1F)<<1);
|
||||||
|
if (setON) colourcode |= 0x0001;
|
||||||
|
// driver treats count 0 as 1
|
||||||
|
for (auto pix=vpin;pix<=vpin+p[4];pix++) IODevice::writeAnalogue(pix,colourcode,0,0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 'z': // direct pin manipulation
|
case 'z': // direct pin manipulation
|
||||||
if (p[0]==0) break;
|
if (p[0]==0) break;
|
||||||
if (params==1) { // <z vpin | -vpin>
|
if (params==1) { // <z vpin | -vpin>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user