-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename VIdeoFramePacket to VideoFramePacket
- Loading branch information
szabolcsit
committed
Feb 17, 2018
1 parent
4f4565c
commit a9ae0d9
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict' | ||
|
||
const FadeCandyPacket = require('./FadeCandyPacket') | ||
|
||
/* | ||
In a type 0 packet, the USB packet contains up to 21 pixels of 24-bit RGB color data. | ||
The last packet (index 24) only needs to contain 8 valid pixels. | ||
Pixels 9-20 in these packets are ignored. | ||
https://github.com/scanlime/fadecandy/blob/master/doc/fc_protocol_usb.md#video-packets | ||
*/ | ||
|
||
|
||
module.exports = class VideoFramePacket extends FadeCandyPacket { | ||
|
||
constructor (data) { | ||
super() | ||
|
||
this.type = 0b00000000 // 0 | ||
this.max_entries = 63 | ||
|
||
if (data) return this.create(data) | ||
} | ||
|
||
create (data) { | ||
|
||
let pA = this.createPacketArray(data) | ||
|
||
// add control byte on index 0 | ||
pA = this.setControlBytes(pA) | ||
|
||
return this.createBuffer(pA) | ||
} | ||
} |