Add some motor support

This commit is contained in:
Michal Moskal
2017-07-07 15:15:36 +01:00
parent ce3fe646fd
commit 99a25e07a7
5 changed files with 136 additions and 2 deletions

21
libs/core/output.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "pxt.h"
#include "ev3.h"
namespace output {
/**
* Create a new zero-initialized buffer.
* @param size number of bytes in the buffer
*/
//%
Buffer createBuffer(int size) {
return mkBuffer(NULL, size);
}
extern "C" int WriteToPWMDevice(char *bytes, int num_bytes);
//%
void writePWM(Buffer buf) {
WriteToPWMDevice((char*)buf->data, buf->length);
}
}