bring back the shims
This commit is contained in:
parent
408631d426
commit
94db31beb7
2
.gitignore
vendored
2
.gitignore
vendored
@ -17,8 +17,6 @@ clients/**/bin/**
|
||||
clients/**/obj/**
|
||||
clients/electron/projects
|
||||
libs/**/_locales/**
|
||||
libs/**/shims.d.ts
|
||||
libs/**/enums.d.ts
|
||||
|
||||
videos/**
|
||||
|
||||
|
34
libs/base/enums.d.ts
vendored
Normal file
34
libs/base/enums.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Auto-generated. Do not edit.
|
||||
|
||||
|
||||
declare const enum NumberFormat {
|
||||
Int8LE = 1,
|
||||
UInt8LE = 2,
|
||||
Int16LE = 3,
|
||||
UInt16LE = 4,
|
||||
Int32LE = 5,
|
||||
Int8BE = 6,
|
||||
UInt8BE = 7,
|
||||
Int16BE = 8,
|
||||
UInt16BE = 9,
|
||||
Int32BE = 10,
|
||||
|
||||
UInt32LE = 11,
|
||||
UInt32BE = 12,
|
||||
Float32LE = 13,
|
||||
Float64LE = 14,
|
||||
Float32BE = 15,
|
||||
Float64BE = 16,
|
||||
}
|
||||
|
||||
|
||||
declare const enum ValType {
|
||||
Undefined = 0,
|
||||
Boolean = 1,
|
||||
Number = 2,
|
||||
String = 3,
|
||||
Object = 4,
|
||||
Function = 5,
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
159
libs/base/shims.d.ts
vendored
Normal file
159
libs/base/shims.d.ts
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
// Auto-generated. Do not edit.
|
||||
|
||||
|
||||
|
||||
//% indexerGet=BufferMethods::getByte indexerSet=BufferMethods::setByte
|
||||
declare interface Buffer {
|
||||
/**
|
||||
* Write a number in specified format in the buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::setNumber
|
||||
setNumber(format: NumberFormat, offset: int32, value: number): void;
|
||||
|
||||
/**
|
||||
* Read a number in specified format from the buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::getNumber
|
||||
getNumber(format: NumberFormat, offset: int32): number;
|
||||
|
||||
/** Returns the length of a Buffer object. */
|
||||
//% property shim=BufferMethods::length
|
||||
length: int32;
|
||||
|
||||
/**
|
||||
* Fill (a fragment) of the buffer with given value.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=BufferMethods::fill
|
||||
fill(value: int32, offset?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Return a copy of a fragment of a buffer.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=BufferMethods::slice
|
||||
slice(offset?: int32, length?: int32): Buffer;
|
||||
|
||||
/**
|
||||
* Shift buffer left in place, with zero padding.
|
||||
* @param offset number of bytes to shift; use negative value to shift right
|
||||
* @param start start offset in buffer. Default is 0.
|
||||
* @param length number of elements in buffer. If negative, length is set as the buffer length minus
|
||||
* start. eg: -1
|
||||
*/
|
||||
//% start.defl=0 length.defl=-1 shim=BufferMethods::shift
|
||||
shift(offset: int32, start?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Convert a buffer to its hexadecimal representation.
|
||||
*/
|
||||
//% shim=BufferMethods::toHex
|
||||
toHex(): string;
|
||||
|
||||
/**
|
||||
* Rotate buffer left in place.
|
||||
* @param offset number of bytes to shift; use negative value to shift right
|
||||
* @param start start offset in buffer. Default is 0.
|
||||
* @param length number of elements in buffer. If negative, length is set as the buffer length minus
|
||||
* start. eg: -1
|
||||
*/
|
||||
//% start.defl=0 length.defl=-1 shim=BufferMethods::rotate
|
||||
rotate(offset: int32, start?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Write contents of `src` at `dstOffset` in current buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::write
|
||||
write(dstOffset: int32, src: Buffer): void;
|
||||
}
|
||||
declare namespace loops {
|
||||
|
||||
/**
|
||||
* Repeats the code forever in the background. On each iteration, allows other codes to run.
|
||||
* @param body code to execute
|
||||
*/
|
||||
//% help=loops/forever weight=100 afterOnStart=true
|
||||
//% blockId=forever block="forever" blockAllowMultiple=1 shim=loops::forever
|
||||
function forever(a: () => void): void;
|
||||
|
||||
/**
|
||||
* Pause for the specified time in milliseconds
|
||||
* @param ms how long to pause for, eg: 100, 200, 500, 1000, 2000
|
||||
*/
|
||||
//% help=loops/pause weight=99
|
||||
//% async block="pause %pause=timePicker|ms"
|
||||
//% blockId=device_pause shim=loops::pause
|
||||
function pause(ms: int32): void;
|
||||
}
|
||||
declare namespace control {
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds elapsed since power on.
|
||||
*/
|
||||
//% help=control/millis weight=50
|
||||
//% blockId=control_running_time block="millis (ms)" shim=control::millis
|
||||
function millis(): int32;
|
||||
|
||||
/**
|
||||
* Run code when a registered event happens.
|
||||
* @param id the event compoent id
|
||||
* @param value the event value to match
|
||||
*/
|
||||
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src|with value %value"
|
||||
//% blockExternalInputs=1
|
||||
//% help="control/on-event" flags.defl=16 shim=control::onEvent
|
||||
function onEvent(src: int32, value: int32, handler: () => void, flags?: int32): void;
|
||||
|
||||
/**
|
||||
* Reset the device.
|
||||
*/
|
||||
//% weight=30 async help=control/reset blockGap=8
|
||||
//% blockId="control_reset" block="reset" shim=control::reset
|
||||
function reset(): void;
|
||||
|
||||
/**
|
||||
* Block the current fiber for the given microseconds
|
||||
* @param micros number of micro-seconds to wait. eg: 4
|
||||
*/
|
||||
//% help=control/wait-micros weight=29 async
|
||||
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
|
||||
function waitMicros(micros: int32): void;
|
||||
|
||||
/**
|
||||
* Run other code in the parallel.
|
||||
*/
|
||||
//% help=control/run-in-parallel handlerStatement=1
|
||||
//% blockId="control_run_in_parallel" block="run in parallel" blockGap=8 shim=control::runInParallel
|
||||
function runInParallel(a: () => void): void;
|
||||
|
||||
/**
|
||||
* Blocks the calling thread until the specified event is raised.
|
||||
*/
|
||||
//% help=control/wait-for-event async
|
||||
//% blockId=control_wait_for_event block="wait for event|from %src|with value %value" shim=control::waitForEvent
|
||||
function waitForEvent(src: int32, value: int32): void;
|
||||
|
||||
/**
|
||||
* Derive a unique, consistent serial number of this device from internal data.
|
||||
*/
|
||||
//% blockId="control_device_serial_number" block="device serial number" weight=9
|
||||
//% help=control/device-serial-number shim=control::deviceSerialNumber
|
||||
function deviceSerialNumber(): int32;
|
||||
}
|
||||
declare namespace serial {
|
||||
|
||||
/**
|
||||
* Write some text to the serial port.
|
||||
*/
|
||||
//% help=serial/write-string
|
||||
//% weight=87 blockHidden=true
|
||||
//% blockId=serial_writestring block="serial|write string %text" shim=serial::writeString
|
||||
function writeString(text: string): void;
|
||||
|
||||
/**
|
||||
* Send a buffer across the serial connection.
|
||||
*/
|
||||
//% help=serial/write-buffer weight=6 blockHidden=true
|
||||
//% blockId=serial_writebuffer block="serial|write buffer %buffer" shim=serial::writeBuffer
|
||||
function writeBuffer(buffer: Buffer): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
29
libs/core/enums.d.ts
vendored
Normal file
29
libs/core/enums.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Auto-generated. Do not edit.
|
||||
|
||||
|
||||
/**
|
||||
* Mode for lseek()
|
||||
*/
|
||||
|
||||
declare const enum SeekWhence {
|
||||
Set = 0,
|
||||
Current = 1,
|
||||
End = 2,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drawing modes
|
||||
*/
|
||||
|
||||
declare const enum Draw {
|
||||
Normal = 0x00,
|
||||
Clear = 0x01,
|
||||
Xor = 0x02,
|
||||
Fill = 0x04,
|
||||
Transparent = 0x08,
|
||||
Double = 0x10,
|
||||
Quad = 0x20,
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
144
libs/core/shims.d.ts
vendored
Normal file
144
libs/core/shims.d.ts
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
// Auto-generated. Do not edit.
|
||||
declare namespace control {
|
||||
|
||||
/** Create new file mapping in memory */
|
||||
//% shim=control::mmap
|
||||
function mmap(filename: string, size: int32, offset: int32): MMap;
|
||||
}
|
||||
|
||||
|
||||
declare interface MMap {
|
||||
/**
|
||||
* Write a number in specified format in the buffer.
|
||||
*/
|
||||
//% shim=MMapMethods::setNumber
|
||||
setNumber(format: NumberFormat, offset: int32, value: number): void;
|
||||
|
||||
/**
|
||||
* Read a number in specified format from the buffer.
|
||||
*/
|
||||
//% shim=MMapMethods::getNumber
|
||||
getNumber(format: NumberFormat, offset: int32): number;
|
||||
|
||||
/**
|
||||
* Read a range of bytes into a buffer.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=MMapMethods::slice
|
||||
slice(offset?: int32, length?: int32): Buffer;
|
||||
|
||||
/** Returns the length of a Buffer object. */
|
||||
//% property shim=MMapMethods::length
|
||||
length: int32;
|
||||
|
||||
/** Perform ioctl(2) on the underlaying file */
|
||||
//% shim=MMapMethods::ioctl
|
||||
ioctl(id: uint32, data: Buffer): int32;
|
||||
|
||||
/** Perform write(2) on the underlaying file */
|
||||
//% shim=MMapMethods::write
|
||||
write(data: Buffer): int32;
|
||||
|
||||
/** Perform read(2) on the underlaying file */
|
||||
//% shim=MMapMethods::read
|
||||
read(data: Buffer): int32;
|
||||
|
||||
/** Set pointer on the underlaying file. */
|
||||
//% shim=MMapMethods::lseek
|
||||
lseek(offset: int32, whence: SeekWhence): int32;
|
||||
}
|
||||
declare namespace control {
|
||||
|
||||
/**
|
||||
* Announce that an event happened to registered handlers.
|
||||
* @param src ID of the Component that generated the event
|
||||
* @param value Component specific code indicating the cause of the event.
|
||||
* @param mode optional definition of how the event should be processed after construction.
|
||||
*/
|
||||
//% weight=21 blockGap=12 blockId="control_raise_event"
|
||||
//% block="raise event|from %src|with value %value" blockExternalInputs=1 shim=control::raiseEvent
|
||||
function raiseEvent(src: int32, value: int32): void;
|
||||
|
||||
/**
|
||||
* Allocates the next user notification event
|
||||
*/
|
||||
//% help=control/allocate-notify-event shim=control::allocateNotifyEvent
|
||||
function allocateNotifyEvent(): int32;
|
||||
|
||||
/** Write data to DMESG debugging buffer. */
|
||||
//% shim=control::dmesg
|
||||
function dmesg(s: string): void;
|
||||
}
|
||||
declare namespace serial {
|
||||
|
||||
/** Send DMESG debug buffer over serial. */
|
||||
//% shim=serial::writeDmesg
|
||||
function writeDmesg(): void;
|
||||
}
|
||||
declare namespace screen {
|
||||
|
||||
/** Decompresses a 1-bit gray scale PNG image to image format. */
|
||||
//% shim=screen::unpackPNG
|
||||
function unpackPNG(png: Buffer): Image;
|
||||
}
|
||||
declare namespace screen {
|
||||
|
||||
/** Clear screen and reset font to normal. */
|
||||
//% shim=screen::clear
|
||||
function clear(): void;
|
||||
|
||||
/** Makes an image bound to a buffer. */
|
||||
//% shim=screen::imageOf
|
||||
function imageOf(buf: Buffer): Image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//% fixedInstances
|
||||
declare interface Image {
|
||||
/** Returns the underlaying Buffer object. */
|
||||
//% property shim=ImageMethods::buffer
|
||||
buffer: Buffer;
|
||||
|
||||
/** Returns the width of an image. */
|
||||
//% property shim=ImageMethods::width
|
||||
width: int32;
|
||||
|
||||
/** Returns the height of an image. */
|
||||
//% property shim=ImageMethods::height
|
||||
height: int32;
|
||||
|
||||
/** Double size of an image. */
|
||||
//% shim=ImageMethods::doubled
|
||||
doubled(): Image;
|
||||
|
||||
/** Draw an image on the screen. */
|
||||
//% shim=ImageMethods::draw
|
||||
draw(x: int32, y: int32, mode: Draw): void;
|
||||
}
|
||||
declare namespace output {
|
||||
|
||||
/**
|
||||
* Create a new zero-initialized buffer.
|
||||
* @param size number of bytes in the buffer
|
||||
*/
|
||||
//% shim=output::createBuffer
|
||||
function createBuffer(size: int32): Buffer;
|
||||
}
|
||||
declare namespace motors {
|
||||
|
||||
/**
|
||||
* Mark a motor as used
|
||||
*/
|
||||
//% shim=motors::__motorUsed
|
||||
function __motorUsed(port: int32, large: boolean): void;
|
||||
}
|
||||
declare namespace sensors {
|
||||
|
||||
/**
|
||||
* Mark a sensor as used
|
||||
*/
|
||||
//% shim=sensors::__sensorUsed
|
||||
function __sensorUsed(port: int32, type: int32): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
56
libs/music/shims.d.ts
vendored
Normal file
56
libs/music/shims.d.ts
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
// Auto-generated. Do not edit.
|
||||
declare namespace music {
|
||||
|
||||
/**
|
||||
* Set the output volume of the sound synthesizer.
|
||||
* @param volume the volume 0...100, eg: 50
|
||||
*/
|
||||
//% weight=96
|
||||
//% blockId=synth_set_volume block="set volume %volume"
|
||||
//% parts="speaker" blockGap=8
|
||||
//% volume.min=0 volume.max=100
|
||||
//% help=music/set-volume
|
||||
//% weight=1 shim=music::setVolume
|
||||
function setVolume(volume: int32): void;
|
||||
|
||||
/**
|
||||
* Play a tone through the speaker for some amount of time.
|
||||
* @param frequency pitch of the tone to play in Hertz (Hz)
|
||||
* @param ms tone duration in milliseconds (ms)
|
||||
*/
|
||||
//% help=music/play-tone
|
||||
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
|
||||
//% parts="headphone" async
|
||||
//% blockNamespace=music
|
||||
//% weight=76 blockGap=8 shim=music::playTone
|
||||
function playTone(frequency: int32, ms: int32): void;
|
||||
|
||||
/**
|
||||
* Play a tone through the speaker for some amount of time.
|
||||
*/
|
||||
//% help=music/stop-all-sounds
|
||||
//% blockId=music_stop_all_sounds block="stop all sounds"
|
||||
//% parts="headphone"
|
||||
//% blockNamespace=music
|
||||
//% weight=97 shim=music::stopAllSounds
|
||||
function stopAllSounds(): void;
|
||||
|
||||
/** Makes a sound bound to a buffer in WAV format. */
|
||||
//% shim=music::fromWAV
|
||||
function fromWAV(buf: Buffer): Sound;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//% fixedInstances
|
||||
declare interface Sound {
|
||||
/** Returns the underlaying Buffer object. */
|
||||
//% property shim=SoundMethods::buffer
|
||||
buffer: Buffer;
|
||||
|
||||
/** Play sound. */
|
||||
//% promise shim=SoundMethods::play
|
||||
play(): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
17
libs/storage/shims.d.ts
vendored
Normal file
17
libs/storage/shims.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Auto-generated. Do not edit.
|
||||
declare namespace storage {
|
||||
|
||||
/** Will be moved. */
|
||||
//% shim=storage::__stringToBuffer
|
||||
function __stringToBuffer(s: string): Buffer;
|
||||
|
||||
/** Will be moved. */
|
||||
//% shim=storage::__bufferToString
|
||||
function __bufferToString(s: Buffer): string;
|
||||
|
||||
/** Create named directory. */
|
||||
//% shim=storage::__mkdir
|
||||
function __mkdir(filename: string): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
Loading…
Reference in New Issue
Block a user