├── .gitignore ├── ArduinoAddons └── Arduino_1.5.x │ └── libraries │ └── U8glib │ ├── ChangeLog │ ├── INSTALL │ ├── INSTALL.TXT │ ├── U8glib.cpp │ ├── U8glib.h │ ├── examples │ ├── A2Printer │ │ └── A2Printer.ino │ ├── Bitmap │ │ └── Bitmap.ino │ ├── Chess │ │ └── Chess.ino │ ├── Color │ │ └── Color.ino │ ├── Console │ │ └── Console.ino │ ├── F │ │ └── F.ino │ ├── FPS │ │ └── FPS.ino │ ├── GraphicsTest │ │ └── GraphicsTest.ino │ ├── HelloWorld │ │ └── HelloWorld.ino │ ├── Menu │ │ └── Menu.ino │ ├── PrintTest │ │ └── PrintTest.ino │ ├── Rotation │ │ └── Rotation.ino │ ├── Scale │ │ └── Scale.ino │ ├── TextRotX │ │ └── TextRotX.ino │ ├── Touch4WSetup │ │ └── Touch4WSetup.ino │ ├── Touch4WTest │ │ └── Touch4WTest.ino │ ├── U8gLogo │ │ └── U8gLogo.ino │ └── XBM │ │ └── XBM.ino │ ├── license.txt │ └── utility │ ├── chessengine.c │ ├── u8g.h │ ├── u8g_bitmap.c │ ├── u8g_circle.c │ ├── u8g_clip.c │ ├── u8g_com_api.c │ ├── u8g_com_api_16gr.c │ ├── u8g_com_arduino_attiny85_hw_spi.c │ ├── u8g_com_arduino_common.c │ ├── u8g_com_arduino_fast_parallel.c │ ├── u8g_com_arduino_hw_spi.c │ ├── u8g_com_arduino_hw_usart_spi.c │ ├── u8g_com_arduino_no_en_parallel.c │ ├── u8g_com_arduino_parallel.c │ ├── u8g_com_arduino_port_d_wr.c │ ├── u8g_com_arduino_ssd_i2c.c │ ├── u8g_com_arduino_st7920_custom.c │ ├── u8g_com_arduino_st7920_hw_spi.c │ ├── u8g_com_arduino_st7920_spi.c │ ├── u8g_com_arduino_std_sw_spi.c │ ├── u8g_com_arduino_sw_spi.c │ ├── u8g_com_arduino_t6963.c │ ├── u8g_com_atmega_hw_spi.c │ ├── u8g_com_atmega_parallel.c │ ├── u8g_com_atmega_st7920_hw_spi.c │ ├── u8g_com_atmega_st7920_spi.c │ ├── u8g_com_atmega_sw_spi.c │ ├── u8g_com_i2c.c │ ├── u8g_com_io.c │ ├── u8g_com_null.c │ ├── u8g_cursor.c │ ├── u8g_delay.c │ ├── u8g_dev_a2_micro_printer.c │ ├── u8g_dev_flipdisc_2x7.c │ ├── u8g_dev_gprof.c │ ├── u8g_dev_ht1632.c │ ├── u8g_dev_ili9325d_320x240.c │ ├── u8g_dev_ks0108_128x64.c │ ├── u8g_dev_lc7981_160x80.c │ ├── u8g_dev_lc7981_240x128.c │ ├── u8g_dev_lc7981_240x64.c │ ├── u8g_dev_lc7981_320x64.c │ ├── u8g_dev_ld7032_60x32.c │ ├── u8g_dev_null.c │ ├── u8g_dev_pcd8544_84x48.c │ ├── u8g_dev_pcf8812_96x65.c │ ├── u8g_dev_sbn1661_122x32.c │ ├── u8g_dev_ssd1306_128x32.c │ ├── u8g_dev_ssd1306_128x64.c │ ├── u8g_dev_ssd1309_128x64.c │ ├── u8g_dev_ssd1322_nhd31oled_bw.c │ ├── u8g_dev_ssd1322_nhd31oled_gr.c │ ├── u8g_dev_ssd1325_nhd27oled_bw.c │ ├── u8g_dev_ssd1325_nhd27oled_bw_new.c │ ├── u8g_dev_ssd1325_nhd27oled_gr.c │ ├── u8g_dev_ssd1325_nhd27oled_gr_new.c │ ├── u8g_dev_ssd1327_96x96_gr.c │ ├── u8g_dev_ssd1351_128x128.c │ ├── u8g_dev_st7565_64128n.c │ ├── u8g_dev_st7565_dogm128.c │ ├── u8g_dev_st7565_dogm132.c │ ├── u8g_dev_st7565_lm6059.c │ ├── u8g_dev_st7565_lm6063.c │ ├── u8g_dev_st7565_nhd_c12832.c │ ├── u8g_dev_st7565_nhd_c12864.c │ ├── u8g_dev_st7687_c144mvgd.c │ ├── u8g_dev_st7920_128x64.c │ ├── u8g_dev_st7920_192x32.c │ ├── u8g_dev_st7920_202x32.c │ ├── u8g_dev_t6963_128x128.c │ ├── u8g_dev_t6963_128x64.c │ ├── u8g_dev_t6963_240x128.c │ ├── u8g_dev_t6963_240x64.c │ ├── u8g_dev_tls8204_84x48.c │ ├── u8g_dev_uc1601_c128032.c │ ├── u8g_dev_uc1608_240x128.c │ ├── u8g_dev_uc1608_240x64.c │ ├── u8g_dev_uc1610_dogxl160.c │ ├── u8g_dev_uc1611_dogm240.c │ ├── u8g_dev_uc1611_dogxl240.c │ ├── u8g_dev_uc1701_dogs102.c │ ├── u8g_dev_uc1701_mini12864.c │ ├── u8g_ellipse.c │ ├── u8g_font.c │ ├── u8g_font_data.c │ ├── u8g_line.c │ ├── u8g_ll_api.c │ ├── u8g_page.c │ ├── u8g_pb.c │ ├── u8g_pb14v1.c │ ├── u8g_pb16h1.c │ ├── u8g_pb16h2.c │ ├── u8g_pb16v1.c │ ├── u8g_pb16v2.c │ ├── u8g_pb32h1.c │ ├── u8g_pb8h1.c │ ├── u8g_pb8h1f.c │ ├── u8g_pb8h2.c │ ├── u8g_pb8h8.c │ ├── u8g_pb8v1.c │ ├── u8g_pb8v2.c │ ├── u8g_pbxh16.c │ ├── u8g_pbxh24.c │ ├── u8g_polygon.c │ ├── u8g_rect.c │ ├── u8g_rot.c │ ├── u8g_scale.c │ ├── u8g_state.c │ ├── u8g_u16toa.c │ ├── u8g_u8toa.c │ └── u8g_virtual_screen.c ├── Documentation ├── BedLeveling.md ├── COPYING.md ├── Compilation.md ├── Contributing.md ├── Features.md ├── FilamentSensor.md ├── GCodes.md ├── LCD Menu Tree.pdf ├── LCDLanguageFont.md ├── Logo │ ├── Marlin Logo GitHub.png │ ├── Marlin Logo LCD High.png │ ├── Marlin Logo LCD Low.png │ ├── Marlin Logo.ai │ ├── Marlin Logo.cdr │ ├── Marlin Logo.dxf │ ├── Marlin Logo.pdf │ ├── Marlin Logo.png │ ├── Marlin Logo.svg │ └── marlinwiki.png ├── Menu Plans.xlsx ├── MeshBedLeveling.md ├── RampsServoPower.md └── changelog.md ├── Marlin ├── .cproject ├── .project ├── .settings │ ├── language.settings.xml │ └── org.eclipse.cdt.core.prefs ├── Conditionals.h ├── Configuration.h ├── Configuration_adv.h ├── Default_Version.h ├── HAL.cpp ├── HAL.h ├── M100_Free_Mem_Chk.cpp ├── Makefile-linux ├── Makefile-win ├── Marlin.h ├── Marlin.ino ├── Marlin_main.cpp ├── Release │ ├── .gitignore │ ├── Marlin.bin │ ├── Marlin.elf │ ├── Marlin.map │ ├── arduino.ar │ └── makefile ├── SanityCheck.h ├── Sd2Card.cpp ├── Sd2Card.h ├── Sd2PinMap.h ├── SdBaseFile.cpp ├── SdBaseFile.h ├── SdFatConfig.h ├── SdFatStructs.h ├── SdFile.cpp ├── SdFile.h ├── SdInfo.h ├── SdVolume.cpp ├── SdVolume.h ├── ServoTimers.h ├── blinkm.cpp ├── blinkm.h ├── boards.h ├── buzzer.cpp ├── buzzer.h ├── cardreader.cpp ├── cardreader.h ├── configuration_store.cpp ├── configuration_store.h ├── configurator │ ├── config │ │ ├── Configuration.h │ │ ├── Configuration_adv.h │ │ ├── _htaccess │ │ ├── boards.h │ │ └── language.h │ ├── css │ │ ├── configurator.css │ │ └── logo.png │ ├── index.html │ └── js │ │ ├── FileSaver.min.js │ │ ├── binaryfileuploader.js │ │ ├── binarystring.js │ │ ├── configurator.js │ │ ├── jcanvas.js │ │ ├── jquery-2.1.3.min.js │ │ ├── jstepper.js │ │ └── jszip.min.js ├── digipot_mcp4451.cpp ├── dogm_bitmaps.h ├── dogm_font_data_6x9_marlin.h ├── dogm_font_data_HD44780_C.h ├── dogm_font_data_HD44780_J.h ├── dogm_font_data_HD44780_W.h ├── dogm_font_data_ISO10646_1.h ├── dogm_font_data_ISO10646_5_Cyrillic.h ├── dogm_font_data_ISO10646_CN.h ├── dogm_font_data_ISO10646_Kana.h ├── dogm_font_data_Marlin_symbols.h ├── dogm_lcd_implementation.h ├── example_configurations │ ├── Configuration.h │ ├── Configuration_adv.h │ ├── coreXY_RADDS │ │ ├── Configuration.h │ │ └── Configuration_adv.h │ └── delta │ │ ├── Configuration.h │ │ └── Configuration_adv.h ├── fastio.h ├── fonts │ ├── HD44780_C.fon │ ├── HD44780_J.fon │ ├── HD44780_W.fon │ ├── ISO10646-1.fon │ ├── ISO10646-5_Cyrillic.fon │ ├── ISO10646_Kana.fon │ ├── Marlin_symbols.fon │ ├── README.fonts │ ├── bdf2u8g.exe │ └── make_fonts.bat ├── fsr_sensor.cpp ├── fsr_sensor.h ├── language.h ├── language_an.h ├── language_bg.h ├── language_ca.h ├── language_cn.h ├── language_de.h ├── language_en.h ├── language_es.h ├── language_eu.h ├── language_fi.h ├── language_fr.h ├── language_it.h ├── language_kana.h ├── language_kana_utf8.h ├── language_nl.h ├── language_pl.h ├── language_pt-br.h ├── language_pt.h ├── language_ru.h ├── language_test.h ├── macros.h ├── mesh_bed_leveling.cpp ├── mesh_bed_leveling.h ├── pins.h ├── pins_RADDS.h ├── pins_RAMPS4DUE.h ├── pins_RAMPS_FD.h ├── planner.cpp ├── planner.h ├── qr_solve.cpp ├── qr_solve.h ├── scripts │ ├── createTemperatureLookupMarlin.py │ ├── due_pins.py │ ├── g29_auto.py │ └── parse_variant_for_fastio.py ├── servo.cpp ├── servo.h ├── stepper.cpp ├── stepper.h ├── stepper_indirection.cpp ├── stepper_indirection.h ├── temperature.cpp ├── temperature.h ├── thermistortables.h ├── ultralcd.cpp ├── ultralcd.h ├── ultralcd_implementation_hitachi_HD44780.h ├── ultralcd_st7920_u8glib_rrd.h ├── utf_mapper.h ├── vector_3.cpp ├── vector_3.h ├── watchdog.cpp └── watchdog.h └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | // Our automatic versioning scheme generates the following file 2 | // NEVER put it in the repository 3 | _Version.h 4 | 5 | // All of the following OS, IDE and compiler generated file 6 | // references should be moved from this file 7 | // They are needed, but they belong in your global .gitignore 8 | // rather than in a per-project file such as this 9 | 10 | *.o 11 | applet/ 12 | *~ 13 | *.orig 14 | *.rej 15 | *.bak 16 | *.DS_Store 17 | *.idea 18 | *.cproject 19 | *.project 20 | *.cpp.d 21 | *.c.d 22 | *.mk -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/INSTALL.TXT: -------------------------------------------------------------------------------- 1 | 2 | U8GLIB 3 | http://code.google.com/p/u8glib/ 4 | 5 | Install instructions for the Arduino environment. 6 | 7 | 1. Start Arduino IDE 8 | 2. In the Arduino IDE, import the library from the "Add Library" Menu. 9 | 10 | Alternative install instructions for the Arduino environment. 11 | 12 | 1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder of the 13 | Arduino install directory 14 | 2. Start Arduino IDE 15 | 16 | Install instructions for the Chipkit (Arduino) environment. 17 | 18 | 1. cd /libraries 19 | 2. unzip u8glib_arduino_vX.XX.zip 20 | 3. cd ///hardware/pic32/libraries 21 | 4. again: u8glib_arduino_vX.XX.zip 22 | 5. Open hardware/pic32/cores/pic32/Print.h 23 | Remove line 24 | #define BYTE 0 25 | from the file, use PRINT_BYTE instead of BYTE. 26 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/U8glib.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | U8glib.cpp 4 | 5 | C++ Interface 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | */ 37 | 38 | #include "U8glib.h" 39 | 40 | 41 | 42 | uint8_t U8GLIB::initSPI(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset) 43 | { 44 | prepare(); 45 | return u8g_InitSPI(&u8g, dev, sck, mosi, cs, a0, reset); 46 | } 47 | 48 | uint8_t U8GLIB::initHWSPI(u8g_dev_t *dev, uint8_t cs, uint8_t a0, uint8_t reset) 49 | { 50 | prepare(); 51 | return u8g_InitHWSPI(&u8g, dev, cs, a0, reset); 52 | } 53 | 54 | uint8_t U8GLIB::initI2C(u8g_dev_t *dev, uint8_t options) 55 | { 56 | prepare(); 57 | return u8g_InitI2C(&u8g, dev, options); 58 | } 59 | 60 | 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, 61 | uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw, uint8_t reset) 62 | { 63 | prepare(); 64 | return u8g_Init8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset); 65 | } 66 | 67 | uint8_t U8GLIB::init8BitFixedPort(u8g_dev_t *dev, uint8_t en, uint8_t cs, uint8_t di, uint8_t rw, uint8_t reset) 68 | { 69 | prepare(); 70 | return u8g_Init8BitFixedPort(&u8g, dev, en, cs, di, rw, reset); 71 | } 72 | 73 | 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, 74 | uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset) 75 | { 76 | prepare(); 77 | return u8g_InitRW8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset); 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/examples/A2Printer/A2Printer.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | A2Printer.pde 4 | 5 | Special example code for the A2 Mciro Printer (https://www.sparkfun.com/products/10438) 6 | 7 | 8 | Universal 8bit Graphics Library, http://code.google.com/p/u8glib/ 9 | 10 | Copyright (c) 2013, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | */ 38 | 39 | 40 | #include "U8glib.h" 41 | 42 | // use this serial interface 43 | #define PRINTER_SERIAL Serial 44 | // #define PRINTER_SERIAL Serial1 45 | 46 | 47 | uint8_t u8g_com_uart(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { 48 | switch(msg) { 49 | case U8G_COM_MSG_WRITE_BYTE: 50 | PRINTER_SERIAL.write(arg_val); 51 | break; 52 | } 53 | return 1; 54 | } 55 | 56 | // setup u8g object, please remove comment from one of the following constructor calls 57 | 58 | // half resolution 59 | //U8GLIB u8g(&u8g_dev_a2_micro_printer_192x120_ds, (u8g_com_fnptr)u8g_com_uart); 60 | 61 | // full resolution, requires to uncomment U8G_16BIT in u8g.h 62 | //U8GLIB u8g(&u8g_dev_a2_micro_printer_384x240, (u8g_com_fnptr)u8g_com_uart); 63 | 64 | // half resolution, extra log, requires to uncomment U8G_16BIT in u8g.h 65 | //U8GLIB u8g(&u8g_dev_a2_micro_printer_192x360_ds, (u8g_com_fnptr)u8g_com_uart); 66 | U8GLIB u8g(&u8g_dev_a2_micro_printer_192x720_ds, (u8g_com_fnptr)u8g_com_uart); 67 | 68 | 69 | 70 | void drawLogo(uint8_t d) { 71 | u8g.setFont(u8g_font_gdr25r); 72 | u8g.drawStr(0+d, 30+d, "U"); 73 | u8g.setFont(u8g_font_gdr30n); 74 | u8g.drawStr90(23+d,10+d,"8"); 75 | u8g.setFont(u8g_font_gdr25r); 76 | u8g.drawStr(53+d,30+d,"g"); 77 | 78 | u8g.drawHLine(2+d, 35+d, 47); 79 | u8g.drawVLine(45+d, 32+d, 12); 80 | } 81 | 82 | void drawURL(void) { 83 | u8g.setFont(u8g_font_4x6); 84 | if ( u8g.getHeight() < 59 ) { 85 | u8g.drawStr(53,9,"code.google.com"); 86 | u8g.drawStr(77,18,"/p/u8glib"); 87 | } 88 | else { 89 | u8g.drawStr(1,54,"code.google.com/p/u8glib"); 90 | } 91 | } 92 | 93 | void draw(void) { 94 | // graphic commands to redraw the complete screen should be placed here 95 | 96 | drawLogo(0); 97 | drawURL(); 98 | u8g.drawFrame(0,0,u8g.getWidth(), u8g.getHeight()); 99 | 100 | u8g.setFont(u8g_font_helvR24r); 101 | u8g.setPrintPos(0, 100); 102 | u8g.print(u8g.getWidth(), DEC); 103 | u8g.print("x"); 104 | u8g.print(u8g.getHeight(), DEC); 105 | } 106 | 107 | void setup(void) { 108 | PRINTER_SERIAL.begin(19200); 109 | 110 | // flip screen, if required 111 | // u8g.setRot180(); 112 | 113 | // assign default color value 114 | u8g.setColorIndex(1); // pixel on 115 | } 116 | 117 | void loop(void) { 118 | 119 | // picture loop: This will print the picture 120 | u8g.firstPage(); 121 | do { 122 | draw(); 123 | } while( u8g.nextPage() ); 124 | 125 | // send manual CR to the printer 126 | PRINTER_SERIAL.write('\n'); 127 | 128 | // reprint the picture after 10 seconds 129 | delay(10000); 130 | } 131 | 132 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/license.txt: -------------------------------------------------------------------------------- 1 | 2 | The U8glib code (http://code.google.com/p/u8glib/) is licensed under the terms of 3 | the new-bsd license (two-clause bsd license). 4 | See also: http://www.opensource.org/licenses/bsd-license.php 5 | 6 | The repository and optionally the releases contain icons, which are 7 | derived from the WPZOOM Developer Icon Set: 8 | http://www.wpzoom.com/wpzoom/new-freebie-wpzoom-developer-icon-set-154-free-icons/ 9 | WPZOOM Developer Icon Set by WPZOOM is licensed under a Creative Commons 10 | Attribution-ShareAlike 3.0 Unported License. 11 | 12 | Fonts are licensed under different conditions. 13 | See http://code.google.com/p/u8glib/wiki/fontgroup for 14 | detailed information on the licensing conditions for each font. 15 | 16 | ============ X11 Fonts COUR, HELV, NCEN, TIM, SYMB ============ 17 | 18 | For fonts derived from the following files, the license below applies. 19 | COURB08.BDF COURB10.BDF COURB12.BDF COURB14.BDF COURB18.BDF 20 | COURB24.BDF COURR08.BDF COURR10.BDF COURR12.BDF COURR14.BDF 21 | COURR18.BDF COURR24.BDF HELVB08.BDF HELVB10.BDF HELVB12.BDF HELVB14.BDF 22 | HELVB18.BDF HELVB24.BDF HELVR08.BDF HELVR10.BDF HELVR12.BDF HELVR14.BDF 23 | HELVR18.BDF HELVR24.BDF NCENB08.BDF NCENB10.BDF NCENB12.BDF 24 | NCENB14.BDF NCENB18.BDF NCENB24.BDF NCENR08.BDF NCENR10.BDF 25 | NCENR12.BDF NCENR14.BDF NCENR18.BDF NCENR24.BDF SYMB08.BDF SYMB10.BDF 26 | SYMB12.BDF SYMB14.BDF SYMB18.BDF SYMB24.BDF TIMB08.BDF TIMB10.BDF 27 | TIMB12.BDF TIMB14.BDF TIMB18.BDF TIMB24.BDF TIMR08.BDF TIMR10.BDF 28 | TIMR12.BDF TIMR14.BDF TIMR18.BDF TIMR24.BDF 29 | 30 | Copyright 1984-1989, 1994 Adobe Systems Incorporated. 31 | Copyright 1988, 1994 Digital Equipment Corporation. 32 | 33 | Adobe is a trademark of Adobe Systems Incorporated which may be 34 | registered in certain jurisdictions. 35 | Permission to use these trademarks is hereby granted only in 36 | association with the images described in this file. 37 | 38 | Permission to use, copy, modify, distribute and sell this software 39 | and its documentation for any purpose and without fee is hereby 40 | granted, provided that the above copyright notices appear in all 41 | copies and that both those copyright notices and this permission 42 | notice appear in supporting documentation, and that the names of 43 | Adobe Systems and Digital Equipment Corporation not be used in 44 | advertising or publicity pertaining to distribution of the software 45 | without specific, written prior permission. Adobe Systems and 46 | Digital Equipment Corporation make no representations about the 47 | suitability of this software for any purpose. It is provided "as 48 | is" without express or implied warranty. 49 | 50 | 51 | ============ BSD License for U8glib Code ============ 52 | 53 | Universal 8bit Graphics Library (http://code.google.com/p/u8glib/) 54 | 55 | Copyright (c) 2011, olikraus@gmail.com 56 | All rights reserved. 57 | 58 | Redistribution and use in source and binary forms, with or without modification, 59 | are permitted provided that the following conditions are met: 60 | 61 | * Redistributions of source code must retain the above copyright notice, this list 62 | of conditions and the following disclaimer. 63 | 64 | * Redistributions in binary form must reproduce the above copyright notice, this 65 | list of conditions and the following disclaimer in the documentation and/or other 66 | materials provided with the distribution. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 69 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 70 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 71 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 72 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 73 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 74 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 75 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 76 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 77 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 78 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 79 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 80 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 81 | 82 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/chessengine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/chessengine.c -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_bitmap.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_bitmap.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2011, 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 | */ 36 | 37 | #include "u8g.h" 38 | 39 | void u8g_DrawHBitmap(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, const uint8_t *bitmap) 40 | { 41 | while( cnt > 0 ) 42 | { 43 | u8g_Draw8Pixel(u8g, x, y, 0, *bitmap); 44 | bitmap++; 45 | cnt--; 46 | x+=8; 47 | } 48 | } 49 | 50 | void u8g_DrawBitmap(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, u8g_uint_t h, const uint8_t *bitmap) 51 | { 52 | if ( u8g_IsBBXIntersection(u8g, x, y, cnt*8, h) == 0 ) 53 | return; 54 | while( h > 0 ) 55 | { 56 | u8g_DrawHBitmap(u8g, x, y, cnt, bitmap); 57 | bitmap += cnt; 58 | y++; 59 | h--; 60 | } 61 | } 62 | 63 | 64 | void u8g_DrawHBitmapP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, const u8g_pgm_uint8_t *bitmap) 65 | { 66 | while( cnt > 0 ) 67 | { 68 | u8g_Draw8Pixel(u8g, x, y, 0, u8g_pgm_read(bitmap)); 69 | bitmap++; 70 | cnt--; 71 | x+=8; 72 | } 73 | } 74 | 75 | void u8g_DrawBitmapP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, u8g_uint_t h, const u8g_pgm_uint8_t *bitmap) 76 | { 77 | if ( u8g_IsBBXIntersection(u8g, x, y, cnt*8, h) == 0 ) 78 | return; 79 | while( h > 0 ) 80 | { 81 | u8g_DrawHBitmapP(u8g, x, y, cnt, bitmap); 82 | bitmap += cnt; 83 | y++; 84 | h--; 85 | } 86 | } 87 | 88 | /*=========================================================================*/ 89 | 90 | static void u8g_DrawHXBM(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, const uint8_t *bitmap) 91 | { 92 | uint8_t d; 93 | x+=7; 94 | while( w >= 8 ) 95 | { 96 | u8g_Draw8Pixel(u8g, x, y, 2, *bitmap); 97 | bitmap++; 98 | w-= 8; 99 | x+=8; 100 | } 101 | if ( w > 0 ) 102 | { 103 | d = *bitmap; 104 | x -= 7; 105 | do 106 | { 107 | if ( d & 1 ) 108 | u8g_DrawPixel(u8g, x, y); 109 | x++; 110 | w--; 111 | d >>= 1; 112 | } while ( w > 0 ); 113 | } 114 | } 115 | 116 | void u8g_DrawXBM(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h, const uint8_t *bitmap) 117 | { 118 | u8g_uint_t b; 119 | b = w; 120 | b += 7; 121 | b >>= 3; 122 | 123 | if ( u8g_IsBBXIntersection(u8g, x, y, w, h) == 0 ) 124 | return; 125 | 126 | while( h > 0 ) 127 | { 128 | u8g_DrawHXBM(u8g, x, y, w, bitmap); 129 | bitmap += b; 130 | y++; 131 | h--; 132 | } 133 | } 134 | 135 | static void u8g_DrawHXBMP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, const u8g_pgm_uint8_t *bitmap) 136 | { 137 | uint8_t d; 138 | x+=7; 139 | while( w >= 8 ) 140 | { 141 | u8g_Draw8Pixel(u8g, x, y, 2, u8g_pgm_read(bitmap)); 142 | bitmap++; 143 | w-= 8; 144 | x+=8; 145 | } 146 | if ( w > 0 ) 147 | { 148 | d = u8g_pgm_read(bitmap); 149 | x -= 7; 150 | do 151 | { 152 | if ( d & 1 ) 153 | u8g_DrawPixel(u8g, x, y); 154 | x++; 155 | w--; 156 | d >>= 1; 157 | } while ( w > 0 ); 158 | } 159 | } 160 | 161 | void u8g_DrawXBMP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h, const u8g_pgm_uint8_t *bitmap) 162 | { 163 | u8g_uint_t b; 164 | b = w; 165 | b += 7; 166 | b >>= 3; 167 | 168 | if ( u8g_IsBBXIntersection(u8g, x, y, w, h) == 0 ) 169 | return; 170 | while( h > 0 ) 171 | { 172 | u8g_DrawHXBMP(u8g, x, y, w, bitmap); 173 | bitmap += b; 174 | y++; 175 | h--; 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_clip.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_clip.c 4 | 5 | procedures for clipping 6 | taken over from procs in u8g_pb.c 7 | 8 | Universal 8bit Graphics Library 9 | 10 | Copyright (c) 2012, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | Notes 38 | 39 | This is one of the most critical parts of u8glib. It must be fast, but still reliable. 40 | Based on the intersection program (see tools folder), there is minimized version of 41 | the condition for the intersaction test: 42 | minimized version 43 | ---1----0 1 b1 <= a2 && b1 > b2 44 | -----1--0 1 b2 >= a1 && b1 > b2 45 | ---1-1--- 1 b1 <= a2 && b2 >= a1 46 | It includes the assumption, that a1 <= a2 is always true (correct, because 47 | a1, a2 are the page dimensions. 48 | 49 | The direct implementation of the above result is done in: 50 | uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 51 | However, this is slower than a decision tree version: 52 | static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 53 | Also suprising is, that the macro implementation is slower than the inlined version. 54 | 55 | The decision tree is based on the expansion of the truth table. 56 | 57 | */ 58 | 59 | #include "u8g.h" 60 | 61 | #ifdef __GNUC__ 62 | #define U8G_ALWAYS_INLINE __inline__ __attribute__((always_inline)) 63 | #else 64 | #define U8G_ALWAYS_INLINE 65 | #endif 66 | 67 | /* 68 | intersection assumptions: 69 | a1 <= a2 is always true 70 | 71 | minimized version 72 | ---1----0 1 b1 <= a2 && b1 > b2 73 | -----1--0 1 b2 >= a1 && b1 > b2 74 | ---1-1--- 1 b1 <= a2 && b2 >= a1 75 | */ 76 | 77 | #ifdef OLD_CODE_WHICH_IS_TOO_SLOW 78 | static uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 79 | { 80 | uint8_t c1, c2, c3, tmp; 81 | c1 = v0 <= a1; 82 | c2 = v1 >= a0; 83 | c3 = v0 > v1; 84 | 85 | tmp = c1; 86 | c1 &= c2; 87 | c2 &= c3; 88 | c3 &= tmp; 89 | c1 |= c2; 90 | c1 |= c3; 91 | return c1 & 1; 92 | } 93 | #endif 94 | 95 | #define U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1) ((uint8_t)( (v0) <= (a1) ) ? ( ( (v1) >= (a0) ) ? ( 1 ) : ( (v0) > (v1) ) ) : ( ( (v1) >= (a0) ) ? ( (v0) > (v1) ) : ( 0 ) )) 96 | 97 | //static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) U8G_ALWAYS_INLINE; 98 | static uint8_t U8G_ALWAYS_INLINE u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) 99 | { 100 | /* surprisingly the macro leads to larger code */ 101 | /* return U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1); */ 102 | if ( v0 <= a1 ) 103 | { 104 | if ( v1 >= a0 ) 105 | { 106 | return 1; 107 | } 108 | else 109 | { 110 | if ( v0 > v1 ) 111 | { 112 | return 1; 113 | } 114 | else 115 | { 116 | return 0; 117 | } 118 | } 119 | } 120 | else 121 | { 122 | if ( v1 >= a0 ) 123 | { 124 | if ( v0 > v1 ) 125 | { 126 | return 1; 127 | } 128 | else 129 | { 130 | return 0; 131 | } 132 | } 133 | else 134 | { 135 | return 0; 136 | } 137 | } 138 | } 139 | 140 | 141 | uint8_t u8g_IsBBXIntersection(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h) 142 | { 143 | register u8g_uint_t tmp; 144 | tmp = y; 145 | tmp += h; 146 | tmp--; 147 | if ( u8g_is_intersection_decision_tree(u8g->current_page.y0, u8g->current_page.y1, y, tmp) == 0 ) 148 | return 0; 149 | 150 | tmp = x; 151 | tmp += w; 152 | tmp--; 153 | return u8g_is_intersection_decision_tree(u8g->current_page.x0, u8g->current_page.x1, x, tmp); 154 | } 155 | 156 | 157 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_com_api_16gr.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_com_api_16gr.c 4 | 5 | Extension of the com api for devices with 16 graylevels (4 bit per pixel). 6 | This should fit to the 8h and 16h architectures (pb8v1, pb8v2, pb16v1, pb16v2), 7 | mainly intended for SSD OLEDs 8 | 9 | Universal 8bit Graphics Library 10 | 11 | Copyright (c) 2011, olikraus@gmail.com 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without modification, 15 | are permitted provided that the following conditions are met: 16 | 17 | * Redistributions of source code must retain the above copyright notice, this list 18 | of conditions and the following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above copyright notice, this 21 | list of conditions and the following disclaimer in the documentation and/or other 22 | materials provided with the distribution. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 25 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 26 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 27 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 29 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 31 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 36 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | 39 | */ 40 | 41 | #include "u8g.h" 42 | 43 | /* interpret b as a monochrome bit pattern, write value 15 for high bit and value 0 for a low bit */ 44 | /* topbit (msb) is sent last */ 45 | /* example: b = 0x083 will send 0xff, 0x00, 0x00, 0xf0 */ 46 | uint8_t u8g_WriteByteBWTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t b) 47 | { 48 | static uint8_t buf[4]; 49 | static uint8_t map[4] = { 0, 0x00f, 0x0f0, 0x0ff }; 50 | buf [3] = map[b & 3]; 51 | b>>=2; 52 | buf [2] = map[b & 3]; 53 | b>>=2; 54 | buf [1] = map[b & 3]; 55 | b>>=2; 56 | buf [0] = map[b & 3]; 57 | return dev->com_fn(u8g, U8G_COM_MSG_WRITE_SEQ, 4, buf); 58 | } 59 | 60 | uint8_t u8g_WriteSequenceBWTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t cnt, uint8_t *ptr) 61 | { 62 | do 63 | { 64 | if ( u8g_WriteByteBWTo16GrDevice(u8g, dev, *ptr++) == 0 ) 65 | return 0; 66 | cnt--; 67 | } while( cnt != 0 ); 68 | return 1; 69 | } 70 | 71 | /* interpret b as a 4L bit pattern, write values 0x000, 0x004, 0x008, 0x00c */ 72 | uint8_t u8g_WriteByte4LTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t b) 73 | { 74 | //static uint8_t map[16] = { 0x000, 0x004, 0x008, 0x00c, 0x040, 0x044, 0x048, 0x04c, 0x080, 0x084, 0x088, 0x08c, 0x0c0, 0x0c4, 0x0c8, 0x0cc}; 75 | //static uint8_t map[16] = { 0x000, 0x004, 0x00a, 0x00f, 0x040, 0x044, 0x04a, 0x04f, 0x0a0, 0x0a4, 0x0aa, 0x0af, 0x0f0, 0x0f4, 0x0fa, 0x0ff}; 76 | static uint8_t map[16] = { 0x000, 0x040, 0x0a0, 0x0f0, 0x004, 0x044, 0x0a4, 0x0f4, 0x00a, 0x04a, 0x0aa, 0x0fa, 0x00f, 0x04f, 0x0af, 0x0ff}; 77 | uint8_t bb; 78 | bb = b; 79 | bb &= 15; 80 | b>>=4; 81 | dev->com_fn(u8g, U8G_COM_MSG_WRITE_BYTE, map[bb], NULL); 82 | return dev->com_fn(u8g, U8G_COM_MSG_WRITE_BYTE, map[b], NULL); 83 | } 84 | 85 | uint8_t u8g_WriteSequence4LTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t cnt, uint8_t *ptr) 86 | { 87 | do 88 | { 89 | if ( u8g_WriteByte4LTo16GrDevice(u8g, dev, *ptr++) == 0 ) 90 | return 0; 91 | cnt--; 92 | } while( cnt != 0 ); 93 | return 1; 94 | } 95 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_com_arduino_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_com_arduino_common.c 4 | 5 | shared procedures for the arduino communication procedures 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | */ 38 | 39 | #include "u8g.h" 40 | 41 | #if defined(ARDUINO) 42 | 43 | #if ARDUINO < 100 44 | #include 45 | #else 46 | #include 47 | #endif 48 | 49 | void u8g_com_arduino_digital_write(u8g_t *u8g, uint8_t pin_index, uint8_t value) 50 | { 51 | uint8_t pin; 52 | pin = u8g->pin_list[pin_index]; 53 | if ( pin != U8G_PIN_NONE ) 54 | digitalWrite(pin, value); 55 | } 56 | 57 | /* this procedure does not set the RW pin */ 58 | void u8g_com_arduino_assign_pin_output_high(u8g_t *u8g) 59 | { 60 | uint8_t i; 61 | /* skip the RW pin, which is the last pin in the list */ 62 | for( i = 0; i < U8G_PIN_LIST_LEN-1; i++ ) 63 | { 64 | if ( u8g->pin_list[i] != U8G_PIN_NONE ) 65 | { 66 | pinMode(u8g->pin_list[i], OUTPUT); 67 | digitalWrite(u8g->pin_list[i], HIGH); 68 | } 69 | } 70 | } 71 | 72 | 73 | #endif 74 | 75 | 76 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_com_arduino_hw_usart_spi.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_com_arduino_hw_usart_spi.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2011, 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 | SPI Clock Cycle Type 35 | 36 | SSD1351 50ns 20 MHz 37 | SSD1322 300ns 3.3 MHz 38 | SSD1327 300ns 39 | SSD1306 300ns 40 | ST7565 400ns 2.5 MHz 41 | ST7920 400ns 42 | 43 | */ 44 | 45 | #include "u8g.h" 46 | 47 | #if defined(ARDUINO) 48 | 49 | #if defined(__AVR_ATmega32U4__ ) 50 | 51 | #include 52 | #include 53 | 54 | #if ARDUINO < 100 55 | #include 56 | #else 57 | #include 58 | #endif 59 | 60 | 61 | 62 | static uint8_t u8g_usart_spi_out(uint8_t data) 63 | { 64 | /* send data */ 65 | UDR1 = data; 66 | /* wait for empty transmit buffer */ 67 | while(!(UCSR1A & (1 << UDRE1))); 68 | 69 | return UDR1; 70 | } 71 | 72 | 73 | uint8_t u8g_com_arduino_hw_usart_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 74 | { 75 | switch(msg) 76 | { 77 | case U8G_COM_MSG_STOP: 78 | break; 79 | 80 | case U8G_COM_MSG_INIT: 81 | /* SCK is already an output as we overwrite TXLED */ 82 | u8g_com_arduino_assign_pin_output_high(u8g); 83 | u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH); 84 | 85 | // Init interface at 2MHz 86 | UBRR1 = 0x00; 87 | UCSR1C = (1 << UMSEL11) | (1 << UMSEL10); 88 | UCSR1B = (1 << TXEN1); 89 | UBRR1 = 3; 90 | 91 | break; 92 | 93 | case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ 94 | u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val); 95 | break; 96 | 97 | case U8G_COM_MSG_CHIP_SELECT: 98 | if ( arg_val == 0 ) 99 | { 100 | /* disable */ 101 | u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH); 102 | } 103 | else 104 | { 105 | /* enable */ 106 | u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW); 107 | } 108 | break; 109 | 110 | case U8G_COM_MSG_RESET: 111 | if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE ) 112 | u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); 113 | break; 114 | 115 | case U8G_COM_MSG_WRITE_BYTE: 116 | u8g_usart_spi_out(arg_val); 117 | break; 118 | 119 | case U8G_COM_MSG_WRITE_SEQ: 120 | { 121 | register uint8_t *ptr = arg_ptr; 122 | while( arg_val > 0 ) 123 | { 124 | u8g_usart_spi_out(*ptr++); 125 | arg_val--; 126 | } 127 | } 128 | break; 129 | case U8G_COM_MSG_WRITE_SEQ_P: 130 | { 131 | register uint8_t *ptr = arg_ptr; 132 | while( arg_val > 0 ) 133 | { 134 | u8g_usart_spi_out(u8g_pgm_read(ptr)); 135 | ptr++; 136 | arg_val--; 137 | } 138 | } 139 | break; 140 | } 141 | return 1; 142 | } 143 | 144 | /* #elif defined(__18CXX) || defined(__PIC32MX) */ 145 | /* #elif defined(__arm__) // Arduino Due, maybe we should better check for __SAM3X8E__ */ 146 | 147 | #else /* __AVR_ATmega32U4__ */ 148 | 149 | #endif /* __AVR_ATmega32U4__ */ 150 | 151 | #else /* ARDUINO */ 152 | 153 | uint8_t u8g_com_arduino_hw_usart_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 154 | { 155 | return 1; 156 | } 157 | 158 | #endif /* ARDUINO */ 159 | 160 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_com_arduino_std_sw_spi.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_arduino_std_sw_spi.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2011, 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 | 36 | #include "u8g.h" 37 | 38 | 39 | #if defined(ARDUINO) 40 | 41 | #if ARDUINO < 100 42 | #include 43 | #else 44 | #include 45 | #endif 46 | 47 | void u8g_arduino_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) 48 | { 49 | uint8_t i = 8; 50 | do 51 | { 52 | if ( val & 128 ) 53 | digitalWrite(dataPin, HIGH); 54 | else 55 | digitalWrite(dataPin, LOW); 56 | val <<= 1; 57 | u8g_MicroDelay(); /* 23 Sep 2012 */ 58 | //delay(1); 59 | digitalWrite(clockPin, HIGH); 60 | u8g_MicroDelay(); /* 23 Sep 2012 */ 61 | //delay(1); 62 | digitalWrite(clockPin, LOW); 63 | u8g_MicroDelay(); /* 23 Sep 2012 */ 64 | //delay(1); 65 | i--; 66 | } while( i != 0 ); 67 | } 68 | 69 | uint8_t u8g_com_arduino_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 70 | { 71 | switch(msg) 72 | { 73 | case U8G_COM_MSG_INIT: 74 | u8g_com_arduino_assign_pin_output_high(u8g); 75 | u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW); 76 | u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, LOW); 77 | break; 78 | 79 | case U8G_COM_MSG_STOP: 80 | break; 81 | 82 | case U8G_COM_MSG_RESET: 83 | if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE ) 84 | u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); 85 | break; 86 | 87 | case U8G_COM_MSG_CHIP_SELECT: 88 | if ( arg_val == 0 ) 89 | { 90 | /* disable */ 91 | u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH); 92 | } 93 | else 94 | { 95 | /* enable */ 96 | u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW); 97 | u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW); 98 | } 99 | break; 100 | 101 | case U8G_COM_MSG_WRITE_BYTE: 102 | u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val); 103 | break; 104 | 105 | case U8G_COM_MSG_WRITE_SEQ: 106 | { 107 | register uint8_t *ptr = arg_ptr; 108 | while( arg_val > 0 ) 109 | { 110 | u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++); 111 | arg_val--; 112 | } 113 | } 114 | break; 115 | 116 | case U8G_COM_MSG_WRITE_SEQ_P: 117 | { 118 | register uint8_t *ptr = arg_ptr; 119 | while( arg_val > 0 ) 120 | { 121 | u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr)); 122 | ptr++; 123 | arg_val--; 124 | } 125 | } 126 | break; 127 | 128 | case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ 129 | u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val); 130 | break; 131 | } 132 | return 1; 133 | } 134 | 135 | #else /* ARDUINO */ 136 | 137 | uint8_t u8g_com_arduino_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 138 | { 139 | return 1; 140 | } 141 | 142 | #endif /* ARDUINO */ 143 | 144 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_com_atmega_sw_spi.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_com_atmega_sw_spi.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2012, 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 | */ 36 | 37 | #include "u8g.h" 38 | 39 | #if defined(__AVR__) 40 | 41 | static void u8g_atmega_sw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE; 42 | static void u8g_atmega_sw_spi_shift_out(u8g_t *u8g, uint8_t val) 43 | { 44 | uint8_t i = 8; 45 | do 46 | { 47 | u8g_SetPILevel(u8g, U8G_PI_MOSI, val & 128 ); 48 | val <<= 1; 49 | u8g_SetPILevel(u8g, U8G_PI_SCK, 1 ); 50 | u8g_MicroDelay(); /* 15 Aug 2012: added for high speed uC */ 51 | u8g_SetPILevel(u8g, U8G_PI_SCK, 0 ); 52 | u8g_MicroDelay(); /* 15 Aug 2012: added for high speed uC */ 53 | i--; 54 | } while( i != 0 ); 55 | } 56 | 57 | uint8_t u8g_com_atmega_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 58 | { 59 | switch(msg) 60 | { 61 | case U8G_COM_MSG_INIT: 62 | u8g_SetPIOutput(u8g, U8G_PI_SCK); 63 | u8g_SetPIOutput(u8g, U8G_PI_MOSI); 64 | u8g_SetPIOutput(u8g, U8G_PI_A0); 65 | u8g_SetPIOutput(u8g, U8G_PI_CS); 66 | u8g_SetPIOutput(u8g, U8G_PI_RESET); 67 | 68 | u8g_SetPILevel(u8g, U8G_PI_SCK, 0 ); 69 | u8g_SetPILevel(u8g, U8G_PI_MOSI, 0 ); 70 | u8g_SetPILevel(u8g, U8G_PI_CS, 1 ); 71 | u8g_SetPILevel(u8g, U8G_PI_A0, 0); 72 | break; 73 | 74 | case U8G_COM_MSG_STOP: 75 | break; 76 | 77 | case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ 78 | u8g_SetPILevel(u8g, U8G_PI_A0, arg_val); 79 | break; 80 | 81 | case U8G_COM_MSG_CHIP_SELECT: 82 | 83 | if ( arg_val == 0 ) 84 | { 85 | /* disable */ 86 | u8g_SetPILevel(u8g, U8G_PI_CS, 1); 87 | } 88 | else 89 | { 90 | u8g_SetPILevel(u8g, U8G_PI_SCK, 0 ); 91 | /* enable */ 92 | u8g_SetPILevel(u8g, U8G_PI_CS, 0); /* CS = 0 (low active) */ 93 | } 94 | break; 95 | 96 | case U8G_COM_MSG_RESET: 97 | u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val); 98 | break; 99 | 100 | 101 | case U8G_COM_MSG_WRITE_BYTE: 102 | u8g_atmega_sw_spi_shift_out(u8g, arg_val); 103 | break; 104 | 105 | case U8G_COM_MSG_WRITE_SEQ: 106 | { 107 | register uint8_t *ptr = arg_ptr; 108 | while( arg_val > 0 ) 109 | { 110 | u8g_atmega_sw_spi_shift_out(u8g, *ptr++); 111 | arg_val--; 112 | } 113 | } 114 | break; 115 | 116 | case U8G_COM_MSG_WRITE_SEQ_P: 117 | { 118 | register uint8_t *ptr = arg_ptr; 119 | while( arg_val > 0 ) 120 | { 121 | u8g_atmega_sw_spi_shift_out(u8g, u8g_pgm_read(ptr)); 122 | ptr++; 123 | arg_val--; 124 | } 125 | } 126 | break; 127 | } 128 | return 1; 129 | } 130 | 131 | #else 132 | 133 | 134 | uint8_t u8g_com_atmega_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 135 | { 136 | return 1; 137 | } 138 | 139 | 140 | #endif 141 | 142 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_com_null.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_com_null.c 4 | 5 | communication null device 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | */ 38 | 39 | #include "u8g.h" 40 | 41 | uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) 42 | { 43 | switch(msg) 44 | { 45 | case U8G_COM_MSG_INIT: 46 | break; 47 | case U8G_COM_MSG_STOP: 48 | break; 49 | 50 | 51 | case U8G_COM_MSG_CHIP_SELECT: 52 | /* arg_val contains the chip number, which should be enabled */ 53 | break; 54 | 55 | 56 | case U8G_COM_MSG_WRITE_BYTE: 57 | break; 58 | case U8G_COM_MSG_WRITE_SEQ: 59 | break; 60 | } 61 | return 1; 62 | } 63 | 64 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_cursor.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_cursor.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2011, 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 | */ 36 | 37 | #include "u8g.h" 38 | 39 | void u8g_SetCursorFont(u8g_t *u8g, const u8g_pgm_uint8_t *cursor_font) 40 | { 41 | u8g->cursor_font = cursor_font; 42 | } 43 | 44 | void u8g_SetCursorStyle(u8g_t *u8g, uint8_t encoding) 45 | { 46 | u8g->cursor_encoding = encoding; 47 | } 48 | 49 | void u8g_SetCursorColor(u8g_t *u8g, uint8_t fg, uint8_t bg) 50 | { 51 | u8g->cursor_bg_color = bg; 52 | u8g->cursor_fg_color = fg; 53 | } 54 | 55 | void u8g_SetCursorPos(u8g_t *u8g, u8g_uint_t cursor_x, u8g_uint_t cursor_y) 56 | { 57 | u8g->cursor_x = cursor_x; 58 | u8g->cursor_y = cursor_y; 59 | } 60 | 61 | void u8g_EnableCursor(u8g_t *u8g) 62 | { 63 | u8g->cursor_fn = u8g_DrawCursor; 64 | } 65 | 66 | void u8g_DisableCursor(u8g_t *u8g) 67 | { 68 | u8g->cursor_fn = (u8g_draw_cursor_fn)0; 69 | } 70 | 71 | void u8g_DrawCursor(u8g_t *u8g) 72 | { 73 | const u8g_pgm_uint8_t *font; 74 | uint8_t color; 75 | uint8_t encoding = u8g->cursor_encoding; 76 | 77 | /* get current values */ 78 | color = u8g_GetColorIndex(u8g); 79 | font = u8g->font; 80 | 81 | /* draw cursor */ 82 | u8g->font = u8g->cursor_font; 83 | encoding++; 84 | u8g_SetColorIndex(u8g, u8g->cursor_bg_color); 85 | /* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */ 86 | /* required, because y adjustment should not happen to the cursor fonts */ 87 | u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); 88 | encoding--; 89 | u8g_SetColorIndex(u8g, u8g->cursor_fg_color); 90 | /* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */ 91 | /* required, because y adjustment should not happen to the cursor fonts */ 92 | /* u8g_DrawGlyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); */ 93 | u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); 94 | 95 | /* restore previous values */ 96 | u8g->font = font; 97 | u8g_SetColorIndex(u8g, color); 98 | } 99 | 100 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_flipdisc_2x7.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_flipdisc.c 4 | 5 | 1-Bit (BW) Driver for flip disc matrix 6 | 2x 7 pixel height 7 | 8 | Universal 8bit Graphics Library 9 | 10 | Copyright (c) 2011, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | */ 38 | 39 | #include "u8g.h" 40 | 41 | #define WIDTH 28 42 | #define HEIGHT 14 43 | #define PAGE_HEIGHT 14 44 | 45 | /* 46 | Write data to the flip disc matrix. 47 | This procedure must be implemented by the user. 48 | Arguments: 49 | id: Id for the matrix. Currently always 0. 50 | page: A page has a height of 14 pixel. For a matrix with HEIGHT == 14 this will be always 0 51 | width: The width of the flip disc matrix. Always equal to WIDTH 52 | row1: first data line (7 pixel per byte) 53 | row2: first data line (7 pixel per byte) 54 | */ 55 | void writeFlipDiscMatrix(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2); 56 | 57 | 58 | 59 | void (*u8g_write_flip_disc_matrix)(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2); 60 | 61 | void u8g_SetFlipDiscCallback(u8g_t *u8g, void (*cb)(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2)) 62 | { 63 | u8g_write_flip_disc_matrix = cb; 64 | } 65 | 66 | uint8_t u8g_dev_flipdisc_2x7_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 67 | { 68 | switch(msg) 69 | { 70 | case U8G_DEV_MSG_INIT: 71 | break; 72 | case U8G_DEV_MSG_STOP: 73 | break; 74 | case U8G_DEV_MSG_PAGE_NEXT: 75 | { 76 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 77 | 78 | /* current page: pb->p.page */ 79 | /* ptr to the buffer: pb->buf */ 80 | 81 | (*u8g_write_flip_disc_matrix)(0, pb->p.page, WIDTH, pb->buf, (uint8_t *)(pb->buf)+WIDTH); 82 | } 83 | break; 84 | case U8G_DEV_MSG_CONTRAST: 85 | return 1; 86 | } 87 | return u8g_dev_pb14v1_base_fn(u8g, dev, msg, arg); 88 | } 89 | 90 | uint8_t u8g_dev_flipdisc_2x7_bw_buf[WIDTH*2] U8G_NOCOMMON ; 91 | u8g_pb_t u8g_dev_flipdisc_2x7_bw_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_flipdisc_2x7_bw_buf}; 92 | u8g_dev_t u8g_dev_flipdisc_2x7 = { u8g_dev_flipdisc_2x7_bw_fn, &u8g_dev_flipdisc_2x7_bw_pb, u8g_com_null_fn }; 93 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_gprof.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_gprof.c 4 | 5 | Device for performance measurement with gprof. 6 | Does not write any data, but uses a buffer. 7 | 8 | Universal 8bit Graphics Library 9 | 10 | Copyright (c) 2011, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | 38 | 39 | */ 40 | 41 | #include "u8g.h" 42 | 43 | 44 | #define WIDTH 128 45 | #define HEIGHT 64 46 | #define PAGE_HEIGHT 8 47 | 48 | uint8_t u8g_dev_gprof_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg); 49 | 50 | uint8_t u8g_pb_dev_gprof_buf[WIDTH]; 51 | u8g_pb_t u8g_pb_dev_gprof = { {PAGE_HEIGHT, HEIGHT, 0, 0, 0}, WIDTH, u8g_pb_dev_gprof_buf }; 52 | 53 | u8g_dev_t u8g_dev_gprof = { u8g_dev_gprof_fn, &u8g_pb_dev_gprof, NULL }; 54 | 55 | uint8_t u8g_dev_gprof_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 56 | { 57 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 58 | 59 | switch(msg) 60 | { 61 | case U8G_DEV_MSG_INIT: 62 | break; 63 | case U8G_DEV_MSG_STOP: 64 | break; 65 | case U8G_DEV_MSG_PAGE_FIRST: 66 | u8g_pb_Clear(pb); 67 | u8g_page_First(&(pb->p)); 68 | break; 69 | case U8G_DEV_MSG_PAGE_NEXT: 70 | /* 71 | { 72 | uint8_t i, j; 73 | uint8_t page_height; 74 | page_height = pb->p.page_y1; 75 | page_height -= pb->p.page_y0; 76 | page_height++; 77 | for( j = 0; j < page_height; j++ ) 78 | { 79 | printf("%02d ", j); 80 | for( i = 0; i < WIDTH; i++ ) 81 | { 82 | if ( (u8g_pb_dev_stdout_buf[i] & (1<p)) == 0 ) 92 | { 93 | //printf("\n"); 94 | return 0; 95 | } 96 | u8g_pb_Clear(pb); 97 | break; 98 | #ifdef U8G_DEV_MSG_IS_BBX_INTERSECTION 99 | case U8G_DEV_MSG_IS_BBX_INTERSECTION: 100 | { 101 | u8g_dev_arg_bbx_t *bbx = (u8g_dev_arg_bbx_t *)arg; 102 | u8g_uint_t x2, y2; 103 | 104 | y2 = bbx->y; 105 | y2 += bbx->h; 106 | y2--; 107 | 108 | if ( u8g_pb_IsYIntersection(pb, bbx->y, y2) == 0 ) 109 | return 0; 110 | 111 | /* maybe this one can be skiped... probability is very high to have an intersection, so it would be ok to always return 1 */ 112 | x2 = bbx->x; 113 | x2 += bbx->w; 114 | x2--; 115 | 116 | if ( u8g_pb_IsXIntersection(pb, bbx->x, x2) == 0 ) 117 | return 0; 118 | } 119 | return 1; 120 | #endif 121 | case U8G_DEV_MSG_GET_PAGE_BOX: 122 | u8g_pb_GetPageBox(pb, (u8g_box_t *)arg); 123 | break; 124 | case U8G_DEV_MSG_SET_COLOR_ENTRY: 125 | break; 126 | case U8G_DEV_MSG_SET_XY_CB: 127 | break; 128 | } 129 | return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 130 | } 131 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_ks0108_128x64.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_ks0108_128x64.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2011, 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 | ADDRESS = 0 (Command Mode) 36 | 0x03f Display On 37 | 0x0c0 Start Display at line 0 38 | 0x040 | y write to y address (y:0..63) 39 | 0x0b8 | x write to page [0..7] 40 | 41 | 42 | u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset) 43 | u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE) 44 | 45 | */ 46 | 47 | #include "u8g.h" 48 | 49 | #define WIDTH 128 50 | #define HEIGHT 64 51 | #define PAGE_HEIGHT 8 52 | 53 | static const uint8_t u8g_dev_ks0108_128x64_init_seq[] PROGMEM = { 54 | U8G_ESC_CS(0), /* disable chip */ 55 | U8G_ESC_ADR(0), /* instruction mode */ 56 | U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */ 57 | U8G_ESC_CS(1), /* enable chip 1 */ 58 | 0x03f, /* display on */ 59 | 0x0c0, /* start at line 0 */ 60 | U8G_ESC_DLY(20), /* delay 20 ms */ 61 | U8G_ESC_CS(2), /* enable chip 2 */ 62 | 0x03f, /* display on */ 63 | 0x0c0, /* start at line 0 */ 64 | U8G_ESC_DLY(20), /* delay 20 ms */ 65 | U8G_ESC_CS(0), /* disable all chips */ 66 | U8G_ESC_END /* end of sequence */ 67 | }; 68 | 69 | 70 | uint8_t u8g_dev_ks0108_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 71 | { 72 | 73 | switch(msg) 74 | { 75 | case U8G_DEV_MSG_INIT: 76 | u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE); 77 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_ks0108_128x64_init_seq); 78 | break; 79 | case U8G_DEV_MSG_STOP: 80 | break; 81 | case U8G_DEV_MSG_PAGE_NEXT: 82 | { 83 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 84 | 85 | u8g_SetAddress(u8g, dev, 0); /* command mode */ 86 | u8g_SetChipSelect(u8g, dev, 2); 87 | u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (KS0108b) */ 88 | u8g_WriteByte(u8g, dev, 0x040 ); /* set address 0 */ 89 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 90 | u8g_WriteSequence(u8g, dev, 64, pb->buf); 91 | u8g_SetChipSelect(u8g, dev, 0); 92 | 93 | u8g_SetAddress(u8g, dev, 0); /* command mode */ 94 | u8g_SetChipSelect(u8g, dev, 1); 95 | u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (KS0108b) */ 96 | u8g_WriteByte(u8g, dev, 0x040 ); /* set address 0 */ 97 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 98 | u8g_WriteSequence(u8g, dev, 64, 64+(uint8_t *)pb->buf); 99 | u8g_SetChipSelect(u8g, dev, 0); 100 | 101 | } 102 | break; 103 | } 104 | return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 105 | } 106 | 107 | U8G_PB_DEV(u8g_dev_ks0108_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ks0108_128x64_fn, U8G_COM_PARALLEL); 108 | U8G_PB_DEV(u8g_dev_ks0108_128x64_fast, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ks0108_128x64_fn, U8G_COM_FAST_PARALLEL); 109 | 110 | 111 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_null.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_null.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2011, 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 | */ 36 | 37 | #include "u8g.h" 38 | 39 | uint8_t u8g_dev_null(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 40 | { 41 | switch(msg) 42 | { 43 | case U8G_DEV_MSG_SET_8PIXEL: /* most often used command */ 44 | break; 45 | case U8G_DEV_MSG_SET_PIXEL: 46 | break; 47 | case U8G_DEV_MSG_INIT: 48 | break; 49 | case U8G_DEV_MSG_STOP: 50 | break; 51 | case U8G_DEV_MSG_PAGE_FIRST: 52 | break; 53 | case U8G_DEV_MSG_PAGE_NEXT: 54 | break; 55 | #ifdef U8G_DEV_MSG_IS_BBX_INTERSECTION 56 | case U8G_DEV_MSG_IS_BBX_INTERSECTION: 57 | return 1; 58 | #endif 59 | case U8G_DEV_MSG_GET_PAGE_BOX: 60 | break; 61 | case U8G_DEV_MSG_SET_COLOR_ENTRY: 62 | break; 63 | case U8G_DEV_MSG_SET_XY_CB: 64 | break; 65 | } 66 | return 1; 67 | } 68 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_sbn1661_122x32.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_sbn1661_122x32.c 4 | 5 | WG12232 display with 2xSBN1661 / SED1520 controller (122x32 display) 6 | At the moment only available in the Arduino Environment 7 | 8 | Universal 8bit Graphics Library 9 | 10 | Copyright (c) 2011, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | 38 | */ 39 | 40 | #include "u8g.h" 41 | 42 | #define WIDTH 122 43 | #define HEIGHT 32 44 | #define PAGE_HEIGHT 8 45 | 46 | 47 | static const uint8_t u8g_dev_sbn1661_122x32_init_seq[] PROGMEM = { 48 | U8G_ESC_CS(0), /* disable chip */ 49 | U8G_ESC_ADR(0), /* instruction mode */ 50 | U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds */ 51 | U8G_ESC_CS(1), /* enable chip 1 */ 52 | 0x0af, /* display on */ 53 | 0x0c0, /* display start at line 0 */ 54 | 0x0a0, /* a0: ADC forward, a1: ADC reverse */ 55 | 0x0a9, /* a8: 1/16, a9: 1/32 duty */ 56 | U8G_ESC_CS(2), /* enable chip 2 */ 57 | 0x0af, /* display on */ 58 | 0x0c0, /* display start at line 0 */ 59 | 0x0a0, /* a0: ADC forward, a1: ADC reverse */ 60 | 0x0a9, /* a8: 1/16, a9: 1/32 duty */ 61 | 62 | U8G_ESC_CS(0), /* disable chip */ 63 | 64 | 65 | U8G_ESC_END /* end of sequence */ 66 | }; 67 | 68 | uint8_t u8g_dev_sbn1661_122x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 69 | { 70 | switch(msg) 71 | { 72 | case U8G_DEV_MSG_INIT: 73 | u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE); 74 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_sbn1661_122x32_init_seq); 75 | break; 76 | case U8G_DEV_MSG_STOP: 77 | break; 78 | case U8G_DEV_MSG_PAGE_NEXT: 79 | { 80 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 81 | 82 | u8g_SetAddress(u8g, dev, 0); /* command mode */ 83 | u8g_SetChipSelect(u8g, dev, 1); 84 | u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (SBN1661/SED1520) */ 85 | u8g_WriteByte(u8g, dev, 0x000 ); /* set X address */ 86 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 87 | u8g_WriteSequence(u8g, dev, WIDTH/2, pb->buf); 88 | 89 | u8g_SetAddress(u8g, dev, 0); /* command mode */ 90 | u8g_SetChipSelect(u8g, dev, 2); 91 | u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (SBN1661/SED1520) */ 92 | u8g_WriteByte(u8g, dev, 0x000 ); /* set X address */ 93 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 94 | u8g_WriteSequence(u8g, dev, WIDTH/2, WIDTH/2+(uint8_t *)pb->buf); 95 | 96 | u8g_SetChipSelect(u8g, dev, 0); 97 | 98 | } 99 | break; 100 | case U8G_DEV_MSG_CONTRAST: 101 | break; 102 | } 103 | return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 104 | } 105 | 106 | /* u8g_com_arduino_sw_spi_fn does not work, too fast??? */ 107 | U8G_PB_DEV(u8g_dev_sbn1661_122x32 , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sbn1661_122x32_fn, u8g_com_arduino_no_en_parallel_fn); 108 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_tls8204_84x48.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_tls8204_84x48.c 4 | 5 | Display: Nokia 84x48 6 | 7 | Status: Tested with TLS8204V12 Display by Olimex MOD-LCD3310 8 | 9 | Contributed: http://code.google.com/p/u8glib/issues/detail?id=126 10 | 11 | Universal 8bit Graphics Library 12 | 13 | Copyright (c) 2011, olikraus@gmail.com 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without modification, 17 | are permitted provided that the following conditions are met: 18 | 19 | * Redistributions of source code must retain the above copyright notice, this list 20 | of conditions and the following disclaimer. 21 | 22 | * Redistributions in binary form must reproduce the above copyright notice, this 23 | list of conditions and the following disclaimer in the documentation and/or other 24 | materials provided with the distribution. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 27 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 28 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 31 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 33 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 38 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | 40 | 41 | */ 42 | 43 | #include "u8g.h" 44 | 45 | #define WIDTH 84 46 | #define HEIGHT 48 47 | #define PAGE_HEIGHT 8 48 | 49 | 50 | static const uint8_t u8g_dev_tls8204_init_seq[] PROGMEM = { 51 | U8G_ESC_CS(0), /* disable chip */ 52 | U8G_ESC_ADR(0), /* instruction mode */ 53 | U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */ 54 | U8G_ESC_CS(1), /* enable chip */ 55 | 0x021, /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */ 56 | 0x006, /* temp. control: b10 = 2 */ 57 | 0x04 | !!((66-1)&(1u<<6)), 58 | 0x40 | ((66-2) & ((1u<<6)-1)), 59 | 0x013, /* bias system 1:48 */ 60 | 0x0c0, /* medium Vop */ 61 | 0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ 62 | 0x00c, /* display on, normal operation */ 63 | U8G_ESC_DLY(100), /* delay 100 ms */ 64 | 0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ 65 | 0x00d, /* display on, invert */ 66 | U8G_ESC_DLY(100), /* delay 100 ms */ 67 | U8G_ESC_DLY(100), /* delay 100 ms */ 68 | 0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ 69 | 0x00c, /* display on, normal */ 70 | U8G_ESC_DLY(100), /* delay 100 ms */ 71 | U8G_ESC_CS(0), /* disable chip */ 72 | U8G_ESC_END /* end of sequence */ 73 | }; 74 | 75 | 76 | uint8_t u8g_dev_tls8204_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 77 | { 78 | switch(msg) 79 | { 80 | case U8G_DEV_MSG_INIT: 81 | u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS); 82 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_tls8204_init_seq); 83 | break; 84 | case U8G_DEV_MSG_STOP: 85 | break; 86 | case U8G_DEV_MSG_PAGE_NEXT: 87 | { 88 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 89 | u8g_SetAddress(u8g, dev, 0); /* command mode */ 90 | u8g_SetChipSelect(u8g, dev, 1); 91 | u8g_WriteByte(u8g, dev, 0x020 ); /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */ 92 | u8g_WriteByte(u8g, dev, 0x080 ); /* set X address */ 93 | u8g_WriteByte(u8g, dev, 0x040 | pb->p.page); /* set Y address */ 94 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 95 | if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 ) 96 | return 0; 97 | u8g_SetChipSelect(u8g, dev, 0); 98 | } 99 | break; 100 | case U8G_DEV_MSG_CONTRAST: 101 | /* the contrast adjustment does not work, needs to be analysed */ 102 | u8g_SetAddress(u8g, dev, 0); /* instruction mode */ 103 | u8g_SetChipSelect(u8g, dev, 1); 104 | u8g_WriteByte(u8g, dev, 0x021); /* command mode, extended function set */ 105 | u8g_WriteByte(u8g, dev, 0x080 | ( (*(uint8_t *)arg) >> 1 ) ); 106 | u8g_WriteByte(u8g, dev, 0x020); /* command mode, extended function set */ 107 | u8g_SetChipSelect(u8g, dev, 0); 108 | return 1; 109 | } 110 | return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 111 | } 112 | 113 | 114 | U8G_PB_DEV(u8g_dev_tls8204_84x48_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_tls8204_fn, U8G_COM_SW_SPI); 115 | 116 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_uc1611_dogm240.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_uc1611_dogm240.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2014, dev.menges.jonas@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 | */ 36 | 37 | #include "u8g.h" 38 | 39 | 40 | #define WIDTH 240 41 | #define HEIGHT 64 42 | #define PAGE_HEIGHT 8 43 | 44 | 45 | static const uint8_t u8g_dev_uc1611_dogm240_init_seq[] PROGMEM = { 46 | U8G_ESC_CS(1), // enable chip 47 | U8G_ESC_ADR(0), // instruction mode 48 | 0xF1, // set last COM electrode 49 | 0x3F, // 64-1=63 50 | 0xF2, // set display start line 51 | 0x00, // 0 52 | 0xF3, // set display end line 53 | 0x3F, // 64-1=63 54 | 0x81, // set contrast (0-255) 55 | 0xB7, // 183 56 | 0xC0, // set view 57 | //0x04, // topview 58 | 0x02, // bottomview 59 | 0xA3, // set line rate (9.4k) 60 | 0xE9, // set bias ratio (10) 61 | 0xA9, // enable display 62 | 0xD1, // set black and white mode 63 | U8G_ESC_CS(0), // disable chip 64 | U8G_ESC_END // end of sequence 65 | }; 66 | 67 | static void setPage(u8g_t *u8g, u8g_dev_t *dev, unsigned char page) 68 | { 69 | u8g_WriteByte(u8g, dev, 0x70); 70 | u8g_WriteByte(u8g, dev, 0x60 + (page&0x0F)); 71 | } 72 | 73 | static const uint8_t u8g_dev_uc1611_dogm240_data_start[] PROGMEM = { 74 | U8G_ESC_ADR(0), /* instruction mode */ 75 | U8G_ESC_CS(1), /* enable chip */ 76 | 0x10, /* set upper 4 bit of the col adr to 0 */ 77 | 0x00, /* set lower 4 bit of the col adr to 0 */ 78 | U8G_ESC_END /* end of sequence */ 79 | }; 80 | 81 | uint8_t u8g_dev_uc1611_dogm240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 82 | { 83 | switch(msg) 84 | { 85 | case U8G_DEV_MSG_INIT: 86 | u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); 87 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogm240_init_seq); 88 | break; 89 | case U8G_DEV_MSG_STOP: 90 | break; 91 | case U8G_DEV_MSG_PAGE_NEXT: 92 | { 93 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 94 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogm240_data_start); 95 | setPage(u8g, dev, pb->p.page); /* select current page (uc1611) */ 96 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 97 | if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 ) 98 | return 0; 99 | u8g_SetChipSelect(u8g, dev, 1); 100 | } 101 | break; 102 | case U8G_DEV_MSG_CONTRAST: 103 | u8g_SetChipSelect(u8g, dev, 0); 104 | u8g_SetAddress(u8g, dev, 0); /* instruction mode */ 105 | u8g_WriteByte(u8g, dev, 0x81); 106 | u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2); /* set contrast from, keep gain at 0 */ 107 | u8g_SetChipSelect(u8g, dev, 1); 108 | return 1; 109 | } 110 | return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 111 | } 112 | 113 | U8G_PB_DEV(u8g_dev_uc1611_dogm240_i2c , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogm240_fn, U8G_COM_UC_I2C); 114 | U8G_PB_DEV(u8g_dev_uc1611_dogm240_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogm240_fn, U8G_COM_SW_SPI); 115 | U8G_PB_DEV(u8g_dev_uc1611_dogm240_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogm240_fn, U8G_COM_HW_SPI); 116 | 117 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_dev_uc1611_dogxl240.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_dev_uc1611_dogxl240.c 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2014, dev.menges.jonas@gmail.com, 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 | */ 36 | 37 | #include "u8g.h" 38 | 39 | 40 | #define WIDTH 240 41 | #define HEIGHT 128 42 | #define PAGE_HEIGHT 8 43 | 44 | 45 | static const uint8_t u8g_dev_uc1611_dogxl240_init_seq[] PROGMEM = { 46 | U8G_ESC_CS(1), // enable chip 47 | U8G_ESC_ADR(0), // instruction mode 48 | 0xF1, // set last COM electrode 49 | 0x7F, // DOGXL240 50 | 0xF2, // set display start line 51 | 0x00, // 0 52 | 0xF3, // set display end line 53 | 0x7F, // DOGXL240 54 | 0x81, // set contrast (0-255) 55 | 0xAA, // DOGXL240 56 | 0xC0, // set view 57 | //0x04, // topview 58 | 0x02, // bottomview 59 | 0xA3, // set line rate (9.4k) 60 | 0xE9, // set bias ratio (10) 61 | 0xA9, // enable display 62 | 0xD1, // set black and white mode 63 | U8G_ESC_CS(0), // disable chip 64 | U8G_ESC_END // end of sequence 65 | }; 66 | 67 | static void u8g_dev_dogxl240_set_page(u8g_t *u8g, u8g_dev_t *dev, unsigned char page) 68 | { 69 | u8g_WriteByte(u8g, dev, 0x70); 70 | u8g_WriteByte(u8g, dev, 0x60 + (page&0x0F)); 71 | } 72 | 73 | static const uint8_t u8g_dev_uc1611_dogxl240_data_start[] PROGMEM = { 74 | U8G_ESC_ADR(0), /* instruction mode */ 75 | U8G_ESC_CS(1), /* enable chip */ 76 | 0x10, /* set upper 4 bit of the col adr to 0 */ 77 | 0x00, /* set lower 4 bit of the col adr to 0 */ 78 | U8G_ESC_END /* end of sequence */ 79 | }; 80 | 81 | static uint8_t u8g_dev_uc1611_dogxl240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 82 | { 83 | switch(msg) 84 | { 85 | case U8G_DEV_MSG_INIT: 86 | u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); 87 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogxl240_init_seq); 88 | break; 89 | case U8G_DEV_MSG_STOP: 90 | break; 91 | case U8G_DEV_MSG_PAGE_NEXT: 92 | { 93 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 94 | u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1611_dogxl240_data_start); 95 | u8g_dev_dogxl240_set_page(u8g, dev, pb->p.page); /* select current page (uc1611) */ 96 | u8g_SetAddress(u8g, dev, 1); /* data mode */ 97 | if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 ) 98 | return 0; 99 | u8g_SetChipSelect(u8g, dev, 1); 100 | } 101 | break; 102 | case U8G_DEV_MSG_CONTRAST: 103 | u8g_SetChipSelect(u8g, dev, 0); 104 | u8g_SetAddress(u8g, dev, 0); /* instruction mode */ 105 | u8g_WriteByte(u8g, dev, 0x81); 106 | u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2); /* set contrast from, keep gain at 0 */ 107 | u8g_SetChipSelect(u8g, dev, 1); 108 | return 1; 109 | } 110 | return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 111 | } 112 | 113 | U8G_PB_DEV(u8g_dev_uc1611_dogxl240_i2c , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogxl240_fn, U8G_COM_UC_I2C); 114 | U8G_PB_DEV(u8g_dev_uc1611_dogxl240_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogxl240_fn, U8G_COM_SW_SPI); 115 | U8G_PB_DEV(u8g_dev_uc1611_dogxl240_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_uc1611_dogxl240_fn, U8G_COM_HW_SPI); 116 | 117 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_font_data.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_font_data.c -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_line.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_line.h 4 | 5 | Universal 8bit Graphics Library 6 | 7 | Copyright (c) 2012, 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 | 36 | #include "u8g.h" 37 | 38 | void u8g_DrawLine(u8g_t *u8g, u8g_uint_t x1, u8g_uint_t y1, u8g_uint_t x2, u8g_uint_t y2) 39 | { 40 | u8g_uint_t tmp; 41 | u8g_uint_t x,y; 42 | u8g_uint_t dx, dy; 43 | u8g_int_t err; 44 | u8g_int_t ystep; 45 | 46 | uint8_t swapxy = 0; 47 | 48 | /* no BBX intersection check at the moment, should be added... */ 49 | 50 | if ( x1 > x2 ) dx = x1-x2; else dx = x2-x1; 51 | if ( y1 > y2 ) dy = y1-y2; else dy = y2-y1; 52 | 53 | if ( dy > dx ) 54 | { 55 | swapxy = 1; 56 | tmp = dx; dx =dy; dy = tmp; 57 | tmp = x1; x1 =y1; y1 = tmp; 58 | tmp = x2; x2 =y2; y2 = tmp; 59 | } 60 | if ( x1 > x2 ) 61 | { 62 | tmp = x1; x1 =x2; x2 = tmp; 63 | tmp = y1; y1 =y2; y2 = tmp; 64 | } 65 | err = dx >> 1; 66 | if ( y2 > y1 ) ystep = 1; else ystep = -1; 67 | y = y1; 68 | for( x = x1; x <= x2; x++ ) 69 | { 70 | if ( swapxy == 0 ) 71 | u8g_DrawPixel(u8g, x, y); 72 | else 73 | u8g_DrawPixel(u8g, y, x); 74 | err -= (uint8_t)dy; 75 | if ( err < 0 ) 76 | { 77 | y += (u8g_uint_t)ystep; 78 | err += (u8g_uint_t)dx; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_page.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_page.c 4 | 5 | page helper functions, only called by the dev handler. 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | */ 38 | 39 | #include "u8g.h" 40 | 41 | /* 42 | setup page count structure 43 | conditions: page_height <= total_height 44 | */ 45 | void u8g_page_Init(u8g_page_t *p, u8g_uint_t page_height, u8g_uint_t total_height ) 46 | { 47 | p->page_height = page_height; 48 | p->total_height = total_height; 49 | p->page = 0; 50 | u8g_page_First(p); 51 | } 52 | 53 | void u8g_page_First(u8g_page_t *p) 54 | { 55 | p->page_y0 = 0; 56 | p->page_y1 = p->page_height; 57 | p->page_y1--; 58 | p->page = 0; 59 | } 60 | 61 | uint8_t u8g_page_Next(u8g_page_t * p) 62 | { 63 | register u8g_uint_t y1; 64 | p->page_y0 += p->page_height; 65 | if ( p->page_y0 >= p->total_height ) 66 | return 0; 67 | p->page++; 68 | y1 = p->page_y1; 69 | y1 += p->page_height; 70 | if ( y1 >= p->total_height ) 71 | { 72 | y1 = p->total_height; 73 | y1--; 74 | } 75 | p->page_y1 = y1; 76 | 77 | return 1; 78 | } 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_pb8h2.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_pb8h2.c 4 | 5 | 8bit height 2 bit per pixel page buffer 6 | byte has horizontal orientation 7 | 8 | Universal 8bit Graphics Library 9 | 10 | Copyright (c) 2011, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | 38 | */ 39 | 40 | #include "u8g.h" 41 | #include 42 | 43 | void u8g_pb8h2_Init(u8g_pb_t *b, void *buf, u8g_uint_t width) 44 | { 45 | b->buf = buf; 46 | b->width = width; 47 | u8g_pb_Clear(b); 48 | } 49 | 50 | static void u8g_pb8h2_set_pixel(u8g_pb_t *b, u8g_uint_t x, u8g_uint_t y, uint8_t color_index) U8G_NOINLINE; 51 | static void u8g_pb8h2_set_pixel(u8g_pb_t *b, u8g_uint_t x, u8g_uint_t y, uint8_t color_index) 52 | { 53 | register uint8_t mask; 54 | register uint16_t tmp; 55 | 56 | uint8_t *ptr = b->buf; 57 | 58 | y -= b->p.page_y0; 59 | 60 | tmp = b->width; 61 | tmp >>= 2; 62 | tmp *= (uint8_t)y; 63 | ptr += tmp; 64 | 65 | tmp = x; 66 | tmp >>= 2; 67 | ptr += tmp; 68 | 69 | tmp = x; 70 | tmp &= 3; 71 | tmp <<= 1; 72 | mask = 3; 73 | mask <<= tmp; 74 | mask = ~mask; 75 | color_index &= 3; 76 | color_index <<= tmp; 77 | 78 | *ptr &= mask; 79 | *ptr |= color_index; 80 | } 81 | 82 | 83 | void u8g_pb8h2_SetPixel(u8g_pb_t *b, const u8g_dev_arg_pixel_t * const arg_pixel) 84 | { 85 | if ( arg_pixel->y < b->p.page_y0 ) 86 | return; 87 | if ( arg_pixel->y > b->p.page_y1 ) 88 | return; 89 | if ( arg_pixel->x >= b->width ) 90 | return; 91 | u8g_pb8h2_set_pixel(b, arg_pixel->x, arg_pixel->y, arg_pixel->color); 92 | } 93 | 94 | 95 | void u8g_pb8h2_Set8PixelStd(u8g_pb_t *b, u8g_dev_arg_pixel_t *arg_pixel) 96 | { 97 | register uint8_t pixel = arg_pixel->pixel; 98 | do 99 | { 100 | if ( pixel & 128 ) 101 | { 102 | u8g_pb8h2_SetPixel(b, arg_pixel); 103 | } 104 | switch( arg_pixel->dir ) 105 | { 106 | case 0: arg_pixel->x++; break; 107 | case 1: arg_pixel->y++; break; 108 | case 2: arg_pixel->x--; break; 109 | case 3: arg_pixel->y--; break; 110 | } 111 | pixel <<= 1; 112 | } while( pixel != 0 ); 113 | } 114 | 115 | 116 | 117 | uint8_t u8g_dev_pb8h2_base_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 118 | { 119 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 120 | switch(msg) 121 | { 122 | case U8G_DEV_MSG_SET_8PIXEL: 123 | if ( u8g_pb_Is8PixelVisible(pb, (u8g_dev_arg_pixel_t *)arg) ) 124 | { 125 | u8g_pb8h2_Set8PixelStd(pb, (u8g_dev_arg_pixel_t *)arg); 126 | } 127 | break; 128 | case U8G_DEV_MSG_SET_PIXEL: 129 | u8g_pb8h2_SetPixel(pb, (u8g_dev_arg_pixel_t *)arg); 130 | break; 131 | case U8G_DEV_MSG_INIT: 132 | break; 133 | case U8G_DEV_MSG_STOP: 134 | break; 135 | case U8G_DEV_MSG_PAGE_FIRST: 136 | u8g_pb_Clear(pb); 137 | u8g_page_First(&(pb->p)); 138 | break; 139 | case U8G_DEV_MSG_PAGE_NEXT: 140 | if ( u8g_page_Next(&(pb->p)) == 0 ) 141 | return 0; 142 | u8g_pb_Clear(pb); 143 | break; 144 | #ifdef U8G_DEV_MSG_IS_BBX_INTERSECTION 145 | case U8G_DEV_MSG_IS_BBX_INTERSECTION: 146 | return u8g_pb_IsIntersection(pb, (u8g_dev_arg_bbx_t *)arg); 147 | #endif 148 | case U8G_DEV_MSG_GET_PAGE_BOX: 149 | u8g_pb_GetPageBox(pb, (u8g_box_t *)arg); 150 | break; 151 | case U8G_DEV_MSG_GET_WIDTH: 152 | *((u8g_uint_t *)arg) = pb->width; 153 | break; 154 | case U8G_DEV_MSG_GET_HEIGHT: 155 | *((u8g_uint_t *)arg) = pb->p.total_height; 156 | break; 157 | case U8G_DEV_MSG_SET_COLOR_ENTRY: 158 | break; 159 | case U8G_DEV_MSG_SET_XY_CB: 160 | break; 161 | case U8G_DEV_MSG_GET_MODE: 162 | return U8G_MODE_GRAY2BIT; 163 | } 164 | return 1; 165 | } 166 | 167 | 168 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_pb8v2.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_pb8v2.c 4 | 5 | 8bit height 2 bit per pixel page buffer 6 | byte has vertical orientation 7 | 8 | Universal 8bit Graphics Library 9 | 10 | Copyright (c) 2011, olikraus@gmail.com 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, this list 17 | of conditions and the following disclaimer. 18 | 19 | * Redistributions in binary form must reproduce the above copyright notice, this 20 | list of conditions and the following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | 38 | */ 39 | 40 | #include "u8g.h" 41 | #include 42 | 43 | void u8g_pb8v2_Init(u8g_pb_t *b, void *buf, u8g_uint_t width) 44 | { 45 | b->buf = buf; 46 | b->width = width; 47 | u8g_pb_Clear(b); 48 | } 49 | 50 | void u8g_pb8v2_set_pixel(u8g_pb_t *b, u8g_uint_t x, u8g_uint_t y, uint8_t color_index) 51 | { 52 | register uint8_t mask; 53 | uint8_t *ptr = b->buf; 54 | y -= b->p.page_y0; 55 | mask = 0x03; 56 | y &= 0x03; 57 | y <<= 1; 58 | mask <<= y; 59 | mask ^=0xff; 60 | color_index &= 3; 61 | color_index <<= y; 62 | ptr += x; 63 | *ptr &= mask; 64 | *ptr |= color_index; 65 | } 66 | 67 | 68 | void u8g_pb8v2_SetPixel(u8g_pb_t *b, const u8g_dev_arg_pixel_t * const arg_pixel) 69 | { 70 | if ( arg_pixel->y < b->p.page_y0 ) 71 | return; 72 | if ( arg_pixel->y > b->p.page_y1 ) 73 | return; 74 | if ( arg_pixel->x >= b->width ) 75 | return; 76 | u8g_pb8v2_set_pixel(b, arg_pixel->x, arg_pixel->y, arg_pixel->color); 77 | } 78 | 79 | 80 | void u8g_pb8v2_Set8PixelStd(u8g_pb_t *b, u8g_dev_arg_pixel_t *arg_pixel) 81 | { 82 | register uint8_t pixel = arg_pixel->pixel; 83 | do 84 | { 85 | if ( pixel & 128 ) 86 | { 87 | u8g_pb8v2_SetPixel(b, arg_pixel); 88 | } 89 | switch( arg_pixel->dir ) 90 | { 91 | case 0: arg_pixel->x++; break; 92 | case 1: arg_pixel->y++; break; 93 | case 2: arg_pixel->x--; break; 94 | case 3: arg_pixel->y--; break; 95 | } 96 | pixel <<= 1; 97 | } while( pixel != 0 ); 98 | 99 | } 100 | 101 | 102 | 103 | uint8_t u8g_dev_pb8v2_base_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 104 | { 105 | u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 106 | switch(msg) 107 | { 108 | case U8G_DEV_MSG_SET_8PIXEL: 109 | if ( u8g_pb_Is8PixelVisible(pb, (u8g_dev_arg_pixel_t *)arg) ) 110 | { 111 | u8g_pb8v2_Set8PixelStd(pb, (u8g_dev_arg_pixel_t *)arg); 112 | } 113 | break; 114 | case U8G_DEV_MSG_SET_PIXEL: 115 | u8g_pb8v2_SetPixel(pb, (u8g_dev_arg_pixel_t *)arg); 116 | break; 117 | case U8G_DEV_MSG_INIT: 118 | break; 119 | case U8G_DEV_MSG_STOP: 120 | break; 121 | case U8G_DEV_MSG_PAGE_FIRST: 122 | u8g_pb_Clear(pb); 123 | u8g_page_First(&(pb->p)); 124 | break; 125 | case U8G_DEV_MSG_PAGE_NEXT: 126 | if ( u8g_page_Next(&(pb->p)) == 0 ) 127 | return 0; 128 | u8g_pb_Clear(pb); 129 | break; 130 | #ifdef U8G_DEV_MSG_IS_BBX_INTERSECTION 131 | case U8G_DEV_MSG_IS_BBX_INTERSECTION: 132 | return u8g_pb_IsIntersection(pb, (u8g_dev_arg_bbx_t *)arg); 133 | #endif 134 | case U8G_DEV_MSG_GET_PAGE_BOX: 135 | u8g_pb_GetPageBox(pb, (u8g_box_t *)arg); 136 | break; 137 | case U8G_DEV_MSG_GET_WIDTH: 138 | *((u8g_uint_t *)arg) = pb->width; 139 | break; 140 | case U8G_DEV_MSG_GET_HEIGHT: 141 | *((u8g_uint_t *)arg) = pb->p.total_height; 142 | break; 143 | case U8G_DEV_MSG_SET_COLOR_ENTRY: 144 | break; 145 | case U8G_DEV_MSG_SET_XY_CB: 146 | break; 147 | case U8G_DEV_MSG_GET_MODE: 148 | return U8G_MODE_GRAY2BIT; 149 | } 150 | return 1; 151 | } 152 | 153 | 154 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_state.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_state.c 4 | 5 | backup and restore hardware state 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, olikraus@gmail.com 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this list 16 | of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, this 19 | list of conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | 37 | state callback: backup env U8G_STATE_MSG_BACKUP_ENV 38 | device callback: DEV_MSG_INIT 39 | state callback: backup u8g U8G_STATE_MSG_BACKUP_U8G 40 | state callback: restore env U8G_STATE_MSG_RESTORE_ENV 41 | 42 | state callback: backup env U8G_STATE_MSG_BACKUP_ENV 43 | state callback: retore u8g U8G_STATE_MSG_RESTORE_U8G 44 | DEV_MSG_PAGE_FIRST or DEV_MSG_PAGE_NEXT 45 | state callback: restore env U8G_STATE_MSG_RESTORE_ENV 46 | 47 | */ 48 | 49 | #include 50 | #include "u8g.h" 51 | 52 | void u8g_state_dummy_cb(uint8_t msg) 53 | { 54 | /* the dummy procedure does nothing */ 55 | } 56 | 57 | void u8g_SetHardwareBackup(u8g_t *u8g, u8g_state_cb backup_cb) 58 | { 59 | u8g->state_cb = backup_cb; 60 | /* in most cases the init message was already sent, so this will backup the */ 61 | /* current u8g state */ 62 | backup_cb(U8G_STATE_MSG_BACKUP_U8G); 63 | } 64 | 65 | 66 | /*===============================================================*/ 67 | /* register variable for restoring interrupt state */ 68 | 69 | #if defined(__AVR__) 70 | uint8_t global_SREG_backup; 71 | #endif 72 | 73 | 74 | 75 | /*===============================================================*/ 76 | /* AVR */ 77 | 78 | #if defined(__AVR__) 79 | #define U8G_ATMEGA_HW_SPI 80 | 81 | /* remove the definition for attiny */ 82 | #if __AVR_ARCH__ == 2 83 | #undef U8G_ATMEGA_HW_SPI 84 | #endif 85 | #if __AVR_ARCH__ == 25 86 | #undef U8G_ATMEGA_HW_SPI 87 | #endif 88 | #endif 89 | 90 | #if defined(U8G_ATMEGA_HW_SPI) 91 | #include 92 | static uint8_t u8g_state_avr_spi_memory[2]; 93 | 94 | void u8g_backup_spi(uint8_t msg) 95 | { 96 | if ( U8G_STATE_MSG_IS_BACKUP(msg) ) 97 | { 98 | u8g_state_avr_spi_memory[U8G_STATE_MSG_GET_IDX(msg)] = SPCR; 99 | } 100 | else 101 | { 102 | uint8_t tmp = SREG; 103 | cli(); 104 | SPCR = 0; 105 | SPCR = u8g_state_avr_spi_memory[U8G_STATE_MSG_GET_IDX(msg)]; 106 | SREG = tmp; 107 | } 108 | } 109 | 110 | #elif defined (U8G_RASPBERRY_PI) 111 | 112 | #include 113 | 114 | void u8g_backup_spi(uint8_t msg) { 115 | printf("u8g_backup_spi %d\r\n",msg); 116 | } 117 | 118 | #elif defined(ARDUINO) && defined(__SAM3X8E__) // Arduino Due, maybe we should better check for __SAM3X8E__ 119 | 120 | #include "sam.h" 121 | 122 | struct sam_backup_struct 123 | { 124 | uint32_t mr; 125 | uint32_t sr; 126 | uint32_t csr[4]; 127 | } sam_backup[2]; 128 | 129 | void u8g_backup_spi(uint8_t msg) 130 | { 131 | uint8_t idx = U8G_STATE_MSG_GET_IDX(msg); 132 | if ( U8G_STATE_MSG_IS_BACKUP(msg) ) 133 | { 134 | sam_backup[idx].mr = SPI0->SPI_MR; 135 | sam_backup[idx].sr = SPI0->SPI_SR; 136 | sam_backup[idx].csr[0] = SPI0->SPI_CSR[0]; 137 | sam_backup[idx].csr[1] = SPI0->SPI_CSR[1]; 138 | sam_backup[idx].csr[2] = SPI0->SPI_CSR[2]; 139 | sam_backup[idx].csr[3] = SPI0->SPI_CSR[3]; 140 | } 141 | else 142 | { 143 | SPI0->SPI_MR = sam_backup[idx].mr; 144 | SPI0->SPI_CSR[0] = sam_backup[idx].csr[0]; 145 | SPI0->SPI_CSR[1] = sam_backup[idx].csr[1]; 146 | SPI0->SPI_CSR[2] = sam_backup[idx].csr[2]; 147 | SPI0->SPI_CSR[3] = sam_backup[idx].csr[3]; 148 | } 149 | } 150 | 151 | #else 152 | 153 | void u8g_backup_spi(uint8_t msg) 154 | { 155 | } 156 | 157 | #endif 158 | 159 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_u16toa.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_u16toa.c 4 | 5 | 6 | Universal 8bit Graphics Library 7 | 8 | Copyright (c) 2012, olikraus@gmail.com 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | * Redistributions of source code must retain the above copyright notice, this list 15 | of conditions and the following disclaimer. 16 | 17 | * Redistributions in binary form must reproduce the above copyright notice, this 18 | list of conditions and the following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 33 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | */ 36 | 37 | 38 | #include "u8g.h" 39 | 40 | const char *u8g_u16toap(char * dest, uint16_t v) 41 | { 42 | uint8_t pos; 43 | uint8_t d; 44 | uint16_t c; 45 | c = 10000; 46 | for( pos = 0; pos < 5; pos++ ) 47 | { 48 | d = '0'; 49 | while( v >= c ) 50 | { 51 | v -= c; 52 | d++; 53 | } 54 | dest[pos] = d; 55 | c /= 10; 56 | } 57 | dest[5] = '\0'; 58 | return dest; 59 | } 60 | 61 | /* v = value, d = number of digits */ 62 | const char *u8g_u16toa(uint16_t v, uint8_t d) 63 | { 64 | static char buf[6]; 65 | d = 5-d; 66 | return u8g_u16toap(buf, v) + d; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.5.x/libraries/U8glib/utility/u8g_u8toa.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_u8toa.c 4 | 5 | 6 | Universal 8bit Graphics Library 7 | 8 | Copyright (c) 2011, olikraus@gmail.com 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | * Redistributions of source code must retain the above copyright notice, this list 15 | of conditions and the following disclaimer. 16 | 17 | * Redistributions in binary form must reproduce the above copyright notice, this 18 | list of conditions and the following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 33 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | */ 36 | 37 | 38 | #include "u8g.h" 39 | 40 | static const unsigned char u8g_u8toa_tab[3] = { 100, 10, 1 } ; 41 | const char *u8g_u8toap(char * dest, uint8_t v) 42 | { 43 | uint8_t pos; 44 | uint8_t d; 45 | uint8_t c; 46 | for( pos = 0; pos < 3; pos++ ) 47 | { 48 | d = '0'; 49 | c = *(u8g_u8toa_tab+pos); 50 | while( v >= c ) 51 | { 52 | v -= c; 53 | d++; 54 | } 55 | dest[pos] = d; 56 | } 57 | dest[3] = '\0'; 58 | return dest; 59 | } 60 | 61 | /* v = value, d = number of digits */ 62 | const char *u8g_u8toa(uint8_t v, uint8_t d) 63 | { 64 | static char buf[4]; 65 | d = 3-d; 66 | return u8g_u8toap(buf, v) + d; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /Documentation/Compilation.md: -------------------------------------------------------------------------------- 1 | # Configuring and compilation 2 | 3 | 1. Install the latest non-beta arduino software IDE/toolset: http://www.arduino.cc/en/Main/Software 4 | 2. Download the Marlin firmware 5 | - [Latest developement version](https://github.com/Wurstnase/Marlin4Due/tree/master) 6 | - [Stable version]() 7 | 3. In both cases use the "Download Zip" button on the right. 8 | 4. Some boards require special files and/or libraries from the ArduinoAddons directory. Take a look at the dedicated [README](/ArduinoAddons/README.md) for details. 9 | 5. Start the arduino IDE. 10 | 6. Select Tools -> Board -> Arduino Due 11 | 7. Select the correct serial port in Tools ->Serial Port 12 | 8. Open Marlin.pde or .ino 13 | 9. Click the Verify/Compile button 14 | 10. Click the Upload button. If all goes well the firmware is uploading 15 | 16 | That's ok. Enjoy Silky Smooth Printing. 17 | -------------------------------------------------------------------------------- /Documentation/Contributing.md: -------------------------------------------------------------------------------- 1 | Developer Notes 2 | =================== 3 | 4 | - There are now 2 branches: The __development__ branch is where new features and code changes will be sorted out. This branch may have untested code in it, so please let us know if you find any bugs. When the __development__ branch has reached a state where it is stable, it will be moved to the __stable__ branch. 5 | 6 | - We are doing a kind of cleanup in the list of Issues and Pull Requests, the aim is to get to a state where we can certify the code as stable. To get the code tested as widely as possible we require several volunteers with a wide variety of hardware configurations willing to test the firmware and help us to certify it as stable. If you want to help out testing go to this issue and let us know: https://github.com/MarlinFirmware/Marlin/issues/1209 7 | 8 | - Before you submit any pull request, we ask that you _PLEASE_ test your code before submission, even if the change seems innocuous. When creating the pull request, please include the hardware you used for testing and a short synopsis of your testing procedure. Untested pull requests are less likely to be merged, as even slight changes create the risk of breaking the main branch. 9 | 10 | - If you have a fix don't open an issue telling about it, but test the code and submit a pull request. Use the __development__ branch when you submit. -------------------------------------------------------------------------------- /Documentation/FilamentSensor.md: -------------------------------------------------------------------------------- 1 | Filament Sensor 2 | --------------- 3 | Supports the use of a real time filament diameter sensor that measures the diameter of the filament going into the extruder and then adjusts the extrusion rate to compensate for filament that does not match what is defined in the g-code. The diameter can also be displayed on the LCD screen. This potentially eliminates the need to measure filament diameter when changing spools of filament. Gcode becomes independent of the filament diameter. Can also compensate for changing diameter. 4 | 5 | For examples of these sensors, see: http://www.thingiverse.com/thing:454584, https://www.youmagine.com/designs/filament-diameter-sensor, http://diy3dprinting.blogspot.com/2014/01/diy-filament-diameter-sensor.html. Any sensor which produces a voltage equivalent to the diameter in mm (i.e. 1v = 1mm) can be used. This provides a very simple interface and may encourage more innovation in this area. 6 | 7 | 4 new Mcodes are defined to set relevant parameters: M404, M405, M406, M407 - see above. 8 | 9 | Implements a delay buffer to handle the transit delay between where the filament is measured and when it gets to the extruder. -------------------------------------------------------------------------------- /Documentation/LCD Menu Tree.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/LCD Menu Tree.pdf -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo GitHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/Marlin Logo GitHub.png -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo LCD High.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/Marlin Logo LCD High.png -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo LCD Low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/Marlin Logo LCD Low.png -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo.cdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/Marlin Logo.cdr -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/Marlin Logo.pdf -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/Marlin Logo.png -------------------------------------------------------------------------------- /Documentation/Logo/Marlin Logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 20 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Documentation/Logo/marlinwiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Logo/marlinwiki.png -------------------------------------------------------------------------------- /Documentation/Menu Plans.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Documentation/Menu Plans.xlsx -------------------------------------------------------------------------------- /Documentation/MeshBedLeveling.md: -------------------------------------------------------------------------------- 1 | ============================================== 2 | Instructions for configuring Mesh Bed Leveling 3 | ============================================== 4 | 5 | Background 6 | ---------- 7 | 8 | This mesh based method of leveling/compensating can compensate for an non-flat bed. There are various opinions about doing this. It was primarily written to compensate a RigidBot BIG bed (40x30cm) that was somewhat bent. 9 | 10 | Currently there is no automatic way to probe the bed like the Auto Bed Leveling feature. So, you can not enable `ENABLE_AUTO_BED_LEVELING` at the same time. This might soon be implemented though, stay tuned. 11 | 12 | Theory 13 | ------ 14 | 15 | The bed is manually probed in a grid maner. During a print the Z axis compensation will be interpolated within each square using a bi-linear method. Because the grid squares can be tilting in different directions a printing move can be split on the borders of the grid squares. During fast travel moves one can sometimes notice a de-acceleration on these borders. 16 | 17 | Mesh point probing can either be carried out from the display, or by issuing `G29` commands. 18 | 19 | The Z-endstop should be set slightly above the bed. An opto endstop is preferable but a switch with a metal arm that allow some travel though should also work. 20 | 21 | Configuration 22 | ------------- 23 | 24 | In `Configuration.h` there are two options that can be enabled. 25 | 26 | `MESH_BED_LEVELING` will enable mesh bed leveling.
27 | `MANUAL_BED_LEVELING` will add the menu option for bed leveling. 28 | 29 | There are also some values that can be set. 30 | 31 | The following will set the step distance used when manually turning the display encoder. Default is 0.025 32 | 33 | `MBL_Z_STEP` 34 | 35 | Following four define the area to cover. Default 10mm from max bed size 36 | 37 | `MESH_MIN_X`
38 | `MESH_MAX_X`
39 | `MESH_MIN_Y`
40 | `MESH_MAX_Y` 41 | 42 | Following two define the number of points to probe, total number will be these two multiplied. Default is 3x3 points. Don't probe more than 7x7 points (software limited) 43 | 44 | `MESH_NUM_X_POINTS`
45 | `MESH_NUM_Y_POINTS`
46 | 47 | The following will set the Z-endstop height during probing. When initiating a bed leveling probing, a homing will take place and the Z-endstop will be set to this height so lowering through the endstop can take place and the bed should be within this distance. Default is 4mm 48 | 49 | `MESH_HOME_SEARCH_Z` 50 | 51 | The probed points will also be saved in the EEPROM if it has been enables. Otherwise a new probe sequence needs to be made next time the printer has been turned on. 52 | 53 | Probing the bed with the display 54 | -------------------------------- 55 | 56 | If `MANUAL_BED_LEVELING` has been enabled then will a `Level bed` menu option be available in the `Prepare` menu. 57 | 58 | When selecting this option the printer will first do a homing, and then travel to the first probe point. There it will wait. By turning the encoder on the display the hotend can now be lowered until it touches the bed. Using a paper to feel the distance when it gets close. Pressing the encoder/button will store this point and then travel to the next point. Repeating this until all points have been probed. 59 | 60 | If the EEPROM has been enable it can be good to issue a `M500` to get these points saved. 61 | 62 | Issuing a `G29` will return the state of the mesh leveling and report the probed points. 63 | 64 | Probing the bed with G-codes 65 | ---------------------------- 66 | 67 | Probing the bed by G-codes follows the sequence much like doing it with the display. 68 | 69 | `G29` or `G29 S0` will return the state of the bed leveling and report the probed points. Where X=1 Y=1 is the top-left value and X=MESH_NUM_X_POINTS Y=MESH_NUM_Y_POINTS is bottom-right value. X per column and Y per row. 70 | 71 | `G29 S1` will initiate the bed leveling, homing and traveling to the first point to probe. 72 | 73 | Then use your preferred Printer controller program, i.e. Printrun, to lower the hotend until it touches the bed. Using a paper to feel the distance when it gets close. 74 | 75 | `G29 S2` will store the point and travel to the next point until last point has been probed. 76 | 77 | `G29 S3 Xn Yn Zn.nn` will modify a single probed point. This can be used to tweak a badly probed point. Specify probe point where `Xn` and `Yn`, where `n` in `Xn` is between 1 and `MESH_NUM_X_POINTS`. Likewise for `Yn`. `Zn.nn` is the new Z value in that probed point. 78 | 79 | Note 80 | ---- 81 | 82 | Depending how firm feel you aim for on the paper you can use the `Z offset` option in Slic3r to compensate a slight height diff. (I like the paper loose so I needed to put `-0.05` in Slic3r) -------------------------------------------------------------------------------- /Documentation/RampsServoPower.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | __Note for RAMPS users:__ 4 | ---------------------- 5 | 6 | -By default, RAMPS have no power on servo bus (if you happen to have a multimeter, check the voltage on servo power pins). 7 | -In order to get the servo working, you need to supply 5V to 5V pin.. You can do it using your power supply (if it has a 5V output) or jumping the "Vcc" from Arduino to the 5V RAMPS rail. 8 | -These 2 pins are located just between the Reset Button and the yellow fuses... There are marks in the board showing 5V and VCC.. just connect them.. 9 | -If jumping the arduino Vcc do RAMPS 5V rail, take care to not use a power hungry servo, otherwise you will cause a blackout in the arduino board ;-) 10 | -------------------------------------------------------------------------------- /Documentation/changelog.md: -------------------------------------------------------------------------------- 1 | ### Version 1.0.3 2 | * Reduced code size, maybe a lot depending on your configuration. 3 | * Improved support for Delta, SCARA, and COREXY kinematics. 4 | * Move parts of Configuration files to `Conditionals.h` and `SanityCheck.h`. 5 | * Clean up of temperature code. 6 | * Enhanced `G29` with improved grid bed leveling based on Roxy code. See documentation. 7 | * Various bugs fixed from 1.0.2. 8 | * EEPROM layout updated to `V17`. 9 | * Added `M204` travel acceleration options. 10 | * `M204` "`P`" parameter replaces "`S`." "`S`" retained for backward compatibility. 11 | * Support for more RAMPS-based boards. 12 | * Configurator utility under development. 13 | * `M404` "`N`" parameter replaced with "`W`." ("`N`" is for line numbers only). 14 | * Much cleanup of the code. 15 | * Improved support for Cyrillic and accented languages. 16 | * LCD controller knob acceleration. 17 | * Improved compatibility with various sensors, MAX6675 thermocouple. 18 | * Filament runout sensor support. 19 | * Filament width measurement support. 20 | * Support for TMC and L6470 stepper drivers. 21 | * Better support of G-Code `;` comments, `\`, `N` line numbers, and `*` checksums. 22 | * Moved GCode handling code into individual functions per-code. 23 | 24 | ### Version 1.0.2 25 | * Progress bar for character-based LCD displays. 26 | 27 | ### Version 1.0.1 28 | 29 | ### Version 1.0.0 30 | * Initial release 31 | -------------------------------------------------------------------------------- /Marlin/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Marlin 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | it.baeyens.arduinonature 27 | 28 | 29 | 30 | Libraries/LiquidCrystal 31 | 2 32 | ArduinoLibPath/LiquidCrystal 33 | 34 | 35 | Libraries/LiquidCrystal_I2C 36 | 2 37 | ArduinoLibPath/LiquidCrystal_I2C 38 | 39 | 40 | Libraries/LiquidTWI2 41 | 2 42 | ArduinoLibPath/LiquidTWI2 43 | 44 | 45 | Libraries/SPI 46 | 2 47 | ArduinoHardwareLibPath/SPI 48 | 49 | 50 | Libraries/U8glib 51 | 2 52 | ArduinoPrivateLibPath/U8glib 53 | 54 | 55 | Libraries/Wire 56 | 2 57 | ArduinoHardwareLibPath/Wire 58 | 59 | 60 | arduino/core 61 | 2 62 | ArduinoPlatformPath/cores/arduino 63 | 64 | 65 | arduino/variant 66 | 2 67 | ArduinoPinPath/arduino_due_x 68 | 69 | 70 | 71 | 72 | ArduinoHardwareLibPath 73 | file:/home/nico/Tools/arduino-1.5.8/hardware/arduino/sam/libraries 74 | 75 | 76 | ArduinoPinPath 77 | file:/home/nico/Tools/arduino-1.5.8/hardware/arduino/sam/variants 78 | 79 | 80 | ArduinoPlatformPath 81 | file:/home/nico/Tools/arduino-1.5.8/hardware/arduino/sam 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Marlin/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Marlin/Default_Version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a placeholder for a file which could be distributed in an archive 3 | * It takes the place of an automatically created "_Version.h" which is generated during the build process 4 | */ 5 | 6 | // #error "You must specify the following parameter related to your distribution" 7 | 8 | #if true 9 | #define BUILD_VERSION "1.0.3 dev" 10 | #define STRING_DISTRIBUTION_DATE "2015-06-00 12:00" 11 | // It might also be appropriate to define a location where additional information can be found 12 | #define SOURCE_CODE_URL "http:// ..." 13 | #endif -------------------------------------------------------------------------------- /Marlin/Marlin.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Marlin Firmware 3 | * 4 | * Based on Sprinter and grbl. 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | * 20 | * About Marlin 21 | * 22 | * This firmware is a mashup between Sprinter and grbl. 23 | * - https://github.com/kliment/Sprinter 24 | * - https://github.com/simen/grbl/tree 25 | * 26 | * It has preliminary support for Matthew Roberts advance algorithm 27 | * - http://reprap.org/pipermail/reprap-dev/2011-May/003323.html 28 | */ 29 | 30 | /* All the implementation is done in *.cpp files to get better compatibility with avr-gcc without the Arduino IDE */ 31 | /* Use this file to help the Arduino IDE find which Arduino libraries are needed and to keep documentation on GCode */ 32 | 33 | #include "Configuration.h" 34 | #include "pins.h" 35 | 36 | #ifdef ULTRA_LCD 37 | #if defined(LCD_I2C_TYPE_PCF8575) 38 | #include 39 | #include 40 | #elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008) 41 | #include 42 | #include 43 | #elif defined(DOGLCD) 44 | #include // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/) 45 | #else 46 | #include // library for character LCD 47 | #endif 48 | #endif 49 | 50 | #if HAS_DIGIPOTSS 51 | #include 52 | #endif 53 | 54 | #if defined(DIGIPOT_I2C) 55 | #include 56 | #endif 57 | -------------------------------------------------------------------------------- /Marlin/Release/.gitignore: -------------------------------------------------------------------------------- 1 | /Libraries/ 2 | /arduino/ 3 | -------------------------------------------------------------------------------- /Marlin/Release/Marlin.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/Release/Marlin.bin -------------------------------------------------------------------------------- /Marlin/Release/Marlin.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/Release/Marlin.elf -------------------------------------------------------------------------------- /Marlin/Release/arduino.ar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/Release/arduino.ar -------------------------------------------------------------------------------- /Marlin/Release/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm -rf 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include subdir.mk 12 | -include arduino/variant/subdir.mk 13 | -include arduino/core/avr/subdir.mk 14 | -include arduino/core/USB/subdir.mk 15 | -include arduino/core/subdir.mk 16 | -include Libraries/Wire/subdir.mk 17 | -include Libraries/U8glib/utility/subdir.mk 18 | -include Libraries/U8glib/subdir.mk 19 | -include Libraries/SPI/subdir.mk 20 | -include Libraries/LiquidTWI2/subdir.mk 21 | -include Libraries/LiquidCrystal_I2C/subdir.mk 22 | -include Libraries/LiquidCrystal/src/subdir.mk 23 | -include objects.mk 24 | 25 | ifneq ($(MAKECMDGOALS),clean) 26 | ifneq ($(strip $(CC_DEPS)),) 27 | -include $(CC_DEPS) 28 | endif 29 | ifneq ($(strip $(C++_DEPS)),) 30 | -include $(C++_DEPS) 31 | endif 32 | ifneq ($(strip $(C_UPPER_DEPS)),) 33 | -include $(C_UPPER_DEPS) 34 | endif 35 | ifneq ($(strip $(CXX_DEPS)),) 36 | -include $(CXX_DEPS) 37 | endif 38 | ifneq ($(strip $(ASM_DEPS)),) 39 | -include $(ASM_DEPS) 40 | endif 41 | ifneq ($(strip $(INO_DEPS)),) 42 | -include $(INO_DEPS) 43 | endif 44 | ifneq ($(strip $(S_UPPER_DEPS)),) 45 | -include $(S_UPPER_DEPS) 46 | endif 47 | ifneq ($(strip $(CPP_DEPS)),) 48 | -include $(CPP_DEPS) 49 | endif 50 | ifneq ($(strip $(C_DEPS)),) 51 | -include $(C_DEPS) 52 | endif 53 | endif 54 | 55 | -include ../makefile.defs 56 | 57 | # Add inputs and outputs from these tool invocations to the build variables 58 | AR += \ 59 | arduino.ar \ 60 | 61 | ELF += \ 62 | Marlin.elf \ 63 | 64 | EEP += \ 65 | Marlin.eep \ 66 | 67 | FLASH_IMAGE += \ 68 | Marlin.bin \ 69 | 70 | 71 | # All Target 72 | all: Marlin 73 | 74 | # Tool invocations 75 | Marlin: $(FLASH_IMAGE) 76 | @echo 'Building target: $@' 77 | @echo 'Printing size:' 78 | "/home/nico/Tools/arduino-1.5.8/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-size" -A "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/Marlin.elf" 79 | @echo 'Finished building target: $@' 80 | @echo ' ' 81 | 82 | arduino.ar: $(AR_OBJ) 83 | @echo 'Starting archiver' 84 | "/home/nico/Tools/arduino-1.5.8/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-ar" rcs "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/arduino.ar" $(AR_OBJ) 85 | @echo 'Finished building: $@' 86 | @echo ' ' 87 | 88 | Marlin.elf: $(LINK_OBJ) $(AR) 89 | @echo 'Starting combiner' 90 | "/home/nico/Tools/arduino-1.5.8/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gcc" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/home/nico/Tools/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/linker_scripts/gcc/flash.ld" "-Wl,-Map,/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/Marlin.map" -o "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/Marlin.elf" "-L/home/nico/github/wurstnase/Marlin4Due/Marlin/Release" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/arduino/syscalls_sam3.c.o" $(LINK_OBJ) $(AR) "/home/nico/Tools/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a" "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/arduino.ar" -Wl,--end-group -lm -gcc 91 | @echo 'Finished building: $@' 92 | @echo ' ' 93 | 94 | Marlin.eep: $(ELF) 95 | @echo 'Create eeprom image' 96 | ${A.RECIPE.OBJCOPY.EEP.PATTERN} 97 | @echo 'Finished building: $@' 98 | @echo ' ' 99 | 100 | Marlin.bin: $(EEP) 101 | @echo 'Create Flash image (ihex format)' 102 | "/home/nico/Tools/arduino-1.5.8/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/Marlin.elf" "/home/nico/github/wurstnase/Marlin4Due/Marlin/Release/Marlin.bin" 103 | @echo 'Finished building: $@' 104 | @echo ' ' 105 | 106 | # Other Targets 107 | clean: 108 | -$(RM) $(C_UPPER_DEPS)$(C_DEPS)$(AR)$(EEP)$(FLASH_IMAGE)$(CC_DEPS)$(AR_OBJ)$(C++_DEPS)$(LINK_OBJ)$(CXX_DEPS)$(ASM_DEPS)$(INO_DEPS)$(SIZEDUMMY)$(S_UPPER_DEPS)$(ELF)$(CPP_DEPS) Marlin 109 | -@echo ' ' 110 | 111 | .PHONY: all clean dependents 112 | .SECONDARY: 113 | 114 | -include ../makefile.targets 115 | -------------------------------------------------------------------------------- /Marlin/Sd2PinMap.h: -------------------------------------------------------------------------------- 1 | /* Arduino SdFat Library 2 | * Copyright (C) 2010 by William Greiman 3 | * 4 | * This file is part of the Arduino SdFat Library 5 | * 6 | * This Library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This Library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with the Arduino SdFat Library. If not, see 18 | * . 19 | */ 20 | // Warning this file was generated by a program. 21 | #include "Marlin.h" 22 | #ifdef SDSUPPORT 23 | 24 | #ifndef Sd2PinMap_h 25 | #define Sd2PinMap_h 26 | 27 | //Note: use hardware SPI only, soft SPI not supported 28 | uint8_t const SS_PIN = SDSS; 29 | uint8_t const MOSI_PIN = MOSI; 30 | uint8_t const MISO_PIN = MISO; 31 | uint8_t const SCK_PIN = SCK; 32 | 33 | 34 | #endif // Sd2PinMap_h 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /Marlin/SdFatConfig.h: -------------------------------------------------------------------------------- 1 | /* Arduino SdFat Library 2 | * Copyright (C) 2009 by William Greiman 3 | * 4 | * This file is part of the Arduino SdFat Library 5 | * 6 | * This Library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This Library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with the Arduino SdFat Library. If not, see 18 | * . 19 | */ 20 | /** 21 | * \file 22 | * \brief configuration definitions 23 | */ 24 | #include "Marlin.h" 25 | #ifdef SDSUPPORT 26 | 27 | #ifndef SdFatConfig_h 28 | #define SdFatConfig_h 29 | #include 30 | //------------------------------------------------------------------------------ 31 | /** 32 | * To use multiple SD cards set USE_MULTIPLE_CARDS nonzero. 33 | * 34 | * Using multiple cards costs 400 - 500 bytes of flash. 35 | * 36 | * Each card requires about 550 bytes of SRAM so use of a Mega is recommended. 37 | */ 38 | #define USE_MULTIPLE_CARDS 0 39 | //------------------------------------------------------------------------------ 40 | /** 41 | * Call flush for endl if ENDL_CALLS_FLUSH is nonzero 42 | * 43 | * The standard for iostreams is to call flush. This is very costly for 44 | * SdFat. Each call to flush causes 2048 bytes of I/O to the SD. 45 | * 46 | * SdFat has a single 512 byte buffer for SD I/O so it must write the current 47 | * data block to the SD, read the directory block from the SD, update the 48 | * directory entry, write the directory block to the SD and read the data 49 | * block back into the buffer. 50 | * 51 | * The SD flash memory controller is not designed for this many rewrites 52 | * so performance may be reduced by more than a factor of 100. 53 | * 54 | * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force 55 | * all data to be written to the SD. 56 | */ 57 | #define ENDL_CALLS_FLUSH 0 58 | //------------------------------------------------------------------------------ 59 | /** 60 | * Allow use of deprecated functions if ALLOW_DEPRECATED_FUNCTIONS is nonzero 61 | */ 62 | #define ALLOW_DEPRECATED_FUNCTIONS 1 63 | //------------------------------------------------------------------------------ 64 | /** 65 | * Allow FAT12 volumes if FAT12_SUPPORT is nonzero. 66 | * FAT12 has not been well tested. 67 | */ 68 | #define FAT12_SUPPORT 0 69 | 70 | #ifdef ARDUINO_ARCH_AVR 71 | //------------------------------------------------------------------------------ 72 | /** 73 | * SPI init rate for SD initialization commands. Must be 5 (F_CPU/64) 74 | * or 6 (F_CPU/128). 75 | */ 76 | #define SPI_SD_INIT_RATE 5 77 | 78 | #elif defined(ARDUINO_ARCH_SAM) 79 | 80 | #define SPI_SD_INIT_RATE SPI_INIT_SPEED 81 | 82 | #endif 83 | //------------------------------------------------------------------------------ 84 | /** 85 | * Set the SS pin high for hardware SPI. If SS is chip select for another SPI 86 | * device this will disable that device during the SD init phase. 87 | */ 88 | #define SET_SPI_SS_HIGH 1 89 | //------------------------------------------------------------------------------ 90 | /** 91 | * Define MEGA_SOFT_SPI nonzero to use software SPI on Mega Arduinos. 92 | * Pins used are SS 10, MOSI 11, MISO 12, and SCK 13. 93 | * 94 | * MEGA_SOFT_SPI allows an unmodified Adafruit GPS Shield to be used 95 | * on Mega Arduinos. Software SPI works well with GPS Shield V1.1 96 | * but many SD cards will fail with GPS Shield V1.0. 97 | */ 98 | #define MEGA_SOFT_SPI 0 99 | //------------------------------------------------------------------------------ 100 | /** 101 | * Set USE_SOFTWARE_SPI nonzero to always use software SPI. 102 | */ 103 | #define USE_SOFTWARE_SPI 0 104 | // define software SPI pins so Mega can use unmodified 168/328 shields 105 | /** Software SPI chip select pin for the SD */ 106 | uint8_t const SOFT_SPI_CS_PIN = 10; 107 | /** Software SPI Master Out Slave In pin */ 108 | uint8_t const SOFT_SPI_MOSI_PIN = 11; 109 | /** Software SPI Master In Slave Out pin */ 110 | uint8_t const SOFT_SPI_MISO_PIN = 12; 111 | /** Software SPI Clock pin */ 112 | uint8_t const SOFT_SPI_SCK_PIN = 13; 113 | //------------------------------------------------------------------------------ 114 | /** 115 | * The __cxa_pure_virtual function is an error handler that is invoked when 116 | * a pure virtual function is called. 117 | */ 118 | #define USE_CXA_PURE_VIRTUAL 1 119 | 120 | /** Number of UTF-16 characters per entry */ 121 | #define FILENAME_LENGTH 13 122 | 123 | /** 124 | * Defines for long (vfat) filenames 125 | */ 126 | /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */ 127 | #define MAX_VFAT_ENTRIES (2) 128 | /** Total size of the buffer used to store the long filenames */ 129 | #define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1) 130 | #endif // SdFatConfig_h 131 | 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /Marlin/SdFile.cpp: -------------------------------------------------------------------------------- 1 | /* Arduino SdFat Library 2 | * Copyright (C) 2009 by William Greiman 3 | * 4 | * This file is part of the Arduino SdFat Library 5 | * 6 | * This Library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This Library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with the Arduino SdFat Library. If not, see 18 | * . 19 | */ 20 | #include "Marlin.h" 21 | 22 | #ifdef SDSUPPORT 23 | #include "SdFile.h" 24 | /** Create a file object and open it in the current working directory. 25 | * 26 | * \param[in] path A path with a valid 8.3 DOS name for a file to be opened. 27 | * 28 | * \param[in] oflag Values for \a oflag are constructed by a bitwise-inclusive 29 | * OR of open flags. see SdBaseFile::open(SdBaseFile*, const char*, uint8_t). 30 | */ 31 | SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) { 32 | } 33 | //------------------------------------------------------------------------------ 34 | /** Write data to an open file. 35 | * 36 | * \note Data is moved to the cache but may not be written to the 37 | * storage device until sync() is called. 38 | * 39 | * \param[in] buf Pointer to the location of the data to be written. 40 | * 41 | * \param[in] nbyte Number of bytes to write. 42 | * 43 | * \return For success write() returns the number of bytes written, always 44 | * \a nbyte. If an error occurs, write() returns -1. Possible errors 45 | * include write() is called before a file has been opened, write is called 46 | * for a read-only file, device is full, a corrupt file system or an I/O error. 47 | * 48 | */ 49 | int16_t SdFile::write(const void* buf, uint16_t nbyte) { 50 | return SdBaseFile::write(buf, nbyte); 51 | } 52 | //------------------------------------------------------------------------------ 53 | /** Write a byte to a file. Required by the Arduino Print class. 54 | * \param[in] b the byte to be written. 55 | * Use writeError to check for errors. 56 | */ 57 | #if ARDUINO >= 100 58 | size_t SdFile::write(uint8_t b) 59 | { 60 | return SdBaseFile::write(&b, 1); 61 | } 62 | #else 63 | void SdFile::write(uint8_t b) 64 | { 65 | SdBaseFile::write(&b, 1); 66 | } 67 | #endif 68 | //------------------------------------------------------------------------------ 69 | /** Write a string to a file. Used by the Arduino Print class. 70 | * \param[in] str Pointer to the string. 71 | * Use writeError to check for errors. 72 | */ 73 | void SdFile::write(const char* str) { 74 | SdBaseFile::write(str, strlen(str)); 75 | } 76 | //------------------------------------------------------------------------------ 77 | /** Write a PROGMEM string to a file. 78 | * \param[in] str Pointer to the PROGMEM string. 79 | * Use writeError to check for errors. 80 | */ 81 | void SdFile::write_P(PGM_P str) { 82 | for (uint8_t c; (c = pgm_read_byte(str)); str++) write(c); 83 | } 84 | //------------------------------------------------------------------------------ 85 | /** Write a PROGMEM string followed by CR/LF to a file. 86 | * \param[in] str Pointer to the PROGMEM string. 87 | * Use writeError to check for errors. 88 | */ 89 | void SdFile::writeln_P(PGM_P str) { 90 | write_P(str); 91 | write_P(PSTR("\r\n")); 92 | } 93 | 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /Marlin/SdFile.h: -------------------------------------------------------------------------------- 1 | /* Arduino SdFat Library 2 | * Copyright (C) 2009 by William Greiman 3 | * 4 | * This file is part of the Arduino SdFat Library 5 | * 6 | * This Library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This Library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with the Arduino SdFat Library. If not, see 18 | * . 19 | */ 20 | /** 21 | * \file 22 | * \brief SdFile class 23 | */ 24 | #include "Marlin.h" 25 | 26 | #ifdef SDSUPPORT 27 | #include "SdBaseFile.h" 28 | #include 29 | #ifndef SdFile_h 30 | #define SdFile_h 31 | //------------------------------------------------------------------------------ 32 | /** 33 | * \class SdFile 34 | * \brief SdBaseFile with Print. 35 | */ 36 | class SdFile : public SdBaseFile, public Print { 37 | public: 38 | SdFile() {} 39 | SdFile(const char* name, uint8_t oflag); 40 | #if ARDUINO >= 100 41 | size_t write(uint8_t b); 42 | #else 43 | void write(uint8_t b); 44 | #endif 45 | 46 | int16_t write(const void* buf, uint16_t nbyte); 47 | void write(const char* str); 48 | void write_P(PGM_P str); 49 | void writeln_P(PGM_P str); 50 | }; 51 | #endif // SdFile_h 52 | 53 | 54 | #endif -------------------------------------------------------------------------------- /Marlin/ServoTimers.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /* 20 | * Defines for 16 bit timers used with Servo library 21 | * 22 | * If _useTimerX is defined then TimerX is a 16 bit timer on the current board 23 | * timer16_Sequence_t enumerates the sequence that the timers should be allocated 24 | * _Nbr_16timers indicates how many 16 bit timers are available. 25 | */ 26 | 27 | /** 28 | * SAM Only definitions 29 | * -------------------- 30 | */ 31 | 32 | // For SAM3X: 33 | //!#define _useTimer1 34 | //!#define _useTimer2 35 | #define _useTimer3 36 | //!#define _useTimer4 37 | #define _useTimer5 38 | 39 | /* 40 | TC0, chan 0 => TC0_Handler 41 | TC0, chan 1 => TC1_Handler 42 | TC0, chan 2 => TC2_Handler 43 | TC1, chan 0 => TC3_Handler 44 | TC1, chan 1 => TC4_Handler 45 | TC1, chan 2 => TC5_Handler 46 | TC2, chan 0 => TC6_Handler 47 | TC2, chan 1 => TC7_Handler 48 | TC2, chan 2 => TC8_Handler 49 | */ 50 | 51 | #if defined (_useTimer1) 52 | #define TC_FOR_TIMER1 TC1 53 | #define CHANNEL_FOR_TIMER1 0 54 | #define ID_TC_FOR_TIMER1 ID_TC3 55 | #define IRQn_FOR_TIMER1 TC3_IRQn 56 | #define HANDLER_FOR_TIMER1 TC3_Handler 57 | #endif 58 | #if defined (_useTimer2) 59 | #define TC_FOR_TIMER2 TC1 60 | #define CHANNEL_FOR_TIMER2 1 61 | #define ID_TC_FOR_TIMER2 ID_TC4 62 | #define IRQn_FOR_TIMER2 TC4_IRQn 63 | #define HANDLER_FOR_TIMER2 TC4_Handler 64 | #endif 65 | #if defined (_useTimer3) 66 | #define TC_FOR_TIMER3 TC1 67 | #define CHANNEL_FOR_TIMER3 2 68 | #define ID_TC_FOR_TIMER3 ID_TC5 69 | #define IRQn_FOR_TIMER3 TC5_IRQn 70 | #define HANDLER_FOR_TIMER3 TC5_Handler 71 | #endif 72 | #if defined (_useTimer4) 73 | #define TC_FOR_TIMER4 TC0 74 | #define CHANNEL_FOR_TIMER4 2 75 | #define ID_TC_FOR_TIMER4 ID_TC2 76 | #define IRQn_FOR_TIMER4 TC2_IRQn 77 | #define HANDLER_FOR_TIMER4 TC2_Handler 78 | #endif 79 | #if defined (_useTimer5) 80 | #define TC_FOR_TIMER5 TC0 81 | #define CHANNEL_FOR_TIMER5 0 82 | #define ID_TC_FOR_TIMER5 ID_TC0 83 | #define IRQn_FOR_TIMER5 TC0_IRQn 84 | #define HANDLER_FOR_TIMER5 TC0_Handler 85 | #endif 86 | 87 | //typedef enum { _timer1, _timer2, _timer3, _timer4, _timer5, _Nbr_16timers } timer16_Sequence_t ; 88 | typedef enum { _timer3, _timer5, _Nbr_16timers } timer16_Sequence_t ; 89 | 90 | -------------------------------------------------------------------------------- /Marlin/blinkm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | blinkm.cpp - Library for controlling a BlinkM over i2c 3 | Created by Tim Koster, August 21 2013. 4 | */ 5 | #include "Marlin.h" 6 | #ifdef BLINKM 7 | 8 | #include "blinkm.h" 9 | 10 | void SendColors(byte red, byte grn, byte blu) { 11 | Wire.begin(); 12 | Wire.beginTransmission(0x09); 13 | Wire.write('o'); //to disable ongoing script, only needs to be used once 14 | Wire.write('n'); 15 | Wire.write(red); 16 | Wire.write(grn); 17 | Wire.write(blu); 18 | Wire.endTransmission(); 19 | } 20 | 21 | #endif //BLINKM 22 | 23 | -------------------------------------------------------------------------------- /Marlin/blinkm.h: -------------------------------------------------------------------------------- 1 | /* 2 | blinkm.h 3 | Library header file for BlinkM library 4 | */ 5 | 6 | #include "Arduino.h" 7 | #include "Wire.h" 8 | 9 | void SendColors(byte red, byte grn, byte blu); 10 | -------------------------------------------------------------------------------- /Marlin/boards.h: -------------------------------------------------------------------------------- 1 | #ifndef BOARDS_H 2 | #define BOARDS_H 3 | 4 | #define BOARD_UNKNOWN -1 5 | 6 | #ifndef __SAM3X8E__ 7 | #error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu. 8 | #endif 9 | 10 | #define BOARD_RADDS 402 // RADDS 11 | #define BOARD_RAMPS_FD_V1 403 // RAMPS-FD V1 WARNING:If you have a RAMPS_FD_V1 on this guide http://forums.reprap.org/read.php?219,424146,507810, you must use RAMPS_FD_V2 configuration 12 | #define BOARD_RAMPS_FD_V2 404 // RAMPS-FD V2 13 | #define BOARD_RAMPS4DUE 433 // RAMPS4DUE with AndrewBCN's RAMPS mods (http://forums.reprap.org/read.php?219,479626,page=1) 14 | 15 | #define MB(board) (MOTHERBOARD==BOARD_##board) 16 | 17 | #endif //__BOARDS_H 18 | -------------------------------------------------------------------------------- /Marlin/buzzer.cpp: -------------------------------------------------------------------------------- 1 | #include "Marlin.h" 2 | #include "buzzer.h" 3 | #include "ultralcd.h" 4 | 5 | #if HAS_BUZZER 6 | void buzz(long duration, uint16_t freq) { 7 | if (freq > 0) { 8 | #ifdef LCD_USE_I2C_BUZZER 9 | lcd_buzz(duration, freq); 10 | #elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition 11 | SET_OUTPUT(BEEPER); 12 | #ifdef SPEAKER // a speaker needs a AC ore a pulsed DC 13 | //tone(BEEPER, freq, duration); // needs a PWMable pin 14 | unsigned int delay = 1000000 / freq / 2; 15 | int i = duration * freq / 1000; 16 | while (i--) { 17 | WRITE(BEEPER,HIGH); 18 | delayMicroseconds(delay); 19 | WRITE(BEEPER,LOW); 20 | delayMicroseconds(delay); 21 | } 22 | #else // buzzer has its own resonator - needs a DC 23 | WRITE(BEEPER, HIGH); 24 | delay(duration); 25 | WRITE(BEEPER, LOW); 26 | #endif 27 | #else 28 | delay(duration); 29 | #endif 30 | } 31 | else { 32 | delay(duration); 33 | } 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /Marlin/buzzer.h: -------------------------------------------------------------------------------- 1 | #ifndef BUZZER_H 2 | #define BUZZER_H 3 | 4 | #if HAS_BUZZER 5 | void buzz(long duration,uint16_t freq); 6 | #endif 7 | 8 | #endif //BUZZER_H -------------------------------------------------------------------------------- /Marlin/cardreader.h: -------------------------------------------------------------------------------- 1 | #ifndef CARDREADER_H 2 | #define CARDREADER_H 3 | 4 | #ifdef SDSUPPORT 5 | 6 | #define MAX_DIR_DEPTH 10 // Maximum folder depth 7 | 8 | #include "SdFile.h" 9 | enum LsAction { LS_SerialPrint, LS_Count, LS_GetFilename }; 10 | 11 | class CardReader { 12 | public: 13 | CardReader(); 14 | 15 | void initsd(); 16 | void write_command(char *buf); 17 | //files auto[0-9].g on the sd card are performed in a row 18 | //this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset 19 | 20 | void checkautostart(bool x); 21 | void openFile(char* name,bool read,bool replace_current=true); 22 | void openLogFile(char* name); 23 | void removeFile(char* name); 24 | void closefile(bool store_location=false); 25 | void release(); 26 | void startFileprint(); 27 | void pauseSDPrint(); 28 | void getStatus(); 29 | void printingHasFinished(); 30 | 31 | #ifdef LONG_FILENAME_HOST_SUPPORT 32 | void printLongPath(char *path); 33 | #endif 34 | 35 | void getfilename(uint16_t nr, const char* const match=NULL); 36 | uint16_t getnrfilenames(); 37 | 38 | void getAbsFilename(char *t); 39 | 40 | void ls(); 41 | void chdir(const char * relpath); 42 | void updir(); 43 | void setroot(); 44 | 45 | 46 | FORCE_INLINE bool isFileOpen() { return file.isOpen(); } 47 | FORCE_INLINE bool eof() { return sdpos >= filesize; } 48 | FORCE_INLINE int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); } 49 | FORCE_INLINE void setIndex(long index) { sdpos = index; file.seekSet(index); } 50 | FORCE_INLINE uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; } 51 | FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; } 52 | 53 | public: 54 | bool saving, logging, sdprinting, cardOK, filenameIsDir; 55 | char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH]; 56 | int autostart_index; 57 | private: 58 | SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH]; 59 | uint16_t workDirDepth; 60 | Sd2Card card; 61 | SdVolume volume; 62 | SdFile file; 63 | #define SD_PROCEDURE_DEPTH 1 64 | #define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH + MAX_DIR_DEPTH + 1) 65 | uint8_t file_subcall_ctr; 66 | uint32_t filespos[SD_PROCEDURE_DEPTH]; 67 | char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; 68 | uint32_t filesize; 69 | millis_t next_autostart_ms; 70 | uint32_t sdpos; 71 | 72 | bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware. 73 | 74 | LsAction lsAction; //stored for recursion. 75 | uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. 76 | char* diveDirName; 77 | void lsDive(const char *prepend, SdFile parent, const char * const match=NULL); 78 | }; 79 | 80 | extern CardReader card; 81 | 82 | #define IS_SD_PRINTING (card.sdprinting) 83 | 84 | #if (SDCARDDETECT > -1) 85 | #ifdef SDCARDDETECTINVERTED 86 | #define IS_SD_INSERTED (READ(SDCARDDETECT) != 0) 87 | #else 88 | #define IS_SD_INSERTED (READ(SDCARDDETECT) == 0) 89 | #endif 90 | #else 91 | //No card detect line? Assume the card is inserted. 92 | #define IS_SD_INSERTED true 93 | #endif 94 | 95 | #else 96 | 97 | #define IS_SD_PRINTING (false) 98 | 99 | #endif //SDSUPPORT 100 | 101 | #endif //__CARDREADER_H 102 | -------------------------------------------------------------------------------- /Marlin/configuration_store.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURATION_STORE_H 2 | #define CONFIGURATION_STORE_H 3 | 4 | #include "Configuration.h" 5 | 6 | void Config_ResetDefault(); 7 | 8 | #ifndef DISABLE_M503 9 | void Config_PrintSettings(bool forReplay=false); 10 | #else 11 | FORCE_INLINE void Config_PrintSettings(bool forReplay=false) {} 12 | #endif 13 | 14 | #ifdef EEPROM_SETTINGS 15 | void Config_StoreSettings(); 16 | void Config_RetrieveSettings(); 17 | #else 18 | FORCE_INLINE void Config_StoreSettings() {} 19 | FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } 20 | #endif 21 | 22 | #endif //CONFIGURATION_STORE_H 23 | -------------------------------------------------------------------------------- /Marlin/configurator/config/_htaccess: -------------------------------------------------------------------------------- 1 | Header set Access-Control-Allow-Origin "*" 2 | -------------------------------------------------------------------------------- /Marlin/configurator/config/boards.h: -------------------------------------------------------------------------------- 1 | #ifndef BOARDS_H 2 | #define BOARDS_H 3 | 4 | #define BOARD_UNKNOWN -1 5 | 6 | #define BOARD_GEN7_CUSTOM 10 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics" 7 | #define BOARD_GEN7_12 11 // Gen7 v1.1, v1.2 8 | #define BOARD_GEN7_13 12 // Gen7 v1.3 9 | #define BOARD_GEN7_14 13 // Gen7 v1.4 10 | #define BOARD_CHEAPTRONIC 2 // Cheaptronic v1.0 11 | #define BOARD_SETHI 20 // Sethi 3D_1 12 | #define BOARD_RAMPS_OLD 3 // MEGA/RAMPS up to 1.2 13 | #define BOARD_RAMPS_13_EFB 33 // RAMPS 1.3 / 1.4 (Extruder, Fan, Bed) 14 | #define BOARD_RAMPS_13_EEB 34 // RAMPS 1.3 / 1.4 (Extruder0, Extruder1, Bed) 15 | #define BOARD_RAMPS_13_EFF 35 // RAMPS 1.3 / 1.4 (Extruder, Fan, Fan) 16 | #define BOARD_RAMPS_13_EEF 36 // RAMPS 1.3 / 1.4 (Extruder0, Extruder1, Fan) 17 | #define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments 18 | #define BOARD_GEN6 5 // Gen6 19 | #define BOARD_GEN6_DELUXE 51 // Gen6 deluxe 20 | #define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2 21 | #define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above 22 | #define BOARD_MELZI 63 // Melzi 23 | #define BOARD_STB_11 64 // STB V1.1 24 | #define BOARD_AZTEEG_X1 65 // Azteeg X1 25 | #define BOARD_MELZI_1284 66 // Melzi with ATmega1284 (MaKr3d version) 26 | #define BOARD_AZTEEG_X3 67 // Azteeg X3 27 | #define BOARD_AZTEEG_X3_PRO 68 // Azteeg X3 Pro 28 | #define BOARD_ULTIMAKER 7 // Ultimaker 29 | #define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare) 30 | #define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) 31 | #define BOARD_3DRAG 77 // 3Drag 32 | #define BOARD_K8200 78 // Vellemann K8200 (derived from 3Drag) 33 | #define BOARD_TEENSYLU 8 // Teensylu 34 | #define BOARD_RUMBA 80 // Rumba 35 | #define BOARD_PRINTRBOARD 81 // Printrboard (AT90USB1286) 36 | #define BOARD_BRAINWAVE 82 // Brainwave (AT90USB646) 37 | #define BOARD_SAV_MKI 83 // SAV Mk-I (AT90USB1286) 38 | #define BOARD_TEENSY2 84 // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84 make 39 | #define BOARD_GEN3_PLUS 9 // Gen3+ 40 | #define BOARD_GEN3_MONOLITHIC 22 // Gen3 Monolithic Electronics 41 | #define BOARD_MEGATRONICS 70 // Megatronics 42 | #define BOARD_MEGATRONICS_2 701 // Megatronics v2.0 43 | #define BOARD_MEGATRONICS_1 702 // Minitronics v1.0 44 | #define BOARD_MEGATRONICS_3 703 // Megatronics v3.0 45 | #define BOARD_OMCA_A 90 // Alpha OMCA board 46 | #define BOARD_OMCA 91 // Final OMCA board 47 | #define BOARD_RAMBO 301 // Rambo 48 | #define BOARD_ELEFU_3 21 // Elefu Ra Board (v3) 49 | #define BOARD_5DPRINT 88 // 5DPrint D8 Driver Board 50 | #define BOARD_LEAPFROG 999 // Leapfrog 51 | #define BOARD_WITBOX 41 // bq WITBOX 52 | #define BOARD_HEPHESTOS 42 // bq Prusa i3 Hephestos 53 | 54 | #define BOARD_99 99 // This is in pins.h but...? 55 | 56 | #define MB(board) (MOTHERBOARD==BOARD_##board) 57 | #define IS_RAMPS (MB(RAMPS_OLD) || MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF)) 58 | 59 | #endif //__BOARDS_H 60 | -------------------------------------------------------------------------------- /Marlin/configurator/css/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/configurator/css/logo.png -------------------------------------------------------------------------------- /Marlin/configurator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Marlin Firmware Configurator 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |

