fetch pxt-microbit v2.2.30 (#102)

* undo buttonEvent

* fetch microbit v2.2.30

Co-authored-by: Amerlander <gitkraken@juriwolf.de>
This commit is contained in:
Amerlander
2020-05-08 18:35:38 +02:00
committed by GitHub
parent 53fae2fac5
commit 64471a53f9
43 changed files with 544 additions and 1442 deletions

View File

@ -1,12 +1,3 @@
{
"name": "radio-broadcast",
"description": "Adds new blocks for message communication in the radio category",
"files": [
"pxt.json",
"radio-broadcast.ts"
],
"dependencies": {
"core": "file:../core",
"radio": "file:../radio"
}
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio-broadcast"
}

View File

@ -1,39 +0,0 @@
namespace radio {
/**
* Gets the message code
*/
//% blockHidden=1 shim=ENUM_GET
//% blockId=radioMessageCode block="$msg" enumInitialMembers="message1"
//% enumName=RadioMessage enumMemberName=msg enumPromptHint="e.g. Start, Stop, Jump..."
//% enumIsHash=1
export function __message(msg: number): number {
return msg;
}
/**
* Broadcasts a message over radio
* @param msg
*/
//% blockId=radioBroadcastMessage block="radio send $msg"
//% msg.shadow=radioMessageCode draggableParameters
//% weight=200
//% blockGap=8
//% help=radio/send-message
export function sendMessage(msg: number): void {
// 0 is MICROBIT_EVT_ANY, shifting by 1
radio.raiseEvent(DAL.MES_BROADCAST_GENERAL_ID, msg + 1);
}
/**
* Registers code to run for a particular message
* @param msg
* @param handler
*/
//% blockId=radioOnMessageReceived block="on radio $msg received"
//% msg.shadow=radioMessageCode draggableParameters
//% weight=199
//% help=radio/on-received-message
export function onReceivedMessage(msg: number, handler: () => void) {
control.onEvent(DAL.MES_BROADCAST_GENERAL_ID, msg + 1, handler);
}
}