拡張機能について

内蔵デバイスの利用機能

サンプル

GPIOの拡張機能

サンプル

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

IconNumber