mirror of
https://github.com/sexybiggetje/pixdisp.git
synced 2024-11-14 06:31:02 +01:00
29 lines
No EOL
456 B
JavaScript
29 lines
No EOL
456 B
JavaScript
"use strict";
|
|
|
|
let { Driver } = require( './driver' );
|
|
|
|
class PimoroniUnicorn extends Driver {
|
|
constructor() {
|
|
super();
|
|
|
|
let SPI = require( 'pi-spi' );
|
|
this.spi = SPI.initialize( '/dev/spidev0.0' );
|
|
}
|
|
|
|
write( buffer ) {
|
|
this.spi.write(
|
|
Buffer.concat(
|
|
[ new Buffer( [ 0x72 ] ),
|
|
buffer ]
|
|
),
|
|
|
|
function ( err ) {
|
|
if ( err ) {
|
|
throw 'Failed writing buffer';
|
|
}
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
exports.PimoroniUnicorn = PimoroniUnicorn; |