Li Weiyi
/
ESP8266BlynkWeatherStation
work.
Diff: U8glib.cpp
- Revision:
- 0:d8f4c441e032
- Child:
- 2:6cd3b0947188
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/U8glib.cpp Fri Jun 10 15:20:20 2016 +0000 @@ -0,0 +1,101 @@ +/* + + U8glib.cpp + + C++ Interface + + Universal 8bit Graphics Library + + Copyright (c) 2011, olikraus@gmail.com + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "U8glib.h" + + +uint8_t U8GLIB::initSPI(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset) +{ + #ifdef U8G_WITH_PINLIST + prepare(); + return u8g_InitSPI(&u8g, dev, sck, mosi, cs, a0, reset); + #else + return 1; + #endif +} + +uint8_t U8GLIB::initHWSPI(u8g_dev_t *dev, uint8_t cs, uint8_t a0, uint8_t reset) +{ + #ifdef U8G_WITH_PINLIST + prepare(); + return u8g_InitHWSPI(&u8g, dev, cs, a0, reset); + #else + return 1; + #endif +} + +uint8_t U8GLIB::initI2C(u8g_dev_t *dev, uint8_t options) +{ + #ifdef U8G_WITH_PINLIST + prepare(); + return u8g_InitI2C(&u8g, dev, options); + #else + return 1; + #endif +} + +uint8_t U8GLIB::init8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, + uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw, uint8_t reset) +{ + #ifdef U8G_WITH_PINLIST + prepare(); + return u8g_Init8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset); + #else + return 1; + #endif +} + +uint8_t U8GLIB::init8BitFixedPort(u8g_dev_t *dev, uint8_t en, uint8_t cs, uint8_t di, uint8_t rw, uint8_t reset) +{ + #ifdef U8G_WITH_PINLIST + prepare(); + return u8g_Init8BitFixedPort(&u8g, dev, en, cs, di, rw, reset); + #else + return 1; + #endif +} + +uint8_t U8GLIB::initRW8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, + uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset) +{ + #ifdef U8G_WITH_PINLIST + prepare(); + return u8g_InitRW8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset); + #else + return 1; + #endif +}