拡張機能について
内蔵デバイスの利用機能
- 内蔵センサー :
readSensor()
(全てのセンサーの値を一度に取得します)
- ボタン :
readSensor()
(同上)
- マトリクスLED :
printLED()
および showIconLED()
サンプル
GPIOの拡張機能
- アナログ入出力 :
export ("analogin")
, export ("analogout")
- プルアップ/プルダウン設定 :
export ("in","up")
, export ("in","down")
, export ("in","none")
サンプル
IDL
partial interface Window {
MicroBitBleFactory microBitBleFactory;
};
interface MicroBitBleFactory {
Promise<MicroBitBle> connect();
};
interface MicroBitBle {
Promise<GPIOAccess> requestGPIOAccess ();
Promise<I2CAccess> requestI2CAccess ();
Promise disconnect ();
attribute readonly boolean connected;
Promise<MicroBitSensData> readSensor ();
Promise printLED (DOMString message);
Promise showIconLED (int iconNumber);
};
interface MicroBitSensData{
attribute readonly VectorValue acceleration;
attribute readonly VectorValue magneticField;
attribute readonly int temperature;
attribute readonly int brightness;
attribute readonly int button;
};
interface VectorValue{
attribute int x;
attribute int y;
attribute int z;
};
partial interface GPIOPort : EventTarget {
Promise export (DirectionMode direction , optional PullMode pullMode);
};
enum DirectionMode { "", "in", "out", "analogin", "analogout" }
enum PullMode { "none", "up", "down" }
partial interface I2CSlaveDevice {
Promise<Int8Array> readBytes(unsigned short byteLength);
Promise writeByte(octet byte);
Promise writeBytes(Int8Array bytes);
};
IconNumber