Skip to content

Commit

Permalink
rename VIdeoFramePacket to VideoFramePacket
Browse files Browse the repository at this point in the history
  • Loading branch information
szabolcsit committed Feb 17, 2018
1 parent 4f4565c commit a9ae0d9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/lib/VideoFramePacket.js
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)
}
}

0 comments on commit a9ae0d9

Please sign in to comment.