forked from 4ib3r/node-epd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
152 lines (133 loc) · 3.1 KB
/
index.js
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**Rect object
* @typedef {Object} Rect
* @property {number} xMin
* @property {number} yMin
* @property {number} xMax
* @property {number} yMax
*/
/**
* FT_Face object wrapper
* @typedef {Object} FontFace
* @property {number} size font size
* @property {number} height font size in px
*/
/**
* EpdSize object
* @typedef {Object} EpdSize
* @property {number} width Display width in px
* @property {number} height Display height in px
*/
/**
* Drawing color -1 inverse, 1 black (default), 0 white
* @typedef {number} Color
*/
/**
* @classdesc Main Epd driver class
*
* @name Epd
* @class
* @param {number} channel spi channel
* @param {number} dc dc pin
* @param {number} cs cs pin
* @param {number} rst rst pin
* @param {number} led additional led pin
*/
/**
* Load ttf font
* @method
* @name Epd#font
* @param {string} ttfPath font path
* @param {number} font size
* @returns {FontFace} Description of return value.
*/
/**
* Return lcd resolution
* @method
* @name Epd#size
* @returns {EpdSize} display width and height
*/
/**
* Clear whole screen and set all refresh mode
* @method
* @name Epd#clear
* */
/**
* Change display mode to partial drawing
* @method
* @name Epd#clearPart
* */
/**
* Update whole screen
* @method
* @name Epd#update
* */
/**
* Update changed part of screen
* @method
* @name Epd#partUpdate
* */
/**
* Draw line
* @method
* @name Epd#line
* @param {number} x start point on x axis
* @param {number} y start point on y axis
* @param {number} x2 end point on x axis
* @param {number} y2 end point on y axis
* @param {Color} col line color
*/
/**
* Draw rect
* @method
* @name Epd#rect
* @param {number} x start point on x axis
* @param {number} y start point on y axis
* @param {number} width rect width
* @param {number} height rect height
* @param {boolean} fill If true rect is filled
* @param {Color} col rect color
*/
/**
* Draw circle
* @method
* @name Epd#circle
* @param {number} x mid point on x axis
* @param {number} y mid point on y axis
* @param {number} r circle size
* @param {boolean} fill If true circle is filled
* @param {Color} col circle color
*/
/**
* Draw pixel
* @method
* @name Epd#pixel
* @param {number} x point on x axis
* @param {number} y point on y axis
* @param {Color} col pixel color
*/
/**
* Draw character from 16 bit representation
* @method
* @name Epd#drawChar
* @param {number} x point on x axis
* @param {number} y point on y axis
* @param {number} char char code
* @return {Rect}
*/
/**
* Draw string from 8bit representation
* @method
* @name Epd#drawString
* @param {FontFace} font Font to draw string
* @param {number} x x position
* @param {number} y y position
* @return {Rect} drawed coordinates
*/
/**
* Set default color to use
* @method
* @name Epd#color
* @param {number} color 0 is white, 1 is black, -1 is inversion of current state
*/
var Epd = require('bindings')('epd');
module.exports = Epd;