-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwa-ssd1306.html
73 lines (64 loc) · 1.51 KB
/
wa-ssd1306.html
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
<html>
<head>
<script type="text/javascript" src="../webduino-js/src/module/SSD1306.js"></script>
</head>
<body>
<script>
(function() {
var proto = Object.create(HTMLElement.prototype, {
textSize: {
get: function() {
return this.getAttribute('textSize');
},
set: function(val) {
this.setAttribute('textSize', val);
}
},
x: {
get: function() {
return this.getAttribute('x');
},
set: function(val) {
this.setAttribute('x', val);
}
},
y: {
get: function() {
return this.getAttribute('y');
},
set: function(val) {
this.setAttribute('y', val);
}
},
text: {
get: function() {
return this.getAttribute('text');
},
set: function(val) {
this.setAttribute('text', val);
}
}
});
proto.init_ = function(board) {
this.display = new webduino.module.SSD1306(board);
this.display.clear();
this.display.textSize = this.textSize;
this.display.print(this.x, this.y, this.text);
};
proto.print = function(x, y, text) {
this.display.textSize = this.textSize;
this.display.print(x, y, text);
};
proto.clear = function() {
this.display.clear();
};
proto.detachedCallback = function() {
//this.off();
};
document.registerElement('wa-ssd1306', {
prototype: proto
});
})();
</script>
</body>
</html>