资源简介
在arduino1.8.2(注意,这里的arduino版本需要大于1.6版本)中,用于在OLED 屏幕上显示图像、文字的库函数,功能较为完善。
代码片段和文件信息
/*
U8x8lib.cpp
Arduino specific low level functions
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2016 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 “U8x8lib.h“
#ifdef U8X8_HAVE_HW_SPI
#include
#endif
#ifdef U8X8_HAVE_HW_I2C
#include
#endif
/*=============================================*/
size_t U8X8::write(uint8_t v)
{
if ( v == ‘\n‘ )
{
ty++;
tx=0;
}
else
{
u8x8_DrawGlyph(&u8x8 tx ty v);
tx++;
}
return 1;
}
/*=============================================*/
/* callbacks */
#ifdef U8X8_USE_PINS
extern “C“ uint8_t u8x8_gpio_and_delay_arduino(u8x8_t *u8x8 uint8_t msg uint8_t arg_int U8X8_UNUSED void *arg_ptr)
{
uint8_t i;
switch(msg)
{
case U8X8_MSG_GPIO_AND_DELAY_INIT:
for( i = 0; i < U8X8_PIN_CNT; i++ )
if ( u8x8->pins[i] != U8X8_PIN_NONE )
{
if ( i < U8X8_PIN_OUTPUT_CNT )
{
pinMode(u8x8->pins[i] OUTPUT);
}
else
{
#ifdef INPUT_PULLUP
pinMode(u8x8->pins[i] INPUT_PULLUP);
#else
pinMode(u8x8->pins[i] OUTPUT);
digitalWrite(u8x8->pins[i] 1);
#endif
}
}
break;
#ifndef __AVR__
/* this case is not compiled for any AVR because AVR uC are so slow */
/* that this delay does not matter */
case U8X8_MSG_DELAY_NANO:
delayMicroseconds(arg_int==0?0:1);
break;
#endif
case U8X8_MSG_DELAY_10MICRO:
/* not used at the moment */
break;
case U8X8_MSG_DELAY_100NANO:
/* not used at the moment */
break;
case U8X8_MSG_DELAY_MILLI:
delay(arg_int);
break;
case U8X8_MSG_DELAY_I2C:
/* arg_int is 1 or 4:
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-02-27 11:41 U8g2\
文件 3999 2019-02-27 11:40 U8g2\LICENSE
文件 459 2019-02-27 11:40 U8g2\README.md
目录 0 2019-02-27 11:42 U8g2\examples\
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\FPS\
文件 30256 2019-02-27 11:41 U8g2\examples\full_buffer\FPS\FPS.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\FontUsage\
文件 26306 2019-02-27 11:41 U8g2\examples\full_buffer\FontUsage\FontUsage.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\GraphicsTest\
文件 26960 2019-02-27 11:41 U8g2\examples\full_buffer\GraphicsTest\GraphicsTest.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\HelloWorld\
文件 20914 2019-02-27 11:41 U8g2\examples\full_buffer\HelloWorld\HelloWorld.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\IconMenu\
文件 25797 2019-02-27 11:41 U8g2\examples\full_buffer\IconMenu\IconMenu.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\PrintUTF8\
文件 21116 2019-02-27 11:41 U8g2\examples\full_buffer\PrintUTF8\PrintUTF8.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\SelectionList\
文件 22077 2019-02-27 11:41 U8g2\examples\full_buffer\SelectionList\SelectionList.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\Shennong\
文件 27793 2019-02-27 11:41 U8g2\examples\full_buffer\Shennong\Shennong.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\U8g2Logo\
文件 22207 2019-02-27 11:41 U8g2\examples\full_buffer\U8g2Logo\U8g2Logo.ino
目录 0 2019-02-27 11:41 U8g2\examples\full_buffer\Weather\
文件 25058 2019-02-27 11:41 U8g2\examples\full_buffer\Weather\Weather.ino
目录 0 2019-02-27 11:41 U8g2\examples\games\
目录 0 2019-02-27 11:41 U8g2\examples\games\LittleRookChess\
文件 64990 2019-02-27 11:41 U8g2\examples\games\LittleRookChess\LittleRookChess.ino
目录 0 2019-02-27 11:42 U8g2\examples\page_buffer\
目录 0 2019-02-27 11:41 U8g2\examples\page_buffer\A2Printer\
文件 4624 2019-02-27 11:41 U8g2\examples\page_buffer\A2Printer\A2Printer.ino
............此处省略159个文件信息
- 上一篇:conll-corpors.zip
- 下一篇:博途v15密匙.zip
评论
共有 条评论