Buffer from commonpackages (#1520)

* use buffer.ts from common packages

* updated common packages

* fix descr

* fix double description

* restore pin descr
This commit is contained in:
Peli de Halleux
2018-10-25 09:19:49 -07:00
committed by GitHub
parent 44a47a7e5c
commit 11dbaabe3a
6 changed files with 15 additions and 30 deletions

View File

@ -38,33 +38,4 @@ namespace pins {
buf.setNumber(format, 0, value)
pins.i2cWriteBuffer(address, buf, repeated)
}
/**
* Get the size in bytes of specified number format.
*/
//%
export function sizeOf(format: NumberFormat) {
switch (format) {
case NumberFormat.Int8LE:
case NumberFormat.UInt8LE:
case NumberFormat.Int8BE:
case NumberFormat.UInt8BE:
return 1;
case NumberFormat.Int16LE:
case NumberFormat.UInt16LE:
case NumberFormat.Int16BE:
case NumberFormat.UInt16BE:
return 2;
case NumberFormat.Int32LE:
case NumberFormat.Int32BE:
return 4;
}
return 0;
}
}
interface Buffer {
[index: number]: number;
// rest defined in buffer.cpp
}