Skip to content

Commit

Permalink
shim for singleSimulator (#6009)
Browse files Browse the repository at this point in the history
* shim

* update

* get shim fixed up

* plumbing hooked up...

* revert change

* rvert deletion

* swap
  • Loading branch information
tballmsft authored Nov 12, 2024
1 parent 2234944 commit 106bb7c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions libs/core/_locales/core-jsdoc-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"control.runtimeWarning": "Display warning in the simulator.",
"control.setDebugFlags": "Set flags used when connecting an external debugger.",
"control.simmessages.onReceived": "Registers the handler for a message on a given channel",
"control.singleSimulator": "Allow only one simulator",
"control.waitForEvent": "Blocks the calling thread until the specified event is raised.",
"control.waitMicros": "Blocks the current fiber for the given microseconds",
"control.waitMicros|param|micros": "number of micro-seconds to wait. eg: 4",
Expand Down
6 changes: 6 additions & 0 deletions libs/core/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ namespace control {
microbit_reset();
}




//%
void singleSimulator() { }

/**
* Blocks the current fiber for the given microseconds
* @param micros number of micro-seconds to wait. eg: 4
Expand Down
8 changes: 8 additions & 0 deletions libs/core/control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace control {
export function runInBackground(a: () => void) {
control.inBackground(a);
}

/**
* Allow only one simulator
*/
//% shim=control::singleSimulator
export function singleSimulator() {

}

/**
* Returns the value of a C++ runtime constant
Expand Down

0 comments on commit 106bb7c

Please sign in to comment.