Almost builds with yotta
This commit is contained in:
Родитель
7ac7d6dcf4
Коммит
ce44580776
|
@ -0,0 +1,4 @@
|
|||
.yotta.json
|
||||
yotta_modules
|
||||
yotta_targets
|
||||
build
|
|
@ -0,0 +1,26 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Third Party Programs: The software may include third party programs that
|
||||
Microsoft, not the third party, licenses to you under this agreement.
|
||||
Notices, if any, for the third party programs are included for your
|
||||
information only.
|
|
@ -97,15 +97,19 @@ namespace micro_bit {
|
|||
a();
|
||||
}
|
||||
|
||||
void onButtonPressed(int button, Action a) {
|
||||
void onButtonPressedExt(int button, int event, Action a) {
|
||||
if (a != NULL)
|
||||
uBit.MessageBus.listen(
|
||||
button,
|
||||
MICROBIT_BUTTON_EVT_CLICK,
|
||||
event,
|
||||
(void (*)(MicroBitEvent, void*)) callback,
|
||||
(void*) a);
|
||||
}
|
||||
|
||||
void onButtonPressed(int button, Action a) {
|
||||
onButtonPressedExt(button, MICROBIT_BUTTON_EVT_CLICK, a);
|
||||
}
|
||||
|
||||
void onPinPressed(int pin, Action a) {
|
||||
if (a != NULL) {
|
||||
// Forces the PIN to switch to makey-makey style detection.
|
||||
|
@ -246,6 +250,21 @@ namespace micro_bit {
|
|||
uBit.MessageBus.listen(id, MICROBIT_EVT_ANY, (void (*)(MicroBitEvent, void*))callback1, (void*)a);
|
||||
}
|
||||
|
||||
namespace events {
|
||||
void remote_control(int event) {
|
||||
micro_bit::generate_event(MES_REMOTE_CONTROL_ID,event);
|
||||
}
|
||||
void camera(int event) {
|
||||
micro_bit::generate_event(MES_CAMERA_ID, event);
|
||||
}
|
||||
void audio_recorder(int event) {
|
||||
micro_bit::generate_event(MES_AUDIO_RECORDER_ID, event);
|
||||
}
|
||||
void alert(int event) {
|
||||
micro_bit::generate_event(MES_ALERTS_ID, event);
|
||||
}
|
||||
}
|
||||
|
||||
void pitch(MicroBitPin& p, int freq, int ms) {
|
||||
float dt = .5/freq;
|
||||
float t = 0;
|
||||
|
@ -353,6 +372,10 @@ namespace string {
|
|||
return s.length() > 0 ? s.charAt(0) : '\0';
|
||||
}
|
||||
|
||||
int code_at(ManagedString s, int i) {
|
||||
return i < s.length() && i >= 0 ? s.charAt(i) : '\0';
|
||||
}
|
||||
|
||||
int to_number(ManagedString s) {
|
||||
return atoi(s.toCharArray());
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "microbit-touchdevelop",
|
||||
"version": "0.0.1",
|
||||
"description": "The glue layer that binds together TouchDevelop programs compiled to C++ and the micro:bit runtime system.",
|
||||
"keywords": [],
|
||||
"author": "Jonathan Protzenko <protz@microsoft.com>",
|
||||
"repository": {
|
||||
"url": "ssh://git@github.com:Microsoft/microbit-touchdevelop.git",
|
||||
"type": "git"
|
||||
},
|
||||
"homepage": "https://github.com/microsoft/microbit-touchdevelop",
|
||||
"licenses": [
|
||||
{
|
||||
"url": "https://spdx.org/licenses/Apache-2.0",
|
||||
"type": "Apache-2.0"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"microbit-dal": "jamesadevine/microbit-dal#master"
|
||||
},
|
||||
"targetDependencies": {}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// mbed library revision:7:17dd2cfe0ff4
|
||||
#include "MicroBitTouchDevelop.h"
|
||||
#include "microbit-touchdevelop/MicroBitTouchDevelop.h"
|
||||
namespace micro_bit {
|
||||
namespace globals {
|
||||
Sprite led_x_index_legend;
|
||||
|
@ -58,4 +58,4 @@ void do_stuff() {
|
|||
micro_bit::scrollNumber(0, 100);
|
||||
micro_bit::scrollNumber(1, 100);
|
||||
micro_bit::scrollNumber(35, 100);
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче