Add control.dmesg

This commit is contained in:
Michal Moskal 2017-07-10 11:42:30 +01:00
parent 1e3bce6d44
commit 6b5dd6c07b
5 changed files with 13 additions and 4 deletions

View File

@ -22,4 +22,9 @@ int allocateNotifyEvent() {
return pxt::allocateNotifyEvent(); return pxt::allocateNotifyEvent();
} }
/** Write data to DMESG debugging buffer. */
//%
void dmesg(String s) {
DMESG("# %s", s->data);
}
} }

View File

@ -1,4 +1,4 @@
namespace core { namespace control {
let nextComponentId = 20000; let nextComponentId = 20000;
export class Component { export class Component {

View File

@ -116,7 +116,7 @@ namespace input.internal {
} }
} }
export class Sensor extends core.Component { export class Sensor extends control.Component {
protected port: number protected port: number
constructor() { constructor() {
@ -407,7 +407,7 @@ namespace input.internal {
} }
namespace input { namespace input {
export class ButtonWrapper extends core.Component { export class ButtonWrapper extends control.Component {
private downTime: number; private downTime: number;
private _isPressed: boolean; private _isPressed: boolean;
private _wasPressed: boolean; private _wasPressed: boolean;

View File

@ -3,7 +3,7 @@
namespace pxt { namespace pxt {
void dmesg(const char *fmt, ...); void dmesg(const char *fmt, ...);
#define DMESG dmesg #define DMESG pxt::dmesg
} }
#endif #endif

View File

@ -51,6 +51,10 @@ declare namespace control {
*/ */
//% help=control/allocate-notify-event shim=control::allocateNotifyEvent //% help=control/allocate-notify-event shim=control::allocateNotifyEvent
function allocateNotifyEvent(): int32; function allocateNotifyEvent(): int32;
/** Write data to DMESG debugging buffer. */
//% shim=control::dmesg
function dmesg(s: string): void;
} }
declare namespace input { declare namespace input {