pxt-ev3/libs/core/shims.d.ts

176 lines
5.1 KiB
TypeScript
Raw Normal View History

2017-07-05 02:17:26 +02:00
// Auto-generated. Do not edit.
2017-07-07 19:26:49 +02:00
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;
/** Returns the length of a Buffer object. */
//% property shim=MMapMethods::length
length: int32;
2017-07-08 12:16:12 +02:00
/** Perform ioctl(2) on the underlaying file */
//% shim=MMapMethods::ioctl
ioctl(id: uint32, data: Buffer): void;
2017-07-07 19:26:49 +02:00
}
2017-07-07 12:44:34 +02:00
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;
}
2017-07-05 02:17:26 +02:00
declare namespace input {
/**
* Left button.
*/
//% indexedInstanceNS=input indexedInstanceShim=pxt::getButton
//% block="button left" weight=95 fixedInstance shim=pxt::getButton(0)
const buttonLeft: Button;
/**
* Right button.
*/
//% block="button right" weight=94 fixedInstance shim=pxt::getButton(1)
const buttonRight: Button;
/**
* Up button.
*/
//% block="button up" weight=95 fixedInstance shim=pxt::getButton(2)
const buttonUp: Button;
/**
* Down button.
*/
//% block="button down" weight=95 fixedInstance shim=pxt::getButton(3)
const buttonDown: Button;
/**
* Enter button.
*/
//% block="button enter" weight=95 fixedInstance shim=pxt::getButton(4)
const buttonEnter: Button;
}
2017-07-05 14:06:58 +02:00
declare namespace control {
/**
* Determine the version of system software currently running.
*/
//% shim=control::deviceFirmwareVersion
function deviceFirmwareVersion(): string;
}
2017-07-05 13:27:54 +02:00
declare namespace output {
/**
* Set lights.
*/
//% blockId=setLights block="set lights %pattern" shim=output::setLights
function setLights(pattern: LightsPattern): void;
}
2017-07-05 02:17:26 +02:00
2017-07-05 13:27:54 +02:00
//% fixedInstances
2017-07-05 02:17:26 +02:00
declare interface Button {
/**
* Do something when a button (`A`, `B` or both `A` + `B`) is clicked, double clicked, etc...
* @param button the button that needs to be clicked or used
* @param event the kind of button gesture that needs to be detected
* @param body code to run when the event is raised
*/
//% help=input/button/on-event weight=99 blockGap=8
//% blockId=buttonEvent block="on %button|%event"
//% parts="buttonpair"
//% blockNamespace=input
//% button.fieldEditor="gridpicker"
//% button.fieldOptions.width=220
//% button.fieldOptions.columns=3 shim=ButtonMethods::onEvent
onEvent(ev: ButtonEvent, body: () => void): void;
/**
* Check if a button is pressed or not.
* @param button the button to query the request
*/
//% help=input/button/is-pressed weight=79
//% block="%button|is pressed"
//% blockId=buttonIsPressed
//% blockGap=8
//% parts="buttonpair"
//% blockNamespace=input
//% button.fieldEditor="gridpicker"
//% button.fieldOptions.width=220
//% button.fieldOptions.columns=3 shim=ButtonMethods::isPressed
isPressed(): boolean;
/**
* See if the button was pressed again since the last time you checked.
* @param button the button to query the request
*/
//% help=input/button/was-pressed weight=78
//% block="%button|was pressed"
//% blockId=buttonWasPressed
//% parts="buttonpair" blockGap=8
//% blockNamespace=input advanced=true
//% button.fieldEditor="gridpicker"
//% button.fieldOptions.width=220
//% button.fieldOptions.columns=3 shim=ButtonMethods::wasPressed
wasPressed(): boolean;
}
2017-07-05 14:06:58 +02:00
declare namespace screen {
/** Draw text. */
2017-07-05 14:56:13 +02:00
//% mode.defl=0 shim=screen::drawText
function drawText(x: int32, y: int32, text: string, mode?: Draw): void;
/** Clear screen and reset font to normal. */
//% shim=screen::clear
function clear(): void;
/** Scroll screen vertically. */
//% shim=screen::scroll
function scroll(v: int32): void;
/** Set font for drawText() */
//% shim=screen::setFont
function setFont(font: ScreenFont): void;
2017-07-05 14:06:58 +02:00
}
2017-07-07 16:15:36 +02:00
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;
}
2017-07-05 02:17:26 +02:00
// Auto-generated. Do not edit. Really.