forked from TrampolineRTOS/trampoline
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5aa4cb2
commit 06b9571
Showing
149 changed files
with
125,264 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
# U8glib | ||
|
||
A graphics library with support for many different monochrome displays. | ||
|
||
![nhd_oled180.jpg](https://github.com/olikraus/u8glib/wiki/otherpic/nhd_oled180.jpg) ![dogs102_180.jpg](https://github.com/olikraus/u8glib/wiki/otherpic/dogs102_180.jpg) | ||
|
||
Left: NHD-2.7-12864 OLED (SSD1325), right: EA DOGS102 LCD (UC1701) | ||
|
||
* [Gallery](https://github.com/olikraus/u8glib/wiki/gallery) | ||
* [Bintray](https://bintray.com/olikraus/u8glib) download links: | ||
* [U8glib for Arduino](https://bintray.com/olikraus/u8glib/Arduino) | ||
* [U8glib for AVR](https://bintray.com/olikraus/u8glib/AVR) | ||
* [U8glib for ARM](https://bintray.com/olikraus/u8glib/ARM) | ||
* Converter for BDF fonts: [bdf2u8g_101.exe on google drive](https://drive.google.com/folderview?id=0B5b6Dv0wCeCRLWJkYTh2TUlYVDg&usp=sharing). | ||
* Supported environments: | ||
* [Arduino (ATMEGA and ARM)](http://www.arduino.cc/) | ||
* [AVR (ATMEGA)](https://github.com/olikraus/u8glib/wiki/avr) | ||
* [ARM (with example for LPC1114)](https://github.com/olikraus/u8glib/wiki/lpc1114) | ||
* Library for graphic LCDs and OLEDs | ||
* [U8glib documentation and tutorials](https://github.com/olikraus/u8glib/wiki) | ||
* Graphical user interface library (GUI) available: [M2tklib](http://code.google.com/p/m2tklib/) | ||
* COM interfaces: Software SPI, Hardware SPI, 8Bit parallel | ||
* Large number of [fonts](https://github.com/olikraus/u8glib/wiki/fontsize) | ||
* Monospaced and proportional fonts | ||
* Mouse-Cursor support | ||
* Landscape and portrait mode | ||
* Many supported [devices](https://github.com/olikraus/u8glib/wiki/device) (SSD1325, ST7565, ST7920, UC1608, UC1610, UC1701, PCD8544, PCF8812, KS0108, LC7981, SBN1661, SSD1306, SH1106, T6963, LD7032) | ||
* Well-defined interface to the device subsystem | ||
|
131 changes: 131 additions & 0 deletions
131
machines/avr/arduino/libraries/U8glib/examples/A2Printer/A2Printer.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* | ||
A2Printer.pde | ||
Special example code for the A2 Mciro Printer (https://www.sparkfun.com/products/10438) | ||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/ | ||
Copyright (c) 2013, 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" | ||
|
||
// use this serial interface | ||
#define PRINTER_SERIAL Serial | ||
// #define PRINTER_SERIAL Serial1 | ||
|
||
|
||
uint8_t u8g_com_uart(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { | ||
switch(msg) { | ||
case U8G_COM_MSG_WRITE_BYTE: | ||
PRINTER_SERIAL.write(arg_val); | ||
break; | ||
} | ||
return 1; | ||
} | ||
|
||
// setup u8g object, please remove comment from one of the following constructor calls | ||
|
||
// half resolution | ||
//U8GLIB u8g(&u8g_dev_a2_micro_printer_192x120_ds, (u8g_com_fnptr)u8g_com_uart); | ||
|
||
// full resolution, requires to uncomment U8G_16BIT in u8g.h | ||
//U8GLIB u8g(&u8g_dev_a2_micro_printer_384x240, (u8g_com_fnptr)u8g_com_uart); | ||
|
||
// half resolution, extra log, requires to uncomment U8G_16BIT in u8g.h | ||
//U8GLIB u8g(&u8g_dev_a2_micro_printer_192x360_ds, (u8g_com_fnptr)u8g_com_uart); | ||
U8GLIB u8g(&u8g_dev_a2_micro_printer_192x720_ds, (u8g_com_fnptr)u8g_com_uart); | ||
|
||
|
||
|
||
void drawLogo(uint8_t d) { | ||
u8g.setFont(u8g_font_gdr25r); | ||
u8g.drawStr(0+d, 30+d, "U"); | ||
u8g.setFont(u8g_font_gdr30n); | ||
u8g.drawStr90(23+d,10+d,"8"); | ||
u8g.setFont(u8g_font_gdr25r); | ||
u8g.drawStr(53+d,30+d,"g"); | ||
|
||
u8g.drawHLine(2+d, 35+d, 47); | ||
u8g.drawVLine(45+d, 32+d, 12); | ||
} | ||
|
||
void drawURL(void) { | ||
u8g.setFont(u8g_font_4x6); | ||
if ( u8g.getHeight() < 59 ) { | ||
u8g.drawStr(53,9,"code.google.com"); | ||
u8g.drawStr(77,18,"/p/u8glib"); | ||
} | ||
else { | ||
u8g.drawStr(1,54,"code.google.com/p/u8glib"); | ||
} | ||
} | ||
|
||
void draw(void) { | ||
// graphic commands to redraw the complete screen should be placed here | ||
|
||
drawLogo(0); | ||
drawURL(); | ||
u8g.drawFrame(0,0,u8g.getWidth(), u8g.getHeight()); | ||
|
||
u8g.setFont(u8g_font_helvR24r); | ||
u8g.setPrintPos(0, 100); | ||
u8g.print(u8g.getWidth(), DEC); | ||
u8g.print("x"); | ||
u8g.print(u8g.getHeight(), DEC); | ||
} | ||
|
||
void setup(void) { | ||
PRINTER_SERIAL.begin(19200); | ||
|
||
// flip screen, if required | ||
// u8g.setRot180(); | ||
|
||
// assign default color value | ||
u8g.setColorIndex(1); // pixel on | ||
} | ||
|
||
void loop(void) { | ||
|
||
// picture loop: This will print the picture | ||
u8g.firstPage(); | ||
do { | ||
draw(); | ||
} while( u8g.nextPage() ); | ||
|
||
// send manual CR to the printer | ||
PRINTER_SERIAL.write('\n'); | ||
|
||
// reprint the picture after 10 seconds | ||
delay(10000); | ||
} | ||
|
Oops, something went wrong.