diff --git a/.github/workflows/makecode.yml b/.github/workflows/makecode.yml index d8f393959..4a23992fe 100644 --- a/.github/workflows/makecode.yml +++ b/.github/workflows/makecode.yml @@ -31,6 +31,7 @@ jobs: - run: makecode -u -j --mono-repo -c mkc.json - run: makecode -u -j --mono-repo -c mkc-maker.json - run: makecode -u -j --mono-repo -c mkc-arcade.json + - run: makecode -u -j --mono-repo -c mkc-calliope.json - run: makecode -c mkc.json - run: makecode -c mkc-maker.json --hw nucleo-f411re - run: makecode -c mkc-arcade.json --hw F4,D5,N4,N3 diff --git a/accelerometer/pxt.json b/accelerometer/pxt.json index b47122dc1..882f71ddf 100644 --- a/accelerometer/pxt.json +++ b/accelerometer/pxt.json @@ -21,6 +21,6 @@ "test.microbit.ts" ], "fileDependencies": { - "test.microbit.ts": "target:microbit || target:calliopemini" + "test.microbit.ts": "target:microbit" } } diff --git a/buzzer-server/pxt.json b/buzzer-server/pxt.json index a454ac9e5..dd2535d6f 100644 --- a/buzzer-server/pxt.json +++ b/buzzer-server/pxt.json @@ -15,8 +15,7 @@ ], "supportedTargets": [ "microbit", - "arcade", - "calliopemini" + "arcade" ], "preferredEditor": "tsprj" } diff --git a/devices/microbit/pxt.json b/devices/microbit/pxt.json index 9e4b697d0..cd44ced43 100644 --- a/devices/microbit/pxt.json +++ b/devices/microbit/pxt.json @@ -41,8 +41,7 @@ "targetId": "microbit" }, "supportedTargets": [ - "microbit", - "calliopemini" + "microbit" ], "preferredEditor": "tsprj" } diff --git a/p-ccontroller/constants.ts b/p-ccontroller/constants.ts deleted file mode 100644 index e81c99d22..000000000 --- a/p-ccontroller/constants.ts +++ /dev/null @@ -1,63 +0,0 @@ -namespace jacdac { - // Service PC controller constants - export const SRV_P_CCONTROLLER = 0x113d0987 - export const enum PCControllerCmd { - /** - * Argument: url string (bytes). Open a URL in the default browser. - * - * ``` - * const [url] = jdunpack<[string]>(buf, "s") - * ``` - */ - OpenUrl = 0x80, - - /** - * Argument: name string (bytes). Start an app. - * - * ``` - * const [name] = jdunpack<[string]>(buf, "s") - * ``` - */ - StartApp = 0x81, - - /** - * Argument: text string (bytes). Send text to the active window. - * - * ``` - * const [text] = jdunpack<[string]>(buf, "s") - * ``` - */ - SendText = 0x82, - - /** - * Argument: script string (bytes). Run a script. - * - * ``` - * const [script] = jdunpack<[string]>(buf, "s") - * ``` - */ - RunScript = 0x83, - } - - export namespace PCControllerCmdPack { - /** - * Pack format for 'open_url' data. - */ - export const OpenUrl = "s" - - /** - * Pack format for 'start_app' data. - */ - export const StartApp = "s" - - /** - * Pack format for 'send_text' data. - */ - export const SendText = "s" - - /** - * Pack format for 'run_script' data. - */ - export const RunScript = "s" - } -} diff --git a/p-ccontroller/pxt.g.json b/p-ccontroller/pxt.g.json deleted file mode 100644 index c63d671b8..000000000 --- a/p-ccontroller/pxt.g.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "jacdac-p-ccontroller", - "version": "0.0.0", - "description": "Send various events to PC, including opening a URL, start an app, sending text, etc.", - "files": [ - "constants.ts", - "client.g.ts" - ], - "testFiles": [ - "test.ts" - ], - "supportedTargets": [ - "microbit", - "arcade", - "maker", - "calliopemini" - ], - "dependencies": { - "core": "*", - "jacdac": "github:microsoft/pxt-jacdac" - } -} \ No newline at end of file diff --git a/p-cmonitor/constants.ts b/p-cmonitor/constants.ts deleted file mode 100644 index 963bef71c..000000000 --- a/p-cmonitor/constants.ts +++ /dev/null @@ -1,77 +0,0 @@ -namespace jacdac { - // Service PC monitor constants - export const SRV_P_CMONITOR = 0x18627b15 - export const enum PCMonitorReg { - /** - * Read-only % uint8_t. CPU usage in percent. - * - * ``` - * const [cpuUsage] = jdunpack<[number]>(buf, "u8") - * ``` - */ - CpuUsage = 0x190, - - /** - * Read-only °C uint8_t. CPU temperature in Celsius. - * - * ``` - * const [cpuTemp] = jdunpack<[number]>(buf, "u8") - * ``` - */ - CpuTemp = 0x191, - - /** - * Read-only % uint8_t. RAM usage in percent. - * - * ``` - * const [ramUsage] = jdunpack<[number]>(buf, "u8") - * ``` - */ - RamUsage = 0x192, - - /** - * GPU info. - * - * ``` - * const [usage, temp] = jdunpack<[number, number]>(buf, "u8 u8") - * ``` - */ - GpuInfo = 0x193, - - /** - * Network transmit/receive speed in Kbytes per second. - * - * ``` - * const [tx, rx] = jdunpack<[number, number]>(buf, "u16 u16") - * ``` - */ - NetInfo = 0x195, - } - - export namespace PCMonitorRegPack { - /** - * Pack format for 'cpu_usage' data. - */ - export const CpuUsage = "u8" - - /** - * Pack format for 'cpu_temp' data. - */ - export const CpuTemp = "u8" - - /** - * Pack format for 'ram_usage' data. - */ - export const RamUsage = "u8" - - /** - * Pack format for 'gpu_info' data. - */ - export const GpuInfo = "u8 u8" - - /** - * Pack format for 'net_info' data. - */ - export const NetInfo = "u16 u16" - } -} diff --git a/p-cmonitor/pxt.g.json b/p-cmonitor/pxt.g.json deleted file mode 100644 index b23cb7c06..000000000 --- a/p-cmonitor/pxt.g.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "jacdac-p-cmonitor", - "version": "0.0.0", - "description": "Measures PC monitor.", - "files": [ - "constants.ts", - "client.g.ts" - ], - "testFiles": [ - "test.ts" - ], - "supportedTargets": [ - "microbit", - "arcade", - "maker", - "calliopemini" - ], - "dependencies": { - "core": "*", - "jacdac": "github:microsoft/pxt-jacdac" - } -} \ No newline at end of file diff --git a/pccontroller/client.g.ts b/pccontroller/client.g.ts new file mode 100644 index 000000000..6a2854c24 --- /dev/null +++ b/pccontroller/client.g.ts @@ -0,0 +1,68 @@ +namespace modules { + /** + * Send various events to PC, including opening a URL, start an app, sending text, etc. + **/ + //% fixedInstances blockGap=8 + export class PCControllerClient extends jacdac.Client { + + + constructor(role: string) { + super(jacdac.SRV_PCCONTROLLER, role) + + } + + + + /** + * Open a URL in the default browser. + */ + //% group="PC controller" + //% blockId=jacdac_pccontroller_open_url_cmd + //% block="%pccontroller open url $url" + //% weight=100 + openUrl(url: string): void { + this.start(); + this.sendCommand(jacdac.JDPacket.jdpacked(jacdac.PCControllerCmd.OpenUrl, jacdac.PCControllerCmdPack.OpenUrl, [url])) + } + + /** + * Start an app. + */ + //% group="PC controller" + //% blockId=jacdac_pccontroller_start_app_cmd + //% block="%pccontroller start app $name" + //% weight=99 + startApp(name: string): void { + this.start(); + this.sendCommand(jacdac.JDPacket.jdpacked(jacdac.PCControllerCmd.StartApp, jacdac.PCControllerCmdPack.StartApp, [name])) + } + + /** + * Send text to the active window. + */ + //% group="PC controller" + //% blockId=jacdac_pccontroller_send_text_cmd + //% block="%pccontroller send text $text" + //% weight=98 + sendText(text: string): void { + this.start(); + this.sendCommand(jacdac.JDPacket.jdpacked(jacdac.PCControllerCmd.SendText, jacdac.PCControllerCmdPack.SendText, [text])) + } + + /** + * Run a script. + */ + //% group="PC controller" + //% blockId=jacdac_pccontroller_run_script_cmd + //% block="%pccontroller run script $script" + //% weight=97 + runScript(script: string): void { + this.start(); + this.sendCommand(jacdac.JDPacket.jdpacked(jacdac.PCControllerCmd.RunScript, jacdac.PCControllerCmdPack.RunScript, [script])) + } + + } + + //% fixedInstance whenUsed weight=1 block="pccontroller1" + export const PCController1 = new PCControllerClient("PCController1"); +} \ No newline at end of file diff --git a/pccontroller/pxt.g.json b/pccontroller/pxt.json similarity index 100% rename from pccontroller/pxt.g.json rename to pccontroller/pxt.json diff --git a/pcmonitor/client.g.ts b/pcmonitor/client.g.ts new file mode 100644 index 000000000..d08ee821f --- /dev/null +++ b/pcmonitor/client.g.ts @@ -0,0 +1,118 @@ +namespace modules { + /** + * Measures PC monitor. + **/ + //% fixedInstances blockGap=8 + export class PCMonitorClient extends jacdac.Client { + + private readonly _cpuUsage : jacdac.RegisterClient<[number]>; + private readonly _cpuTemperature : jacdac.RegisterClient<[number]>; + private readonly _ramUsage : jacdac.RegisterClient<[number]>; + private readonly _gpuInformation : jacdac.RegisterClient<[number,number]>; + private readonly _networkInformation : jacdac.RegisterClient<[number,number]>; + + constructor(role: string) { + super(jacdac.SRV_PCMONITOR, role) + + this._cpuUsage = this.addRegister<[number]>(jacdac.PCMonitorReg.CpuUsage, jacdac.PCMonitorRegPack.CpuUsage) + this._cpuTemperature = this.addRegister<[number]>(jacdac.PCMonitorReg.CpuTemperature, jacdac.PCMonitorRegPack.CpuTemperature) + this._ramUsage = this.addRegister<[number]>(jacdac.PCMonitorReg.RamUsage, jacdac.PCMonitorRegPack.RamUsage) + this._gpuInformation = this.addRegister<[number,number]>(jacdac.PCMonitorReg.GpuInformation, jacdac.PCMonitorRegPack.GpuInformation) + this._networkInformation = this.addRegister<[number,number]>(jacdac.PCMonitorReg.NetworkInformation, jacdac.PCMonitorRegPack.NetworkInformation) + } + + + /** + * CPU usage in percent. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=100 + cpuUsage(): number { + this.start(); + const values = this._cpuUsage.pauseUntilValues() as any[]; + return values[0]; + } + + /** + * CPU temperature in Celsius. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=99 + cpuTemperature(): number { + this.start(); + const values = this._cpuTemperature.pauseUntilValues() as any[]; + return values[0]; + } + + /** + * RAM usage in percent. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=98 + ramUsage(): number { + this.start(); + const values = this._ramUsage.pauseUntilValues() as any[]; + return values[0]; + } + + /** + * GPU info. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=97 + gpuInformationUsage(): number { + this.start(); + const values = this._gpuInformation.pauseUntilValues() as any[]; + return values[0]; + } + + /** + * GPU info. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=96 + gpuInformationTemperature(): number { + this.start(); + const values = this._gpuInformation.pauseUntilValues() as any[]; + return values[1]; + } + + /** + * Network transmit/receive speed in Kbytes per second. + * + * A measure of PC monitor. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=95 + networkInformationTx(): number { + this.start(); + const values = this._networkInformation.pauseUntilValues() as any[]; + return values[0]; + } + + /** + * Network transmit/receive speed in Kbytes per second. + * + * A measure of PC monitor. + */ + //% callInDebugger + //% group="PC monitor" + //% weight=94 + networkInformationRx(): number { + this.start(); + const values = this._networkInformation.pauseUntilValues() as any[]; + return values[1]; + } + + + } + + //% fixedInstance whenUsed weight=1 block="pcmonitor1" + export const PCMonitor1 = new PCMonitorClient("PCMonitor1"); +} \ No newline at end of file diff --git a/pcmonitor/pxt.g.json b/pcmonitor/pxt.json similarity index 100% rename from pcmonitor/pxt.g.json rename to pcmonitor/pxt.json diff --git a/tools/microbit-microcode-servers/pxt.json b/tools/microbit-microcode-servers/pxt.json index 8b105fb4c..dffd7d05f 100644 --- a/tools/microbit-microcode-servers/pxt.json +++ b/tools/microbit-microcode-servers/pxt.json @@ -18,8 +18,7 @@ "targetId": "microbit" }, "supportedTargets": [ - "microbit", - "calliopemini" + "microbit" ], "preferredEditor": "tsprj", "disableTargetTemplateFiles": true, diff --git a/tools/microbit-oob/pxt.json b/tools/microbit-oob/pxt.json index ee46ee8a1..a36a8d4e5 100644 --- a/tools/microbit-oob/pxt.json +++ b/tools/microbit-oob/pxt.json @@ -30,8 +30,7 @@ "targetId": "microbit" }, "supportedTargets": [ - "microbit", - "calliopemini" + "microbit" ], "preferredEditor": "tsprj", "disableTargetTemplateFiles": true,