Repository navigation
Expand file tree
/
Copy pathpxt.h
More file actions
83 lines (59 loc) · 1.8 KB
/
Copy pathpxt.h
File metadata and controls
83 lines (59 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __PXT_H
#define __PXT_H
//#define DEBUG_MEMLEAKS 1
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "pxtbase.h"
namespace pxt {
class RefMImage : public RefObject {
public:
ImageData *img;
RefMImage(ImageData *d);
void makeWritable();
static void destroy(RefMImage *map);
static void print(RefMImage *map);
static void scan(RefMImage *t);
static unsigned gcsize(RefMImage *t);
};
#define MSTR(s) ManagedString((s)->getUTF8Data(), (s)->getUTF8Size())
static inline String PSTR(ManagedString s) {
return mkString(s.toCharArray(), s.length());
}
typedef uint32_t ImageLiteral_;
static inline ImageData *imageBytes(ImageLiteral_ lit) {
return (ImageData *)lit;
}
#if MICROBIT_CODAL
// avoid clashes with codal-defined classes
#define Image MImage
#define Button MButton
#endif
typedef MicroBitPin DevicePin;
typedef RefMImage *Image;
extern MicroBit uBit;
extern MicroBitEvent lastEvent;
MicroBitPin *getPin(int id);
static inline int min_(int a, int b) {
if (a < b)
return a;
else
return b;
}
static inline int max_(int a, int b) {
if (a > b)
return a;
else
return b;
}
void initMicrobitGC();
} // namespace pxt
using namespace pxt;
#define DEVICE_EVT_ANY 0
#undef PXT_MAIN
#define PXT_MAIN \
int main() { \
pxt::initMicrobitGC(); \
pxt::start(); \
return 0; \
}
#endif
// vim: ts=2 sw=2 expandtab