Marlin Configurator

20 |

Select presets (coming soon), modify, and download.

21 | 22 |
23 |
24 | 25 |
26 | 27 |
28 | 29 | 30 | 31 | Download Zip 32 | 33 |
34 | Machine 35 | 36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
56 | 57 |
58 | Homing 59 |
60 | 61 |
62 | Temperature 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 | 75 |
76 | Extruder 77 |
78 | 79 |
80 | LCD / SD 81 |
82 | 83 |
84 | Bed Leveling 85 |
86 | 87 |
88 | Extras 89 |
90 | 91 |
92 | Info 93 |
94 | 95 |
96 | More… 97 |
98 | 99 |
100 |

Configuration.h

101 | 102 | Download 103 |

104 |         
105 | 106 |
107 |

Configuration_adv.h

108 | 109 | Download 110 |

111 |         
112 | 113 |
114 |
115 |
116 | 117 | 118 | -------------------------------------------------------------------------------- /Marlin/configurator/js/FileSaver.min.js: -------------------------------------------------------------------------------- 1 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ 2 | var saveAs=saveAs||typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator)||function(view){"use strict";if(typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var doc=view.document,get_URL=function(){return view.URL||view.webkitURL||view},save_link=doc.createElementNS("http://www.w3.org/1999/xhtml","a"),can_use_save_link="download"in save_link,click=function(node){var event=doc.createEvent("MouseEvents");event.initMouseEvent("click",true,false,view,0,0,0,0,0,false,false,false,false,0,null);node.dispatchEvent(event)},webkit_req_fs=view.webkitRequestFileSystem,req_fs=view.requestFileSystem||webkit_req_fs||view.mozRequestFileSystem,throw_outside=function(ex){(view.setImmediate||view.setTimeout)(function(){throw ex},0)},force_saveable_type="application/octet-stream",fs_min_size=0,arbitrary_revoke_timeout=500,revoke=function(file){var revoker=function(){if(typeof file==="string"){get_URL().revokeObjectURL(file)}else{file.remove()}};if(view.chrome){revoker()}else{setTimeout(revoker,arbitrary_revoke_timeout)}},dispatch=function(filesaver,event_types,event){event_types=[].concat(event_types);var i=event_types.length;while(i--){var listener=filesaver["on"+event_types[i]];if(typeof listener==="function"){try{listener.call(filesaver,event||filesaver)}catch(ex){throw_outside(ex)}}}},FileSaver=function(blob,name){var filesaver=this,type=blob.type,blob_changed=false,object_url,target_view,dispatch_all=function(){dispatch(filesaver,"writestart progress write writeend".split(" "))},fs_error=function(){if(blob_changed||!object_url){object_url=get_URL().createObjectURL(blob)}if(target_view){target_view.location.href=object_url}else{var new_tab=view.open(object_url,"_blank");if(new_tab==undefined&&typeof safari!=="undefined"){view.location.href=object_url}}filesaver.readyState=filesaver.DONE;dispatch_all();revoke(object_url)},abortable=function(func){return function(){if(filesaver.readyState!==filesaver.DONE){return func.apply(this,arguments)}}},create_if_not_found={create:true,exclusive:false},slice;filesaver.readyState=filesaver.INIT;if(!name){name="download"}if(can_use_save_link){object_url=get_URL().createObjectURL(blob);save_link.href=object_url;save_link.download=name;click(save_link);filesaver.readyState=filesaver.DONE;dispatch_all();revoke(object_url);return}if(view.chrome&&type&&type!==force_saveable_type){slice=blob.slice||blob.webkitSlice;blob=slice.call(blob,0,blob.size,force_saveable_type);blob_changed=true}if(webkit_req_fs&&name!=="download"){name+=".download"}if(type===force_saveable_type||webkit_req_fs){target_view=view}if(!req_fs){fs_error();return}fs_min_size+=blob.size;req_fs(view.TEMPORARY,fs_min_size,abortable(function(fs){fs.root.getDirectory("saved",create_if_not_found,abortable(function(dir){var save=function(){dir.getFile(name,create_if_not_found,abortable(function(file){file.createWriter(abortable(function(writer){writer.onwriteend=function(event){target_view.location.href=file.toURL();filesaver.readyState=filesaver.DONE;dispatch(filesaver,"writeend",event);revoke(file)};writer.onerror=function(){var error=writer.error;if(error.code!==error.ABORT_ERR){fs_error()}};"writestart progress write abort".split(" ").forEach(function(event){writer["on"+event]=filesaver["on"+event]});writer.write(blob);filesaver.abort=function(){writer.abort();filesaver.readyState=filesaver.DONE};filesaver.readyState=filesaver.WRITING}),fs_error)}),fs_error)};dir.getFile(name,{create:false},abortable(function(file){file.remove();save()}),abortable(function(ex){if(ex.code===ex.NOT_FOUND_ERR){save()}else{fs_error()}}))}),fs_error)}),fs_error)},FS_proto=FileSaver.prototype,saveAs=function(blob,name){return new FileSaver(blob,name)};FS_proto.abort=function(){var filesaver=this;filesaver.readyState=filesaver.DONE;dispatch(filesaver,"abort")};FS_proto.readyState=FS_proto.INIT=0;FS_proto.WRITING=1;FS_proto.DONE=2;FS_proto.error=FS_proto.onwritestart=FS_proto.onprogress=FS_proto.onwrite=FS_proto.onabort=FS_proto.onerror=FS_proto.onwriteend=null;return saveAs}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!=null){define([],function(){return saveAs})} 3 | -------------------------------------------------------------------------------- /Marlin/configurator/js/binaryfileuploader.js: -------------------------------------------------------------------------------- 1 | function BinaryFileUploader(o) { 2 | this.options = null; 3 | 4 | 5 | this._defaultOptions = { 6 | element: null, // HTML file element 7 | onFileLoad: function(file) { 8 | console.log(file.toString()); 9 | } 10 | }; 11 | 12 | 13 | this._init = function(o) { 14 | if (!this.hasFileUploaderSupport()) return; 15 | 16 | this._verifyDependencies(); 17 | 18 | this.options = this._mergeObjects(this._defaultOptions, o); 19 | this._verifyOptions(); 20 | 21 | this.addFileChangeListener(); 22 | } 23 | 24 | 25 | this.hasFileUploaderSupport = function() { 26 | return !!(window.File && window.FileReader && window.FileList && window.Blob); 27 | } 28 | 29 | this.addFileChangeListener = function() { 30 | this.options.element.addEventListener( 31 | 'change', 32 | this._bind(this, this.onFileChange) 33 | ); 34 | } 35 | 36 | this.onFileChange = function(e) { 37 | // TODO accept multiple files 38 | var file = e.target.files[0], 39 | reader = new FileReader(); 40 | 41 | reader.onload = this._bind(this, this.onFileLoad); 42 | reader.readAsBinaryString(file); 43 | } 44 | 45 | this.onFileLoad = function(e) { 46 | var content = e.target.result, 47 | string = new BinaryString(content); 48 | this.options.onFileLoad(string); 49 | } 50 | 51 | 52 | this._mergeObjects = function(starting, override) { 53 | var merged = starting; 54 | for (key in override) merged[key] = override[key]; 55 | 56 | return merged; 57 | } 58 | 59 | this._verifyOptions = function() { 60 | if (!(this.options.element && this.options.element.type && this.options.element.type === 'file')) { 61 | throw 'Invalid element param in options. Must be a file upload DOM element'; 62 | } 63 | 64 | if (typeof this.options.onFileLoad !== 'function') { 65 | throw 'Invalid onFileLoad param in options. Must be a function'; 66 | } 67 | } 68 | 69 | this._verifyDependencies = function() { 70 | if (!window.BinaryString) throw 'BinaryString is missing. Check that you\'ve correctly included it'; 71 | } 72 | 73 | // helper function for binding methods to objects 74 | this._bind = function(object, method) { 75 | return function() {return method.apply(object, arguments);}; 76 | } 77 | 78 | this._init(o); 79 | } 80 | -------------------------------------------------------------------------------- /Marlin/configurator/js/binarystring.js: -------------------------------------------------------------------------------- 1 | function BinaryString(source) { 2 | this._source = null; 3 | this._bytes = []; 4 | this._pos = 0; 5 | this._length = 0; 6 | 7 | this._init = function(source) { 8 | this._source = source; 9 | this._bytes = this._stringToBytes(this._source); 10 | this._length = this._bytes.length; 11 | } 12 | 13 | this.current = function() {return this._pos;} 14 | 15 | this.rewind = function() {return this.jump(0);} 16 | this.end = function() {return this.jump(this.length() - 1);} 17 | this.next = function() {return this.jump(this.current() + 1);} 18 | this.prev = function() {return this.jump(this.current() - 1);} 19 | 20 | this.jump = function(pos) { 21 | if (pos < 0 || pos >= this.length()) return false; 22 | 23 | this._pos = pos; 24 | return true; 25 | } 26 | 27 | this.readByte = function(pos) { 28 | pos = (typeof pos == 'number') ? pos : this.current(); 29 | return this.readBytes(1, pos)[0]; 30 | } 31 | 32 | this.readBytes = function(length, pos) { 33 | length = length || 1; 34 | pos = (typeof pos == 'number') ? pos : this.current(); 35 | 36 | if (pos > this.length() || 37 | pos < 0 || 38 | length <= 0 || 39 | pos + length > this.length() || 40 | pos + length < 0 41 | ) { 42 | return false; 43 | } 44 | 45 | var bytes = []; 46 | 47 | for (var i = pos; i < pos + length; i++) { 48 | bytes.push(this._bytes[i]); 49 | } 50 | 51 | return bytes; 52 | } 53 | 54 | this.length = function() {return this._length;} 55 | 56 | this.toString = function() { 57 | var string = '', 58 | length = this.length(); 59 | 60 | for (var i = 0; i < length; i++) { 61 | string += String.fromCharCode(this.readByte(i)); 62 | } 63 | 64 | return string; 65 | } 66 | 67 | this.toUtf8 = function() { 68 | var inc = 0, 69 | string = '', 70 | length = this.length(); 71 | 72 | // determine if first 3 characters are the BOM 73 | // then skip them in output if so 74 | if (length >= 3 && 75 | this.readByte(0) === 0xEF && 76 | this.readByte(1) === 0xBB && 77 | this.readByte(2) === 0xBF 78 | ) { 79 | inc = 3; 80 | } 81 | 82 | for (; inc < length; inc++) { 83 | var byte1 = this.readByte(inc), 84 | byte2 = 0, 85 | byte3 = 0, 86 | byte4 = 0, 87 | code1 = 0, 88 | code2 = 0, 89 | point = 0; 90 | 91 | switch (true) { 92 | // single byte character; same as ascii 93 | case (byte1 < 0x80): 94 | code1 = byte1; 95 | break; 96 | 97 | // 2 byte character 98 | case (byte1 >= 0xC2 && byte1 < 0xE0): 99 | byte2 = this.readByte(++inc); 100 | 101 | code1 = ((byte1 & 0x1F) << 6) + 102 | (byte2 & 0x3F); 103 | break; 104 | 105 | // 3 byte character 106 | case (byte1 >= 0xE0 && byte1 < 0xF0): 107 | byte2 = this.readByte(++inc); 108 | byte3 = this.readByte(++inc); 109 | 110 | code1 = ((byte1 & 0xFF) << 12) + 111 | ((byte2 & 0x3F) << 6) + 112 | (byte3 & 0x3F); 113 | break; 114 | 115 | // 4 byte character 116 | case (byte1 >= 0xF0 && byte1 < 0xF5): 117 | byte2 = this.readByte(++inc); 118 | byte3 = this.readByte(++inc); 119 | byte4 = this.readByte(++inc); 120 | 121 | point = ((byte1 & 0x07) << 18) + 122 | ((byte2 & 0x3F) << 12) + 123 | ((byte3 & 0x3F) << 6) + 124 | (byte4 & 0x3F) 125 | point -= 0x10000; 126 | 127 | code1 = (point >> 10) + 0xD800; 128 | code2 = (point & 0x3FF) + 0xDC00; 129 | break; 130 | 131 | default: 132 | throw 'Invalid byte ' + this._byteToString(byte1) + ' whilst converting to UTF-8'; 133 | break; 134 | } 135 | 136 | string += (code2) ? String.fromCharCode(code1, code2) 137 | : String.fromCharCode(code1); 138 | } 139 | 140 | return string; 141 | } 142 | 143 | this.toArray = function() {return this.readBytes(this.length() - 1, 0);} 144 | 145 | 146 | this._stringToBytes = function(str) { 147 | var bytes = [], 148 | chr = 0; 149 | 150 | for (var i = 0; i < str.length; i++) { 151 | chr = str.charCodeAt(i); 152 | bytes.push(chr & 0xFF); 153 | } 154 | 155 | return bytes; 156 | } 157 | 158 | this._byteToString = function(byte) { 159 | var asString = byte.toString(16).toUpperCase(); 160 | while (asString.length < 2) { 161 | asString = '0' + asString; 162 | } 163 | 164 | return '0x' + asString; 165 | } 166 | 167 | this._init(source); 168 | } 169 | -------------------------------------------------------------------------------- /Marlin/digipot_mcp4451.cpp: -------------------------------------------------------------------------------- 1 | #include "Configuration.h" 2 | 3 | #ifdef DIGIPOT_I2C 4 | 5 | #include "Stream.h" 6 | #include "utility/twi.h" 7 | #include "Wire.h" 8 | 9 | // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro 10 | #if MB(5DPRINT) 11 | #define DIGIPOT_I2C_FACTOR 117.96 12 | #define DIGIPOT_I2C_MAX_CURRENT 1.736 13 | #else 14 | #define DIGIPOT_I2C_FACTOR 106.7 15 | #define DIGIPOT_I2C_MAX_CURRENT 2.5 16 | #endif 17 | 18 | static byte current_to_wiper(float current) { 19 | return byte(ceil(float((DIGIPOT_I2C_FACTOR*current)))); 20 | } 21 | 22 | static void i2c_send(byte addr, byte a, byte b) { 23 | Wire.beginTransmission(addr); 24 | Wire.write(a); 25 | Wire.write(b); 26 | Wire.endTransmission(); 27 | } 28 | 29 | // This is for the MCP4451 I2C based digipot 30 | void digipot_i2c_set_current(int channel, float current) { 31 | current = min( (float) max( current, 0.0f ), DIGIPOT_I2C_MAX_CURRENT); 32 | // these addresses are specific to Azteeg X3 Pro, can be set to others, 33 | // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1 34 | byte addr = 0x2C; // channel 0-3 35 | if (channel >= 4) { 36 | addr = 0x2E; // channel 4-7 37 | channel -= 4; 38 | } 39 | 40 | // Initial setup 41 | i2c_send(addr, 0x40, 0xff); 42 | i2c_send(addr, 0xA0, 0xff); 43 | 44 | // Set actual wiper value 45 | byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 }; 46 | i2c_send(addr, addresses[channel], current_to_wiper(current)); 47 | } 48 | 49 | void digipot_i2c_init() { 50 | const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS; 51 | Wire.begin(); 52 | // setup initial currents as defined in Configuration_adv.h 53 | for(int i = 0; i < COUNT(digipot_motor_current); i++) { 54 | digipot_i2c_set_current(i, digipot_motor_current[i]); 55 | } 56 | } 57 | 58 | #endif //DIGIPOT_I2C 59 | -------------------------------------------------------------------------------- /Marlin/dogm_font_data_Marlin_symbols.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fontname: Marlin_symbols 3 | Copyright: Created with Fony 1.4.7 4 | Capital A Height: 0, '1' Height: 0 5 | Calculated Max Values w= 5 h=10 x= 0 y= 3 dx= 6 dy= 0 ascent= 8 len=10 6 | Font Bounding box w= 6 h= 9 x= 0 y=-2 7 | Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 8 | Pure Font ascent = 0 descent= 0 9 | X Font ascent = 0 descent= 0 10 | Max Font ascent = 8 descent=-2 11 | */ 12 | #include 13 | const u8g_fntpgm_uint8_t Marlin_symbols[140] U8G_SECTION(".progmem.Marlin_symbols") = { 14 | 0,6,9,0,254,0,0,0,0,0,1,9,0,8,254,0, 15 | 0,5,8,8,6,0,0,64,240,200,136,136,152,120,16,5, 16 | 8,8,6,0,0,192,248,136,136,136,136,136,248,5,5,5, 17 | 6,0,1,32,48,248,48,32,5,8,8,6,0,0,32,112, 18 | 248,32,32,32,32,224,5,9,9,6,0,255,32,112,168,168, 19 | 184,136,136,112,32,5,9,9,6,0,255,224,128,192,176,168, 20 | 40,48,40,40,5,9,9,6,0,255,248,168,136,136,136,136, 21 | 136,168,248,5,10,10,6,0,254,32,80,80,80,80,136,168, 22 | 168,136,112,3,3,3,6,0,3,64,160,64}; 23 | -------------------------------------------------------------------------------- /Marlin/fonts/HD44780_C.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/HD44780_C.fon -------------------------------------------------------------------------------- /Marlin/fonts/HD44780_J.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/HD44780_J.fon -------------------------------------------------------------------------------- /Marlin/fonts/HD44780_W.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/HD44780_W.fon -------------------------------------------------------------------------------- /Marlin/fonts/ISO10646-1.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/ISO10646-1.fon -------------------------------------------------------------------------------- /Marlin/fonts/ISO10646-5_Cyrillic.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/ISO10646-5_Cyrillic.fon -------------------------------------------------------------------------------- /Marlin/fonts/ISO10646_Kana.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/ISO10646_Kana.fon -------------------------------------------------------------------------------- /Marlin/fonts/Marlin_symbols.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/Marlin_symbols.fon -------------------------------------------------------------------------------- /Marlin/fonts/README.fonts: -------------------------------------------------------------------------------- 1 | The fonts are created with Fony.exe (http://hukka.ncn.fi/?fony) because Fontforge didn't do what I want (probably lack off experience). 2 | In Fony export the fonts to bdf-format. Maybe another one can edit them with Fontforge. 3 | Then run make_fonts.bat what calls bdf2u8g.exe with the needed parameters to produce the .h files. 4 | The .h files must be edited to replace '#include "u8g.h"' with '#include ', replace 'U8G_FONT_SECTION' with 'U8G_SECTION', insert '.progmem.' right behind the first '"' and moved to the main directory. 5 | 6 | Especially the Kana and Cyrillic fonts should be revised by someone who knows what he/she does. I am only a west-European with very little knowledge about this scripts. 7 | -------------------------------------------------------------------------------- /Marlin/fonts/bdf2u8g.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonnico/Marlin4Due/4f3d1ece2648d0db4262336d7748fbed320b576d/Marlin/fonts/bdf2u8g.exe -------------------------------------------------------------------------------- /Marlin/fonts/make_fonts.bat: -------------------------------------------------------------------------------- 1 | .\bdf2u8g.exe -b 1 -e 9 Marlin_symbols.bdf Marlin_symbols dogm_font_data_Marlin_symbols.h 2 | .\bdf2u8g.exe -b 16 -e 255 HD44780_W.bdf HD44780_W_5x7 dogm_font_data_HD44780_W.h 3 | .\bdf2u8g.exe -b 32 -e 255 HD44780_C.bdf HD44780_C_5x7 dogm_font_data_HD44780_C.h 4 | .\bdf2u8g.exe -b 32 -e 255 HD44780_J.bdf HD44780_J_5x7 dogm_font_data_HD44780_J.h 5 | .\bdf2u8g.exe -b 32 -e 255 ISO10646-1.bdf ISO10646_1_5x7 dogm_font_data_ISO10646_1.h 6 | .\bdf2u8g.exe -b 32 -e 255 ISO10646_5_Cyrillic.bdf ISO10646_5_Cyrillic_5x7 dogm_font_data_ISO10646_5_Cyrillic.h 7 | .\bdf2u8g.exe -b 32 -e 255 ISO10646_Kana.bdf ISO10646_Kana_5x7 dogm_font_data_ISO10646_Kana.h 8 | -------------------------------------------------------------------------------- /Marlin/fsr_sensor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * fsr_sensor.cpp 3 | * 4 | * Created on: 05.07.2015 5 | * Author: nico 6 | */ 7 | 8 | #include "Marlin.h" 9 | #include "fsr_sensor.h" 10 | 11 | #define SHORT_SIZE 8 12 | #define LONG_SIZE 16 13 | #define LONG_INTERVAL (2000 / LONG_SIZE) 14 | #define THRESHOLD 0.8 15 | 16 | #define FSR_PIN TEMP_1_PIN 17 | 18 | millis_t lastLongTime; 19 | uint16_t longSamples[LONG_SIZE]; 20 | uint8_t longIndex = 0; 21 | uint16_t longAverage = 0; 22 | 23 | uint16_t shortSamples[SHORT_SIZE]; 24 | uint8_t averageIndex = 0; 25 | 26 | void init_fsr_values() 27 | { 28 | for (int i = 0; i < SHORT_SIZE; i++) 29 | shortSamples[i] = 0; 30 | 31 | for (int i = 0; i < LONG_SIZE; i++) 32 | longSamples[i] = 0; 33 | 34 | lastLongTime = millis(); 35 | } 36 | 37 | uint16_t UpdateLongSamples(int avg) { 38 | // 39 | // If enough time hasn't passed, just return the last value 40 | // 41 | millis_t current = millis(); 42 | if (current - lastLongTime <= LONG_INTERVAL) 43 | return longAverage; 44 | 45 | // 46 | // Update the log sample with the new value, and then update the long average 47 | // 48 | longSamples[longIndex++] = avg; 49 | if (longIndex >= LONG_SIZE) 50 | longIndex = 0; 51 | 52 | uint16_t total = 0; 53 | for (int i = 0; i < LONG_SIZE; i++) 54 | total += longSamples[i]; 55 | 56 | longAverage = total / LONG_SIZE; 57 | 58 | lastLongTime = millis(); 59 | return longAverage; 60 | } 61 | 62 | bool CheckIfTriggered() { 63 | uint16_t total = 0; 64 | for (int i = 0; i < SHORT_SIZE; i++) 65 | total += shortSamples[i]; 66 | 67 | uint16_t avg = total / SHORT_SIZE; 68 | 69 | uint16_t longAverage = UpdateLongSamples(avg); 70 | 71 | uint16_t threshold = THRESHOLD * longAverage; 72 | 73 | bool triggered = avg < threshold; 74 | return triggered; 75 | } 76 | 77 | bool get_fsr_value() { 78 | int value = getAdcFreerun(pinToAdcChannel(FSR_PIN), true); 79 | 80 | shortSamples[averageIndex++] = value; 81 | if (averageIndex >= SHORT_SIZE) 82 | averageIndex = 0; 83 | 84 | return CheckIfTriggered(); 85 | } 86 | -------------------------------------------------------------------------------- /Marlin/fsr_sensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fsr_sensor.h 3 | * 4 | * Created on: 05.07.2015 5 | * Author: nico 6 | */ 7 | 8 | #ifndef FSR_SENSOR_H_ 9 | #define FSR_SENSOR_H_ 10 | 11 | bool get_fsr_value(); 12 | void init_fsr_values(); 13 | 14 | #endif /* FSR_SENSOR_H_ */ 15 | -------------------------------------------------------------------------------- /Marlin/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef MACROS_H 2 | #define MACROS_H 3 | 4 | // Macros for bit masks 5 | #define BIT(b) (1<<(b)) 6 | #define TEST(n,b) (((n)&BIT(b))!=0) 7 | #define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b)) 8 | 9 | // Macros for maths shortcuts 10 | #define RADIANS(d) ((d)*M_PI/180.0) 11 | #define DEGREES(r) ((r)*180.0/M_PI) 12 | 13 | // Macros to contrain values 14 | #define NOLESS(v,n) do{ if (v < n) v = n; }while(0) 15 | #define NOMORE(v,n) do{ if (v > n) v = n; }while(0) 16 | 17 | // Macros to support option testing 18 | #define _CAT(a, ...) a ## __VA_ARGS__ 19 | #define SWITCH_ENABLED_0 0 20 | #define SWITCH_ENABLED_1 1 21 | #define SWITCH_ENABLED_ 1 22 | #define ENABLED(b) _CAT(SWITCH_ENABLED_, b) 23 | #define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b)) 24 | 25 | #define COUNT(a) (sizeof(a)/sizeof(*a)) 26 | 27 | #endif //__MACROS_H 28 | -------------------------------------------------------------------------------- /Marlin/mesh_bed_leveling.cpp: -------------------------------------------------------------------------------- 1 | #include "mesh_bed_leveling.h" 2 | 3 | #ifdef MESH_BED_LEVELING 4 | 5 | mesh_bed_leveling mbl; 6 | 7 | mesh_bed_leveling::mesh_bed_leveling() { reset(); } 8 | 9 | void mesh_bed_leveling::reset() { 10 | active = 0; 11 | for (int y = 0; y < MESH_NUM_Y_POINTS; y++) 12 | for (int x = 0; x < MESH_NUM_X_POINTS; x++) 13 | z_values[y][x] = 0; 14 | } 15 | 16 | #endif // MESH_BED_LEVELING 17 | -------------------------------------------------------------------------------- /Marlin/mesh_bed_leveling.h: -------------------------------------------------------------------------------- 1 | #include "Marlin.h" 2 | 3 | #ifdef MESH_BED_LEVELING 4 | 5 | #define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1)) 6 | #define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1)) 7 | 8 | class mesh_bed_leveling { 9 | public: 10 | uint8_t active; 11 | float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS]; 12 | 13 | mesh_bed_leveling(); 14 | 15 | void reset(); 16 | 17 | float get_x(int i) { return MESH_MIN_X + MESH_X_DIST * i; } 18 | float get_y(int i) { return MESH_MIN_Y + MESH_Y_DIST * i; } 19 | void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; } 20 | 21 | int select_x_index(float x) { 22 | int i = 1; 23 | while (x > get_x(i) && i < MESH_NUM_X_POINTS-1) i++; 24 | return i - 1; 25 | } 26 | 27 | int select_y_index(float y) { 28 | int i = 1; 29 | while (y > get_y(i) && i < MESH_NUM_Y_POINTS - 1) i++; 30 | return i - 1; 31 | } 32 | 33 | float calc_z0(float a0, float a1, float z1, float a2, float z2) { 34 | float delta_z = (z2 - z1)/(a2 - a1); 35 | float delta_a = a0 - a1; 36 | return z1 + delta_a * delta_z; 37 | } 38 | 39 | float get_z(float x0, float y0) { 40 | int x_index = select_x_index(x0); 41 | int y_index = select_y_index(y0); 42 | float z1 = calc_z0(x0, 43 | get_x(x_index), z_values[y_index][x_index], 44 | get_x(x_index+1), z_values[y_index][x_index+1]); 45 | float z2 = calc_z0(x0, 46 | get_x(x_index), z_values[y_index+1][x_index], 47 | get_x(x_index+1), z_values[y_index+1][x_index+1]); 48 | float z0 = calc_z0(y0, 49 | get_y(y_index), z1, 50 | get_y(y_index+1), z2); 51 | return z0; 52 | } 53 | }; 54 | 55 | extern mesh_bed_leveling mbl; 56 | 57 | #endif // MESH_BED_LEVELING 58 | -------------------------------------------------------------------------------- /Marlin/pins.h: -------------------------------------------------------------------------------- 1 | /** 2 | * pins.h 3 | */ 4 | 5 | #ifndef PINS_H 6 | #define PINS_H 7 | 8 | // Preset optional pins 9 | #define X_MS1_PIN -1 10 | #define X_MS2_PIN -1 11 | #define Y_MS1_PIN -1 12 | #define Y_MS2_PIN -1 13 | #define Z_MS1_PIN -1 14 | #define Z_MS2_PIN -1 15 | #define E0_MS1_PIN -1 16 | #define E0_MS2_PIN -1 17 | #define E1_MS1_PIN -1 18 | #define E1_MS2_PIN -1 19 | #define DIGIPOTSS_PIN -1 20 | #define HEATER_3_PIN -1 21 | #define TEMP_3_PIN -1 22 | 23 | #if MB(RADDS) 24 | #include "pins_RADDS.h" 25 | #elif MB(RAMPS_FD_V1) || MB(RAMPS_FD_V2) 26 | #include "pins_RAMPS_FD.h" 27 | #elif MB(RAMPS4DUE) 28 | #include "pins_RAMPS4DUE.h" 29 | #else 30 | #error Unknown MOTHERBOARD value set in Configuration.h 31 | #endif 32 | 33 | // List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! 34 | #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, analogInputToDigitalPin(TEMP_0_PIN), 35 | #define _E1_PINS 36 | #define _E2_PINS 37 | #define _E3_PINS 38 | 39 | #if EXTRUDERS > 1 40 | #undef _E1_PINS 41 | #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, analogInputToDigitalPin(TEMP_1_PIN), 42 | #if EXTRUDERS > 2 43 | #undef _E2_PINS 44 | #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, analogInputToDigitalPin(TEMP_2_PIN), 45 | #if EXTRUDERS > 3 46 | #undef _E3_PINS 47 | #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, analogInputToDigitalPin(TEMP_3_PIN), 48 | #endif 49 | #endif 50 | #endif 51 | 52 | #ifdef X_STOP_PIN 53 | #if X_HOME_DIR < 0 54 | #define X_MIN_PIN X_STOP_PIN 55 | #define X_MAX_PIN -1 56 | #else 57 | #define X_MIN_PIN -1 58 | #define X_MAX_PIN X_STOP_PIN 59 | #endif 60 | #endif 61 | 62 | #ifdef Y_STOP_PIN 63 | #if Y_HOME_DIR < 0 64 | #define Y_MIN_PIN Y_STOP_PIN 65 | #define Y_MAX_PIN -1 66 | #else 67 | #define Y_MIN_PIN -1 68 | #define Y_MAX_PIN Y_STOP_PIN 69 | #endif 70 | #endif 71 | 72 | #ifdef Z_STOP_PIN 73 | #if Z_HOME_DIR < 0 74 | #define Z_MIN_PIN Z_STOP_PIN 75 | #define Z_MAX_PIN -1 76 | #else 77 | #define Z_MIN_PIN -1 78 | #define Z_MAX_PIN Z_STOP_PIN 79 | #endif 80 | #endif 81 | 82 | #ifdef DISABLE_MAX_ENDSTOPS 83 | #undef X_MAX_PIN 84 | #undef Y_MAX_PIN 85 | #undef Z_MAX_PIN 86 | #define X_MAX_PIN -1 87 | #define Y_MAX_PIN -1 88 | #define Z_MAX_PIN -1 89 | #endif 90 | 91 | #ifdef DISABLE_MIN_ENDSTOPS 92 | #undef X_MIN_PIN 93 | #undef Y_MIN_PIN 94 | #undef Z_MIN_PIN 95 | #define X_MIN_PIN -1 96 | #define Y_MIN_PIN -1 97 | #define Z_MIN_PIN -1 98 | #endif 99 | 100 | #if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting. 101 | #undef Z_PROBE_PIN 102 | #define Z_PROBE_PIN -1 103 | #endif 104 | 105 | #ifdef DISABLE_XMAX_ENDSTOP 106 | #undef X_MAX_PIN 107 | #define X_MAX_PIN -1 108 | #endif 109 | 110 | #ifdef DISABLE_XMIN_ENDSTOP 111 | #undef X_MIN_PIN 112 | #define X_MIN_PIN -1 113 | #endif 114 | 115 | #ifdef DISABLE_YMAX_ENDSTOP 116 | #define Y_MAX_PIN -1 117 | #endif 118 | 119 | #ifdef DISABLE_YMIN_ENDSTOP 120 | #undef Y_MIN_PIN 121 | #define Y_MIN_PIN -1 122 | #endif 123 | 124 | #ifdef DISABLE_ZMAX_ENDSTOP 125 | #undef Z_MAX_PIN 126 | #define Z_MAX_PIN -1 127 | #endif 128 | 129 | #ifdef DISABLE_ZMIN_ENDSTOP 130 | #undef Z_MIN_PIN 131 | #define Z_MIN_PIN -1 132 | #endif 133 | 134 | #define SENSITIVE_PINS { 0, 1, \ 135 | X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ 136 | Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \ 137 | Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_PROBE_PIN, \ 138 | PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, \ 139 | _E0_PINS _E1_PINS _E2_PINS _E3_PINS \ 140 | analogInputToDigitalPin(TEMP_BED_PIN) \ 141 | } 142 | 143 | #define HAS_DIGIPOTSS (DIGIPOTSS_PIN >= 0) 144 | 145 | #endif //__PINS_H 146 | 147 | -------------------------------------------------------------------------------- /Marlin/pins_RADDS.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * Arduino Due pin assignment 3 | * 4 | * for RADDS 5 | ****************************************************************************************/ 6 | 7 | #define X_STEP_PIN_ORIGIN 24 8 | #define X_DIR_PIN_ORIGIN 23 9 | #define X_ENABLE_PIN_ORIGIN 26 10 | 11 | #define Y_STEP_PIN_ORIGIN 17 12 | #define Y_DIR_PIN_ORIGIN 16 13 | #define Y_ENABLE_PIN_ORIGIN 22 14 | 15 | #define DIR_STD_XY 16 | 17 | #ifdef DIR_STD_XY 18 | #define X_STEP_PIN X_STEP_PIN_ORIGIN 19 | #define X_DIR_PIN X_DIR_PIN_ORIGIN 20 | #define X_ENABLE_PIN X_ENABLE_PIN_ORIGIN 21 | 22 | #define Y_STEP_PIN Y_STEP_PIN_ORIGIN 23 | #define Y_DIR_PIN Y_DIR_PIN_ORIGIN 24 | #define Y_ENABLE_PIN Y_ENABLE_PIN_ORIGIN 25 | #endif 26 | #ifdef DIR_STD_YX 27 | #define X_STEP_PIN Y_STEP_PIN_ORIGIN 28 | #define X_DIR_PIN Y_DIR_PIN_ORIGIN 29 | #define X_ENABLE_PIN Y_ENABLE_PIN_ORIGIN 30 | 31 | #define Y_STEP_PIN X_STEP_PIN_ORIGIN 32 | #define Y_DIR_PIN X_DIR_PIN_ORIGIN 33 | #define Y_ENABLE_PIN X_ENABLE_PIN_ORIGIN 34 | #endif 35 | 36 | #define Z_STEP_PIN 2 37 | #define Z_DIR_PIN 3 38 | #define Z_ENABLE_PIN 15 39 | 40 | #define X_MIN_PIN 28 41 | #define X_MAX_PIN 34 // 34 //Max endstops default to disabled "-1", set to commented value to enable. 42 | #define Y_MIN_PIN 30 43 | #define Y_MAX_PIN 36 // 36 44 | #define Z_MIN_PIN 32 // 32 45 | #define Z_MAX_PIN 38 // 38 46 | 47 | #define E0_STEP_PIN 61 48 | #define E0_DIR_PIN 60 49 | #define E0_ENABLE_PIN 62 50 | 51 | #define E1_STEP_PIN 64 52 | #define E1_DIR_PIN 63 53 | #define E1_ENABLE_PIN 65 54 | 55 | #define E2_STEP_PIN 51 56 | #define E2_DIR_PIN 53 57 | #define E2_ENABLE_PIN 49 58 | 59 | #define SDPOWER -1 60 | #define SDSS 4 //10 Display 61 | #define LED_PIN -1 62 | 63 | #define BEEPER 41 64 | 65 | #define FAN_PIN -1 66 | 67 | #define PS_ON_PIN 40 68 | 69 | #define KILL_PIN -1 70 | 71 | #if defined(FILAMENT_SENSOR) // FMM added for Filament Extruder 72 | // define analog pin for the filament width sensor input 73 | #define FILWIDTH_PIN -1 74 | #endif 75 | 76 | #if defined(FILAMENT_RUNOUT_SENSOR) 77 | #define FILRUNOUT_PIN -1 78 | #endif 79 | 80 | #define HEATER_BED_PIN 7 // BED 81 | #define HEATER_0_PIN 13 82 | #define HEATER_1_PIN -1 // 12 83 | #define HEATER_2_PIN -1 // 11 84 | #define HEATER_3_PIN -1 85 | 86 | #define TEMP_BED_PIN 4 // ANALOG NUMBERING 87 | #define TEMP_0_PIN 0 // ANALOG NUMBERING 88 | #define TEMP_1_PIN -1 // 1 // ANALOG NUMBERING 89 | #define TEMP_2_PIN -1 // 2 // ANALOG NUMBERING 90 | #define TEMP_3_PIN -1 // 3 // ANALOG NUMBERING 91 | 92 | 93 | 94 | #ifdef NUM_SERVOS 95 | #define SERVO0_PIN 5 96 | #if NUM_SERVOS > 1 97 | #define SERVO1_PIN 6 98 | #if NUM_SERVOS > 2 99 | #define SERVO2_PIN 39 100 | #if NUM_SERVOS > 3 101 | #define SERVO3_PIN 40 102 | #endif 103 | #endif 104 | #endif 105 | #endif 106 | 107 | 108 | #ifdef ULTRA_LCD 109 | 110 | // RADDS LCD panel 111 | #ifdef NEWPANEL 112 | 113 | #ifdef RADDS_DISPLAY 114 | #define LCD_PINS_RS 42 115 | #define LCD_PINS_ENABLE 43 116 | #define LCD_PINS_D4 44 117 | #define LCD_PINS_D5 45 118 | #define LCD_PINS_D6 46 119 | #define LCD_PINS_D7 47 120 | 121 | #define BEEPER 41 122 | 123 | #define BTN_EN1 50 124 | #define BTN_EN2 52 125 | #define BTN_ENC 48 126 | 127 | #define BTN_BACK 71 128 | 129 | #undef SDSS 130 | #define SDSS 10 131 | #define SDCARDDETECT 14 132 | 133 | #elif defined(SSD1306_OLED_I2C_CONTROLLER) 134 | #define BTN_EN1 50 135 | #define BTN_EN2 52 136 | #define BTN_ENC 48 137 | #define BEEPER 41 138 | #define LCD_SDSS 10 139 | #define SDCARDDETECT 14 140 | #define KILL_PIN -1 141 | 142 | // Sparklabs Full Graphic Display for RADDS 143 | #elif defined(SPARK_FULL_GRAPHICS) 144 | #define LCD_PINS_D4 29 145 | #define LCD_PINS_ENABLE 27 146 | #define LCD_PINS_RS 25 147 | 148 | #define BTN_EN1 35 149 | #define BTN_EN2 33 150 | #define BTN_ENC 37 151 | 152 | #define KILL_PIN -1 153 | #undef BEEPER 154 | #define BEEPER -1 155 | #endif // SPARK_FULL_GRAPHICS 156 | 157 | #endif 158 | 159 | #endif //ULTRA_LCD 160 | 161 | // SPI for Max6675 Thermocouple 162 | 163 | //works with radds??? #ifndef SDSUPPORT 164 | //// these pins are defined in the SD library if building with SD support 165 | // #define MAX_SCK_PIN 52 166 | // #define MAX_MISO_PIN 50 167 | // #define MAX_MOSI_PIN 51 168 | // #define MAX6675_SS 53 169 | //#else 170 | // #define MAX6675_SS 49 171 | //#endif 172 | -------------------------------------------------------------------------------- /Marlin/pins_RAMPS_FD.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * Arduino Due pin assignment 3 | * 4 | * for RAMPS-FD 5 | ****************************************************************************************/ 6 | 7 | // 8 | #if MB(RAMPS_FD_V1) 9 | #define INVERTED_HEATER_PINS 10 | #define INVERTED_MOSFET_CHANNELS 11 | //WARNING:If you have a RAMPS_FD_V1 modded for bugfix (same http://forums.reprap.org/read.php?219,424146,507810), you must use RAMPS_FD_V2 configuration 12 | // No EEPROM - unless you trivially add it . . . 13 | // Use 4k7 thermistor tables 14 | #else 15 | // #define RAMPS_FD_V2 16 | // EEPROM supported 17 | // Use 1k thermistor tables 18 | #endif 19 | 20 | #define X_STEP_PIN 63 21 | #define X_DIR_PIN 62 22 | #define X_ENABLE_PIN 48 23 | #define X_MIN_PIN 22 24 | #define X_MAX_PIN 30 25 | 26 | #define Y_STEP_PIN 65 27 | #define Y_DIR_PIN 64 28 | #define Y_ENABLE_PIN 46 29 | #define Y_MIN_PIN 24 30 | #define Y_MAX_PIN 38 31 | 32 | #define Z_STEP_PIN 67 33 | #define Z_DIR_PIN 66 34 | #define Z_ENABLE_PIN 44 35 | #define Z_MIN_PIN 26 36 | #define Z_MAX_PIN 34 37 | 38 | #define E0_STEP_PIN 36 39 | #define E0_DIR_PIN 28 40 | #define E0_ENABLE_PIN 42 41 | 42 | #define E1_STEP_PIN 43 43 | #define E1_DIR_PIN 41 44 | #define E1_ENABLE_PIN 39 45 | 46 | #define E2_STEP_PIN 32 47 | #define E2_DIR_PIN 47 48 | #define E2_ENABLE_PIN 45 49 | 50 | #define SDPOWER -1 51 | #define SDSS 4 52 | #define LED_PIN 13 53 | 54 | #define BEEPER -1 55 | 56 | #define FAN_PIN 10 //fet3 57 | 58 | #define PS_ON_PIN -1 59 | 60 | #define KILL_PIN 41 //Dawson 61 | 62 | 63 | #define HEATER_BED_PIN 8 // BED //Dawson - OTW, not on the right power feed! 64 | 65 | #define HEATER_0_PIN 9 //Dawson - OTW, not on the right power feed! 66 | #define HEATER_1_PIN -1 67 | // #define HEATER_2_PIN 11 68 | #define HEATER_2_PIN -1 // Dawson - use this for stepper fan control 69 | 70 | #define TEMP_BED_PIN 0 // ANALOG NUMBERING 71 | 72 | #define TEMP_0_PIN 1 // ANALOG NUMBERING 73 | #define TEMP_1_PIN 2 // 2 // ANALOG NUMBERING 74 | #define TEMP_2_PIN -1 // 3 // ANALOG NUMBERING 75 | 76 | #define TEMP_3_PIN -1 // ANALOG NUMBERING 77 | #define TEMP_4_PIN -1 // ANALOG NUMBERING 78 | 79 | 80 | 81 | #ifdef NUM_SERVOS 82 | #define SERVO0_PIN 7 83 | 84 | #if NUM_SERVOS > 1 85 | #define SERVO1_PIN 6 86 | #endif 87 | 88 | #if NUM_SERVOS > 2 89 | #define SERVO2_PIN 5 90 | #endif 91 | 92 | #if NUM_SERVOS > 3 93 | #define SERVO3_PIN 4 94 | #endif 95 | #endif 96 | 97 | #ifdef ULTRA_LCD 98 | 99 | #ifdef NEWPANEL 100 | // ramps-fd lcd adaptor 101 | #define LCD_PINS_RS 16 102 | #define LCD_PINS_ENABLE 17 103 | #define LCD_PINS_D4 23 104 | #define LCD_PINS_D5 25 105 | #define LCD_PINS_D6 27 106 | #define LCD_PINS_D7 29 107 | 108 | #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER 109 | #define BEEPER 37 110 | 111 | #define BTN_EN1 33 112 | #define BTN_EN2 31 113 | #define BTN_ENC 35 114 | 115 | #define SDCARDDETECT 49 116 | 117 | #elif defined(SSD1306_OLED_I2C_CONTROLLER) 118 | #define BTN_EN1 31 119 | #define BTN_EN2 33 120 | #define BTN_ENC 35 121 | #define BEEPER -1 122 | #define LCD_SDSS 49 123 | #define SDCARDDETECT 37 124 | #define KILL_PIN 39 125 | #endif 126 | 127 | #endif 128 | 129 | #endif //ULTRA_LCD 130 | 131 | 132 | // SPI for Max6675 Thermocouple 133 | 134 | #ifndef SDSUPPORT 135 | // these pins are defined in the SD library if building with SD support 136 | #define MAX_SCK_PIN 52 137 | #define MAX_MISO_PIN 50 138 | #define MAX_MOSI_PIN 51 139 | #define MAX6675_SS 53 140 | #else 141 | #define MAX6675_SS 49 142 | #endif 143 | 144 | // -------------------------------------------------------------------------- 145 | // 146 | // -------------------------------------------------------------------------- 147 | -------------------------------------------------------------------------------- /Marlin/qr_solve.h: -------------------------------------------------------------------------------- 1 | #include "Configuration.h" 2 | 3 | #ifdef AUTO_BED_LEVELING_GRID 4 | 5 | void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); 6 | double ddot ( int n, double dx[], int incx, double dy[], int incy ); 7 | double dnrm2 ( int n, double x[], int incx ); 8 | void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, 9 | int jpvt[], double qraux[] ); 10 | void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], 11 | double work[], int job ); 12 | int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], 13 | double x[], double rsd[], int jpvt[], double qraux[], int itask ); 14 | void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], 15 | double rsd[], int jpvt[], double qraux[] ); 16 | int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], 17 | double qy[], double qty[], double b[], double rsd[], double ab[], int job ); 18 | void dscal ( int n, double sa, double x[], int incx ); 19 | void dswap ( int n, double x[], int incx, double y[], int incy ); 20 | double *qr_solve ( int m, int n, double a[], double b[] ); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Marlin/scripts/due_pins.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Nico' 2 | 3 | for i in range(0, 87+1): 4 | print('#define DIO{0}_PIN '.format(i)) 5 | print('#define DIO{0}_WPORT PIO\n'.format(i)) -------------------------------------------------------------------------------- /Marlin/scripts/parse_variant_for_fastio.py: -------------------------------------------------------------------------------- 1 | __author__ = 'Nico' 2 | 3 | input_file = 'C:/Users/Nico/AppData/Roaming/Arduino15/packages/arduino/hardware/sam/1.6.3/variants/arduino_due_x' 4 | input_file += '/variant.cpp' 5 | 6 | at_pins = False 7 | 8 | 9 | def skip_until_pin_description(line): 10 | global at_pins 11 | if line.find('PinDescription g_APinDescription'): 12 | at_pins = True 13 | 14 | 15 | def has_pin_line(line): 16 | has_pin = line.find('PIO_DEFAULT') 17 | if has_pin > 10: 18 | if line.find('PIO_NOT_A_PIN') > 10: 19 | return False 20 | else: 21 | return True 22 | 23 | 24 | def get_wport(line): 25 | pos = line.find('PIO') 26 | return line[pos:pos+4] 27 | 28 | 29 | def get_pin(line): 30 | pos = line.find('_P') + 3 31 | my_string = line[pos:pos+4] 32 | number = '' 33 | for char in my_string: 34 | try: 35 | int(char) 36 | number += char 37 | except ValueError: 38 | break 39 | return number 40 | 41 | with open(input_file, 'r') as file: 42 | due_pin = 0 43 | for line in file: 44 | if not at_pins: 45 | skip_until_pin_description(line) 46 | else: 47 | if has_pin_line(line): 48 | # print(line[:30]) 49 | print('#define DIO{}_PIN {}'.format(due_pin, get_pin(line))) 50 | print('#define DIO{}_WPORT {}\n'.format(due_pin, get_wport(line))) 51 | due_pin += 1 52 | file.close() 53 | -------------------------------------------------------------------------------- /Marlin/ultralcd_st7920_u8glib_rrd.h: -------------------------------------------------------------------------------- 1 | #ifndef ULCDST7920_H 2 | #define ULCDST7920_H 3 | 4 | #include "Marlin.h" 5 | 6 | #ifdef U8GLIB_ST7920 7 | 8 | //set optimization so ARDUINO optimizes this file 9 | #pragma GCC optimize (3) 10 | 11 | #define ST7920_CLK_PIN LCD_PINS_D4 12 | #define ST7920_DAT_PIN LCD_PINS_ENABLE 13 | #define ST7920_CS_PIN LCD_PINS_RS 14 | 15 | //#define PAGE_HEIGHT 8 //128 byte framebuffer 16 | //#define PAGE_HEIGHT 16 //256 byte framebuffer 17 | #define PAGE_HEIGHT 32 //512 byte framebuffer 18 | 19 | #define LCD_PIXEL_WIDTH 128 20 | #define LCD_PIXEL_HEIGHT 64 21 | 22 | #include 23 | 24 | static void ST7920_SWSPI_SND_8BIT(uint8_t val) 25 | { 26 | uint8_t i; 27 | for( i=0; i<8; i++ ) 28 | { 29 | WRITE(ST7920_CLK_PIN,0); 30 | delayMicroseconds(2); 31 | WRITE(ST7920_DAT_PIN,val&0x80); 32 | val<<=1; 33 | WRITE(ST7920_CLK_PIN,1); 34 | delayMicroseconds(2); 35 | } 36 | } 37 | 38 | #define ST7920_CS() {WRITE(ST7920_CS_PIN,1);u8g_10MicroDelay();} 39 | #define ST7920_NCS() {WRITE(ST7920_CS_PIN,0);} 40 | #define ST7920_SET_CMD() {ST7920_SWSPI_SND_8BIT(0xf8);u8g_10MicroDelay();} 41 | #define ST7920_SET_DAT() {ST7920_SWSPI_SND_8BIT(0xfa);u8g_10MicroDelay();} 42 | #define ST7920_WRITE_BYTE(a) {ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xf0u));ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u));u8g_10MicroDelay();} 43 | #define ST7920_WRITE_BYTES(p,l) {uint8_t i;for(i=0;idev_mem); 83 | y = pb->p.page_y0; 84 | ptr = (uint8_t*)pb->buf; 85 | 86 | ST7920_CS(); 87 | for( i = 0; i < PAGE_HEIGHT; i ++ ) 88 | { 89 | ST7920_SET_CMD(); 90 | if ( y < 32 ) 91 | { 92 | ST7920_WRITE_BYTE(0x80 | y); //y 93 | ST7920_WRITE_BYTE(0x80); //x=0 94 | } 95 | else 96 | { 97 | ST7920_WRITE_BYTE(0x80 | (y-32)); //y 98 | ST7920_WRITE_BYTE(0x80 | 8); //x=64 99 | } 100 | 101 | ST7920_SET_DAT(); 102 | ST7920_WRITE_BYTES(ptr,LCD_PIXEL_WIDTH/8); //ptr is incremented inside of macro 103 | y++; 104 | } 105 | ST7920_NCS(); 106 | } 107 | break; 108 | } 109 | #if PAGE_HEIGHT == 8 110 | return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg); 111 | #elif PAGE_HEIGHT == 16 112 | return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg); 113 | #else 114 | return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg); 115 | #endif 116 | } 117 | 118 | uint8_t u8g_dev_st7920_128x64_rrd_buf[LCD_PIXEL_WIDTH*(PAGE_HEIGHT/8)] U8G_NOCOMMON; 119 | u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT,LCD_PIXEL_HEIGHT,0,0,0},LCD_PIXEL_WIDTH,u8g_dev_st7920_128x64_rrd_buf}; 120 | u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn,&u8g_dev_st7920_128x64_rrd_pb,&u8g_com_null_fn}; 121 | 122 | class U8GLIB_ST7920_128X64_RRD : public U8GLIB 123 | { 124 | public: 125 | U8GLIB_ST7920_128X64_RRD(uint8_t dummy) : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi) {} 126 | }; 127 | 128 | 129 | #endif //U8GLIB_ST7920 130 | #endif //ULCDST7920_H 131 | -------------------------------------------------------------------------------- /Marlin/vector_3.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | vector_3.cpp - Vector library for bed leveling 3 | Copyright (c) 2012 Lars Brubaker. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | #include 20 | #include "Marlin.h" 21 | 22 | #ifdef ENABLE_AUTO_BED_LEVELING 23 | #include "vector_3.h" 24 | 25 | vector_3::vector_3() : x(0), y(0), z(0) { } 26 | 27 | vector_3::vector_3(float x_, float y_, float z_) : x(x_), y(y_), z(z_) { } 28 | 29 | vector_3 vector_3::cross(vector_3 left, vector_3 right) { 30 | return vector_3(left.y * right.z - left.z * right.y, 31 | left.z * right.x - left.x * right.z, 32 | left.x * right.y - left.y * right.x); 33 | } 34 | 35 | vector_3 vector_3::operator+(vector_3 v) { return vector_3((x + v.x), (y + v.y), (z + v.z)); } 36 | vector_3 vector_3::operator-(vector_3 v) { return vector_3((x - v.x), (y - v.y), (z - v.z)); } 37 | 38 | vector_3 vector_3::get_normal() { 39 | vector_3 normalized = vector_3(x, y, z); 40 | normalized.normalize(); 41 | return normalized; 42 | } 43 | 44 | float vector_3::get_length() { return sqrt((x * x) + (y * y) + (z * z)); } 45 | 46 | void vector_3::normalize() { 47 | float length = get_length(); 48 | x /= length; 49 | y /= length; 50 | z /= length; 51 | } 52 | 53 | void vector_3::apply_rotation(matrix_3x3 matrix) { 54 | float resultX = x * matrix.matrix[3*0+0] + y * matrix.matrix[3*1+0] + z * matrix.matrix[3*2+0]; 55 | float resultY = x * matrix.matrix[3*0+1] + y * matrix.matrix[3*1+1] + z * matrix.matrix[3*2+1]; 56 | float resultZ = x * matrix.matrix[3*0+2] + y * matrix.matrix[3*1+2] + z * matrix.matrix[3*2+2]; 57 | x = resultX; 58 | y = resultY; 59 | z = resultZ; 60 | } 61 | 62 | void vector_3::debug(const char title[]) { 63 | SERIAL_PROTOCOL(title); 64 | SERIAL_PROTOCOLPGM(" x: "); 65 | SERIAL_PROTOCOL_F(x, 6); 66 | SERIAL_PROTOCOLPGM(" y: "); 67 | SERIAL_PROTOCOL_F(y, 6); 68 | SERIAL_PROTOCOLPGM(" z: "); 69 | SERIAL_PROTOCOL_F(z, 6); 70 | SERIAL_EOL; 71 | } 72 | 73 | void apply_rotation_xyz(matrix_3x3 matrix, float &x, float& y, float& z) { 74 | vector_3 vector = vector_3(x, y, z); 75 | vector.apply_rotation(matrix); 76 | x = vector.x; 77 | y = vector.y; 78 | z = vector.z; 79 | } 80 | 81 | matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2) { 82 | //row_0.debug("row_0"); 83 | //row_1.debug("row_1"); 84 | //row_2.debug("row_2"); 85 | matrix_3x3 new_matrix; 86 | new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z; 87 | new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z; 88 | new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z; 89 | //new_matrix.debug("new_matrix"); 90 | return new_matrix; 91 | } 92 | 93 | void matrix_3x3::set_to_identity() { 94 | matrix[0] = 1; matrix[1] = 0; matrix[2] = 0; 95 | matrix[3] = 0; matrix[4] = 1; matrix[5] = 0; 96 | matrix[6] = 0; matrix[7] = 0; matrix[8] = 1; 97 | } 98 | 99 | matrix_3x3 matrix_3x3::create_look_at(vector_3 target) { 100 | vector_3 z_row = target.get_normal(); 101 | vector_3 x_row = vector_3(1, 0, -target.x/target.z).get_normal(); 102 | vector_3 y_row = vector_3::cross(z_row, x_row).get_normal(); 103 | 104 | // x_row.debug("x_row"); 105 | // y_row.debug("y_row"); 106 | // z_row.debug("z_row"); 107 | 108 | // create the matrix already correctly transposed 109 | matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row); 110 | 111 | // rot.debug("rot"); 112 | return rot; 113 | } 114 | 115 | matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) { 116 | matrix_3x3 new_matrix; 117 | new_matrix.matrix[0] = original.matrix[0]; new_matrix.matrix[1] = original.matrix[3]; new_matrix.matrix[2] = original.matrix[6]; 118 | new_matrix.matrix[3] = original.matrix[1]; new_matrix.matrix[4] = original.matrix[4]; new_matrix.matrix[5] = original.matrix[7]; 119 | new_matrix.matrix[6] = original.matrix[2]; new_matrix.matrix[7] = original.matrix[5]; new_matrix.matrix[8] = original.matrix[8]; 120 | return new_matrix; 121 | } 122 | 123 | void matrix_3x3::debug(const char title[]) { 124 | SERIAL_PROTOCOLLN(title); 125 | int count = 0; 126 | for(int i=0; i<3; i++) { 127 | for(int j=0; j<3; j++) { 128 | if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+'); 129 | SERIAL_PROTOCOL_F(matrix[count], 6); 130 | SERIAL_PROTOCOLCHAR(' '); 131 | count++; 132 | } 133 | SERIAL_EOL; 134 | } 135 | } 136 | 137 | #endif // ENABLE_AUTO_BED_LEVELING 138 | 139 | -------------------------------------------------------------------------------- /Marlin/vector_3.h: -------------------------------------------------------------------------------- 1 | /* 2 | vector_3.cpp - Vector library for bed leveling 3 | Copyright (c) 2012 Lars Brubaker. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | #ifndef VECTOR_3_H 20 | #define VECTOR_3_H 21 | 22 | #ifdef ENABLE_AUTO_BED_LEVELING 23 | class matrix_3x3; 24 | 25 | struct vector_3 26 | { 27 | float x, y, z; 28 | 29 | vector_3(); 30 | vector_3(float x, float y, float z); 31 | 32 | static vector_3 cross(vector_3 a, vector_3 b); 33 | 34 | vector_3 operator+(vector_3 v); 35 | vector_3 operator-(vector_3 v); 36 | void normalize(); 37 | float get_length(); 38 | vector_3 get_normal(); 39 | 40 | void debug(const char title[]); 41 | 42 | void apply_rotation(matrix_3x3 matrix); 43 | }; 44 | 45 | struct matrix_3x3 46 | { 47 | float matrix[9]; 48 | 49 | static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2); 50 | static matrix_3x3 create_look_at(vector_3 target); 51 | static matrix_3x3 transpose(matrix_3x3 original); 52 | 53 | void set_to_identity(); 54 | 55 | void debug(const char title[]); 56 | }; 57 | 58 | 59 | void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float& y, float& z); 60 | #endif // ENABLE_AUTO_BED_LEVELING 61 | 62 | #endif // VECTOR_3_H 63 | -------------------------------------------------------------------------------- /Marlin/watchdog.cpp: -------------------------------------------------------------------------------- 1 | #include "Marlin.h" 2 | 3 | #ifdef USE_WATCHDOG 4 | 5 | #include "watchdog.h" 6 | #include "ultralcd.h" 7 | 8 | //=========================================================================== 9 | //============================ private variables ============================ 10 | //=========================================================================== 11 | 12 | //=========================================================================== 13 | //================================ functions ================================ 14 | //=========================================================================== 15 | 16 | 17 | /// intialise watch dog with a 4 sec interrupt time 18 | void watchdog_init() 19 | { 20 | const uint32_t wdtTicks = 256; // number of watchdog ticks @ 32768Hz/128 before the watchdog times out (max 4095) 21 | WDT_Enable(WDT, (wdtTicks << WDT_MR_WDV_Pos) | (wdtTicks << WDT_MR_WDD_Pos) | WDT_MR_WDRSTEN); // enable watchdog, reset the mcu if it times out 22 | } 23 | 24 | /// reset watchdog. MUST be called every 1s after init or avr will reset. 25 | void watchdog_reset() 26 | { 27 | WDT_Restart(WDT); 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Marlin/watchdog.h: -------------------------------------------------------------------------------- 1 | #ifndef WATCHDOG_H 2 | #define WATCHDOG_H 3 | 4 | #include "Marlin.h" 5 | 6 | #ifdef USE_WATCHDOG 7 | // initialize watch dog with a 1 sec interrupt time 8 | void watchdog_init(); 9 | // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures.. 10 | void watchdog_reset(); 11 | #else 12 | //If we do not have a watchdog, then we can have empty functions which are optimized away. 13 | FORCE_INLINE void watchdog_init() {}; 14 | FORCE_INLINE void watchdog_reset() {}; 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Marlin4Due 3D Printer Firmware 2 | 3 | 4 | ### Story about Marlin 32bit 5 | ####The story is over. I will not make any new updates. 6 | 7 | Thanks to bobc. He is the guy for real open source in any case! \*thumbsup* 8 | 9 | *Wurstnase* 10 | 11 | ### This is an experimental repository! You should never leave your printer alone. 12 | 13 | ## Quick Information 14 | 15 | This is a firmware for reprap single-processor electronics setups. 16 | It also works on the Ultimaker PCB. It supports printing from SD card+Folders and look-ahead trajectory planning. 17 | This firmware is a mashup between [Sprinter](https://github.com/kliment/Sprinter), [grbl](https://github.com/simen/grbl), and many original parts. 18 | 19 | ## License 20 | 21 | Marlin is published under the [GPL license](/Documentation/COPYING.md) because We believe in open development. 22 | Do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent. 23 | --------------------------------------------------------------------------------