2017-07-07 12:44:34 +02:00
|
|
|
#include "pxt.h"
|
|
|
|
|
|
|
|
namespace control {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Announce that an event happened to registered handlers.
|
|
|
|
* @param src ID of the Component that generated the event
|
|
|
|
* @param value Component specific code indicating the cause of the event.
|
|
|
|
* @param mode optional definition of how the event should be processed after construction.
|
|
|
|
*/
|
|
|
|
//% weight=21 blockGap=12 blockId="control_raise_event"
|
2017-08-07 21:07:43 +02:00
|
|
|
//% block="raise event|from %src|with value %value" blockExternalInputs=1
|
2018-02-23 23:13:08 +01:00
|
|
|
//% help=control/raise-event
|
2017-07-07 12:44:34 +02:00
|
|
|
void raiseEvent(int src, int value) {
|
|
|
|
pxt::raiseEvent(src, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocates the next user notification event
|
|
|
|
*/
|
|
|
|
//% help=control/allocate-notify-event
|
|
|
|
int allocateNotifyEvent() {
|
|
|
|
return pxt::allocateNotifyEvent();
|
|
|
|
}
|
|
|
|
|
2017-07-10 12:42:30 +02:00
|
|
|
/** Write data to DMESG debugging buffer. */
|
|
|
|
//%
|
|
|
|
void dmesg(String s) {
|
|
|
|
DMESG("# %s", s->data);
|
|
|
|
}
|
2017-07-10 13:47:00 +02:00
|
|
|
|
2017-07-07 12:44:34 +02:00
|
|
|
}
|
2017-07-10 13:47:00 +02:00
|
|
|
|
|
|
|
namespace serial {
|
|
|
|
/** Send DMESG debug buffer over serial. */
|
|
|
|
//%
|
|
|
|
void writeDmesg() {
|
|
|
|
pxt::dumpDmesg();
|
|
|
|
}
|
|
|
|
}
|