| 1 | /* |
| 2 | |
| 3 | u8g2_cleardisplay.c |
| 4 | |
| 5 | Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) |
| 6 | |
| 7 | Copyright (c) 2016, olikraus@gmail.com |
| 8 | All rights reserved. |
| 9 | |
| 10 | Redistribution and use in source and binary forms, with or without modification, |
| 11 | are permitted provided that the following conditions are met: |
| 12 | |
| 13 | * Redistributions of source code must retain the above copyright notice, this list |
| 14 | of conditions and the following disclaimer. |
| 15 | |
| 16 | * Redistributions in binary form must reproduce the above copyright notice, this |
| 17 | list of conditions and the following disclaimer in the documentation and/or other |
| 18 | materials provided with the distribution. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
| 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 23 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 27 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 30 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 32 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 | |
| 34 | */ |
| 35 | #include "u8g2.h" |
| 36 | |
| 37 | /* Clear screen buffer & display reliable for all u8g2 displays. */ |
| 38 | /* This is done with u8g2 picture loop, because we can not use the u8x8 function in all cases */ |
| 39 | void u8g2_ClearDisplay(u8g2_t *u8g2) |
| 40 | { |
| 41 | u8g2_FirstPage(u8g2); |
| 42 | do { |
| 43 | } while ( u8g2_NextPage(u8g2) ); |
| 44 | /* |
| 45 | This function is usually called during startup (u8g2.begin()). |
| 46 | However the user might want to use full buffer mode with clear and |
| 47 | send commands. |
| 48 | This will not work because the current tile row is modified by the picture |
| 49 | loop above. To fix this, reset the tile row to 0, issue #370 |
| 50 | A workaround would be, that the user sets the current tile row to 0 manually. |
| 51 | */ |
| 52 | u8g2_SetBufferCurrTileRow(u8g2, 0); |
| 53 | } |
| 54 | |