pxt-jacdac/character-screen/client.g.ts

61 строка
2.2 KiB
TypeScript
Исходник Обычный вид История

2021-02-11 13:11:35 +03:00
namespace modules {
2021-02-11 14:05:12 +03:00
/**
* A screen that displays characters.
**/
//% fixedInstances blockGap=8
2021-02-11 13:11:35 +03:00
export class CharacterScreenClient extends jacdac.Client {
private readonly _brightness : jacdac.RegisterClient<[number]>;
private readonly _message : jacdac.RegisterClient<[string]>;
constructor(role: string) {
2021-02-11 13:11:35 +03:00
super(jacdac.SRV_CHARACTER_SCREEN, role);
2021-02-11 19:16:50 +03:00
this._brightness = this.addRegister<[number]>(jacdac.CharacterScreenReg.Brightness, "u0.8");
this._message = this.addRegister<[string]>(jacdac.CharacterScreenReg.Message, "s");
2021-02-11 13:11:35 +03:00
}
/**
* Brightness of the screen. `0` means off.
*/
//% group="Character Screen" blockSetVariable=myModule
//% blockCombine block="brightness" callInDebugger
get brightness(): number {
const values = this._brightness.values() as any[];
2021-02-11 19:16:50 +03:00
return values[0];
}
/**
* Brightness of the screen. `0` means off.
*/
//% group="Character Screen" blockSetVariable=myModule
//% blockCombine block="brightness" callInDebugger
set brightness(value: number) {
const values = this._brightness.values() as any[];
values[0] = value;
this._brightness.setValues(values as [number]);
}
/**
* Text to show. Use `\n` to break lines.
*/
//% group="Character Screen" blockSetVariable=myModule
//% blockCombine block="message" callInDebugger
2021-02-11 19:16:50 +03:00
get message(): string {
const values = this._message.values() as any[];
return values[0];
}
/**
* Text to show. Use `\n` to break lines.
*/
//% group="Character Screen" blockSetVariable=myModule
//% blockCombine block="message" callInDebugger
set message(value: string) {
const values = this._message.values() as any[];
values[0] = value;
this._message.setValues(values as [string]);
2021-02-11 19:16:50 +03:00
}
}
2021-02-11 13:11:35 +03:00
//% fixedInstance whenUsed
export const characterScreen = new CharacterScreenClient("character Screen");
}