├── .gitignore
├── LICENSE
├── README.md
├── data
├── font10
├── font12
├── font32
├── font60
├── font70
├── weathericon
├── weathericon32
├── weathericon50
└── weathericon80
├── docs
├── API手册.md
└── 用户手册.md
├── examples
├── HardSPIHelloWorld
│ ├── HardSPIHelloWorld.ino
│ └── data
│ │ ├── font10
│ │ ├── font12
│ │ ├── font32
│ │ ├── font60
│ │ ├── font70
│ │ ├── weathericon
│ │ ├── weathericon32
│ │ ├── weathericon50
│ │ └── weathericon80
├── HelloWorld
│ ├── HelloWorld.ino
│ └── data
│ │ ├── font10
│ │ ├── font12
│ │ ├── font32
│ │ ├── font60
│ │ ├── font70
│ │ ├── weathericon
│ │ ├── weathericon32
│ │ ├── weathericon50
│ │ └── weathericon80
└── ThreeColor
│ ├── ThreeColor.ino
│ └── data
│ ├── ThreeColor.ino
│ ├── font10
│ ├── font12
│ ├── font32
│ ├── font60
│ ├── font70
│ ├── weathericon32
│ ├── weathericon50
│ └── weathericon80
├── keywords.txt
├── library.properties
└── src
├── EPaperDrive.cpp
├── EPaperDrive.h
└── WAVEFORM_SETTING_LUT.h
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # EPaperDrive
2 | 这是一个简单好用性能强大的Arduino墨水屏驱动库,支持目前市面上较常见的多种墨水屏。
3 |
4 | ## 我应该如何使用它?
5 | 请着重参考[例程](https://github.com/HalfSweetStudio/EPaperDrive/tree/main/examples)、[API手册](docs/API手册.md)以及[用户手册](docs/用户手册.md),如果您遇到了例程不能使用的情况,请提交issue说明详细情况。
6 |
7 | ## 我应该采用什么样的驱动电路?
8 | 事实上,几乎所有的串口SPI的墨水屏驱动电路以及引脚定义都是相同的,如果您有微雪或者大连佳显等厂商提供的驱动板,您可以直接使用它。如果您是裸屏,那么我建议您采用这款[驱动板](https://oshwhub.com/ludas/mo-shui-ping-qu-dong)。需要注意的是,请您采用4-wire模式来驱动墨水屏,我们暂不支持3-wire模式。
9 |
10 | ## 这个驱动库支持什么MCU?
11 | 很遗憾,目前为止该驱动库仅支持ESP8266/ESP32或者别的带文件系统的MCU,我们会在之后重构整个驱动库来达到更好的兼容性。
12 |
13 | ## 有什么联系方式吗?
14 | 您可以发送邮件(HalfSweet@HalfSweet.cn)给我,或者加我的QQ好友(2522182733),当然,您也可以加入QQ群聊(735507661)与我们进行讨论。
15 |
16 | ## 你会适配新的屏幕吗?
17 | 当然可以!我们会逐渐适配一些常见的以及我们拥有的屏幕,当然,如果您想要适配您手上的屏幕,请您与我取得联系并邮寄相应的屏幕进行测试,
18 |
19 | ## 目前支持的屏幕?
20 | 下表即为目前支持的屏幕的名称(即`EPD_Set_Model`函数内填的内容,留空即为我暂不知道)
21 | |屏幕名称|驱动芯片型号|参考链接|
22 | |:---:|:---:|:---:|
23 | |WX29|SSD1608||
24 | |WF29|||
25 | |OPM42|SSD1619||
26 | |WF58|||
27 | |WF29BZ03|||
28 | |C154|||
29 | |DKE42_3COLOR|SSD1619||
30 | |DKE29_3COLOR|SSD1680||
31 | |WF42|UC8176||
32 | |WFT0290CZ10|UC8151C||
33 | |GDEY042Z98|SSD1683||
34 | |HINKE0266A15A0|SSD1675||
35 |
36 | ## 致谢
37 | 非常感谢Duck大佬的支持,这个驱动库最开始的架构也是出自于他,这是他的[个人主页](https://github.com/duck531a98)以及最开始的[开源链接](https://github.com/duck531a98/esp8266-weather-station-epaper),我入坑于电子便是受到了他的影响,同时也非常感谢他教会了我很多编程以及电子的知识,同时在我成长的道路上也一直支持鼓励着我。
38 | 同时也非常感谢在我学习的路上支持着我的各位大佬,是你们的存在让我在漫天的bug中找到继续学习下去的动力。
39 |
--------------------------------------------------------------------------------
/data/font10:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/font10
--------------------------------------------------------------------------------
/data/font12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/font12
--------------------------------------------------------------------------------
/data/font32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/font32
--------------------------------------------------------------------------------
/data/font60:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/font60
--------------------------------------------------------------------------------
/data/font70:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/font70
--------------------------------------------------------------------------------
/data/weathericon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/weathericon
--------------------------------------------------------------------------------
/data/weathericon32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/weathericon32
--------------------------------------------------------------------------------
/data/weathericon50:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/weathericon50
--------------------------------------------------------------------------------
/data/weathericon80:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/data/weathericon80
--------------------------------------------------------------------------------
/docs/API手册.md:
--------------------------------------------------------------------------------
1 | # EPaperDrive API手册
2 | 该手册的标题为函数声明,在正文部分会以此介绍函数的用法、参数和返回值。
3 |
4 | ## EPaperDrive(bool SPIMode, uint8_t CS, uint8_t RST, uint8_t DC, uint8_t BUSY, uint8_t CLK, uint8_t DIN)
5 | * @brief 构造函数,初始化软硬SPI及引脚定义
6 | * @param SPIMode 选择是硬件SPI还是软件SPI,0为软件,1为硬件(不采用硬件CS)
7 | * @param CS CS脚
8 | * @param RST RST脚
9 | * @param DC DC脚
10 | * @param BUSY BUSY脚
11 | * @param CLK 时钟线,如果是硬件SPI可以不填
12 | * @param DIN 数据线,如果是硬件SPI可以不填
13 |
14 | ## void EPD_Set_Model(uint8_t model)
15 | * @brief 设置墨水屏的型号
16 |
17 | * @param model 墨水屏的型号,目前支持的屏幕可在README里面查看
18 |
19 | ## void EPD_init_Full(void)
20 | * @brief 墨水屏全刷的初始化
21 |
22 | ## void EPD_init_Part(void)
23 | * @brief 墨水屏局刷的初始化
24 |
25 | ## void deepsleep(void)
26 | * @brief 让墨水屏进入睡眠模式,节省功耗
27 |
28 | ## void EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label)
29 | * @brief 全刷传入的图像
30 | * @param DisBuffer 传入的图像缓存指针
31 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑
32 |
33 | ## EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label)
34 | * @brief 局刷传入的图像
35 | * xStart 局刷区域x开始的坐标
36 | * @param xEnd 局刷区域x结束的坐标
37 | * @param yStart 局刷区域y开始的坐标
38 | * @param yEnd 局刷区域y结束的坐标
39 | * @param DisBuffer 传入的图像缓存指针
40 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑
41 |
42 | ## void EPD_Transfer_Full_BW(uint8_t *DisBuffer, uint8_t Label)
43 | * @brief 直接向RAM中写全刷的黑白图片
44 | * @param DisBuffer 应当写入的图像缓存指针
45 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑;4为向“OLD”RAM中写全黑
46 |
47 | ## void EPD_Transfer_Full_RED(uint8_t *DisBuffer, uint8_t Label)
48 | * @brief 直接向RAM中写全刷的红色图片
49 | * @param DisBuffer 应当写入的图像缓存指针
50 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全红
51 |
52 | ## void EPD_Transfer_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label)
53 | @brief 直接向RAM中写局刷的图像
54 | * @param xStart 局刷区域x开始的坐标
55 | * @param xEnd 局刷区域x结束的坐标
56 | * @param yStart 局刷区域y开始的坐标
57 | * @param yEnd 局刷区域y结束的坐标
58 | * @param DisBuffer 传入的图像缓存指针
59 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑
60 |
61 | ## void SetFS(FS *userFS)
62 | * @brief 设置采用什么文件系统
63 | * @param userFS 应当传入的文件系统的指针
64 |
65 | ## void SetHardSPI(SPIClass *spi)
66 | * @brief 设置采用硬件spi的通道(用户请先初始化SPI之后再传入对应SPI的指针)
67 | * @param spi 应当传入的SPI的指针
68 |
69 | ## void clearbuffer()
70 | * @brief 清除之前所绘的图像缓存
71 |
72 | ## void SetFont(FONT fontindex)
73 | * @brief 设置字体样式
74 | * @param fontindex 字体样式,目前仅支持如下字体:
75 |
76 |
77 | |字体|
78 | |:----:|
79 | |FONT12|
80 | |FONT16|
81 | |FONT32|
82 | |FONT10|
83 | |FONT70|
84 | |FONT12_NUM|
85 | |FONT24|
86 | |FONT8|
87 | |DIGI_NUM_100|
88 | |ICON32|
89 | |ICON80|
90 | |ICON50|
91 |
92 | 如果对字体的效果并不满意,可以参考[用户手册]()自行修改
93 |
94 | ## void DrawUTF(int16_t x, int16_t y, String code)
95 | @brief 在图像缓存中画字符串
96 | *
97 | * @param x 字符串图像开始的x坐标
98 | * @param y 字符串图像开始的y坐标
99 | * @param code 字符串内容
100 |
101 | ## DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code)
102 | @brief 在图像缓存中画字符(可以忽略,采用`DrawUTF`函数即可)
103 | *
104 | * @param x 开始的x坐标
105 | * @param y 开始的y坐标
106 | * @param width 字符的宽度
107 | * @param height 字符的高度
108 | * @param code 字符的指针
109 |
110 | ## DrawUnicodeStr(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t strlength, uint8_t *code)
111 | * @brief 在图像缓存中画指定长度的字符串(可以忽略,采用`DrawUTF`函数即可)
112 | * @param x 开始的x坐标
113 | * @param y 开始的y坐标
114 | * @param width 字符的宽度
115 | * @param height 字符的高度
116 | * @param strlength 字符串的长度
117 | * @param code 字符串指针
118 |
119 | ## void DrawYline(int start, int end, int y)
120 | * @brief 在图像缓存中画竖线(一个像素)
121 | * @param start 线开始的x坐标
122 | * @param end 线结束的x坐标
123 | * @param y 线的y坐标
124 |
125 | ## void DrawXline(int start, int end, int x)
126 | * @brief 在图像缓存中画横线(一个像素)
127 | * @param start 线开始的y坐标
128 | * @param end 线结束的y坐标
129 | * @param x 线的x坐标
130 |
131 | ## void DrawLine(int xstart, int ystart, int xend, int yend)
132 | * @brief 在图像缓存中画直线
133 | * @param xstart 线开始的x坐标
134 | * @param ystart 线开始的y坐标
135 | * @param xend 线结束的x坐标
136 | * @param yend 线结束的y坐标
137 |
138 | ## void Inverse(int xStart, int xEnd, int yStart, int yEnd)
139 | * @brief 反向一个区域的图像(黑变白,白变黑)
140 | * @param xStart 这个区域开始的x坐标
141 | * @param xEnd 这个区域结束的x坐标
142 | * @param yStart 这个区域开始的y坐标
143 | * @param yEnd 这个区域结束的y坐标
144 |
145 | ## void DrawWeatherChart(int xmin, int xmax, int ymin, int ymax, int point_n, int show_n, String tmax, String tmin, String code_d, String code_n, String text_d, String text_n, String date, String week)
146 | * @brief 绘制天气温度变化曲线
147 | * @param xmin 绘制区域中开始的x坐标
148 | * @param xmax 绘制区域中结束的x坐标
149 | * @param ymin 绘制区域中开始的y坐标
150 | * @param ymax 绘制区域中结束的y坐标
151 | * @param point_n 传入的天气数据的数量
152 | * @param show_n 需要显示的天气数据的数量
153 | * @param tmax 需要显示的这几天每天温度的最大值(如12,13,14,15)
154 | * @param tmin 需要显示的这几天每天温度的最小值(如2,3,4,5)
155 | * @param code_d 需要显示的这几天每天温度最大值的图标对应的字符
156 | * @param code_n 需要显示的这几天每天温度最小值的图标对应的字符
157 | * @param text_d 需要显示的这几天每天温度最大值对应的天气状况
158 | * @param text_n 需要显示的这几天每天温度最小值对应的天气状况
159 | * @param date 我也不知道这是啥,看函数定义里面好像没啥用
160 | * @param week 需要显示的这几天每天是星期几(例如1,2,3,4)
161 |
162 | ## void DrawCircle(int x, int y, int r, bool fill)
163 | * @brief 在图像缓存中画圆
164 | * @param x 圆心的x坐标
165 | * @param y 圆心的y坐标
166 | * @param r 半径长度
167 | * @param fill 0为空心圆;1为实心圆
168 |
169 | ## void DrawBox(uint8_t x, int y, int w, int h)
170 | * @brief 在图像缓存中画实心矩形
171 | * @param x 开始的x坐标
172 | * @param y 开始的y坐标
173 | * @param w 矩形的宽度
174 | * @param h 矩形的高度
175 |
176 | ## void DrawEmptyBox(int x, int y, int w, int h)
177 | * @brief 在图像缓存中画空心矩形
178 | * @param x 开始的x坐标
179 | * @param y 开始的y坐标
180 | * @param w 矩形的宽度
181 | * @param h 矩形的高度
182 |
183 | ## void DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6)
184 | * @brief 在图像缓存中画水平方向的柱状图(显示空气质量数据的,不建议使用)
185 | * @param x 开始的x坐标
186 | * @param y 开始的y坐标
187 | * @param w 图表的宽度
188 | * @param c1 第1个数据
189 | * @param c2 第2个数据
190 | * @param c3 第3个数据
191 | * @param c4 第4个数据
192 | * @param c5 第5个数据
193 | * @param c6 第6个数据
194 |
195 | ## void DrawCircleChart(int x, int y, int r, int w, int c1, int c2, int c3)
196 | * @brief 在图像缓存中画圆环图表(显示空气质量数据的,不建议使用)
197 | * @param x 开始的x坐标
198 | * @param y 开始的y坐标
199 | * @param r 圆环的半径
200 | * @param w 圆环的宽度
201 | * @param c1 第1个数据
202 | * @param c2 第2个数据
203 | * @param c3 第3个数据
204 |
205 | ## void drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t *xbm);
206 | * @brief 在图像缓存中绘制图像
207 | * @param xMove 开始的x坐标
208 | * @param yMove 开始的y坐标
209 | * @param width 图像的宽度
210 | * @param height 图像的高度
211 | * @param xbm 图像的指针
212 |
213 | ## void DrawXbm_P(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm)
214 | * @brief 在图像缓存中画以PROGMEM类型储存图片
215 | * @param xMove 开始的x坐标
216 | * @param yMove 开始的y坐标
217 | * @param width 图像的宽度
218 | * @param height 图像的高度
219 | * @param xbm 图像的指针
220 |
221 | ## void DrawXbm_p_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm, uint8_t level)
222 | * @brief 在图像缓存中画以PROGMEM类型储存的灰度图片
223 | * @param xMove 开始的x坐标
224 | * @param yMove 开始的y坐标
225 | * @param width 图像的宽度
226 | * @param height 图像的高度
227 | * @param xbm 图像的指针
228 | * @param level 灰度的等级
229 |
230 | ## void DrawXbm_spiff_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t level)
231 | * @brief 在图像缓存中画以文件系统储存的灰度图片
232 | * @param xMove 开始的x坐标
233 | * @param yMove 开始的y坐标
234 | * @param width 图像的宽度
235 | * @param height 图像的高度
236 | * @param level 灰度的等级
237 |
238 | ## void EPD_Set_Contrast(uint8_t vcom)
239 | * @brief 设置vcom(仅有OPM42这块屏需要在意,别的屏幕不用管)
240 | * @param vcom vcom的等级
241 |
242 | ## void EPD_Update(void)
243 | * @brief 墨水屏全刷更新(一般用户不需要关心)
244 |
245 | ## void EPD_Update_Part(void)
246 | * @brief 墨水屏局刷更新(一般用户不需要关心)
247 |
248 | ## bool ReadBusy(void)
249 | * @brief 等待BUSY信号变为空闲(最大200ms超时)(一般用户不需要关心)
250 | * @return bool 1代表成功,0代表超时
251 |
252 | ## bool ReadBusy_long(void)
253 | * @brief 等待BUSY信号变为空闲(最大2000ms超时)(一般用户不需要关心)
254 | * @return bool 1代表成功,0代表超时
255 |
256 | ## void EPD_WriteCMD(uint8_t command)
257 | * @brief 向墨水屏驱动芯片写入命令(一般用户不需要关心)
258 | * @param command 命令的值
259 |
260 | ## void EPD_WriteData(uint8_t data)
261 | * @brief 向墨水屏驱动芯片写入数据(一般用户不需要关心)
262 | * @param data 数据的值
--------------------------------------------------------------------------------
/docs/用户手册.md:
--------------------------------------------------------------------------------
1 | # 用户手册
2 | 本手册为该驱动库的用户手册,让用户对如何使用该驱动库有个大概的了解。
3 |
4 | ## 将驱动库进行实例化并进行一些初始化操作
5 | 将该驱动库进行实例化的时候,其构造函数有如下几个构造参数:`SPIMode` `CS` `RST` `DC` `BUSY` `CLK` `DIN` 。其中SPIMode用于选择使用硬件SPI还是软件SPI,当其为0的时候为软件SPI;当其为1的时候为硬件SPI。其余的参数均为对应连接的引脚,值得注意的是,如果您打算采用硬件SPI的方式驱动,您可以不用填`CLK`与`DIN`的参数,留空即可。
6 |
7 | ## 选择硬件SPI还是软件SPI
8 | 当您看到构造函数中可选硬件SPI以及软件SPI的时候,您也许会有些困惑,不知道应当如何选择。实际上,除了引脚冲突或者是别的原因导致您无法使用硬件SPI之外,我都诚恳地建议您采用硬件SPI来驱动。以常见的ESP8266为例,如果采用软件SPI,不仅频率难以控制,并且其最大速率并不会超过500kHz。但是如果您采用硬件SPI,那您可以轻松达到大部分驱动芯片的速率上限:20MHz,这样可以大大为您节省不少本不应该被浪费的时间。
9 | 不过需要注意的是,如果您采用的硬件SPI,请您先主动初始化SPI并调用`SetHardSPI`函数来将实际的硬件SPI指针传入,以便驱动库进行下一步操作。如果您没有看懂这一步,请参阅[HardSPIHelloWorld](../examples/HardSPIHelloWorld/HardSPIHelloWorld.ino)例程来查看
10 |
11 | ## 传入对应的文件系统指针以使用字库
12 | 您可以在例程中注意到,在我们对墨水屏进行任何操作之前,往往都会调用一个名为`SetFS`的函数,这个函数的作用便是将您喜欢的文件系统传入。需要注意的是,您在传入之前请先将您使用的文件系统初始化,例如`LittleFS.begin()`;并将对应的字库文件上传(字库文件在每个例程及驱动库的根目录下的data文件夹中)。
13 |
14 | ## 墨水屏的驱动步骤
15 | 首先,当您是第一次上电的时候,您需要至少进行一次全刷,之后才可以继续进行全刷或者是局刷的操作。
16 | 想要全刷的话,您仅仅需要调用`EPD_init_Full()`函数进行全刷的初始化,然后利用别的绘图函数在图像缓存中进行绘图。当您绘图结束之后,您可以调用`EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label)`函数来将绘图完成的缓存传入驱动芯片并且开始全刷。别忘了,在刷屏结束之后调用`deepsleep()`函数来使墨水屏进入休眠模式,这不仅利于您降低功耗,同时也可以避免墨水屏出现颜色逐渐变浅的情况。
17 |
18 | ## 如何显示图片?
19 | 想要在墨水屏上显示一些图片,也许是个不错的主意。令人兴奋的是,我们提供了一系列的API供您完成您绝妙的创意。您可以调用`drawXbm`与`DrawXbm_P`函数来向缓存中绘入您所期望的图片。这两个函数的区别在于`DrawXbm_P`绘制的是您采用PROGMEM类型存储的图像,这会将数据存储在flash而不是RAM,相信您会喜欢上这一点。
20 | 也许您会有这样的疑问,如何将.jpg等拓展名的图像转换为可识别的数据呢?非常简单,只需要使用任意一款图像取模软件(我喜欢用Image2lcd,虽然它很古老,但是依旧能完美地完成任务),使用单色模式垂直扫描将其转换为一连串的c数组即可。
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/HardSPIHelloWorld.ino:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | //包含你需要使用的文件系统,例如:
4 | #include
5 |
6 | #define BAUD_SPEED 74880 //串口调试的波特率,可自行修改
7 |
8 | #define CS 15
9 | #define RST 2
10 | #define DC 0
11 | #define BUSY 4
12 |
13 | EPaperDrive EPD(1, CS, RST, DC, BUSY); //驱动库的实例化,此处为使用硬件SPI
14 |
15 | const uint8_t city_icon[24] = {
16 | /* 0X01,0X01,0X0C,0X00,0X0C,0X00, */
17 | 0X00,
18 | 0X00,
19 | 0X1C,
20 | 0X00,
21 | 0X77,
22 | 0X00,
23 | 0X41,
24 | 0X80,
25 | 0X9C,
26 | 0X60,
27 | 0XA2,
28 | 0X30,
29 | 0XA2,
30 | 0X30,
31 | 0X9C,
32 | 0XC0,
33 | 0X41,
34 | 0X80,
35 | 0X77,
36 | 0X00,
37 | 0X1C,
38 | 0X00,
39 | 0X00,
40 | 0X00,
41 | };
42 |
43 | void setup()
44 | {
45 | Serial.begin(BAUD_SPEED);
46 | #if defined(ESP8266)
47 | SPI.begin();
48 | SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE0));
49 | #else
50 | #if defined(ESP32)
51 | SPIClass SPI(HSPI); //可自行更换SPI通道
52 | SPI.begin();
53 | SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE0));
54 | #else
55 | #error 不支持您的MCU
56 | #endif
57 | #endif
58 | EPD.SetHardSPI(&SPI);
59 | LittleFS.begin();
60 | EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改
61 |
62 | EPD.EPD_Set_Model(HINKE0266A15A0); //设置屏幕类型,具体型号可以参考文档
63 | EPD.EPD_init_Full(); //全刷初始化,使用全刷波形
64 | EPD.clearbuffer(); //清空缓存(全白)
65 | EPD.fontscale = 2; //字体缩放系数(支持1和2,对图片也有效,用完记得重新改成1)
66 | EPD.SetFont(FONT12); //选择字体,具体支持的字体见文档
67 | EPD.DrawUTF(0, 0, "Hello World"); //绘制字符串
68 | EPD.DrawUTF(26, 0, "我喜欢墨水屏"); //绘制字符串
69 | EPD.fontscale = 1; //字体缩放系数改回1
70 | EPD.DrawXbm_P(60, 0, 12, 12, (uint8_t *)city_icon); //绘制图片
71 | Serial.printf("缓存图像绘制完毕,准备全刷 \n");
72 | EPD.EPD_Dis_Full((uint8_t *)EPD.EPDbuffer, 1); //将缓存中的图像传给屏幕控制芯片全刷屏幕
73 | EPD.deepsleep(); //让屏幕进入休眠模式
74 | Serial.println("全刷完毕");
75 |
76 | delay(5000);
77 |
78 | EPD.EPD_init_Part(); //局刷的初始化
79 | EPD.clearbuffer();
80 | EPD.fontscale = 2;
81 | EPD.SetFont(FONT12);
82 | EPD.DrawUTF(0, 0, "现在是局刷");
83 | Serial.printf("开始局刷 \n");
84 | EPD.EPD_Dis_Part(0, 23, 0, 199, (uint8_t *)EPD.EPDbuffer, 1); //将缓存中的图像传给屏幕控制芯片局新屏幕
85 | Serial.printf("局刷结束 \n");
86 | EPD.deepsleep();
87 | }
88 |
89 | void loop()
90 | {
91 | delay(1); //防止看门狗咬
92 | }
93 |
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/font10:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/font10
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/font12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/font12
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/font32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/font32
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/font60:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/font60
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/font70:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/font70
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/weathericon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/weathericon
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/weathericon32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/weathericon32
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/weathericon50:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/weathericon50
--------------------------------------------------------------------------------
/examples/HardSPIHelloWorld/data/weathericon80:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HardSPIHelloWorld/data/weathericon80
--------------------------------------------------------------------------------
/examples/HelloWorld/HelloWorld.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @file HelloWorld.ino
3 | * @author HalfSweet (Email:HalfSweet@HalfSweet.cn or QQ:2522182733)
4 | * @brief 该文件为墨水屏驱动显示Hello World的示例程序,此文件仅仅作为最简单的点亮屏幕,具体的函数用法请参阅文档
5 | * @version 0.1
6 | * @date 2022-01-30
7 | *
8 | * @copyright Copyright (c) 2022
9 | *
10 | */
11 | #include
12 | #include
13 | //包含你需要使用的文件系统,例如:
14 | #include
15 |
16 | #define BAUD_SPEED 74880 //串口调试的波特率,可自行修改
17 |
18 | #define CS 15
19 | #define RST 2
20 | #define DC 0
21 | #define BUSY 4
22 | #define CLK 14
23 | #define DIN 13
24 | EPaperDrive EPD(0, CS, RST, DC, BUSY, CLK, DIN); //驱动库的实例化,此处为使用软件SPI
25 |
26 | const uint8_t city_icon[24] = {
27 | /* 0X01,0X01,0X0C,0X00,0X0C,0X00, */
28 | 0X00,
29 | 0X00,
30 | 0X1C,
31 | 0X00,
32 | 0X77,
33 | 0X00,
34 | 0X41,
35 | 0X80,
36 | 0X9C,
37 | 0X60,
38 | 0XA2,
39 | 0X30,
40 | 0XA2,
41 | 0X30,
42 | 0X9C,
43 | 0XC0,
44 | 0X41,
45 | 0X80,
46 | 0X77,
47 | 0X00,
48 | 0X1C,
49 | 0X00,
50 | 0X00,
51 | 0X00,
52 | };
53 |
54 | void setup()
55 | {
56 | Serial.begin(BAUD_SPEED);
57 | LittleFS.begin(); //请务必先手动初始化一遍文件系统再将指针传入
58 | EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改
59 |
60 | EPD.EPD_Set_Model(HINKE0266A15A0); //设置屏幕类型,具体型号可以参考文档
61 | EPD.EPD_init_Full(); //全刷初始化,使用全刷波形
62 | EPD.clearbuffer(); //清空缓存(全白)
63 | EPD.fontscale = 2; //字体缩放系数(支持1和2,对图片也有效,用完记得重新改成1)
64 | EPD.SetFont(FONT12); //选择字体,具体支持的字体见文档
65 | EPD.DrawUTF(0, 0, "Hello World"); //绘制字符串
66 | EPD.DrawUTF(26, 0, "我喜欢墨水屏"); //绘制字符串
67 | EPD.fontscale = 1; //字体缩放系数改回1
68 | EPD.DrawXbm_P(60, 0, 12, 12, (uint8_t *)city_icon); //绘制图片
69 | Serial.printf("缓存图像绘制完毕,准备全刷 \n");
70 | EPD.EPD_Dis_Full((uint8_t *)EPD.EPDbuffer, 1); //将缓存中的图像传给屏幕控制芯片全刷屏幕
71 | EPD.deepsleep(); //让屏幕进入休眠模式
72 | Serial.println("全刷完毕");
73 |
74 | delay(5000);
75 |
76 | EPD.EPD_init_Part(); //局刷的初始化
77 | EPD.clearbuffer();
78 | EPD.fontscale = 2;
79 | EPD.SetFont(FONT12);
80 | EPD.DrawUTF(0, 0, "现在是局刷");
81 | Serial.printf("开始局刷 \n");
82 | EPD.EPD_Dis_Part(0, 23, 0, 199, (uint8_t *)EPD.EPDbuffer, 1); //将缓存中的图像传给屏幕控制芯片局新屏幕
83 | Serial.printf("局刷结束 \n");
84 | EPD.deepsleep();
85 | }
86 |
87 | void loop()
88 | {
89 | delay(1); //防止看门狗咬
90 | }
91 |
--------------------------------------------------------------------------------
/examples/HelloWorld/data/font10:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/font10
--------------------------------------------------------------------------------
/examples/HelloWorld/data/font12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/font12
--------------------------------------------------------------------------------
/examples/HelloWorld/data/font32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/font32
--------------------------------------------------------------------------------
/examples/HelloWorld/data/font60:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/font60
--------------------------------------------------------------------------------
/examples/HelloWorld/data/font70:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/font70
--------------------------------------------------------------------------------
/examples/HelloWorld/data/weathericon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/weathericon
--------------------------------------------------------------------------------
/examples/HelloWorld/data/weathericon32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/weathericon32
--------------------------------------------------------------------------------
/examples/HelloWorld/data/weathericon50:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/weathericon50
--------------------------------------------------------------------------------
/examples/HelloWorld/data/weathericon80:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/HelloWorld/data/weathericon80
--------------------------------------------------------------------------------
/examples/ThreeColor/ThreeColor.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @file HelloWorld.ino
3 | * @author HalfSweet (Email:HalfSweet@HalfSweet.cn or QQ:2522182733)
4 | * @brief 该文件为支持三色的墨水屏显示出三种颜色的例程
5 | * @version 0.1
6 | * @date 2022-04-20
7 | *
8 | * @copyright Copyright (c) 2022
9 | *
10 | */
11 | #include
12 | #include
13 | //包含你需要使用的文件系统,例如:
14 | #include
15 |
16 | #define BAUD_SPEED 74880 //串口调试的波特率,可自行修改
17 |
18 | #define CS 15
19 | #define RST 2
20 | #define DC 0
21 | #define BUSY 4
22 | #define CLK 14
23 | #define DIN 13
24 | EPaperDrive EPD(0, CS, RST, DC, BUSY, CLK, DIN); //驱动库的实例化,此处为使用软件SPI
25 |
26 | const uint8_t city_icon[24] = {
27 | /* 0X01,0X01,0X0C,0X00,0X0C,0X00, */
28 | 0X00,
29 | 0X00,
30 | 0X1C,
31 | 0X00,
32 | 0X77,
33 | 0X00,
34 | 0X41,
35 | 0X80,
36 | 0X9C,
37 | 0X60,
38 | 0XA2,
39 | 0X30,
40 | 0XA2,
41 | 0X30,
42 | 0X9C,
43 | 0XC0,
44 | 0X41,
45 | 0X80,
46 | 0X77,
47 | 0X00,
48 | 0X1C,
49 | 0X00,
50 | 0X00,
51 | 0X00,
52 | };
53 |
54 | void setup()
55 | {
56 | Serial.begin(BAUD_SPEED);
57 | LittleFS.begin(); //请务必先手动初始化一遍文件系统再将指针传入
58 | EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改
59 |
60 | EPD.EPD_Set_Model(DKE42_3COLOR); //设置屏幕类型,具体型号可以参考文档
61 | EPD.EPD_init_Full(); //全刷初始化,使用全刷波形
62 | EPD.clearbuffer(); //清空缓存(全白)
63 | EPD.fontscale = 2; //字体缩放系数(支持1和2,对图片也有效,用完记得重新改成1)
64 | EPD.SetFont(FONT12); //选择字体,具体支持的字体见文档
65 | EPD.DrawUTF(0, 0, "Hello World"); //绘制字符串
66 | EPD.DrawUTF(26, 0, "我喜欢墨水屏"); //绘制字符串
67 | EPD.fontscale = 1; //字体缩放系数改回1
68 | EPD.DrawXbm_P(100, 0, 12, 12, (uint8_t *)city_icon); //绘制图片
69 | EPD.EPD_Transfer_Full_BW((unsigned char *)EPD.EPDbuffer, 1); //将黑白图像传入缓存
70 | EPD.clearbuffer();
71 | EPD.fontscale = 2;
72 | EPD.DrawUTF(40, 0, "现在是红色");
73 | EPD.fontscale = 1;
74 | EPD.DrawXbm_P(100, 30, 12, 12, (uint8_t *)city_icon); //绘制图片
75 | EPD.EPD_Transfer_Full_RED((unsigned char *)EPD.EPDbuffer,1);
76 | Serial.printf("缓存图像绘制完毕,准备全刷 \n");
77 | EPD.EPD_Update();
78 | EPD.ReadBusy_long();//等待屏幕刷新完成后才继续往下运行
79 | EPD.deepsleep(); //让屏幕进入休眠模式
80 | Serial.println("全刷完毕");
81 | }
82 |
83 | void loop()
84 | {
85 | delay(1); //防止看门狗咬
86 | }
87 |
--------------------------------------------------------------------------------
/examples/ThreeColor/data/ThreeColor.ino:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/ThreeColor.ino
--------------------------------------------------------------------------------
/examples/ThreeColor/data/font10:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/font10
--------------------------------------------------------------------------------
/examples/ThreeColor/data/font12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/font12
--------------------------------------------------------------------------------
/examples/ThreeColor/data/font32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/font32
--------------------------------------------------------------------------------
/examples/ThreeColor/data/font60:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/font60
--------------------------------------------------------------------------------
/examples/ThreeColor/data/font70:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/font70
--------------------------------------------------------------------------------
/examples/ThreeColor/data/weathericon32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/weathericon32
--------------------------------------------------------------------------------
/examples/ThreeColor/data/weathericon50:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/weathericon50
--------------------------------------------------------------------------------
/examples/ThreeColor/data/weathericon80:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HalfSweetStudio/EPaperDrive/6a97489d8addea0a4ffacfac8eaeefa9c09da0bc/examples/ThreeColor/data/weathericon80
--------------------------------------------------------------------------------
/keywords.txt:
--------------------------------------------------------------------------------
1 | ###########################################
2 | # Syntax Coloring Map For EPaperDrive-library
3 | ###########################################
4 |
5 | ###########################################
6 | # Datatypes (KEYWORD1)
7 | ###########################################
8 |
9 | EPaperDrive KEYWORD1
10 |
11 | ###########################################
12 | # Methods and Functions (KEYWORD2)
13 | ###########################################
14 |
15 | deepsleep KEYWORD2
16 | SetFS KEYWORD2
17 | SetHardSPI KEYWORD2
18 | EPD_Set_Model KEYWORD2
19 | EPD_init_Full KEYWORD2
20 | EPD_init_Part KEYWORD2
21 | EPD_Dis_Full KEYWORD2
22 | EPD_Dis_Part KEYWORD2
23 | EPD_Transfer_Full_BW KEYWORD2
24 | EPD_Transfer_Full_RED KEYWORD2
25 | EPD_Transfer_Part KEYWORD2
26 | SetFont KEYWORD2
27 | DrawUTF KEYWORD2
28 | DrawUnicodeChar KEYWORD2
29 | DrawUnicodeStr KEYWORD2
30 | clearbuffer KEYWORD2
31 | DrawYline KEYWORD2
32 | DrawXline KEYWORD2
33 | DrawLine KEYWORD2
34 | Inverse KEYWORD2
35 | DrawWeatherChart KEYWORD2
36 | DrawCircle KEYWORD2
37 | DrawBox KEYWORD2
38 | DrawEmptyBox KEYWORD2
39 | DrawChart KEYWORD2
40 | DrawCircleChart KEYWORD2
41 | drawXbm KEYWORD2
42 | DrawXbm_P KEYWORD2
43 | DrawXbm_p_gray KEYWORD2
44 | DrawXbm_spiff_gray KEYWORD2
45 | EPD_Set_Contrast KEYWORD2
46 | EPD_Update KEYWORD2
47 | EPD_Update_Part KEYWORD2
48 | ReadBusy KEYWORD2
49 | ReadBusy_long KEYWORD2
50 | EPD_WriteCMD KEYWORD2
51 | EPD_WriteData KEYWORD2
52 | EPD_Write KEYWORD2
53 |
54 | fontscale KEYWORD3
55 | EPDbuffer KEYWORD3
56 |
57 | FONT KEYWORD3
58 | epd_type KEYWORD3
--------------------------------------------------------------------------------
/library.properties:
--------------------------------------------------------------------------------
1 | name=EPaperDrive
2 | version=1.0.0
3 | author=HalfSweet,HalfSweet@HalfSweet.cn
4 | maintainer=HalfSweet,HalfSweet@HalfSweet.cn
5 | sentence=一个优秀的串口墨水屏驱动库
6 | paragraph=支持目前市面上绝大多数的墨水屏以及驱动芯片
7 | category=Display
8 | url=https://github.com/HalfSweetStudio/EPaperDrive
9 | architectures=*
10 |
--------------------------------------------------------------------------------
/src/EPaperDrive.cpp:
--------------------------------------------------------------------------------
1 | #include "EPaperDrive.h"
2 | //#include "EPD_drive_gpio.h"
3 |
4 | uint8_t UNICODEbuffer[200];
5 | String fontname;
6 |
7 | EPaperDrive::EPaperDrive(bool SPIMode, uint8_t CS, uint8_t RST, uint8_t DC, uint8_t BUSY, uint8_t CLK, uint8_t DIN)
8 | {
9 | _CS = CS;
10 | _RST = RST;
11 | _DC = DC;
12 | _BUSY = BUSY;
13 | _CLK = CLK;
14 | _DIN = DIN;
15 | _SPIMode = SPIMode;
16 | if (SPIMode == 0)
17 | {
18 | pinMode(CS, OUTPUT); // io初始化
19 | pinMode(DC, OUTPUT);
20 | pinMode(RST, OUTPUT);
21 | digitalWrite(RST, HIGH);
22 | pinMode(BUSY, INPUT);
23 | pinMode(CLK, OUTPUT);
24 | pinMode(DIN, OUTPUT);
25 | }
26 | else
27 | {
28 | pinMode(CS, OUTPUT);
29 | pinMode(DC, OUTPUT);
30 | pinMode(RST, OUTPUT);
31 | digitalWrite(RST, HIGH);
32 | pinMode(BUSY, INPUT);
33 | }
34 | }
35 |
36 | EPaperDrive::~EPaperDrive()
37 | {
38 | }
39 |
40 | void EPaperDrive::driver_delay_xms(unsigned long xms)
41 | {
42 | delay(xms);
43 | }
44 |
45 | void EPaperDrive::SetFS(fs::FS* FSType)
46 | {
47 | UserFS = FSType;
48 | }
49 |
50 | void EPaperDrive::SetHardSPI(SPIClass *spi)
51 | {
52 | MySPI = spi;
53 | }
54 |
55 | void EPaperDrive::SPI_Write(uint8_t value)
56 | {
57 | if (_SPIMode == 1)
58 | {
59 | MySPI->transfer(value);
60 | }
61 | else
62 | {
63 | EPD_CLK_0;
64 | // delayMicroseconds(1);
65 | for (int i = 0; i < 8; i++)
66 | {
67 | //高位在前发送方式 根据升级器件特性定
68 | if ((value & 0x80) == 0x80)
69 | EPD_DIN_1;
70 | else
71 | EPD_DIN_0;
72 | // delayMicroseconds(1); //等待数据稳定 根据实际时钟调整
73 | EPD_CLK_1; //上升沿发送数据
74 | // delayMicroseconds(1);//CLK高电平保持一段时间 这个可以不需要 根据具体的spi时钟来确定
75 | EPD_CLK_0; //把时钟拉低实现为下一次上升沿发送数据做准备
76 | value = value << 1; //发送数据的位向前移动一位
77 | }
78 | }
79 | }
80 |
81 | void EPaperDrive::SetFont(FONT fontindex)
82 | {
83 | FontIndex = fontindex;
84 | switch (fontindex)
85 | {
86 | case 0:
87 | fontname = "/font16";
88 | fontwidth = 16;
89 | fontheight = 16;
90 | break;
91 | case 1:
92 | fontname = "/font32";
93 | fontwidth = 32;
94 | fontheight = 32;
95 | break;
96 | case 2:
97 | fontname = "/font10";
98 | fontwidth = 10;
99 | fontheight = 10;
100 | break;
101 | case 3:
102 | fontname = "/font12";
103 | fontwidth = 12;
104 | fontheight = 12;
105 | break;
106 | case 5:
107 | fontname = "/font70";
108 | fontwidth = 70;
109 | fontheight = 70;
110 | break;
111 | case 6:
112 | fontname = "/font12num";
113 | fontwidth = 12;
114 | fontheight = 12;
115 | break;
116 | case 7:
117 | fontname = "/font24";
118 | fontwidth = 24;
119 | fontheight = 24;
120 | break;
121 | case 8:
122 | fontname = "/font8";
123 | fontwidth = 8;
124 | fontheight = 8;
125 | break;
126 | case 9:
127 | fontname = "/font100num";
128 | fontwidth = 100;
129 | fontheight = 100;
130 | break;
131 | case 11:
132 | fontname = "/weathericon";
133 | fontwidth = 32;
134 | fontheight = 32;
135 | break;
136 | case 12:
137 | fontname = "/weathericon80";
138 | fontwidth = 80;
139 | fontheight = 80;
140 | break;
141 | case 13:
142 | fontname = "/weathericon32";
143 | fontwidth = 32;
144 | fontheight = 32;
145 | break;
146 | case 14:
147 | fontname = "/weathericon50";
148 | fontwidth = 50;
149 | fontheight = 50;
150 | break;
151 | }
152 | }
153 | void EPaperDrive::DrawCircle(int x, int y, int r, bool fill)
154 | {
155 | if (fill == 0)
156 | {
157 | for (int i = 0; i < 360; i++)
158 | {
159 | SetPixel(round(cos(i) * r + x), round(sin(i) * r) + y);
160 | }
161 | }
162 | else
163 | {
164 | for (int j = 0; j < r; j++)
165 | {
166 |
167 | for (int i = 0; i < 360; i++)
168 | {
169 | SetPixel(round(cos(i) * j + x), round(sin(i) * j) + y);
170 | }
171 | }
172 | }
173 | }
174 |
175 | void EPaperDrive::DrawBox(uint8_t x, int y, int w, int h)
176 | {
177 |
178 | for (int i = x; i < x + h; i++)
179 | {
180 | DrawXline(y, y + w - 1, i);
181 | }
182 | }
183 | void EPaperDrive::DrawEmptyBox(int x, int y, int w, int h)
184 | {
185 | DrawXline(y, y + w, x);
186 | DrawXline(y, y + w, x + h);
187 | DrawYline(x, x + h, y);
188 | DrawYline(x, x + h, y + w);
189 | }
190 |
191 | void EPaperDrive::DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6)
192 | {
193 |
194 | int percent, sum, max_c = 0;
195 | sum = c1 + c2 + c3 + c4 + c5 + c6;
196 | if (sum == 0)
197 | sum = 1;
198 | max_c = max(c1, max_c);
199 | max_c = max(c2, max_c);
200 | max_c = max(c3, max_c);
201 | max_c = max(c4, max_c);
202 | max_c = max(c5, max_c);
203 | max_c = max(c6, max_c);
204 | if (max_c == 0)
205 | max_c = 1;
206 | w = w * sum / (2 * max_c);
207 |
208 | SetFont(FONT12);
209 | DrawUTF(x, y, ">0.3um");
210 | percent = w * c1 / sum;
211 | DrawBox(x + 1, y + 41, percent, 10);
212 | SetFont(FONT8);
213 | DrawUTF(x + 2, y + 41 + percent, String(c1));
214 |
215 | SetFont(FONT12);
216 | DrawUTF(x + 12, y, ">0.5um");
217 | percent = w * c2 / sum;
218 | DrawBox(x + 13, y + 41, percent, 10);
219 | SetFont(FONT8);
220 | DrawUTF(x + 14, y + 41 + percent, String(c2));
221 |
222 | SetFont(FONT12);
223 | DrawUTF(x + 24, y, ">1.0um");
224 | percent = w * c3 / sum;
225 | DrawBox(x + 25, y + 41, percent, 10);
226 | SetFont(FONT8);
227 | DrawUTF(x + 26, y + 41 + percent, String(c3));
228 |
229 | SetFont(FONT12);
230 | DrawUTF(x + 36, y, ">2.5um");
231 | percent = w * c4 / sum;
232 | DrawBox(x + 37, y + 41, percent, 10);
233 | SetFont(FONT8);
234 | DrawUTF(x + 38, y + 41 + percent, String(c4));
235 |
236 | SetFont(FONT12);
237 | DrawUTF(x + 48, y, ">5.0um");
238 | percent = w * c5 / sum;
239 | DrawBox(x + 49, y + 41, percent, 10);
240 | SetFont(FONT8);
241 | DrawUTF(x + 50, y + 41 + percent, String(c5));
242 |
243 | SetFont(FONT12);
244 | DrawUTF(x + 60, y, ">10um");
245 | percent = w * c6 / sum;
246 | DrawBox(x + 61, y + 41, percent, 10);
247 | SetFont(FONT8);
248 | DrawUTF(x + 62, y + 41 + percent, String(c6));
249 | }
250 | void EPaperDrive::DrawCircleChart(int x, int y, int r, int w, int c1, int c2, int c3)
251 | {
252 | int sum = c1 + c2 + c3;
253 | if (sum == 0)
254 | sum = 1;
255 | for (int i = 0; i < 360; i++)
256 | {
257 | SetPixel(-round(cos(M_PI * i / 180) * r) + x, round(sin(M_PI * i / 180) * r) + y);
258 | }
259 |
260 | for (int i = 0; i < 360; i++)
261 | {
262 | SetPixel(-round(cos(M_PI * i / 180) * (r - w)) + x, round(sin(M_PI * i / 180) * (r - w)) + y);
263 | }
264 |
265 | for (int i = 0; i < c1 * 360 / sum; i++)
266 | {
267 | for (int j = 0; j < w; j++)
268 | {
269 | SetPixel(-round(cos(M_PI * i / 180) * (r - j)) + x, round(sin(M_PI * i / 180) * (r - j)) + y);
270 | }
271 | }
272 |
273 | for (int i = (c1 + c2) * 360 / sum - 1; i < (c1 + c2) * 360 / sum; i++)
274 | {
275 |
276 | for (int j = 0; j < w; j++)
277 | {
278 | SetPixel(-round(cos(M_PI * i / 180) * (r - j)) + x, round(sin(M_PI * i / 180) * (r - j)) + y);
279 | }
280 | }
281 |
282 | for (int i = (c1 + c2) * 360 / sum; i < 360; i += 10)
283 | {
284 |
285 | for (int j = 0; j < w; j++)
286 | {
287 | SetPixel(-round(cos(M_PI * i / 180) * (r - j)) + x, round(sin(M_PI * i / 180) * (r - j)) + y);
288 | }
289 | }
290 |
291 | y += 2;
292 | DrawBox(x - r, y + r + 2, 8, 8);
293 | SetFont(FONT12);
294 | DrawUTF(x - r - 2, y + r + 12, "PM1.0");
295 | SetFont(FONT12);
296 | DrawUTF(x - r - 2, y + r + 12 + 30, String(c1));
297 |
298 | SetFont(FONT12);
299 | DrawEmptyBox(x - r + 14, y + r + 2, 8, 8);
300 | DrawUTF(x - r + 12, y + r + 12, "PM2.5");
301 |
302 | SetFont(FONT12);
303 | DrawUTF(x - r + 12, y + r + 12 + 30, String(c2));
304 | DrawEmptyBox(x - r + 28, y + r + 2, 8, 8);
305 | for (int i = y + r + 2; i < y + r + 2 + 8; i += 2)
306 | {
307 | DrawYline(x - r + 28, x - r + 28 + 7, i);
308 | }
309 | SetFont(FONT12);
310 | DrawUTF(x - r + 26, y + r + 12, "PM10");
311 | SetFont(FONT12);
312 | DrawUTF(x - r + 26, y + r + 12 + 30, String(c3));
313 | }
314 | int EPaperDrive::getIcon(int weathercodeindex)
315 | {
316 | if (weathercodeindex == 0)
317 | return 12; //晴
318 | if (weathercodeindex == 1)
319 | return 58; //多云
320 | if (weathercodeindex == 2)
321 | return 58; //少云
322 | if (weathercodeindex == 3)
323 | return 58; //晴间多云
324 | if (weathercodeindex == 4)
325 | return 54; //阴
326 | if (weathercodeindex >= 5 && weathercodeindex <= 18)
327 | return 0;
328 | if (weathercodeindex >= 19 && weathercodeindex <= 32)
329 | return 19; //雨
330 | if (weathercodeindex >= 33 && weathercodeindex <= 36)
331 | return 16; //雪
332 | if (weathercodeindex >= 37 && weathercodeindex <= 40)
333 | return 16; //雪(雨夹雪)
334 | if (weathercodeindex == 41)
335 | return 37; //雾(薄雾)
336 | if (weathercodeindex == 42)
337 | return 37; //雾
338 | if (weathercodeindex == 43)
339 | return 37; //雾(霾)
340 | return 17; //阵雨夹雪
341 | }
342 | void EPaperDrive::DrawWeatherChart(int xmin, int xmax, int ymin, int ymax, int point_n, int show_n, String tmax, String tmin, String code_d, String code_n, String text_d, String text_n, String date, String week) //绘制天气温度变化曲线
343 | {
344 | if (tmax == ",,,,,")
345 | {
346 | tmax = "5,5,5,5,5,5";
347 | tmin = "2,2,2,2,2,2";
348 | code_d = "0,0,0,0,0,0";
349 | code_n = "0,0,0,0,0,0";
350 | text_n = "晴,晴,晴,晴,晴,晴";
351 | text_d = "晴,晴,晴,晴,晴,晴";
352 | date = "1-1,1-2,1-3,1-4,1-5,1-6";
353 | week = "1,1,1,1,1,1";
354 | }
355 | String code_d_a[point_n], code_n_a[point_n], text_d_a[point_n], text_n_a[point_n], date_a[point_n], week_a[point_n];
356 | int tmax_a[point_n], tmin_a[point_n];
357 | int min_data = 999, max_data = -999;
358 | int tmin_x_cord[point_n], tmax_x_cord[point_n]; //将数值转成屏幕坐标
359 |
360 | String temp_min[point_n];
361 | String temp_max[point_n];
362 | int j = 0, k = 0, l = 0;
363 | //分割tmax和tmin
364 | // Serial.println(tmax); Serial.println(tmin);
365 | // Serial.println(code_d);
366 | for (int i = 0; i < tmin.length(); i++)
367 | {
368 | temp_min[j] += tmin[i];
369 |
370 | if (tmin.charAt(i) == char(','))
371 | j++;
372 | }
373 | for (int i = 0; i < tmax.length(); i++)
374 | {
375 |
376 | temp_max[k] += tmax[i];
377 |
378 | if (tmax.charAt(i) == char(','))
379 | k++;
380 | }
381 | j = 0;
382 | //分割code_d
383 | for (int i = 0; i < code_d.length(); i++)
384 | {
385 | code_d_a[j] += code_d[i];
386 | if (code_d.charAt(i) == char(','))
387 | j++;
388 | }
389 | //分割code_n
390 | j = 0;
391 | for (int i = 0; i < code_n.length(); i++)
392 | {
393 | code_n_a[j] += code_n[i];
394 | if (code_n.charAt(i) == char(','))
395 | j++;
396 | }
397 | //分割text_d
398 | j = 0;
399 | for (int i = 0; i < text_d.length(); i++)
400 | {
401 | if (text_d.charAt(i) == char(','))
402 | j++;
403 | else
404 | text_d_a[j] += text_d[i];
405 | }
406 | //分割text_n
407 | j = 0;
408 | for (int i = 0; i < text_n.length(); i++)
409 | {
410 | if (text_n.charAt(i) == char(','))
411 | j++;
412 | else
413 | text_n_a[j] += text_n[i];
414 | }
415 | //分割week_n
416 | j = 0;
417 | for (int i = 0; i < week.length(); i++)
418 | {
419 | if (week.charAt(i) == char(','))
420 | j++;
421 | else
422 | week_a[j] += week[i];
423 | }
424 | j = 0;
425 | for (int i = 0; i < date.length(); i++)
426 | {
427 | if (date.charAt(i) == char(','))
428 | j++;
429 | else
430 | date_a[j] += date[i];
431 | }
432 | for (int i = 0; i < point_n; i++)
433 | {
434 | tmax_a[i] = temp_max[i].toInt(); // Serial.printf("max:%d\n",tmax_a[i]);
435 | tmin_a[i] = temp_min[i].toInt(); // Serial.printf("min:%d\n",tmin_a[i]);
436 | }
437 | //找出计算最大最小值
438 | for (int i = 0; i < show_n; i++)
439 | {
440 | if (tmax_a[i] > max_data)
441 | max_data = tmax_a[i];
442 | if (tmax_a[i] < min_data)
443 | min_data = tmax_a[i];
444 | if (tmin_a[i] > max_data)
445 | max_data = tmin_a[i];
446 | if (tmin_a[i] < min_data)
447 | min_data = tmin_a[i];
448 | }
449 | //转换坐标
450 | if ((max_data - min_data) != 0)
451 | {
452 | for (int i = 0; i < show_n; i++)
453 | {
454 | tmin_x_cord[i] = xmax - ((xmax - xmin) * (tmin_a[i] - min_data) / (max_data - min_data));
455 | tmax_x_cord[i] = xmax - ((xmax - xmin) * (tmax_a[i] - min_data) / (max_data - min_data));
456 | }
457 | }
458 | int dy = (ymax - ymin) / (show_n - 1);
459 |
460 | /*
461 | Spline line;
462 | float x[point_n];float y[point_n];
463 | for(int i=0;i= dy)
549 | {
550 | if (xend > xstart)
551 | {
552 | for (int i = xstart; i <= xend; i++)
553 | {
554 | SetPixel(i, round((i - xstart) * (yend - ystart) / (xend - xstart)) + ystart);
555 | }
556 | }
557 | else
558 | {
559 | for (int i = xstart; i >= xend; i--)
560 | {
561 | SetPixel(i, round((i - xstart) * (yend - ystart) / (xend - xstart)) + ystart);
562 | }
563 | }
564 | }
565 |
566 | else
567 | {
568 | if (yend > ystart)
569 | {
570 | for (int i = ystart; i <= yend; i++)
571 | {
572 | SetPixel(round((i - ystart) * (xend - xstart) / (yend - ystart)) + xstart, i);
573 | }
574 | }
575 | else
576 | {
577 | for (int i = ystart; i >= yend; i--)
578 | {
579 | SetPixel(round((i - ystart) * (xend - xstart) / (yend - ystart)) + xstart, i);
580 | }
581 | }
582 | }
583 | }
584 |
585 | void EPaperDrive::Inverse(int xStart, int xEnd, int yStart, int yEnd)
586 | {
587 | for (int i = 0; i < (xEnd - xStart); i++)
588 | {
589 | for (int j = 0; j < (yEnd - yStart); j++)
590 | {
591 | InversePixel(xStart + i, yStart + j);
592 | }
593 | }
594 | }
595 | void EPaperDrive::DrawUTF(int16_t x, int16_t y, String code)
596 | {
597 | char buffer[200];
598 | code.toCharArray(buffer, 200);
599 | DrawUTF(x, y, fontwidth, fontheight, (uint8_t *)buffer);
600 | }
601 | void EPaperDrive::DrawUTF(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code)
602 | {
603 | int charcount;
604 | charcount = UTFtoUNICODE((uint8_t *)code);
605 | DrawUnicodeStr(x, y, width, height, charcount, (uint8_t *)UNICODEbuffer);
606 | }
607 | int EPaperDrive::UTFtoUNICODE(uint8_t *code)
608 | {
609 | int i = 0;
610 | int charcount = 0;
611 | while (code[i] != '\0')
612 | {
613 | // Serial.println("current codei");
614 | // Serial.println(code[i],HEX);
615 | // Serial.println(code[i]&0xf0,HEX);
616 | if (code[i] <= 0x7f) // ascii
617 | {
618 |
619 | UNICODEbuffer[charcount * 2] = 0x00;
620 | UNICODEbuffer[charcount * 2 + 1] = code[i];
621 | // Serial.println("english or number");
622 | // Serial.println(UNICODEbuffer[charcount*2],HEX);
623 | // Serial.println(UNICODEbuffer[charcount*2+1],HEX);
624 | i++;
625 | charcount++;
626 | }
627 | else if ((code[i] & 0xe0) == 0xc0)
628 | {
629 |
630 | UNICODEbuffer[charcount * 2 + 1] = (code[i] << 6) + (code[i + 1] & 0x3f);
631 | UNICODEbuffer[charcount * 2] = (code[i] >> 2) & 0x07;
632 | i += 2;
633 | charcount++;
634 | // Serial.println("two bits utf-8");
635 | }
636 | else if ((code[i] & 0xf0) == 0xe0)
637 | {
638 |
639 | UNICODEbuffer[charcount * 2 + 1] = (code[i + 1] << 6) + (code[i + 2] & 0x7f);
640 | UNICODEbuffer[charcount * 2] = (code[i] << 4) + ((code[i + 1] >> 2) & 0x0f);
641 |
642 | // Serial.println("three bits utf-8");
643 | // Serial.println(UNICODEbuffer[charcount*2],HEX);
644 | // Serial.println(UNICODEbuffer[charcount*2+1],HEX);
645 | i += 3;
646 | charcount++;
647 | }
648 | else
649 | {
650 | return 0;
651 | }
652 | }
653 | UNICODEbuffer[charcount * 2] = '\0';
654 | return charcount;
655 | }
656 | void EPaperDrive::DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code)
657 | {
658 |
659 | int offset;
660 | int sizeofsinglechar;
661 | if (height % 8 == 0)
662 | sizeofsinglechar = (height / 8) * width;
663 | else
664 | sizeofsinglechar = (height / 8 + 1) * width;
665 | offset = (code[0] * 0x100 + code[1]) * sizeofsinglechar;
666 | Serial.printf("offset:%d",offset);
667 | // Serial.println("code[1]");
668 | // Serial.println(code[1]);
669 | //Serial.println("sizeofsinglechar");
670 | //Serial.println(sizeofsinglechar);
671 | // File f = UserFS->open(fontname, "r");
672 | File f = UserFS->open(fontname, "r");
673 | f.seek(offset, SeekSet);
674 | char zi[sizeofsinglechar];
675 | f.readBytes(zi, sizeofsinglechar);
676 | /*for(int i=0;i<32;i++)
677 | {
678 |
679 | Serial.println(zi[i],HEX);
680 | }*/
681 | // Serial.println("offset");
682 | // Serial.println(offset);
683 | if (offset < 0xff * sizeofsinglechar && FontIndex < 10)
684 | {
685 | drawXbm(x, y, width, height, (uint8_t *)zi);
686 | }
687 | else
688 | {
689 | drawXbm(x, y, width, height, (uint8_t *)zi);
690 | }
691 |
692 | // SPIFFS.end();
693 | }
694 |
695 | void EPaperDrive::DrawUnicodeStr(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t strlength, uint8_t *code)
696 | {
697 | int ymax = yDot;
698 | if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98)
699 | {
700 | ymax = xDot;
701 | }
702 |
703 | CurrentCursor = 0;
704 | uint8_t sizeofsinglechar;
705 | if (height % 8 == 0)
706 | sizeofsinglechar = (height / 8) * width;
707 | else
708 | sizeofsinglechar = (height / 8 + 1) * width;
709 | int ymove = 0;
710 | int xmove = 0;
711 | strlength *= 2;
712 | int i = 0;
713 | while (i < strlength)
714 | {
715 | int offset;
716 | offset = (code[i] * 0x100 + code[i + 1]) * sizeofsinglechar;
717 | if (offset < 0xff * sizeofsinglechar && fontscale == 1)
718 | {
719 |
720 | DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i);
721 | ymove += CurrentCursor + 1;
722 | if ((y + ymove + width / 2) >= ymax - 1)
723 | {
724 | xmove += height + 1;
725 | ymove = 0;
726 | CurrentCursor = 0;
727 | }
728 | }
729 | else if (offset < 0xff * sizeofsinglechar && fontscale == 2)
730 | {
731 | DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i);
732 | ymove += CurrentCursor + 2;
733 | if ((y + ymove + width) >= ymax - 1)
734 | {
735 | xmove += height + 1;
736 | ymove = 0;
737 | CurrentCursor = 0;
738 | }
739 | }
740 | else if (fontscale == 2)
741 | {
742 | DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i);
743 | ymove += width * 2;
744 | if ((y + ymove + width * 2) >= ymax - 1)
745 | {
746 | xmove += height * 2 + 2;
747 | ymove = 0;
748 | CurrentCursor = 0;
749 | }
750 | }
751 | else
752 | {
753 | DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i);
754 | ymove += width;
755 | if ((y + ymove + width) >= ymax - 1)
756 | {
757 | xmove += height + 1;
758 | ymove = 0;
759 | CurrentCursor = 0;
760 | }
761 | }
762 | i++;
763 | i++;
764 | }
765 | }
766 | void EPaperDrive::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t *xbm)
767 | {
768 | int16_t heightInXbm = (height + 7) / 8;
769 | uint8_t Data;
770 | for (int16_t x = 0; x < width; x++)
771 | {
772 | for (int16_t y = 0; y < height; y++)
773 | {
774 | if (y & 7)
775 | {
776 | Data <<= 1; // Move a bit
777 | }
778 | else
779 | { // Read new Data every 8 bit
780 | Data = xbm[(y / 8) + x * heightInXbm];
781 | }
782 | // if there is a bit draw it
783 | if (((Data & 0x80) >> 7))
784 | {
785 | if (fontscale == 1)
786 | {
787 | SetPixel(xMove + y, yMove + x);
788 | CurrentCursor = x;
789 | }
790 | if (fontscale == 2)
791 | {
792 | SetPixel(xMove + y * 2, yMove + x * 2);
793 | SetPixel(xMove + y * 2 + 1, yMove + x * 2);
794 | SetPixel(xMove + y * 2, yMove + x * 2 + 1);
795 | SetPixel(xMove + y * 2 + 1, yMove + x * 2 + 1);
796 | CurrentCursor = x * 2;
797 | }
798 | // if(fontscale==2) {SetPixel(xMove + y*2, yMove + x*2);CurrentCursor=x*2;}
799 | }
800 | }
801 | }
802 | }
803 |
804 | void EPaperDrive::DrawXbm_P(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm)
805 | {
806 | int16_t heightInXbm = (height + 7) / 8;
807 | uint8_t Data;
808 | // uint8_t temp[heightInXbm*width];
809 | // memcpy_P(temp, xbm, heightInXbm*width);
810 |
811 | for (int16_t x = 0; x < width; x++)
812 | {
813 | for (int16_t y = 0; y < height; y++)
814 | {
815 | if (y & 7)
816 | {
817 | Data <<= 1; // Move a bit
818 | }
819 | else
820 | { // Read new Data every 8 bit
821 | Data = pgm_read_byte(xbm + (y / 8) + x * heightInXbm);
822 | }
823 | // if there is a bit draw it
824 | if (((Data & 0x80) >> 7))
825 | {
826 | if (fontscale == 1)
827 | {
828 | SetPixel(xMove + y, yMove + x);
829 | CurrentCursor = x;
830 | }
831 | if (fontscale == 2)
832 | {
833 | SetPixel(xMove + y * 2, yMove + x * 2);
834 | SetPixel(xMove + y * 2 + 1, yMove + x * 2);
835 | SetPixel(xMove + y * 2, yMove + x * 2 + 1);
836 | SetPixel(xMove + y * 2 + 1, yMove + x * 2 + 1);
837 | }
838 | }
839 | }
840 | }
841 | }
842 | void EPaperDrive::DrawXbm_p_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm, uint8_t level)
843 | {
844 | int16_t heightInXbm = (height + 1) / 2;
845 | uint8_t Data;
846 |
847 | for (int16_t x = 0; x < width; x++)
848 | {
849 | for (int16_t y = 0; y < height; y++)
850 | {
851 | if (y % 2 != 0)
852 | {
853 | Data <<= 4; // Move a bit
854 | }
855 | else
856 | { // Read new Data every 8 bit
857 | Data = pgm_read_byte(xbm + (y / 2) + x * heightInXbm);
858 | }
859 | // if there is a bit draw it
860 | if (((Data & 0xf0) >> 4 == level))
861 | {
862 | SetPixel(xMove + y, yMove + x);
863 | CurrentCursor = x;
864 | }
865 | }
866 | }
867 | }
868 | void EPaperDrive::DrawXbm_spiff_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t level)
869 | {
870 | // File f = UserFS->open("/pic.xbm", "r");
871 | File f = UserFS->open("/pic.xbm", "r");
872 |
873 | int16_t heightInXbm = (height + 1) / 2;
874 | uint8_t Data;
875 |
876 | for (int16_t x = 0; x < width; x++)
877 | {
878 | for (int16_t y = 0; y < height; y++)
879 | {
880 | if (y % 2 != 0)
881 | {
882 | Data <<= 4; // Move a bit
883 | }
884 | else
885 | { // Read new Data every 8 bit
886 | Data = ~f.read();
887 | }
888 | // if there is a bit draw it
889 | if (((Data & 0xf0) >> 4 == level))
890 | {
891 | SetPixel(xMove + y, yMove + x);
892 | CurrentCursor = x;
893 | }
894 | }
895 | }
896 | f.close();
897 | }
898 | void EPaperDrive::SetPixel(int16_t x, int16_t y)
899 | {
900 |
901 | if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98)
902 | {
903 | int16_t temp = x;
904 | x = y;
905 | y = yDot - 1 - temp;
906 | if (x < xDot && y < yDot)
907 | EPDbuffer[x / 8 + y * xDot / 8] &= ~(0x80 >> x % 8);
908 | }
909 | else if (EPD_Type == WF29BZ03)
910 | {
911 | if (frame == 0)
912 | {
913 | if (x < (xDot * 2) && y < (yDot * 2))
914 | EPDbuffer[x / 4 + y * xDot / 4] &= ~(0x80 >> ((x % 4) * 2));
915 | }
916 | else
917 | {
918 | if (x < (xDot * 2) && y < (yDot * 2))
919 | EPDbuffer[x / 4 + y * xDot / 4] &= ~(0x40 >> ((x % 4) * 2));
920 | }
921 | }
922 | else
923 | {
924 | if (x < xDot && y < yDot)
925 | EPDbuffer[x / 8 + y * xDot / 8] &= ~(0x80 >> x % 8);
926 | }
927 | }
928 | void EPaperDrive::InversePixel(int16_t x, int16_t y)
929 | {
930 |
931 | if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98)
932 | {
933 | int16_t temp = x;
934 | x = y;
935 | y = yDot - 1 - temp;
936 | if (x < xDot && y < yDot)
937 | EPDbuffer[x / 8 + y * xDot / 8] ^= (0x80 >> x % 8);
938 | }
939 | else if (EPD_Type == WF29BZ03)
940 | {
941 | if (frame == 0)
942 | {
943 | if (x < (xDot * 2) && y < (yDot * 2))
944 | EPDbuffer[x / 4 + y * xDot / 4] ^= (0x80 >> ((x % 4) * 2));
945 | }
946 | else
947 | {
948 | if (x < (xDot * 2) && y < (yDot * 2))
949 | EPDbuffer[x / 4 + y * xDot / 4] ^= (0x40 >> ((x % 4) * 2));
950 | }
951 | }
952 | else
953 | {
954 | if (x < xDot && y < yDot)
955 | EPDbuffer[x / 8 + y * xDot / 8] ^= (0x80 >> x % 8);
956 | // Serial.printf("(%d,%d)\n",x,y);
957 | }
958 | }
959 | void EPaperDrive::clearbuffer()
960 | {
961 |
962 | if (EPD_Type == WF29BZ03)
963 | {
964 | for (int i = 0; i < (xDot * yDot / 4); i++)
965 | EPDbuffer[i] = 0xff;
966 | }
967 | else
968 | for (int i = 0; i < (xDot * yDot / 8); i++)
969 | EPDbuffer[i] = 0xff;
970 | }
971 | void EPaperDrive::EPD_Set_Model(uint8_t model)
972 | {
973 | EPD_Type = epd_type(model);
974 |
975 | switch (model)
976 | {
977 | case 0:
978 | xDot = 128;
979 | yDot = 296;
980 | break; // WX29
981 | case 1:
982 | xDot = 128;
983 | yDot = 296;
984 | break; // WF29
985 | case 2:
986 | xDot = 400;
987 | yDot = 300;
988 | break; // OPM4_2
989 | case 3:
990 | xDot = 648;
991 | yDot = 480;
992 | break; // WF58
993 | case 4:
994 | xDot = 128;
995 | yDot = 296;
996 | break; // WF29BZ03
997 | case 5:
998 | xDot = 152;
999 | yDot = 152;
1000 | break; // C154
1001 | case 6:
1002 | xDot = 400;
1003 | yDot = 300;
1004 | break; // DKE42_3COLOR
1005 | case 7:
1006 | xDot = 128;
1007 | yDot = 296;
1008 | break; // DKE29_3COLOR
1009 | case 8:
1010 | xDot = 400;
1011 | yDot = 300;
1012 | break; // WF42
1013 | case 9:
1014 | break; // WF32
1015 |
1016 | case 10:
1017 | xDot = 128;
1018 | yDot = 296;
1019 | break; // WFT0290CZ10
1020 |
1021 | case 11:
1022 | xDot = 400;
1023 | yDot = 300;
1024 | break; // GDEY042Z98
1025 |
1026 | case 12:
1027 | xDot = 152;
1028 | yDot = 296;
1029 | break;
1030 | }
1031 | }
1032 | bool EPaperDrive::ReadBusy(void)
1033 | {
1034 | unsigned long i = 0;
1035 | for (i = 0; i < 100; i++)
1036 | {
1037 | // println("isEPD_BUSY = %d\r\n",isEPD_CS);
1038 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
1039 | {
1040 | if (READ_EPD_BUSY == 0)
1041 | {
1042 | // Serial.println("Busy is Low \r\n");
1043 | return 1;
1044 | }
1045 | }
1046 | if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
1047 | {
1048 | if (READ_EPD_BUSY != 0)
1049 | {
1050 | // Serial.println("Busy is H \r\n");
1051 | return 1;
1052 | }
1053 | }
1054 | delay(2);
1055 | // Serial.println("epd is Busy");
1056 | }
1057 | return 0;
1058 | }
1059 | bool EPaperDrive::ReadBusy_long(void)
1060 | {
1061 | unsigned long i = 0;
1062 | for (i = 0; i < 2000; i++)
1063 | {
1064 | // println("isEPD_BUSY = %d\r\n",isEPD_CS);
1065 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
1066 | {
1067 | if (READ_EPD_BUSY == 0)
1068 | {
1069 | // Serial.println("Busy is Low \r\n");
1070 | return 1;
1071 | }
1072 | }
1073 | if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
1074 | {
1075 | if (READ_EPD_BUSY != 0)
1076 | {
1077 | // Serial.println("Busy is H \r\n");
1078 | return 1;
1079 | }
1080 | }
1081 | delay(2);
1082 | // Serial.println("epd is Busy");
1083 | }
1084 | return 0;
1085 | }
1086 | void EPaperDrive::EPD_WriteCMD(uint8_t command)
1087 | {
1088 | /*if(EPD_Type==WX29||EPD_Type==OPM42||EPD_Type==DKE42_3COLOR||EPD_Type==DKE29_3COLOR)
1089 | {
1090 | ReadBusy();
1091 | } */
1092 | // ReadBusy();
1093 | EPD_CS_0;
1094 | EPD_DC_0; // command write
1095 | SPI_Write(command);
1096 | EPD_CS_1;
1097 | }
1098 | void EPaperDrive::EPD_WriteData(uint8_t Data)
1099 | {
1100 |
1101 | EPD_CS_0;
1102 | EPD_DC_1;
1103 | SPI_Write(Data);
1104 | EPD_CS_1;
1105 | }
1106 |
1107 | void EPaperDrive::EPD_WriteCMD_p1(uint8_t command, uint8_t para)
1108 | {
1109 | /*if(EPD_Type==WX29||EPD_Type==OPM42||EPD_Type==DKE42_3COLOR||EPD_Type==DKE29_3COLOR)
1110 | {
1111 | ReadBusy();
1112 | }*/
1113 | // ReadBusy();
1114 | EPD_CS_0;
1115 | EPD_DC_0; // command write
1116 | SPI_Write(command);
1117 | EPD_DC_1; // command write
1118 | SPI_Write(para);
1119 | EPD_CS_1;
1120 | }
1121 |
1122 | void EPaperDrive::deepsleep(void)
1123 | {
1124 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
1125 | {
1126 | ReadBusy_long();
1127 | EPD_WriteCMD_p1(0x10, 0x01);
1128 | // EPD_WriteCMD_p1(0x22,0xc0);//power off
1129 | // EPD_WriteCMD(0x20);
1130 | }
1131 | if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
1132 | {
1133 | ReadBusy_long();
1134 | EPD_WriteCMD(0x50);
1135 | EPD_WriteData(0xf7); // border floating
1136 | EPD_WriteCMD(0x02); // power off
1137 | // ReadBusy();
1138 | EPD_WriteCMD(0x07); // sleep
1139 | EPD_WriteData(0xa5);
1140 | }
1141 | }
1142 |
1143 | void EPaperDrive::EPD_Write(uint8_t *value, uint8_t Datalen)
1144 | {
1145 |
1146 | uint8_t i = 0;
1147 | uint8_t *ptemp;
1148 | ptemp = value;
1149 |
1150 | ReadBusy();
1151 |
1152 | EPD_CS_0;
1153 | EPD_DC_0; // When DC is 0, write command
1154 | SPI_Write(*ptemp); // The first uint8_t is written with the command value
1155 | ptemp++;
1156 | EPD_DC_1; // When DC is 1, write Data
1157 | for (i = 0; i < Datalen - 1; i++)
1158 | { // sub the Data
1159 | SPI_Write(*ptemp);
1160 | ptemp++;
1161 | }
1162 | ReadBusy();
1163 | EPD_CS_1;
1164 | }
1165 |
1166 | void EPaperDrive::EPD_WriteDispRam(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label)
1167 | {
1168 |
1169 | int i = 0, j = 0;
1170 | if (EPD_Type == WF29BZ03)
1171 | {
1172 | EPD_WriteCMD(0x10);
1173 | EPD_CS_0;
1174 | EPD_DC_1;
1175 | /* for(i=0;i<(YSize*2);i++){
1176 | for(j=0;j<(XSize*2);j++){
1177 | SPI_Write(*Dispbuff);
1178 | Dispbuff++;
1179 | }
1180 | } */
1181 | if (label != 1)
1182 | {
1183 | for (i = 0; i < (YSize * 2); i++)
1184 | {
1185 | for (j = 0; j < (XSize * 2); j++)
1186 | {
1187 | SPI_Write(label);
1188 | }
1189 | }
1190 | }
1191 | else
1192 | {
1193 | Dispbuff += offset;
1194 | for (i = 0; i < (YSize * 2); i++)
1195 | {
1196 | for (j = 0; j < (XSize * 2); j++)
1197 | {
1198 | SPI_Write(*Dispbuff);
1199 | Dispbuff++;
1200 | }
1201 | }
1202 | }
1203 | EPD_CS_1;
1204 | return;
1205 | }
1206 |
1207 | /*if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == C154 || EPD_Type == WF42)
1208 | {
1209 | /*EPD_WriteCMD(0x10);
1210 | EPD_CS_0;
1211 | EPD_DC_1;
1212 | for(i=0;i400
1697 | EPD_WriteCMD(0x45);
1698 | EPD_WriteData(0x2B); // RAM y address start at 12Bh
1699 | EPD_WriteData(0x01);
1700 | EPD_WriteData(0x00); // RAM y address end at 00h
1701 | EPD_WriteData(0x00);
1702 | EPD_WriteCMD(0x3C); // board
1703 | EPD_WriteData(0x01); // HIZ
1704 |
1705 | EPD_WriteCMD(0x18);
1706 | EPD_WriteData(0X80);
1707 | EPD_WriteCMD(0x22);
1708 | EPD_WriteData(0XB1); //Load Temperature and waveform setting.
1709 | EPD_WriteCMD(0x20);
1710 | ReadBusy();
1711 |
1712 |
1713 | EPD_WriteCMD(0x4E);
1714 | EPD_WriteData(0x00);
1715 | EPD_WriteCMD(0x4F);
1716 | EPD_WriteData(0x2B);
1717 | EPD_WriteData(0x01);
1718 |
1719 | }*/
1720 | else if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR)
1721 | {
1722 | EPD_WriteCMD(0x74); //
1723 | EPD_WriteData(0x54); //
1724 | EPD_WriteCMD(0x7E); //
1725 | EPD_WriteData(0x3B); //
1726 | EPD_WriteCMD(0x01); //
1727 | EPD_WriteData(0x2B); //
1728 | EPD_WriteData(0x01);
1729 | EPD_WriteData(0x00); //
1730 |
1731 | EPD_WriteCMD(0x0C); //
1732 | EPD_WriteData(0x8B); //
1733 | EPD_WriteData(0x9C); //
1734 | EPD_WriteData(0xD6); //
1735 | EPD_WriteData(0x0F); //
1736 |
1737 | EPD_WriteCMD(0x3A); //
1738 | EPD_WriteData(0x21); //
1739 | EPD_WriteCMD(0x3B); //
1740 | EPD_WriteData(0x06); //
1741 | EPD_WriteCMD(0x3C); //
1742 | EPD_WriteData(0x03); //
1743 |
1744 | EPD_WriteCMD(0x11); // data enter mode
1745 | EPD_WriteData(0x01); // 01 –Y decrement, X increment,
1746 |
1747 | EPD_WriteCMD(0x2C); //
1748 | EPD_WriteData(0x00); // fff
1749 |
1750 | EPD_WriteCMD(0x37); //
1751 | EPD_WriteData(0x00); //
1752 | EPD_WriteData(0x00); //
1753 | EPD_WriteData(0x00); //
1754 | EPD_WriteData(0x00); //
1755 | EPD_WriteData(0x80); //
1756 |
1757 | EPD_WriteCMD(0x21); //
1758 | EPD_WriteData(0x40); //
1759 | EPD_WriteCMD(0x22);
1760 | EPD_WriteData(0xc7); // c5forgraymode//
1761 | }
1762 | else if (EPD_Type == C154)
1763 | {
1764 | EPD_WriteCMD(0x01);
1765 | EPD_WriteData(0x03);
1766 | EPD_WriteData(0x00);
1767 | EPD_WriteData(0x2b);
1768 | EPD_WriteData(0x26);
1769 | EPD_WriteData(0x03);
1770 |
1771 | EPD_WriteCMD(0x06); // boost soft start
1772 | EPD_WriteData(0x17);
1773 | EPD_WriteData(0x17);
1774 | EPD_WriteData(0x17);
1775 | EPD_WriteCMD(0x04);
1776 |
1777 | ReadBusy();
1778 |
1779 | EPD_WriteCMD(0x00); // panel setting
1780 | EPD_WriteData(0xff); // LUT from OTP,160x296
1781 | EPD_WriteData(0x0d); // VCOM to 0V fast
1782 |
1783 | EPD_WriteCMD(0x61); // resolution setting
1784 | EPD_WriteData(0x98); // 152
1785 | EPD_WriteData(0x00); // 152
1786 | EPD_WriteData(0x98);
1787 |
1788 | EPD_WriteCMD(0X30);
1789 | EPD_WriteData(0x29);
1790 |
1791 | EPD_WriteCMD(0X50); // VCOM AND DATA INTERVAL SETTING
1792 | EPD_WriteData(0x97); // WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
1793 | ReadBusy();
1794 | }
1795 | else if (EPD_Type == DKE29_3COLOR)
1796 | {
1797 | ReadBusy();
1798 | EPD_WriteCMD(0x12); // SWRESET
1799 | ReadBusy();
1800 |
1801 | EPD_WriteCMD(0x01); // Driver output control
1802 | EPD_WriteData(0x27);
1803 | EPD_WriteData(0x01);
1804 | EPD_WriteData(0x00);
1805 |
1806 | EPD_WriteCMD(0x11); // data entry mode
1807 | EPD_WriteData(0x01);
1808 |
1809 | EPD_WriteCMD(0x44); // set Ram-X address start/end position
1810 | EPD_WriteData(0x00);
1811 | EPD_WriteData(0x0F); // 0x0F-->(15+1)*8=128
1812 |
1813 | EPD_WriteCMD(0x45); // set Ram-Y address start/end position
1814 | EPD_WriteData(0x27); // 0x0127-->(295+1)=296
1815 | EPD_WriteData(0x01);
1816 | EPD_WriteData(0x00);
1817 | EPD_WriteData(0x00);
1818 |
1819 | EPD_WriteCMD(0x3C); // BorderWavefrom
1820 | EPD_WriteData(0x05);
1821 |
1822 | EPD_WriteCMD(0x18); // Read built-in temperature sensor
1823 | EPD_WriteData(0x80);
1824 |
1825 | EPD_WriteCMD(0x21); // Display update control
1826 | EPD_WriteData(0x00);
1827 | EPD_WriteData(0x80);
1828 |
1829 | EPD_WriteCMD(0x4E); // set RAM x address count to 0;
1830 | EPD_WriteData(0x00);
1831 | EPD_WriteCMD(0x4F); // set RAM y address count to 0X199;
1832 | EPD_WriteData(0x27);
1833 | EPD_WriteData(0x01);
1834 | ReadBusy();
1835 | }
1836 |
1837 | else if (EPD_Type == WFT0290CZ10)
1838 | {
1839 | driver_delay_xms(10);
1840 | EPD_WriteCMD(0x06); // boost soft start
1841 | EPD_WriteData(0x17); // A
1842 | EPD_WriteData(0x17); // B
1843 | EPD_WriteData(0x17); // C
1844 |
1845 | EPD_WriteCMD(0x04); // Power on
1846 | ReadBusy();
1847 |
1848 | EPD_WriteCMD(0x00); // panel setting
1849 | EPD_WriteData(0x97); // LUT from OTP£¬128x296
1850 | // EPD_WriteData(0x0d); //实测这一句话没啥用,可能是兼容IC的锅
1851 |
1852 | EPD_WriteCMD(0x61); // resolution setting
1853 | EPD_WriteData(0x80);
1854 | EPD_WriteData(0x01);
1855 | EPD_WriteData(0x28);
1856 |
1857 | EPD_WriteCMD(0x82); // vcom_DC setting
1858 | EPD_WriteData(0x12);
1859 |
1860 | EPD_WriteCMD(0X50); // VCOM AND DATA INTERVAL SETTING
1861 | EPD_WriteData(0x97);
1862 | }
1863 |
1864 | else if (EPD_Type == GDEY042Z98)
1865 | {
1866 | // Serial.printf("开始全刷初始化 \n");
1867 | driver_delay_xms(10);
1868 | ReadBusy(); //读busy信号
1869 |
1870 | EPD_WriteCMD(0x12); // 软件复位 soft reset
1871 | ReadBusy();
1872 |
1873 | EPD_WriteCMD(0x01); // 驱动输出控制 drive output control
1874 | EPD_WriteData(0x2B); // Y 的低字节
1875 | EPD_WriteData(0x01); // Y 的高字节
1876 | EPD_WriteData(0x00);
1877 |
1878 | EPD_WriteCMD(0x11); // 数据 扫描设置 对数据地址设置有影响 以及对图片取模等也有影响 data entry mode
1879 | EPD_WriteData(0x01); // X模式 x加 y 减 X-mode x+ y-
1880 |
1881 | EPD_WriteCMD(0x44); // X 地址起始位 设置与扫描方式 有关
1882 | EPD_WriteData(0x00);
1883 | EPD_WriteData(0x31);
1884 |
1885 | EPD_WriteCMD(0x45); // Y 地址起始位 设置与扫描方式 有关
1886 | EPD_WriteData(0x2B);
1887 | EPD_WriteData(0x01);
1888 | EPD_WriteData(0x00);
1889 | EPD_WriteData(0x00);
1890 |
1891 | EPD_WriteCMD(0x3C); // Border 设置 黑白一般设置为跟随白波形即 0x01 Border setting
1892 | EPD_WriteData(0x01);
1893 | }
1894 |
1895 | else if (EPD_Type == HINKE0266A15A0)
1896 | {
1897 | driver_delay_xms(10);
1898 | ReadBusy();
1899 |
1900 | EPD_WriteCMD(0x12); // 软件复位 soft reset
1901 | ReadBusy();
1902 |
1903 | EPD_WriteCMD(0x01); // Driver output control
1904 | EPD_WriteData(0x27);
1905 | EPD_WriteData(0x01);
1906 | EPD_WriteData(0x00);
1907 |
1908 | EPD_WriteCMD(0x11); // data entry mode
1909 | EPD_WriteData(0x01);
1910 |
1911 | EPD_WriteCMD(0x44); // set Ram-X address start/end position
1912 | EPD_WriteData(0x00);
1913 | EPD_WriteData(0x12); // 0x0F-->(15+1)*8=128
1914 |
1915 | EPD_WriteCMD(0x45); // set Ram-Y address start/end position
1916 | EPD_WriteData(0x27); // 0x0127-->(295+1)=296
1917 | EPD_WriteData(0x01);
1918 | EPD_WriteData(0x00);
1919 | EPD_WriteData(0x00);
1920 |
1921 | EPD_WriteCMD(0x3C); // BorderWavefrom
1922 | EPD_WriteData(0x05);
1923 |
1924 | /*EPD_WriteCMD(0x18); // Read built-in temperature sensor
1925 | EPD_WriteData(0x80);*/
1926 |
1927 | /*EPD_WriteCMD(0x21); // Display update control
1928 | EPD_WriteData(0x00);
1929 | EPD_WriteData(0x80);*/
1930 |
1931 | EPD_WriteCMD(0x4E); // set RAM x address count to 0;
1932 | EPD_WriteData(0x00);
1933 | EPD_WriteCMD(0x4F); // set RAM y address count to 0X199;
1934 | EPD_WriteData(0x27);
1935 | EPD_WriteData(0x01);
1936 | ReadBusy();
1937 | }
1938 | }
1939 | void EPaperDrive::EPD_Set_Contrast(uint8_t vcom)
1940 | {
1941 | if (EPD_Type == OPM42)
1942 | {
1943 | EPD_WriteCMD(0x2C); //
1944 | EPD_WriteData(vcom); // fff
1945 | }
1946 | }
1947 |
1948 | void EPaperDrive::EPD_Update(void)
1949 | {
1950 | if (EPD_Type == OPM42)
1951 | {
1952 | EPD_WriteCMD(0x20);
1953 | }
1954 | if (EPD_Type == DKE42_3COLOR)
1955 | {
1956 | EPD_WriteCMD(0x22); // Display Update Control
1957 | EPD_WriteData(0xC7);
1958 | EPD_WriteCMD(0x20); // Activate Display Update Sequence
1959 | }
1960 | if (EPD_Type == WX29)
1961 | {
1962 | EPD_WriteCMD_p1(0x22, 0x04);
1963 | EPD_WriteCMD(0x20);
1964 | }
1965 | if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
1966 | {
1967 | EPD_WriteCMD(0x12);
1968 | ReadBusy();
1969 | }
1970 | if (EPD_Type == DKE29_3COLOR)
1971 | {
1972 | EPD_WriteCMD(0x22); // Display Update Control
1973 | EPD_WriteData(0xc7);
1974 | EPD_WriteCMD(0x20); // Activate Display Update Sequence
1975 | ReadBusy();
1976 | }
1977 | else if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
1978 | {
1979 | EPD_WriteCMD(0x22); // Display Update Control
1980 | EPD_WriteData(0xC7);
1981 | EPD_WriteCMD(0x20); // Activate Display Update Sequence
1982 | ReadBusy();
1983 | }
1984 | }
1985 | void EPaperDrive::EPD_Update_Part(void)
1986 | {
1987 | if (EPD_Type == DKE29_3COLOR)
1988 | {
1989 | EPD_WriteCMD(0x22); // Display Update Control
1990 | EPD_WriteData(0xff);
1991 | EPD_WriteCMD(0x20); // Activate Display Update Sequence
1992 | }
1993 | else if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR)
1994 | {
1995 | EPD_WriteCMD(0x20);
1996 | }
1997 | else if (EPD_Type == WX29)
1998 | {
1999 | EPD_WriteCMD_p1(0x22, 0x04);
2000 | EPD_WriteCMD(0x20);
2001 | }
2002 | else if (EPD_Type == WF29 || EPD_Type == WF42)
2003 | {
2004 | EPD_WriteCMD(0x92);
2005 | EPD_WriteCMD(0x12);
2006 | }
2007 | else if (EPD_Type == WFT0290CZ10)
2008 | {
2009 | EPD_WriteCMD(0x91);
2010 | EPD_WriteCMD(0x12);
2011 | // ReadBusy();
2012 | }
2013 | else if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2014 | {
2015 | EPD_WriteCMD(0x22); // Display Update Control
2016 | EPD_WriteData(0xFF);
2017 | EPD_WriteCMD(0x20); // Activate Display Update Sequence
2018 | }
2019 | }
2020 |
2021 | void EPaperDrive::EPD_init_Full(void)
2022 | {
2023 | EPD_Init();
2024 | #ifdef debug
2025 | Serial.println("EPD_Init");
2026 | #endif
2027 |
2028 | if (EPD_Type == WX29)
2029 | {
2030 | EPD_Write((uint8_t *)LUTDefault_full, sizeof(LUTDefault_full));
2031 | }
2032 | else if (EPD_Type == OPM42)
2033 | {
2034 | EPD_Write((uint8_t *)LUTDefault_full_opm42, sizeof(LUTDefault_full_opm42));
2035 | }
2036 |
2037 | else if (EPD_Type == DKE42_3COLOR)
2038 | {
2039 | EPD_Write((uint8_t *)LUTDefault_full_dke42, sizeof(LUTDefault_full_dke42));
2040 | }
2041 | else if (EPD_Type == WF29BZ03)
2042 | {
2043 | EPD_Write((uint8_t *)lut_vcomDC_bz03, sizeof(lut_vcomDC_bz03));
2044 | EPD_Write((uint8_t *)lut_ww_bz03, sizeof(lut_ww_bz03));
2045 | EPD_Write((uint8_t *)lut_bw_bz03, sizeof(lut_bw_bz03));
2046 | EPD_Write((uint8_t *)lut_wb_bz03, sizeof(lut_wb_bz03));
2047 | EPD_Write((uint8_t *)lut_bb_bz03, sizeof(lut_bb_bz03));
2048 | }
2049 | else if (EPD_Type == WF42)
2050 | {
2051 | EPD_Write((uint8_t *)lut_vcomDC, sizeof(lut_vcomDC));
2052 | EPD_Write((uint8_t *)lut_ww, sizeof(lut_ww));
2053 | EPD_Write((uint8_t *)lut_bw, sizeof(lut_bw));
2054 | EPD_Write((uint8_t *)lut_wb, sizeof(lut_wb));
2055 | EPD_Write((uint8_t *)lut_bb, sizeof(lut_bb));
2056 | }
2057 | else if (EPD_Type == WF42)
2058 | {
2059 | EPD_Write((uint8_t *)lut_wf42_vcomDC, sizeof(lut_wf42_vcomDC));
2060 | EPD_Write((uint8_t *)lut_wf42_ww, sizeof(lut_wf42_ww));
2061 | EPD_Write((uint8_t *)lut_wf42_bw, sizeof(lut_wf42_bw));
2062 | EPD_Write((uint8_t *)lut_wf42_wb, sizeof(lut_wf42_wb));
2063 | EPD_Write((uint8_t *)lut_wf42_bb, sizeof(lut_wf42_bb));
2064 | }
2065 | else if (EPD_Type == C154)
2066 | {
2067 | EPD_Write((uint8_t *)lut_vcomDC_154, sizeof(lut_vcomDC_154));
2068 | EPD_Write((uint8_t *)lut_ww_154, sizeof(lut_ww_154));
2069 | EPD_Write((uint8_t *)lut_bw_154, sizeof(lut_bw_154));
2070 | EPD_Write((uint8_t *)lut_wb_154, sizeof(lut_wb_154));
2071 | EPD_Write((uint8_t *)lut_bb_154, sizeof(lut_bb_154));
2072 | }
2073 | else if (EPD_Type == DKE29_3COLOR)
2074 | {
2075 | EPD_Write((uint8_t *)LUTDefault_full_dke29, sizeof(LUTDefault_full_dke29));
2076 | }
2077 |
2078 | else if (EPD_Type == WFT0290CZ10)
2079 | {
2080 | EPD_Write((uint8_t *)lut_vcomDC_WFT0290CZ10, sizeof(lut_vcomDC_WFT0290CZ10));
2081 | EPD_Write((uint8_t *)lut_ww_WFT0290CZ10, sizeof(lut_ww_WFT0290CZ10));
2082 | EPD_Write((uint8_t *)lut_bw_WFT0290CZ10, sizeof(lut_bw_WFT0290CZ10));
2083 | EPD_Write((uint8_t *)lut_wb_WFT0290CZ10, sizeof(lut_wb_WFT0290CZ10));
2084 | EPD_Write((uint8_t *)lut_bb_WFT0290CZ10, sizeof(lut_bb_WFT0290CZ10));
2085 | }
2086 |
2087 | else if (EPD_Type == GDEY042Z98)
2088 | {
2089 | // Serial.printf("即将写入全刷波形 \n");
2090 | EPD_Write((uint8_t *)LUTDefault_full_GDEY042Z98, sizeof(LUTDefault_full_GDEY042Z98));
2091 |
2092 | //EPD_WriteCMD(0x3F);
2093 | //EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 227 + 1));
2094 |
2095 | EPD_WriteCMD(0x03); //门电压 gate voltage
2096 | EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 228 + 1));
2097 |
2098 | EPD_WriteCMD(0x04); //源电压 source voltage
2099 | EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 229 + 1));
2100 | EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 230 + 1));
2101 | EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 231 + 1));
2102 |
2103 | EPD_WriteCMD(0x2C); /// vcom
2104 | EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 232 + 1));
2105 |
2106 | EPD_WriteCMD(0x22);
2107 | EPD_WriteData(0xC0);
2108 | EPD_WriteCMD(0x20);
2109 | }
2110 |
2111 | else if (EPD_Type == HINKE0266A15A0)
2112 | {
2113 | EPD_Write((uint8_t *)LUTDefault_full_HINKE0266A15A0, sizeof(LUTDefault_full_HINKE0266A15A0));
2114 | }
2115 | }
2116 |
2117 | void EPaperDrive::EPD_init_Part(void)
2118 | {
2119 |
2120 | if (EPD_Type == WX29)
2121 | {
2122 | EPD_Init(); // display
2123 | EPD_Write((uint8_t *)LUTDefault_part, sizeof(LUTDefault_part));
2124 | EPD_WriteCMD_p1(0x22, 0xc0); // poweron
2125 | EPD_WriteCMD(0x20);
2126 | }
2127 | else if (EPD_Type == OPM42)
2128 | {
2129 | EPD_Init();
2130 | EPD_WriteCMD(0x21);
2131 | EPD_WriteData(0x00);
2132 | EPD_Write((uint8_t *)LUTDefault_part_opm42, sizeof(LUTDefault_part_opm42));
2133 | }
2134 | else if (EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR)
2135 | {
2136 | EPD_Init();
2137 | EPD_WriteCMD(0x21);
2138 | EPD_WriteData(0x00);
2139 | EPD_Write((uint8_t *)LUTDefault_part_dke42, sizeof(LUTDefault_part_dke42));
2140 | }
2141 | else if (EPD_Type == WF29)
2142 | {
2143 | EPD_Init();
2144 | EPD_WriteCMD(0x50);
2145 | EPD_WriteData(0xb7);
2146 | EPD_Write((uint8_t *)lut_vcomDC1, sizeof(lut_vcomDC1));
2147 | EPD_Write((uint8_t *)lut_ww1, sizeof(lut_ww1));
2148 | EPD_Write((uint8_t *)lut_bw1, sizeof(lut_bw1));
2149 | EPD_Write((uint8_t *)lut_wb1, sizeof(lut_wb1));
2150 | EPD_Write((uint8_t *)lut_bb1, sizeof(lut_bb1));
2151 | }
2152 | else if (EPD_Type == WF42)
2153 | {
2154 | EPD_Init();
2155 | // EPD_WriteCMD(0x50);
2156 | // EPD_WriteData(0xb7);
2157 | EPD_Write((uint8_t *)lut_part_wf42_vcomDC, sizeof(lut_part_wf42_vcomDC));
2158 | EPD_Write((uint8_t *)lut_part_wf42_ww, sizeof(lut_part_wf42_ww));
2159 | EPD_Write((uint8_t *)lut_part_wf42_bw, sizeof(lut_part_wf42_bw));
2160 | EPD_Write((uint8_t *)lut_part_wf42_wb, sizeof(lut_part_wf42_wb));
2161 | EPD_Write((uint8_t *)lut_part_wf42_bb, sizeof(lut_part_wf42_bb));
2162 | }
2163 | else if (EPD_Type == DKE29_3COLOR)
2164 | {
2165 | EPD_Init();
2166 | EPD_WriteCMD(0x21);
2167 | EPD_WriteData(0x00);
2168 | EPD_Write((uint8_t *)LUTDefault_part_dke29, sizeof(LUTDefault_part_dke29));
2169 | }
2170 | else if (EPD_Type == WF29BZ03)
2171 | {
2172 | EPD_Init();
2173 | EPD_Write((uint8_t *)lut_vcomDC_part_bz03, sizeof(lut_vcomDC_part_bz03));
2174 | EPD_Write((uint8_t *)lut_ww_part_bz03, sizeof(lut_ww_part_bz03));
2175 | EPD_Write((uint8_t *)lut_bw_part_bz03, sizeof(lut_bw_part_bz03));
2176 | EPD_Write((uint8_t *)lut_wb_part_bz03, sizeof(lut_wb_part_bz03));
2177 | EPD_Write((uint8_t *)lut_bb_part_bz03, sizeof(lut_wb_part_bz03));
2178 | }
2179 | else if (EPD_Type == WFT0290CZ10)
2180 | {
2181 | // EPD_Init();
2182 | // Serial.println("Will EPD Write");
2183 | EPD_RST_0;
2184 | driver_delay_xms(10);
2185 | EPD_RST_1;
2186 | driver_delay_xms(10);
2187 |
2188 | EPD_WriteCMD(0x01); // POWER SETTING
2189 | EPD_WriteData(0x03);
2190 | EPD_WriteData(0x02);
2191 | EPD_WriteData(0x21);
2192 | EPD_WriteData(0x21);
2193 |
2194 | EPD_WriteCMD(0x06); // boost soft start
2195 | EPD_WriteData(0x17); // A
2196 | EPD_WriteData(0x17); // B
2197 | EPD_WriteData(0x17); // C
2198 |
2199 | EPD_WriteCMD(0x04);
2200 | ReadBusy();
2201 |
2202 | EPD_WriteCMD(0x00); // panel setting
2203 | EPD_WriteData(0xA7); // LUT from OTP£¬128x296
2204 | // EPD_WriteData(0x0d); // VCOM to 0V fast
2205 |
2206 | EPD_WriteCMD(0x30); // PLL setting
2207 | EPD_WriteData(0x3c); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
2208 |
2209 | EPD_WriteCMD(0x61); // resolution setting
2210 | EPD_WriteData(0x80);
2211 | EPD_WriteData(0x01);
2212 | EPD_WriteData(0x28);
2213 |
2214 | EPD_WriteCMD(0x82); // vcom_DC setting
2215 | EPD_WriteData(0x08);
2216 |
2217 | EPD_WriteCMD(0X50);
2218 | EPD_WriteData(0xD7);
2219 | /*EPD_Write((uint8_t *)lut_vcomDC1, sizeof(lut_vcomDC1));
2220 | EPD_Write((uint8_t *)lut_ww1, sizeof(lut_ww1));
2221 | EPD_Write((uint8_t *)lut_bw1, sizeof(lut_bw1));
2222 | EPD_Write((uint8_t *)lut_wb1, sizeof(lut_wb1));
2223 | EPD_Write((uint8_t *)lut_bb1, sizeof(lut_bb1));*/
2224 |
2225 | EPD_Write((uint8_t *)lut_vcomDC_part_WFT0290CZ10, sizeof(lut_vcomDC_part_WFT0290CZ10)); // Serial.println("vcom");
2226 | EPD_Write((uint8_t *)lut_ww_part_WFT0290CZ10, sizeof(lut_ww_part_WFT0290CZ10)); // Serial.println("ww");
2227 | EPD_Write((uint8_t *)lut_bw_part_WFT0290CZ10, sizeof(lut_bw_part_WFT0290CZ10)); // Serial.println("bw");
2228 | EPD_Write((uint8_t *)lut_wb_part_WFT0290CZ10, sizeof(lut_wb_part_WFT0290CZ10)); // Serial.println("wb");
2229 | EPD_Write((uint8_t *)lut_bb_part_WFT0290CZ10, sizeof(lut_bb_part_WFT0290CZ10)); // Serial.println("bb");
2230 | // Serial.println("EPD Write OK");
2231 | }
2232 |
2233 | else if (EPD_Type == GDEY042Z98)
2234 | {
2235 | EPD_Init();
2236 |
2237 | EPD_WriteCMD(0x21);
2238 | EPD_WriteData(0x00);
2239 | EPD_Write((uint8_t *)LUTDefault_part_GDEY042Z98, sizeof(LUTDefault_part_GDEY042Z98));
2240 |
2241 | EPD_WriteCMD(0x3F);
2242 | EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 227 + 1));
2243 |
2244 | EPD_WriteCMD(0x03); //门电压 gate voltage
2245 | EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 228 + 1));
2246 |
2247 | EPD_WriteCMD(0x04); //源电压 source voltage
2248 | EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 229 + 1));
2249 | EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 230 + 1));
2250 | EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 231 + 1));
2251 |
2252 | EPD_WriteCMD(0x2C); /// vcom
2253 | EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 232 + 1));
2254 |
2255 | EPD_WriteCMD(0x22);
2256 | EPD_WriteData(0xC0);
2257 | EPD_WriteCMD(0x20);
2258 |
2259 | ReadBusy();
2260 | }
2261 |
2262 | else if (EPD_Type == HINKE0266A15A0)
2263 | {
2264 | EPD_Init();
2265 |
2266 | EPD_Write((uint8_t *)LUTDefault_part_HINKE0266A15A0, sizeof(LUTDefault_part_HINKE0266A15A0));
2267 |
2268 | /*EPD_WriteCMD(0x37);
2269 | EPD_WriteData(0x00);
2270 | EPD_WriteData(0x00);
2271 | EPD_WriteData(0x00);
2272 | EPD_WriteData(0x00);
2273 | EPD_WriteData(0x40);
2274 | EPD_WriteData(0x00);
2275 | EPD_WriteData(0x00);*/
2276 |
2277 | // EPD_WriteCMD(0x22); // Display Update Control
2278 | // EPD_WriteData(0xC0);
2279 | // EPD_WriteCMD(0x20); // Activate Display Update Sequence
2280 | ReadBusy();
2281 | }
2282 | }
2283 |
2284 | void EPaperDrive::EPD_Transfer_Full_BW(uint8_t *DisBuffer, uint8_t Label)
2285 | {
2286 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == WFT0290CZ10 || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2287 | {
2288 | unsigned int yStart = 0;
2289 | unsigned int yEnd = yDot - 1;
2290 | unsigned int xStart = 0;
2291 | unsigned int xEnd = xDot - 1;
2292 | unsigned long temp = yStart;
2293 |
2294 | yStart = yDot - 1 - yEnd;
2295 | yEnd = yDot - 1 - temp;
2296 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2297 | EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256);
2298 |
2299 | if (Label == 2)
2300 | {
2301 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // white
2302 | }
2303 | else if (Label == 3)
2304 | {
2305 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // black
2306 | }
2307 | else if (Label == 4)
2308 | {
2309 | EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // black
2310 | }
2311 | else
2312 | {
2313 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2314 | }
2315 | // EPD_Update();
2316 | // ReadBusy_long();
2317 | // EPD_WriteDispRam(xDot/8, yDot, (uint8_t *)DisBuffer,0,1);
2318 | }
2319 | else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
2320 | {
2321 | if (Label == 2)
2322 | {
2323 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white
2324 | }
2325 | else if (Label == 3)
2326 | {
2327 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // black
2328 | }
2329 | else if (Label == 4)
2330 | {
2331 | EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // black
2332 | }
2333 | else
2334 | {
2335 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // white
2336 | }
2337 | // EPD_Update();
2338 | }
2339 | }
2340 | void EPaperDrive::EPD_Transfer_Full_RED(uint8_t *DisBuffer, uint8_t Label)
2341 | {
2342 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2343 | {
2344 | unsigned int yStart = 0;
2345 | unsigned int yEnd = yDot - 1;
2346 | unsigned int xStart = 0;
2347 | unsigned int xEnd = xDot - 1;
2348 | unsigned long temp = yStart;
2349 |
2350 | yStart = yDot - 1 - yEnd;
2351 | yEnd = yDot - 1 - temp;
2352 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2353 | EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256);
2354 |
2355 | if (Label == 2)
2356 | {
2357 | EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // white
2358 | }
2359 | else if (Label == 3)
2360 | {
2361 | EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // black
2362 | }
2363 | else
2364 | {
2365 | EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2366 | }
2367 | // EPD_Update();
2368 | // ReadBusy_long();
2369 | // EPD_WriteDispRam_Old(xDot/8, yDot, (uint8_t *)DisBuffer,0,1);
2370 | }
2371 |
2372 | if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
2373 | {
2374 | if (Label == 2)
2375 | {
2376 | EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white
2377 | }
2378 | else if (Label == 3)
2379 | {
2380 | EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // black
2381 | }
2382 | else
2383 | {
2384 | EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // white
2385 | }
2386 | // EPD_Update();
2387 | }
2388 | }
2389 | void EPaperDrive::EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label)
2390 | {
2391 | int nowtime = millis();
2392 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2393 | {
2394 | unsigned int yStart = 0;
2395 | unsigned int yEnd = yDot - 1;
2396 | unsigned int xStart = 0;
2397 | unsigned int xEnd = xDot - 1;
2398 | unsigned long temp = yStart;
2399 |
2400 | yStart = yDot - 1 - yEnd;
2401 | yEnd = yDot - 1 - temp;
2402 |
2403 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2404 | EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256);
2405 |
2406 | if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2407 | {
2408 | EPD_Transfer_Full_RED((uint8_t *)DisBuffer, 2);
2409 | }
2410 |
2411 | if (Label == 2)
2412 | {
2413 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // white
2414 | }
2415 | else if (Label == 3)
2416 | {
2417 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // black
2418 | }
2419 | else
2420 | {
2421 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2422 | }
2423 | nowtime = millis() - nowtime;
2424 | EPD_Update();
2425 | nowtime = millis() - nowtime;
2426 |
2427 | int updatatime = nowtime;
2428 | // Serial.printf("开始全刷 \n");
2429 | ReadBusy_long();
2430 | ReadBusy_long();
2431 | ReadBusy_long();
2432 | ReadBusy_long();
2433 | nowtime = millis() - nowtime;
2434 | // Serial.printf("全刷结束,耗时%dms", nowtime - updatatime);
2435 | if (EPD_Type == DKE29_3COLOR)
2436 | {
2437 | // EPD_Transfer_Full_RED((uint8_t *)EPDbuffer,1);
2438 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2439 | // Serial.printf("即将写入的是全刷的0x26数据 \n");
2440 | // EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2441 | EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2442 | }
2443 | else if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2444 | {
2445 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2446 | EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); //我也不知道啥情况,但是如果你不对这个寄存器写两遍一样的数据局刷无效
2447 | // EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2448 | }
2449 | else
2450 | {
2451 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2452 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2453 | }
2454 | }
2455 |
2456 | else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
2457 | {
2458 | if(EPD_Type == WFT0290CZ10)
2459 | {
2460 | EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff);
2461 | }
2462 | if (Label == 2)
2463 | {
2464 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white
2465 | }
2466 | else if (Label == 3)
2467 | {
2468 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // black
2469 | }
2470 | else
2471 | {
2472 | EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2473 | }
2474 | ReadBusy_long();
2475 | // EPD_WriteDispRam_Old(xDot/8, yDot, (uint8_t *)DisBuffer,0,1);
2476 | EPD_Update();
2477 | /*if(EPD_Type==WF32)
2478 | {
2479 | WiFi.mode(WIFI_OFF);
2480 | wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
2481 | gpio_pin_wakeup_enable(GPIO_ID_PIN(4), GPIO_PIN_INTR_HILEVEL);
2482 | wifi_fpm_open();
2483 | wifi_fpm_do_sleep(0xFFFFFFF); // only 0xFFFFFFF, any other value and it won't disconnect the RTC timer
2484 | delay(10);
2485 | } */
2486 | // ReadBusy_long();
2487 | // ReadBusy_long();
2488 | // ReadBusy_long();
2489 | EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1);
2490 | ReadBusy_long();
2491 | }
2492 | }
2493 |
2494 | void EPaperDrive::EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label)
2495 | {
2496 | // EPD.EPD_Dis_Part(16,87,237,399,(uint8_t *)EPD.EPDbuffer,1);
2497 | if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98)
2498 | {
2499 | int temp1 = xStart, temp2 = xEnd;
2500 | xStart = yStart;
2501 | xEnd = yEnd;
2502 | yEnd = yDot - temp1 - 2;
2503 | yStart = yDot - temp2 - 3;
2504 | }
2505 | unsigned int Xsize = xEnd - xStart;
2506 | unsigned int Ysize = yEnd - yStart + 1;
2507 | if (Xsize % 8 != 0)
2508 | {
2509 | Xsize = Xsize + (8 - Xsize % 8);
2510 | }
2511 | Xsize = Xsize / 8;
2512 | unsigned int offset = yStart * xDot / 8 + xStart / 8;
2513 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2514 | {
2515 | unsigned long temp = yStart;
2516 | yStart = yDot - 1 - yEnd;
2517 | yEnd = yDot - 1 - temp;
2518 |
2519 | EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256);
2520 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2521 | if (Label == 2)
2522 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00);
2523 | else if (Label == 3)
2524 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff);
2525 | else
2526 | EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2527 |
2528 | EPD_Update_Part();
2529 | ReadBusy_long();
2530 | ReadBusy_long();
2531 | if (EPD_Type == DKE29_3COLOR)
2532 | {
2533 | // Serial.printf("即将写入的是局刷的的0x26数据 \n");
2534 | EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2535 | }
2536 | else if (EPD_Type == GDEY042Z98 )
2537 | {
2538 |
2539 | EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2540 | }
2541 |
2542 | else if (EPD_Type == HINKE0266A15A0)
2543 | {
2544 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2545 | EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2546 | }
2547 | else if(EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR)
2548 | {
2549 | EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2550 | }
2551 | else if(EPD_Type == WX29)
2552 | {
2553 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2554 | EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2555 | }
2556 |
2557 | // EPD_WriteDispRam_Old(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1);
2558 | }
2559 |
2560 | else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
2561 | {
2562 |
2563 | EPD_SetRamArea(xStart, xEnd, yStart / 256, yStart % 256, yEnd / 256, yEnd % 256);
2564 | ReadBusy_long();
2565 | // EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer,offset,0x00);
2566 | if (Label == 2)
2567 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff);
2568 | else if (Label == 3)
2569 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00);
2570 | else
2571 | EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2572 |
2573 | EPD_Update_Part();
2574 | ReadBusy();
2575 | ReadBusy();
2576 | ReadBusy();
2577 | EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2578 | ReadBusy();
2579 | }
2580 | }
2581 | void EPaperDrive::EPD_Transfer_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label)
2582 | {
2583 | if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98)
2584 | {
2585 | int temp1 = xStart, temp2 = xEnd;
2586 | xStart = yStart;
2587 | xEnd = yEnd;
2588 | yEnd = yDot - temp1 - 2;
2589 | yStart = yDot - temp2 - 3;
2590 | }
2591 | unsigned int Xsize = xEnd - xStart;
2592 | unsigned int Ysize = yEnd - yStart + 1;
2593 | if (Xsize % 8 != 0)
2594 | {
2595 | Xsize = Xsize + (8 - Xsize % 8);
2596 | }
2597 | Xsize = Xsize / 8;
2598 | unsigned int offset = yStart * xDot / 8 + xStart / 8;
2599 | if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
2600 | {
2601 |
2602 | unsigned long temp = yStart;
2603 | yStart = yDot - 1 - yEnd;
2604 | yEnd = yDot - 1 - temp;
2605 |
2606 | EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256);
2607 | EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
2608 | if (Label == 2)
2609 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00);
2610 | else if (Label == 3)
2611 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff);
2612 | else
2613 | EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2614 | // EPD_Update_Part();
2615 | ReadBusy();
2616 | // EPD_WriteDispRam_Old(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1);
2617 | // ReadBusy();
2618 | // EPD_SetRamArea(xStart,xEnd,yEnd%256,yEnd/256,yStart%256,yStart/256);
2619 | // EPD_SetRamPointer(xStart/8,yEnd%256,yEnd/256);
2620 | // EPD_WriteDispRam(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1);
2621 | }
2622 |
2623 | else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF42 || EPD_Type == WF29BZ03 || EPD_Type == WFT0290CZ10)
2624 | {
2625 |
2626 | EPD_SetRamArea(xStart, xEnd, yStart / 256, yStart % 256, yEnd / 256, yEnd % 256);
2627 | if (Label == 2)
2628 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff);
2629 | else if (Label == 3)
2630 | EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00);
2631 | else
2632 | EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
2633 | // EPD_Update_Part();
2634 | }
2635 | }
2636 |
--------------------------------------------------------------------------------
/src/EPaperDrive.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | //#include "spline.h"
4 |
5 | #include
6 | #include
7 | #if defined(ESP8266)
8 | #include "FS.h"
9 | #else
10 | #if defined(ESP32)
11 | #include "FS.h"
12 | #include
13 | #include
14 | #include
15 | #endif
16 | #endif
17 | #include "WAVEFORM_SETTING_LUT.h"
18 |
19 | extern uint8_t UNICODEbuffer[200];
20 | extern String fontname;
21 |
22 | #define EPD_CS_0 digitalWrite(_CS, LOW)
23 | #define EPD_CS_1 digitalWrite(_CS, HIGH)
24 | #define isEPD_CS digitalRead(_CS)
25 |
26 | #define EPD_RST_0 digitalWrite(_RST, LOW)
27 | #define EPD_RST_1 digitalWrite(_RST, HIGH)
28 | #define isEPD_RST digitalRead(_RST)
29 |
30 | #define EPD_DC_0 digitalWrite(_DC, LOW)
31 | #define EPD_DC_1 digitalWrite(_DC, HIGH)
32 |
33 | #define READ_EPD_BUSY digitalRead(_BUSY)
34 |
35 | #define EPD_CLK_0 digitalWrite(_CLK, LOW)
36 | #define EPD_CLK_1 digitalWrite(_CLK, HIGH)
37 |
38 | #define EPD_DIN_0 digitalWrite(_DIN, LOW)
39 | #define EPD_DIN_1 digitalWrite(_DIN, HIGH)
40 |
41 | enum FONT
42 | {
43 | FONT16 = 0,
44 | FONT32 = 1,
45 | FONT10 = 2,
46 | FONT12 = 3,
47 | FONT70 = 5,
48 | FONT12_NUM = 6,
49 | FONT24 = 7,
50 | FONT8 = 8,
51 | DIGI_NUM_100 = 9,
52 | ICON32 = 13,
53 | ICON80 = 12,
54 | ICON50 = 14,
55 | };
56 | enum epd_type
57 | {
58 | WX29 = 0, // SSD1608
59 | WF29 = 1,
60 | OPM42 = 2, // SSD1619
61 | WF58 = 3,
62 | WF29BZ03 = 4,
63 | C154 = 5,
64 | DKE42_3COLOR = 6, // SSD1619
65 | DKE29_3COLOR = 7, // SSD1680
66 | WF42 = 8,
67 | WF32 = 9,
68 | WFT0290CZ10 = 10, // UC8151C
69 | GDEY042Z98 = 11, // SSD1683
70 | HINKE0266A15A0 = 12, // SSD1675
71 | };
72 |
73 | enum EPDFS
74 | {
75 | littlefs = 0,
76 | spiffs = 1,
77 | fatfs = 2,
78 | };
79 | /*
80 | * 典型使用流程
81 | * 1.EPD_init_Full/EPD_init_Part初始化
82 | * 2.clearbuffer清除缓存图像
83 | * 3.SetFont设置字体
84 | * 4.fontscale=1设置字体缩放
85 | * 5.DrawUTF 绘制文字。图像等
86 | * 6.EPD_DisFull/EPD_Dis_Part更新屏幕图像
87 | * 7.deepsleep睡眠
88 | *
89 | * 屏幕有圆点的角为(0,0)点,x方向为垂直方向,y方向为水平方向
90 | */
91 | class EPaperDrive
92 | {
93 | public:
94 | /**
95 | * @brief 构造函数,初始化软硬SPI及引脚定义
96 | *
97 | * @param SPIMode 选择是硬件SPI还是软件SPI,0为软件,1为硬件(不采用硬件CS)
98 | * @param CS CS脚
99 | * @param RST RST脚
100 | * @param DC DC脚
101 | * @param BUSY BUSY脚
102 | * @param CLK 时钟线,如果是硬件SPI可以不填
103 | * @param DIN 数据线,如果是硬件SPI可以不填
104 | */
105 | EPaperDrive(bool SPIMode, uint8_t CS, uint8_t RST, uint8_t DC, uint8_t BUSY, uint8_t CLK = 127, uint8_t DIN = 127);
106 |
107 | /**
108 | * @brief 构析函数,暂无作用
109 | *
110 | */
111 | ~EPaperDrive();
112 |
113 | /**
114 | * @brief 让墨水屏进入睡眠模式,节省功耗
115 | *
116 | */
117 | void deepsleep(void);
118 |
119 | uint8_t fontscale; ///> 字体缩放,仅支持1,2
120 | uint8_t frame; //用于4灰度屏,fram=0,在2bit中的第一个bit中存储图像,frame=1在第二bit种存储图像
121 | uint8_t EPDbuffer[400 * 300 / 8]; ///>屏幕图像
122 | epd_type EPD_Type;
123 |
124 | /**
125 | * @brief 设置采用什么文件系统
126 | *
127 | * @param userFS 应当传入的文件系统的指针
128 | */
129 | void SetFS(fs::FS* FSType);
130 |
131 | /**
132 | * @brief 设置采用硬件spi的通道(用户请先初始化SPI之后再传入对应SPI的指针)
133 | *
134 | * @param spi 应当传入的SPI的指针
135 | */
136 | void SetHardSPI(SPIClass *spi);
137 |
138 | /**
139 | * @brief 设置墨水屏的型号
140 | *
141 | * @param model 墨水屏的型号,目前支持的在epd_type这个枚举里面
142 | */
143 | void EPD_Set_Model(uint8_t model);
144 |
145 | /**
146 | * @brief 墨水屏全刷的初始化
147 | *
148 | */
149 | void EPD_init_Full(void);
150 |
151 | /**
152 | * @brief 墨水屏局刷的初始化
153 | *
154 | */
155 | void EPD_init_Part(void);
156 |
157 | /**
158 | * @brief 全刷传入的图像
159 | *
160 | * @param DisBuffer 传入的图像缓存指针
161 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑
162 | */
163 | void EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label); // 1正常2全白3全黑
164 |
165 | /**
166 | * @brief 局刷传入的图像
167 | *
168 | * @param xStart 局刷区域x开始的坐标
169 | * @param xEnd 局刷区域x结束的坐标
170 | * @param yStart 局刷区域y开始的坐标
171 | * @param yEnd 局刷区域y结束的坐标
172 | * @param DisBuffer 传入的图像缓存指针
173 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑
174 | */
175 | void EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label);
176 |
177 | /**
178 | * @brief 直接向RAM中写全刷的黑白图片
179 | *
180 | * @param DisBuffer 应当写入的图像缓存指针
181 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑;4为向“OLD”RAM中写全黑
182 | */
183 | void EPD_Transfer_Full_BW(uint8_t *DisBuffer, uint8_t Label);
184 |
185 | /**
186 | * @brief 直接向RAM中写全刷的红色图片
187 | *
188 | * @param DisBuffer 应当写入的图像缓存指针
189 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全红
190 | */
191 | void EPD_Transfer_Full_RED(uint8_t *DisBuffer, uint8_t Label);
192 |
193 | /**
194 | * @brief 直接向RAM中写局刷的图像
195 | *
196 | * @param xStart 局刷区域x开始的坐标
197 | * @param xEnd 局刷区域x结束的坐标
198 | * @param yStart 局刷区域y开始的坐标
199 | * @param yEnd 局刷区域y结束的坐标
200 | * @param DisBuffer 传入的图像缓存指针
201 | * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑
202 | */
203 | void EPD_Transfer_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label);
204 |
205 | /**
206 | * @brief 设置字体样式
207 | *
208 | * @param fontindex 字体样式,目前仅支持FONT枚举里面的
209 | */
210 | void SetFont(FONT fontindex);
211 |
212 | /**
213 | * @brief 在图像缓存中画字符串
214 | *
215 | * @param x 字符串图像开始的x坐标
216 | * @param y 字符串图像开始的y坐标
217 | * @param code 字符串内容
218 | */
219 | void DrawUTF(int16_t x, int16_t y, String code);
220 |
221 | /**
222 | * @brief 在图像缓存中画字符
223 | *
224 | * @param x 开始的x坐标
225 | * @param y 开始的y坐标
226 | * @param width 字符的宽度
227 | * @param height 字符的高度
228 | * @param code 字符的指针
229 | */
230 | void DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code);
231 |
232 | /**
233 | * @brief 在图像缓存中画指定长度的字符串
234 | *
235 | * @param x 开始的x坐标
236 | * @param y 开始的y坐标
237 | * @param width 字符的宽度
238 | * @param height 字符的高度
239 | * @param strlength 字符串的长度
240 | * @param code 字符串指针
241 | */
242 | void DrawUnicodeStr(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t strlength, uint8_t *code);
243 |
244 | /**
245 | * @brief 清除之前所绘的图像缓存
246 | *
247 | */
248 | void clearbuffer();
249 |
250 | /**
251 | * @brief 在图像缓存中画竖线(一个像素)
252 | *
253 | * @param start 线开始的x坐标
254 | * @param end 线结束的x坐标
255 | * @param y 线的y坐标
256 | */
257 | void DrawYline(int start, int end, int y); //画竖线
258 |
259 | /**
260 | * @brief 在图像缓存中画横线(一个像素)
261 | *
262 | * @param start 线开始的y坐标
263 | * @param end 线结束的y坐标
264 | * @param x 线的x坐标
265 | */
266 | void DrawXline(int start, int end, int x); //画横线
267 |
268 | /**
269 | * @brief 在图像缓存中画直线
270 | *
271 | * @param xstart 线开始的x坐标
272 | * @param ystart 线开始的y坐标
273 | * @param xend 线结束的x坐标
274 | * @param yend 线结束的y坐标
275 | */
276 | void DrawLine(int xstart, int ystart, int xend, int yend);
277 |
278 | /**
279 | * @brief 反向一个区域的图像(黑变白,白变黑)
280 | *
281 | * @param xStart 这个区域开始的x坐标
282 | * @param xEnd 这个区域结束的x坐标
283 | * @param yStart 这个区域开始的y坐标
284 | * @param yEnd 这个区域结束的y坐标
285 | */
286 | void Inverse(int xStart, int xEnd, int yStart, int yEnd);
287 |
288 | /**
289 | * @brief 绘制天气温度变化曲线
290 | *
291 | * @param xmin 绘制区域中开始的x坐标
292 | * @param xmax 绘制区域中结束的x坐标
293 | * @param ymin 绘制区域中开始的y坐标
294 | * @param ymax 绘制区域中结束的y坐标
295 | * @param point_n 传入的天气数据的数量
296 | * @param show_n 需要显示的天气数据的数量
297 | * @param tmax 需要显示的这几天每天温度的最大值(如12,13,14,15)
298 | * @param tmin 需要显示的这几天每天温度的最小值(如2,3,4,5)
299 | * @param code_d 需要显示的这几天每天温度最大值的图标对应的字符
300 | * @param code_n 需要显示的这几天每天温度最小值的图标对应的字符
301 | * @param text_d 需要显示的这几天每天温度最大值对应的天气状况
302 | * @param text_n 需要显示的这几天每天温度最小值对应的天气状况
303 | * @param date 我也不知道这是啥,看函数定义里面好像没啥用
304 | * @param week 需要显示的这几天每天是星期几(例如1,2,3,4)
305 | */
306 | void DrawWeatherChart(int xmin, int xmax, int ymin, int ymax, int point_n, int show_n, String tmax, String tmin, String code_d, String code_n, String text_d, String text_n, String date, String week); //绘制天气温度变化曲线
307 |
308 | /**
309 | * @brief 在图像缓存中画圆
310 | *
311 | * @param x 圆心的x坐标
312 | * @param y 圆心的y坐标
313 | * @param r 半径长度
314 | * @param fill 0为空心圆;1为实心圆
315 | */
316 | void DrawCircle(int x, int y, int r, bool fill); //画圆圈,xy圆心,r半径
317 |
318 | /**
319 | * @brief 在图像缓存中画实心矩形
320 | *
321 | * @param x 开始的x坐标
322 | * @param y 开始的y坐标
323 | * @param w 矩形的宽度
324 | * @param h 矩形的高度
325 | */
326 | void DrawBox(uint8_t x, int y, int w, int h); //画矩形,填充
327 |
328 | /**
329 | * @brief 在图像缓存中画空心矩形
330 | *
331 | * @param x 开始的x坐标
332 | * @param y 开始的y坐标
333 | * @param w 矩形的宽度
334 | * @param h 矩形的高度
335 | */
336 | void DrawEmptyBox(int x, int y, int w, int h); //画矩形,空心
337 |
338 | /**
339 | * @brief 在图像缓存中画水平方向的柱状图(显示空气质量数据的,不建议使用)
340 | *
341 | * @param x 开始的x坐标
342 | * @param y 开始的y坐标
343 | * @param w 图表的宽度
344 | * @param c1 第1个数据
345 | * @param c2 第2个数据
346 | * @param c3 第3个数据
347 | * @param c4 第4个数据
348 | * @param c5 第5个数据
349 | * @param c6 第6个数据
350 | */
351 | void DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6); //画水平方向的柱状图,w图表宽度,c1-C6变量
352 |
353 | /**
354 | * @brief 在图像缓存中画圆环图表(显示空气质量数据的,不建议使用)
355 | *
356 | * @param x 开始的x坐标
357 | * @param y 开始的y坐标
358 | * @param r 圆环的半径
359 | * @param w 圆环的宽度
360 | * @param c1 第1个数据
361 | * @param c2 第2个数据
362 | * @param c3 第3个数据
363 | */
364 | void DrawCircleChart(int x, int y, int r, int w, int c1, int c2, int c3); //画圆环图表,r半径,w圆环宽,c1-c3变量
365 |
366 | /**
367 | * @brief 在图像缓存中绘制图像
368 | *
369 | * @param xMove 开始的x坐标
370 | * @param yMove 开始的y坐标
371 | * @param width 图像的宽度
372 | * @param height 图像的高度
373 | * @param xbm 图像的指针
374 | */
375 | void drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t *xbm); //绘制图像
376 |
377 | /**
378 | * @brief 在图像缓存中画以PROGMEM类型储存图片
379 | *
380 | * @param xMove 开始的x坐标
381 | * @param yMove 开始的y坐标
382 | * @param width 图像的宽度
383 | * @param height 图像的高度
384 | * @param xbm 图像的指针
385 | */
386 | void DrawXbm_P(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm);
387 |
388 | /**
389 | * @brief 在图像缓存中画以PROGMEM类型储存的灰度图片
390 | *
391 | * @param xMove 开始的x坐标
392 | * @param yMove 开始的y坐标
393 | * @param width 图像的宽度
394 | * @param height 图像的高度
395 | * @param xbm 图像的指针
396 | * @param level 灰度的等级
397 | */
398 | void DrawXbm_p_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm, uint8_t level);
399 |
400 | /**
401 | * @brief 在图像缓存中画以文件系统储存的灰度图片
402 | *
403 | * @param xMove 开始的x坐标
404 | * @param yMove 开始的y坐标
405 | * @param width 图像的宽度
406 | * @param height 图像的高度
407 | * @param level 灰度的等级
408 | */
409 | void DrawXbm_spiff_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t level);
410 |
411 | /**
412 | * @brief 设置vcom(仅有OPM42这块屏需要在意,别的屏幕不用管)
413 | *
414 | * @param vcom vcom的等级
415 | */
416 | void EPD_Set_Contrast(uint8_t vcom);
417 |
418 | /**
419 | * @brief 墨水屏全刷更新
420 | *
421 | */
422 | void EPD_Update(void);
423 |
424 | /**
425 | * @brief 墨水屏局刷更新
426 | *
427 | */
428 | void EPD_Update_Part(void);
429 |
430 | /**
431 | * @brief 等待BUSY信号变为空闲(最大200ms超时)
432 | *
433 | * @return bool 1代表成功,0代表超时
434 | */
435 | bool ReadBusy(void);
436 |
437 | /**
438 | * @brief 等待BUSY信号变为空闲(最大2000ms超时)
439 | *
440 | * @return bool 1代表成功,0代表超时
441 | */
442 | bool ReadBusy_long(void);
443 |
444 | /**
445 | * @brief 向墨水屏驱动芯片写入命令
446 | *
447 | * @param command 命令的值
448 | */
449 | void EPD_WriteCMD(uint8_t command);
450 |
451 | /**
452 | * @brief 向墨水屏驱动芯片写入数据
453 | *
454 | * @param data 数据的值
455 | */
456 | void EPD_WriteData(uint8_t data);
457 |
458 | /**
459 | * @brief 向墨水屏驱动芯片中写命令和数据(第一个字节为命令,剩下的均为数据)
460 | *
461 | * @param value 要写的所有字节的指针
462 | * @param datalen 要写的所有字节的长度
463 | */
464 | void EPD_Write(uint8_t *value, uint8_t datalen);
465 |
466 | void EPD_WriteDispRam_Old(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
467 | void EPD_WriteDispRam(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
468 | void EPD_SetRamPointer(uint16_t addrX, uint8_t addrY, uint8_t addrY1);
469 |
470 |
471 | private:
472 | uint8_t _CS;
473 | uint8_t _RST;
474 | uint8_t _DC;
475 | uint8_t _BUSY;
476 | uint8_t _CLK;
477 | uint8_t _DIN;
478 | bool _SPIMode;
479 |
480 | fs::FS *UserFS;
481 |
482 |
483 | SPIClass *MySPI;
484 |
485 | uint8_t FontIndex;
486 |
487 | int xDot;
488 | int yDot;
489 | int16_t CurrentCursor;
490 | uint8_t fontwidth;
491 | uint8_t fontheight;
492 |
493 | void SPI_Write(uint8_t value);
494 | void driver_delay_xms(unsigned long xms);
495 |
496 | void EPD_WriteDispRam_RED(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
497 | // void EPD_SetRamArea(uint16_t Xstart,uint16_t Xend,uint8_t Ystart,uint8_t Ystart1,uint8_t Yend,uint8_t Yend1);
498 |
499 | void EPD_WirteLUT(uint8_t *LUTvalue, uint8_t Size);
500 |
501 | void EPD_Init(void);
502 | void EPD_WriteCMD_p1(uint8_t command, uint8_t para);
503 |
504 | void EPD_SetRamArea(uint16_t Xstart, uint16_t Xend, uint8_t Ystart, uint8_t Ystart1, uint8_t Yend, uint8_t Yend1);
505 |
506 | int getIcon(int weathercodeindex);
507 | void SetPixel(int16_t x, int16_t y);
508 | void InversePixel(int16_t x, int16_t y);
509 | void DrawUTF(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code);
510 | int UTFtoUNICODE(uint8_t *code);
511 |
512 |
513 | };
514 |
--------------------------------------------------------------------------------
/src/WAVEFORM_SETTING_LUT.h:
--------------------------------------------------------------------------------
1 | static const uint8_t GDVol[] = {0x03,0x00}; // Gate voltage +15V/-15V
2 | static uint8_t GDOControl[]={0x01,39,1,0x00}; //for 1.54inch
3 | static uint8_t softstart[]={0x0c,0xd7,0xd6,0x9d};
4 | static uint8_t Rambypass[] = {0x21,0x8f}; // Display update
5 | static uint8_t MAsequency[] = {0x22,0xf0}; // clock
6 | static uint8_t SDVol[] = {0x04,0x0a}; // Source voltage +15V/-15V
7 | static uint8_t VCOMVol[] = {0x2c,0xa8}; // VCOM 7c 0xa8
8 | static uint8_t GateVol[]={0x03,0xea};
9 |
10 | static uint8_t BOOSTERFB[] = {0xf0,0x1f}; // Source voltage +15V/-15V
11 | static uint8_t DummyLine[] = {0x3a,0x01}; // 4 dummy line per gate
12 | static uint8_t Gatetime[] = {0x3b,B1000}; // 2us per line
13 | static uint8_t BorderWavefrom[] = {0x3c,0x63}; // Border
14 | static uint8_t RamDataEntryMode[] = {0x11,0x01}; // Ram data entry mode
15 | static const uint8_t LUTDefault_part[31] = {
16 | 0x32, // command
17 | 0x10,0x18,0x18,0x08,0x18,0x18,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
18 | 0x13,0x14,0x44,0x12,0x00,0x00,0x00,0x00,0x00,0x00,
19 | /* 10 wb 01 bw
20 | * 10 H REPEAT 3
21 | * 10 H 01 L REPEAT 1
22 | * 10 H 01 L REPEAT 4
23 | * 01 L REPEAT 1
24 | * 10 H 01 L REPEAT 4
25 | * 10 H 01 L REPEAT 4
26 | * 01 L REPEAT 2
27 |
28 |
29 | */
30 | };
31 | static const uint8_t LUTDefault_full[31] = {
32 | 0x32, // command
33 | 0x02,0x02,0x01,0x11,0x12,0x12,0x22,0x22,0x66,0x69,0x69,0x59,0x58,0x99,0x99,0x88,0x00,0x00,0x00,
34 | 0x00,0xF8,0xB4,0x13,0x51,0x35,0x51,0x51,0x19,0x01,0x00,
35 | };
36 | ////////////
37 |
38 |
39 | const uint8_t lut_vcomDC_154[] ={
40 | 0x20,
41 | 0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
42 | 0x60 ,0x13 ,0x14 ,0x00 ,0x00 ,0x05,
43 | 0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
44 | 0x00 ,0x24 ,0x24 ,0x00 ,0x00 ,0x00,
45 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
46 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
47 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
48 | ,0x00 ,0x00, };
49 | const uint8_t lut_ww_154[] ={
50 | 0x21,
51 | //
52 | 0x40 ,0x16 ,0x00 ,0x00 ,0x00 ,0x01,
53 | 0x90 ,0x13 ,0x14 ,0x00 ,0x00 ,0x05,
54 | 0x40 ,0x02 ,0x00 ,0x00 ,0x00 ,0x01,
55 | 0xA0 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
56 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
57 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
58 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
59 | const uint8_t lut_wb_154[] ={
60 | 0x23,
61 | 0x80 ,0x02 ,0x00 ,0x00 ,0x00 ,0x01,
62 | 0x90 ,0x13 ,0x14 ,0x00 ,0x00 ,0x05,
63 | 0x80 ,0x02 ,0x00 ,0x00 ,0x00 ,0x01,
64 | 0x50 ,0x24 ,0x24 ,0x00 ,0x00 ,0x05,
65 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
66 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
67 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
68 |
69 | const uint8_t lut_bw_154[] ={
70 | 0x22,
71 | 0x40 ,0x17 ,0x00 ,0x00 ,0x00 ,0x02 ,
72 | 0x90 ,0x0F ,0x0F ,0x00 ,0x00 ,0x03 ,
73 | 0x40 ,0x0A ,0x01 ,0x00 ,0x00 ,0x01 ,
74 | 0xA0 ,0x0E ,0x0E ,0x00 ,0x00 ,0x02 ,
75 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
76 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
77 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , };
78 |
79 | const uint8_t lut_bb_154[] ={
80 | 0x24,
81 | 0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
82 | 0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
83 | 0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
84 | 0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
85 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
86 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
87 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
88 |
89 | static const uint8_t LUTDefault_part_opm42[] = {
90 | /*
91 | 0x08,0x48,0x40,0x00,0x00,0x00,0x00,//L0 B low-high-low-high
92 | 0x20,0x12,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low
93 | 0x48,0x48,0x40,0x00,0x00,0x00,0x00,
94 | 0x48,0x48,0x00,0x00,0x00,0x00,0x00,
95 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
96 | 0x0c,0x08,0x0c,0x01,0x00,
97 | 0x0c,0x10,0x0c,0x08,0x00,
98 | 0x0c,0x01,0x00,0x00,0x00,
99 | 0x00,0x00,0x00,0x00,0x00,
100 | 0x00,0x00,0x00,0x00,0x00,
101 | 0x00,0x00,0x00,0x00,0x00,
102 | 0x00,0x00,0x00,0x00,0x00,
103 | */
104 | 0x32, // command
105 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L0 BB R0 B/W 0
106 | 0x82,0x00,0x00,0x00,0x00,0x00,0x00, //L1 BW R0 B/W 1
107 | 0x50,0x00,0x00,0x00,0x00,0x00,0x00, //L2 WB R1 B/W 0
108 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 WW R0 W/W 0
109 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM
110 | //b1w1 b2 w2
111 | 0x08,0x08,0x00,0x08,0x01,
112 | 0x00,0x00,0x00,0x00,0x01,
113 | 0x00,0x00,0x00,0x00,0x00,
114 | 0x00,0x00,0x00,0x00,0x00,
115 | 0x00,0x00,0x00,0x00,0x00,
116 | 0x00,0x00,0x00,0x00,0x00,
117 | 0x00,0x00,0x00,0x00,0x00,
118 |
119 |
120 | };
121 | static const uint8_t LUTDefault_full_opm42[] = {
122 | 0x32, // command
123 | /*
124 | 0x08,0x48,0x40,0x00,0x00,0x00,0x00,//L0 B low-high-low-high
125 | 0x08,0x48,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low
126 | 0x48,0x48,0x40,0x00,0x00,0x00,0x00,
127 | 0x48,0x48,0x00,0x00,0x00,0x00,0x00,
128 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
129 | 0x0F,0x01,0x0F,0x01,0x00,
130 | 0x0F,0x01,0x0F,0x01,0x00,
131 | 0x0F,0x01,0x00,0x00,0x00,
132 | 0x00,0x00,0x00,0x00,0x00,
133 | 0x00,0x00,0x00,0x00,0x00,
134 | 0x00,0x00,0x00,0x00,0x00,
135 | 0x00,0x00,0x00,0x00,0x00,
136 | */
137 | /*
138 | black
139 | 0x08 vsl repeat f
140 | 0x48 vsh1 repeat f vsl repeat f
141 | 0x40 vshl repeat f
142 |
143 | white
144 | 0x08 vsl repeat f
145 | 0x48 vsh1 repeat f vsl repeat f
146 | */
147 |
148 |
149 | 0x08,0x00,0x48,0x40,0x00,0x00,0x00,//L0 B low-high-low-high
150 | 0x20,0x00,0x12,0x20,0x00,0x00,0x00,//L1 W low-high-low
151 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
152 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
153 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
154 | // w1白 b1白
155 | 0x05,0x20,0x20,0x05,0x00,
156 | //wait
157 | 0x0f,0x00,0x00,0x00,0x00,
158 | //b2黑 w2黑 b3白 w3白
159 | 0x20,0x40,0x20,0x20,0x00,
160 | //b4黑 w4白
161 | 0x20,0x00,0x00,0x00,0x00,
162 | //
163 |
164 | 0x05,0x00,0x00,0x00,0x01,
165 | 0x00,0x00,0x00,0x00,0x00,
166 | 0x00,0x00,0x00,0x00,0x00, };
167 | static const uint8_t LUTDefault_part_dke42[] = {
168 |
169 | 0x32, // command
170 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L0 BB R0 B/W 0
171 | 0x82,0x00,0x00,0x00,0x00,0x00,0x00, //L1 BW R0 B/W 1
172 | 0x50,0x00,0x00,0x00,0x00,0x00,0x00, //L2 WB R1 B/W 0
173 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 WW R0 W/W 0
174 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM
175 | //b1w1 b2 w2
176 | 0x20,0x00,0x00,0x05,0x01,
177 | 0x00,0x00,0x00,0x00,0x00,
178 | 0x00,0x00,0x00,0x00,0x00,
179 | 0x00,0x00,0x00,0x00,0x00,
180 | 0x00,0x00,0x00,0x00,0x00,
181 | 0x00,0x00,0x00,0x00,0x00,
182 | 0x00,0x00,0x00,0x00,0x00,
183 |
184 |
185 | };
186 | static const uint8_t LUTDefault_full_dke42[] = {
187 | 0x32, // command
188 |
189 | 0x08,0x66,0x48,0x40,0x00,0x00,0x00,//L0 B low-high-low-high
190 | 0x20,0x66,0x12,0x20,0x00,0x00,0x00,//L1 W low-high-low
191 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
192 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
193 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
194 | // w1白 b1白
195 | 0x05,0x00,0x00,0x05,0x00,
196 | //wait
197 | 0x06,0x06,0x06,0x06,0x12,
198 | //b2黑 w2黑 b3白 w3白
199 | 0x00,0x00,0x15,0x20,0x00,
200 | //b4黑 w4白
201 | 0x25,0x00,0x00,0x00,0x00,
202 | //
203 |
204 | 0x05,0x00,0x00,0x00,0x01,
205 | 0x00,0x00,0x00,0x00,0x00,
206 | 0x00,0x00,0x00,0x00,0x00, };
207 | static const uint8_t LUT_gray_opm42[]={
208 | 0x32, // command
209 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00, //L0 B low-high-low-high 40
210 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L1 W low-high
211 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L2 R
212 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 R
213 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM
214 | 0x03,0x00,0x00,0x00,0x00,//[36]
215 | 0x00,0x00,0x00,0x00,0x00,
216 | 0x00,0x00,0x00,0x00,0x00,
217 | 0x00,0x00,0x00,0x00,0x00,
218 | 0x00,0x00,0x00,0x00,0x00,
219 | 0x00,0x00,0x00,0x00,0x00,
220 | 0x00,0x00,0x00,0x00,0x00,
221 | };
222 | static const uint8_t LUT_gray_red_opm42[]={
223 | 0x32, // command
224 | 0xc0,0x80,0x00,0x00,0x00,0x00,0x00, //L0 B low-high-low-high 40
225 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L1 W low-high
226 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L2 R
227 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 R
228 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM
229 | 0x20,0x01,0x00,0x00,0x00,//[36]
230 | 0x00,0x00,0x00,0x00,0x00,
231 | 0x00,0x00,0x00,0x00,0x00,
232 | 0x00,0x00,0x00,0x00,0x00,
233 | 0x00,0x00,0x00,0x00,0x00,
234 | 0x00,0x00,0x00,0x00,0x00,
235 | 0x00,0x00,0x00,0x00,0x00,
236 | };
237 | static const uint8_t LUTDefault_full_dke29[] = {
238 | 0x32, // command
239 | 0x08,0x00,0x48,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L0 B low-high-low-high
240 | 0x20,0x00,0x12,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low
241 | 0x08,0x00,0x48,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L0 B low-high-low-high
242 | 0x20,0x00,0x12,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low
243 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
244 | // w1白 b1白
245 | 0x00,0x40,0x00,0x40,0x00,0x00,0x00,
246 | //wait
247 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
248 | //b2黑 w2黑 b3白 w3白
249 | 0x40,0x40,0x00,0x40,0x40,0x00,0x00,
250 | //b4黑 w4白
251 | 0x40,0x05,0x00,0x00,0x00,0x00,0x00,
252 | //
253 |
254 | 0x05,0x00,0x00,0x00,0x01,0x00,0x00,
255 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
256 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
257 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
258 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
259 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
260 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
261 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
262 | 0xff,
263 | 0xff,
264 | 0xff,
265 | 0xff,
266 | 0xff,
267 | 0xff,
268 |
269 | 0x00,
270 | 0x00,
271 | 0x00,
272 |
273 | 0x00,
274 |
275 | };
276 | static const uint8_t LUTDefault_part_dke29[] = {
277 | 0x32, // command
278 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L0 B low-high-low-high
279 | 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low
280 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
281 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
282 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
283 | // b1w1 b2 w2
284 | 0x80,0x00,0x00,0x00,0x00,0x00,0x00,
285 | //wait
286 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
287 | //b2黑 w2黑 b3白 w3白
288 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
289 | //b4黑 w4白
290 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
291 | //
292 |
293 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
294 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
295 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
296 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
297 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
298 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
299 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
300 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
301 | 0xff,
302 | 0xff,
303 | 0xff,
304 | 0xff,
305 | 0xff,
306 | 0xff,
307 |
308 | 0x00,
309 | 0x00,
310 | 0x00,
311 |
312 | 0x00,
313 |
314 | };
315 | const uint8_t lut_wf42_vcomDC[] ={
316 | 0x20,
317 | 0x00, 0x17, 0x00, 0x00, 0x00, 0x02,
318 | 0x00, 0x17, 0x17, 0x00, 0x00, 0x02,
319 | 0x00, 0x0A, 0x01, 0x00, 0x00, 0x01,
320 | 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02,
321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324 | 0x00, 0x00,
325 | /*0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332 | 0x00, 0x00, */
333 |
334 |
335 | };
336 | const uint8_t lut_wf42_ww[] ={
337 | 0x21,
338 | 0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
339 | 0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
340 | 0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
341 | 0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
345 | const uint8_t lut_wf42_bw[] ={
346 | 0x22,
347 | 0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
348 | 0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
349 | 0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
350 | 0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
351 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
354 | const uint8_t lut_wf42_wb[] ={
355 | 0x23,
356 | 0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
357 | 0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
358 | 0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
359 | 0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
360 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
363 | const uint8_t lut_wf42_bb[] ={
364 | 0x24,
365 | 0x80, 0x17, 0x00, 0x00, 0x00, 0x02,
366 | 0x90, 0x17, 0x17, 0x00, 0x00, 0x02,
367 | 0x80, 0x0A, 0x01, 0x00, 0x00, 0x01,
368 | 0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02,
369 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
372 |
373 |
374 |
375 | const uint8_t lut_vcomDC[] ={
376 | 0x20,
377 | 0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
378 | 0x60 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
379 | 0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
380 | 0x00 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
381 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
382 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
383 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
384 | ,0x00 ,0x00, };
385 | const uint8_t lut_ww[] ={
386 | 0x21,
387 | 0x40 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
388 | 0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
389 | 0x40 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
390 | 0xA0 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
391 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
392 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
393 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
394 | const uint8_t lut_bw[] ={
395 | 0x22,
396 | 0x40 ,0x17 ,0x00 ,0x00 ,0x00 ,0x02 ,
397 | 0x90 ,0x0F ,0x0F ,0x00 ,0x00 ,0x03 ,
398 | 0x40 ,0x0A ,0x01 ,0x00 ,0x00 ,0x01 ,
399 | 0xA0 ,0x0E ,0x0E ,0x00 ,0x00 ,0x02 ,
400 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
401 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
402 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , };
403 | const uint8_t lut_wb[] ={
404 | 0x23,
405 | 0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
406 | 0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
407 | 0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
408 | 0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
409 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
410 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
411 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
412 | const uint8_t lut_bb[] ={
413 | 0x24,
414 | 0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02,
415 | 0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01,
416 | 0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
417 | 0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01,
418 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
419 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
420 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
421 |
422 | //////////////////////////////////////partial screen update LUT////////////////////////////////////////////
423 | const uint8_t lut_vcomDC1[] ={
424 | 0x20,
425 | 0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, //GND
426 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
427 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
428 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
429 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
430 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
431 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
432 | ,0x00 ,0x00, };
433 | const uint8_t lut_ww1[] ={
434 | 0x21,
435 | //level0 level 1 level 2 level 3
436 | //frame0
437 | //frame1
438 | //frame2
439 | //frame3
440 | //repeat
441 | //level f0 f1 f2 f3 repeat
442 | 0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
443 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
444 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
445 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
446 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
447 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
448 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,};
449 | const uint8_t lut_bw1[] ={
450 | 0x22,
451 | //level f0 f1 f2 f3 repeat
452 | 0x80 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, //LOW - GND
453 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
454 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
455 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
456 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
457 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
458 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
459 | const uint8_t lut_wb1[] ={
460 | 0x23,
461 | 0x40 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,//HIGH - GND
462 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
463 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
464 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
465 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
466 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
467 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
468 | const uint8_t lut_bb1[] ={
469 | 0x24,
470 | 0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,
471 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
472 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
473 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
474 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
475 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
476 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
477 | //////////////////////////////////////partial screen update LUT////////////////////////////////////////////
478 | const uint8_t lut_part_wf42_vcomDC[] ={
479 | 0x20,
480 | 0x02 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //GND
481 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
482 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
483 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
484 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
485 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
486 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
487 | ,0x00 ,0x00,
488 | /*0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
489 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
491 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
492 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
493 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
494 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
495 | 0x00, 0x00, */
496 | };
497 | const uint8_t lut_part_wf42_ww[] ={
498 | 0x21,
499 | //level0 level 1 level 2 level 3
500 | //frame0
501 | //frame1
502 | //frame2
503 | //frame3
504 | //repeat
505 | //level f0 f1 f2 f3 repeat
506 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
507 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
508 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
509 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
510 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
511 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
512 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,};
513 | const uint8_t lut_part_wf42_bw[] ={
514 | 0x22,
515 | //level f0 f1 f2 f3 repeat
516 | 0x80 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //LOW - GND
517 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
518 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
519 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
520 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
521 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
522 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
523 | const uint8_t lut_part_wf42_wb[] ={
524 | 0x23,
525 | 0x40 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01,//HIGH - GND
526 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
527 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
528 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
529 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
530 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
531 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
532 | const uint8_t lut_part_wf42_bb[] ={
533 | 0x24,
534 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
535 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
536 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
537 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
538 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
539 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
540 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
541 |
542 | const uint8_t lut_vcomDCfast[] ={
543 | 0x20,
544 | 0x01 ,0x01 ,0x02 ,
545 | 0x01 ,0x01 ,0x02 ,
546 | 0x41 ,0x41 ,0x02 ,
547 | 0x41 ,0x41 ,0x02 ,
548 | 0x02 ,0x02 ,0x19 };
549 | const uint8_t lut_wwfast[] ={//w
550 | 0x21,
551 |
552 | 0x81 ,0x81 ,0x02,
553 | 0x81 ,0x81 ,0x02,
554 | 0x81 ,0x81 ,0x02,
555 | 0x81 ,0x81 ,0x02,
556 | 0x82 ,0xc2 ,0x0f,
557 | };
558 | const uint8_t lut_bwfast[] ={//b
559 | 0x22,
560 |
561 | 0x41 ,0x41 ,0x06 ,
562 | 0x41 ,0x41 ,0x02 ,
563 | 0x41 ,0x41 ,0x02 ,
564 | 0x41 ,0x41 ,0x02 ,
565 | 0x42 ,0xc2 ,0x02 ,};
566 |
567 | const uint8_t lut_vcomDC2[] ={
568 | 0x20,
569 | 0x0E ,0x14 ,0x01 ,
570 | 0x0A ,0x06 ,0x04 ,
571 | 0x0A ,0x0A ,0x0F ,
572 | 0x03 ,0x03 ,0x0C ,
573 | 0x06 ,0x0A ,0x00 };
574 | const uint8_t lut_ww2[] ={//w
575 | 0x21,
576 | 0x0E ,0x14 ,0x01,
577 | 0x0A ,0x46 ,0x04 ,
578 | 0x8A ,0x4A ,0x0F ,
579 | 0x83 ,0x43 ,0x0C ,
580 | 0x86 ,0x0A ,0x04};
581 | const uint8_t lut_bw2[] ={//b
582 | 0x22,
583 | 0x0E ,0x14 ,0x01 ,
584 | 0x8A ,0x06 ,0x04 ,
585 | 0x8A ,0x4A ,0x0F ,
586 | 0x83 ,0x43 ,0x0C ,
587 | 0x06 ,0x4A ,0x04};
588 | const uint8_t lut_wb2[] ={
589 | 0x23,
590 | 0x8E ,0x94 ,0x01 ,
591 | 0x8A ,0x06 ,0x04 ,
592 | 0x8A ,0x4A ,0x0F ,
593 | 0x83 ,0x43 ,0x0C ,
594 | 0x06 ,0x0A ,0x04 };
595 | const uint8_t lut_bb2[] ={
596 | 0x24,
597 | 0x8E ,0x94 ,0x01 ,
598 | 0x8A ,0x06 ,0x04 ,
599 | 0x8A ,0x4A ,0x0F ,
600 | 0x83 ,0x43 ,0x0C ,
601 | 0x06 ,0x0A ,0x04 };
602 | /*
603 | const uint8_t lut_vcomDC_bz03[] ={
604 | 0x20,
605 | 0x0E ,0x14 ,0x01 ,
606 | 0x0A ,0x06 ,0x04 ,
607 | 0x0A ,0x0A ,0x0F ,
608 | 0x03 ,0x03 ,0x0C ,
609 | 0x06 ,0x0A ,0x00 };
610 | const uint8_t lut_ww_bz03[] ={//w
611 | 0x21,
612 | 0x0E ,0x14 ,0x01,
613 | 0x0A ,0x46 ,0x04 ,
614 | 0x8A ,0x4A ,0x0F ,
615 | 0x83 ,0x43 ,0x0C ,
616 | 0x86 ,0x0A ,0x04};
617 | const uint8_t lut_bw_bz03[] ={//b
618 | 0x22,
619 | 0x0E ,0x14 ,0x01 ,
620 | 0x8A ,0x06 ,0x04 ,
621 | 0x8A ,0x4A ,0x0F ,
622 | 0x83 ,0x43 ,0x0C ,
623 | 0x06 ,0x4A ,0x04};
624 | const uint8_t lut_wb_bz03[] ={
625 | 0x23,
626 | 0x0E ,0x14 ,0x01 ,
627 | 0x8A ,0x06 ,0x04 ,
628 | 0x8A ,0x4A ,0x0F ,
629 | 0x83 ,0x43 ,0x0C ,
630 | 0x06 ,0x4A ,0x04 };
631 | const uint8_t lut_bb_bz03[] ={
632 | 0x24,
633 | 0x0E ,0x14 ,0x01 ,
634 | 0x8A ,0x06 ,0x04 ,
635 | 0x8A ,0x4A ,0x0F ,
636 | 0x83 ,0x43 ,0x0C ,
637 | 0x06 ,0x4A ,0x04};
638 | */
639 | const uint8_t lut_vcomDC_bz03[] ={
640 | 0x20,
641 | 0x0a ,0x00 ,0x06 ,
642 | 0x0a ,0x00 ,0x06 ,
643 | 0x0a ,0x00 ,0x06 ,
644 | 0x0a ,0x00 ,0x06 ,
645 | 0x00 ,0x00 ,0x00 };
646 | const uint8_t lut_ww_bz03[] ={//w
647 | 0x21,
648 | 0x4a ,0x00 ,0x06,
649 | 0x8a ,0x00 ,0x06 ,
650 | 0x4A ,0x00 ,0x06 ,
651 | 0x8a ,0x00 ,0x06 ,
652 | 0x00 ,0x00 ,0x00};
653 | const uint8_t lut_bw_bz03[] ={//b
654 | 0x22,
655 | 0x8a ,0x00 ,0x06 ,
656 | 0x4A ,0x00 ,0x06 ,
657 | 0x8A ,0x00 ,0x06 ,
658 | 0x4a ,0x00 ,0x06 ,
659 | 0x00 ,0x00 ,0x00};
660 | const uint8_t lut_wb_bz03[] ={
661 | 0x23,
662 | 0x8a ,0x00 ,0x06 ,
663 | 0x4A ,0x00 ,0x06 ,
664 | 0x8A ,0x00 ,0x06 ,
665 | 0x4a ,0x00 ,0x06 ,
666 | 0x00 ,0x00 ,0x00};
667 | const uint8_t lut_bb_bz03[] ={
668 | 0x24,
669 | 0x4a ,0x00 ,0x06,
670 | 0x8a ,0x00 ,0x06 ,
671 | 0x4A ,0x00 ,0x06 ,
672 | 0x8a ,0x00 ,0x06 ,
673 | 0x00 ,0x00 ,0x00};
674 |
675 | const uint8_t lut_vcomDC_part_bz03[] ={
676 | 0x20,
677 | 0x0a ,0x00 ,0x04 ,
678 | 0x00 ,0x00 ,0x00 ,
679 | 0x00 ,0x00 ,0x00 ,
680 | 0x00 ,0x00 ,0x00 ,
681 | 0x00 ,0x00 ,0x00 };
682 | const uint8_t lut_ww_part_bz03[] ={//w
683 | 0x21,
684 | 0x0a ,0x00 ,0x04,
685 | 0x00 ,0x00 ,0x00 ,
686 | 0x00 ,0x00 ,0x00 ,
687 | 0x00 ,0x00 ,0x00 ,
688 | 0x00 ,0x00 ,0x00 };
689 | const uint8_t lut_bb_part_bz03[] ={//01
690 | 0x22,
691 | 0x0a ,0x00 ,0x04 ,
692 | 0x00 ,0x00 ,0x00 ,
693 | 0x00 ,0x00 ,0x00 ,
694 | 0x00 ,0x00 ,0x00 ,
695 | 0x00 ,0x00 ,0x00 };
696 | const uint8_t lut_bw_part_bz03[] ={//10
697 | 0x23,
698 | 0x4a ,0x00 ,0x12 ,
699 | 0x00 ,0x00 ,0x00 ,
700 | 0x00 ,0x00 ,0x00 ,
701 | 0x00 ,0x00 ,0x00 ,
702 | 0x00 ,0x00 ,0x00 };
703 | const uint8_t lut_wb_part_bz03[] ={//10
704 | 0x24,
705 | 0x8a ,0x00 ,0x12 ,
706 | 0x00 ,0x00 ,0x00 ,
707 | 0x00 ,0x00 ,0x00 ,
708 | 0x00 ,0x00 ,0x00 ,
709 | 0x00 ,0x00 ,0x00};
710 |
711 | const uint8_t lut_vcomDC_WFT0290CZ10[] =
712 | {
713 | 0x20,
714 | 0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
715 | 0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
716 | 0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01,
717 | 0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01,
718 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
719 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
720 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
721 | };
722 | //R21
723 | const uint8_t lut_ww_WFT0290CZ10[]={
724 | 0x21,
725 | 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
726 | 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
727 | 0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
728 | 0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
729 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
730 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
731 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
732 | };
733 | //R22H r
734 | const uint8_t lut_bw_WFT0290CZ10[] ={
735 | 0x22,
736 | 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
737 | 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
738 | 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
739 | 0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01,
740 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
741 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
742 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
743 | };
744 | //R23H w
745 | const uint8_t lut_wb_WFT0290CZ10[] ={
746 | 0x23,
747 | 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
748 | 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
749 | 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
750 | 0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01,
751 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
752 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
753 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
754 | };
755 | //R24H b
756 | const uint8_t lut_bb_WFT0290CZ10[] ={
757 | 0x24,
758 | 0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01,
759 | 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01,
760 | 0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01,
761 | 0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01,
762 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
763 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
764 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
765 | };
766 |
767 | const uint8_t lut_vcomDC_part_WFT0290CZ10[]={
768 | 0x20,
769 | 0x02 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //GND
770 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
771 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
772 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
773 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
774 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
775 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
776 | ,0x00 ,0x00, };
777 | const uint8_t lut_ww_part_WFT0290CZ10[]={
778 | 0x21,
779 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
780 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
781 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
782 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
783 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
784 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
785 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
786 | const uint8_t lut_bw_part_WFT0290CZ10[]={
787 | 0x22,
788 | 0x80 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //LOW - GND
789 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
790 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
791 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
792 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
793 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
794 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
795 | const uint8_t lut_wb_part_WFT0290CZ10[]={
796 | 0x23,
797 | 0x40 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01,//HIGH - GND
798 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
799 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
800 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
801 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
802 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
803 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
804 | const uint8_t lut_bb_part_WFT0290CZ10[]={
805 | 0x24,
806 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
807 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
808 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
809 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
810 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
811 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
812 | 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, };
813 |
814 | const uint8_t LUTDefault_full_GDEY042Z98[] = {
815 | 0x32,
816 | //VCOM
817 | 0x01, 0x23, 0x23, 0x05, 0x3C, 0x02, 0x03,
818 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
819 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
820 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
821 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
822 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
823 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
824 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
825 | //RED
826 | 0x01, 0x63, 0xA3, 0x85, 0xFC, 0x02, 0x03,
827 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
828 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
829 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
830 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
831 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
832 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
833 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
834 | //WHITE
835 | 0x01, 0x63, 0xA3, 0x05, 0x3C, 0x02, 0x03,
836 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
837 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
838 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
839 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
840 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
841 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
842 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
843 | //BLACK
844 | 0x01, 0xA3, 0x63, 0x05, 0x3C, 0x02, 0x03,
845 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
846 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
847 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
848 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
849 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
850 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
851 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
852 |
853 | 0x03, 0x00, 0x00, 0x22, 0x17, 0x41, 0xA8,
854 | 0x32, 0x48,
855 |
856 |
857 | };
858 |
859 | const uint8_t LUTDefault_part_GDEY042Z98[] = {
860 | 0x32,
861 | //VCOM
862 | //0x01, 0x0F, 0x00, 0x00, 0x00, 0x01, 0x00,
863 | 0x01, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00,
864 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
865 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
866 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
867 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
868 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
869 |
870 | //WW
871 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
872 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
873 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
874 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
875 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
876 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
877 |
878 | //BW
879 | 0x01, 0x5E, 0x00, 0x00, 0x00, 0x01, 0x00,
880 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
881 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
882 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
883 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
884 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
885 |
886 | //WB
887 | 0x01, 0x9E, 0x00, 0x00, 0x00, 0x01, 0x00,
888 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
889 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
890 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
891 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
892 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
893 |
894 | //BB
895 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
896 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
897 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
898 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
899 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
900 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
901 |
902 | //Reserve
903 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
904 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
905 |
906 | //Voltage
907 | 0x02, 0x00, 0x00, 0x22, 0x17, 0x41, 0xA8,
908 | 0x32, 0x08,
909 | };
910 |
911 | const uint8_t LUT_gray_GDEY042Z98[] = {
912 | 0x32,
913 | //VCOM
914 | 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
915 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
916 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
917 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
918 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
919 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
920 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
921 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
922 | //RED
923 | 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
924 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
925 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
926 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
927 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
928 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
929 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
930 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
931 | //WHITE
932 | 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
933 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
934 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
935 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
936 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
937 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
938 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
939 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
940 | //BLACK
941 | 0x01, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00,
942 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
943 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
944 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
945 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
946 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
947 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
948 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
949 |
950 | 0x02, 0x00, 0x00, 0x22, 0x17, 0x4B, 0xA8,
951 | 0x32, 0x48,
952 |
953 | };
954 |
955 | const uint8_t LUT_gray_red_GDEY042Z98[] = {
956 | 0x32,
957 | //VCOM
958 | 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00,
959 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
960 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
961 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
962 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
963 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
964 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
965 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
966 | //RED
967 | 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00,
968 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
969 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
970 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
971 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
972 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
973 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
974 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
975 | //WHITE
976 | 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00,
977 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
978 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
979 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
980 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
981 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
982 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
983 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
984 | //BLACK
985 | 0x01, 0xC9, 0x00, 0x00, 0x00, 0x01, 0x00,
986 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
987 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
988 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
989 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
990 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
991 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
992 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
993 |
994 | 0x03, 0x00, 0x00, 0x22, 0x17, 0x4B, 0xA8,
995 | 0x32, 0x48,
996 |
997 | };
998 |
999 | static const uint8_t LUTDefault_full_HINKE0266A15A0[] = {
1000 | 0x32, // command
1001 |
1002 | 0x08,0x66,0x48,0x40,0x00,0x00,0x00,//L0 B low-high-low-high
1003 | 0x20,0x66,0x12,0x20,0x00,0x00,0x00,//L1 W low-high-low
1004 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1005 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1006 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM
1007 | // w1白 b1白
1008 | 0x05,0x00,0x00,0x05,0x00,
1009 | //wait
1010 | 0x06,0x06,0x06,0x06,0x12,
1011 | //b2黑 w2黑 b3白 w3白
1012 | 0x00,0x00,0x15,0x20,0x00,
1013 | //b4黑 w4白
1014 | 0x25,0x00,0x00,0x00,0x00,
1015 | //
1016 |
1017 | 0x05,0x00,0x00,0x00,0x01,
1018 | 0x00,0x00,0x00,0x00,0x00,
1019 | 0x00,0x00,0x00,0x00,0x00,
1020 |
1021 | 0x15,0x41,0xA8,0x32,0x30,0x0A,
1022 | };
1023 |
1024 | static const uint8_t LUTDefault_part_HINKE0266A15A0[] = {
1025 | 0x32,
1026 | 0X00,0x40,0x00,0x00,0x00,0x00,0x00,
1027 | 0X80,0x80,0x00,0x00,0x00,0x00,0x00,
1028 | 0X40,0x40,0x00,0x00,0x00,0x00,0x00,
1029 | 0X00,0x80,0x00,0x00,0x00,0x00,0x00,
1030 | 0X00,0x00,0x00,0x00,0x00,0x00,0x00,
1031 |
1032 | 0x14,0x00,0x00,0x00,0x02,
1033 | 0x04,0x00,0x00,0x00,0x01,
1034 | 0x00,0x00,0x00,0x00,0x00,
1035 | 0x00,0x00,0x00,0x00,0x00,
1036 | 0x00,0x00,0x00,0x00,0x00,
1037 | 0x00,0x00,0x00,0x00,0x00,
1038 | 0x00,0x00,0x00,0x00,0x00,
1039 |
1040 | 0x15,0x41,0xA8,0x32,0x30,0x0A,
1041 | };
--------------------------------------------------------------------------------