├── .gitattributes ├── .gitignore ├── ArduinoAddons ├── Arduino_0.xx │ ├── Gen6 │ │ ├── boards.txt │ │ ├── bootloaders │ │ │ └── atmega644p │ │ │ │ ├── ATmegaBOOT.c │ │ │ │ ├── ATmegaBOOT_324P.hex │ │ │ │ ├── ATmegaBOOT_644.hex │ │ │ │ ├── ATmegaBOOT_644P.hex │ │ │ │ ├── Makefile │ │ │ │ └── README.txt │ │ └── cores │ │ │ └── arduino │ │ │ ├── Arduino.h │ │ │ ├── HardwareSerial.cpp │ │ │ ├── HardwareSerial.h │ │ │ ├── Print.cpp │ │ │ ├── Print.h │ │ │ ├── Stream.h │ │ │ ├── Tone.cpp │ │ │ ├── WCharacter.h │ │ │ ├── WConstants.h │ │ │ ├── WInterrupts.c │ │ │ ├── WMath.cpp │ │ │ ├── WProgram.h │ │ │ ├── WString.cpp │ │ │ ├── WString.h │ │ │ ├── binary.h │ │ │ ├── main.cpp │ │ │ ├── pins_arduino.c │ │ │ ├── pins_arduino.h │ │ │ ├── wiring.c │ │ │ ├── wiring.h │ │ │ ├── wiring_analog.c │ │ │ ├── wiring_digital.c │ │ │ ├── wiring_private.h │ │ │ ├── wiring_pulse.c │ │ │ └── wiring_shift.c │ ├── Gen7 │ │ ├── boards.txt │ │ ├── bootloaders │ │ │ └── Gen7 │ │ │ │ ├── bootloader-1284P-16MHz.hex │ │ │ │ ├── bootloader-644-16MHz.hex │ │ │ │ ├── bootloader-644-20MHz.hex │ │ │ │ ├── bootloader-644P-16MHz.hex │ │ │ │ └── bootloader-644P-20MHz.hex │ │ └── cores │ │ │ └── arduino │ │ │ ├── HardwareSerial.cpp │ │ │ ├── HardwareSerial.h │ │ │ ├── Makefile │ │ │ ├── Print.cpp │ │ │ ├── Print.h │ │ │ ├── Tone.cpp │ │ │ ├── WCharacter.h │ │ │ ├── WConstants.h │ │ │ ├── WInterrupts.c │ │ │ ├── WMath.cpp │ │ │ ├── WProgram.h │ │ │ ├── WString.cpp │ │ │ ├── WString.h │ │ │ ├── binary.h │ │ │ ├── main.cpp │ │ │ ├── main.cxx │ │ │ ├── pins_arduino.c │ │ │ ├── pins_arduino.h │ │ │ ├── wiring.c │ │ │ ├── wiring.h │ │ │ ├── wiring_analog.c │ │ │ ├── wiring_digital.c │ │ │ ├── wiring_private.h │ │ │ ├── wiring_pulse.c │ │ │ ├── wiring_serial.c │ │ │ └── wiring_shift.c │ ├── Sanguino │ │ ├── boards.txt │ │ ├── bootloaders │ │ │ ├── atmega1284p │ │ │ │ ├── Makefile │ │ │ │ ├── boot.h │ │ │ │ ├── optiboot.c │ │ │ │ ├── optiboot_1284P_20MHz_57k6_baud.hex │ │ │ │ ├── pin_defs.h │ │ │ │ └── stk500.h │ │ │ └── atmega644p │ │ │ │ ├── ATmegaBOOT.c │ │ │ │ ├── ATmegaBOOT_324P.hex │ │ │ │ ├── ATmegaBOOT_644.hex │ │ │ │ ├── ATmegaBOOT_644P.hex │ │ │ │ ├── Makefile │ │ │ │ └── README.txt │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── HardwareSerial.cpp │ │ │ │ ├── HardwareSerial.h │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ ├── Stream.h │ │ │ │ ├── Tone.cpp │ │ │ │ ├── WCharacter.h │ │ │ │ ├── WConstants.h │ │ │ │ ├── WInterrupts.c │ │ │ │ ├── WMath.cpp │ │ │ │ ├── WProgram.h │ │ │ │ ├── WString.cpp │ │ │ │ ├── WString.h │ │ │ │ ├── binary.h │ │ │ │ ├── main.cpp │ │ │ │ ├── pins_arduino.c │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── wiring.c │ │ │ │ ├── wiring.h │ │ │ │ ├── wiring_analog.c │ │ │ │ ├── wiring_digital.c │ │ │ │ ├── wiring_private.h │ │ │ │ ├── wiring_pulse.c │ │ │ │ └── wiring_shift.c │ │ └── programmers.txt │ ├── hardware │ │ └── tools │ │ │ └── avr │ │ │ └── etc │ │ │ └── avrdude.conf │ └── libraries │ │ ├── LiquidCrystal │ │ ├── LiquidCrystal.cpp │ │ ├── LiquidCrystal.h │ │ └── keywords.txt │ │ ├── SPI │ │ ├── SPI.cpp │ │ ├── SPI.h │ │ └── keywords.txt │ │ └── U8glib │ │ ├── ChangeLog │ │ ├── INSTALL.TXT │ │ ├── U8glib.cpp │ │ ├── U8glib.h │ │ ├── examples │ │ ├── Bitmap │ │ │ └── Bitmap.pde │ │ ├── Chess │ │ │ └── Chess.pde │ │ ├── Console │ │ │ └── Console.pde │ │ ├── F │ │ │ └── F.pde │ │ ├── GraphicsTest │ │ │ └── GraphicsTest.pde │ │ ├── HelloWorld │ │ │ └── HelloWorld.pde │ │ ├── Menu │ │ │ └── Menu.pde │ │ ├── PrintTest │ │ │ └── PrintTest.pde │ │ ├── Rotation │ │ │ └── Rotation.pde │ │ ├── Scale │ │ │ └── Scale.pde │ │ ├── TextRotX │ │ │ └── TextRotX.pde │ │ ├── U8gLogo │ │ │ └── U8gLogo.pde │ │ └── XBM │ │ │ └── XBM.pde │ │ ├── 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_common.c │ │ ├── u8g_com_arduino_fast_parallel.c │ │ ├── u8g_com_arduino_hw_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_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_flipdisc_2x7.c │ │ ├── u8g_dev_gprof.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_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_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_128x64.c │ │ ├── u8g_dev_t6963_240x128.c │ │ ├── u8g_dev_t6963_240x64.c │ │ ├── u8g_dev_tls8204_84x48.c │ │ ├── u8g_dev_uc1610_dogxl160.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_rect.c │ │ ├── u8g_rot.c │ │ ├── u8g_scale.c │ │ ├── u8g_state.c │ │ ├── u8g_u16toa.c │ │ ├── u8g_u8toa.c │ │ └── u8g_virtual_screen.c └── Arduino_1.x.x │ ├── hardware │ ├── Sanguino │ │ ├── boards.txt │ │ ├── bootloaders │ │ │ ├── atmega │ │ │ │ ├── ATmegaBOOT_168.c │ │ │ │ ├── ATmegaBOOT_168_atmega1284p.hex │ │ │ │ ├── ATmegaBOOT_168_atmega1284p_8m.hex │ │ │ │ ├── ATmegaBOOT_168_atmega644p.hex │ │ │ │ └── Makefile │ │ │ └── atmega644p │ │ │ │ ├── ATmegaBOOT.c │ │ │ │ ├── ATmegaBOOT.c.tst │ │ │ │ ├── ATmegaBOOT_644P.elf │ │ │ │ ├── ATmegaBOOT_644P.hex │ │ │ │ ├── Makefile │ │ │ │ └── README.txt │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── CDC.cpp │ │ │ │ ├── Client.h │ │ │ │ ├── HID.cpp │ │ │ │ ├── HardwareSerial.cpp │ │ │ │ ├── HardwareSerial.h │ │ │ │ ├── IPAddress.cpp │ │ │ │ ├── IPAddress.h │ │ │ │ ├── Platform.h │ │ │ │ ├── Print.cpp │ │ │ │ ├── Print.h │ │ │ │ ├── Printable.h │ │ │ │ ├── Server.h │ │ │ │ ├── Stream.cpp │ │ │ │ ├── Stream.h │ │ │ │ ├── Tone.cpp │ │ │ │ ├── USBAPI.h │ │ │ │ ├── USBCore.cpp │ │ │ │ ├── USBCore.h │ │ │ │ ├── USBDesc.h │ │ │ │ ├── Udp.h │ │ │ │ ├── WCharacter.h │ │ │ │ ├── WInterrupts.c │ │ │ │ ├── WMath.cpp │ │ │ │ ├── WString.cpp │ │ │ │ ├── WString.h │ │ │ │ ├── binary.h │ │ │ │ ├── main.cpp │ │ │ │ ├── new.cpp │ │ │ │ ├── new.h │ │ │ │ ├── wiring.c │ │ │ │ ├── wiring_analog.c │ │ │ │ ├── wiring_digital.c │ │ │ │ ├── wiring_private.h │ │ │ │ ├── wiring_pulse.c │ │ │ │ └── wiring_shift.c │ │ └── variants │ │ │ └── standard │ │ │ └── pins_arduino.h │ └── rambo │ │ ├── boards.txt │ │ ├── cores │ │ └── arduino │ │ │ ├── Arduino.h │ │ │ ├── CDC.cpp │ │ │ ├── Client.h │ │ │ ├── HID.cpp │ │ │ ├── HardwareSerial.cpp │ │ │ ├── HardwareSerial.h │ │ │ ├── IPAddress.cpp │ │ │ ├── IPAddress.h │ │ │ ├── Platform.h │ │ │ ├── Print.cpp │ │ │ ├── Print.h │ │ │ ├── Printable.h │ │ │ ├── Server.h │ │ │ ├── Stream.cpp │ │ │ ├── Stream.h │ │ │ ├── Tone.cpp │ │ │ ├── USBAPI.h │ │ │ ├── USBCore.cpp │ │ │ ├── USBCore.h │ │ │ ├── USBDesc.h │ │ │ ├── Udp.h │ │ │ ├── WCharacter.h │ │ │ ├── WInterrupts.c │ │ │ ├── WMath.cpp │ │ │ ├── WString.cpp │ │ │ ├── WString.h │ │ │ ├── binary.h │ │ │ ├── main.cpp │ │ │ ├── new.cpp │ │ │ ├── new.h │ │ │ ├── wiring.c │ │ │ ├── wiring_analog.c │ │ │ ├── wiring_digital.c │ │ │ ├── wiring_private.h │ │ │ ├── wiring_pulse.c │ │ │ └── wiring_shift.c │ │ └── variants │ │ └── standard │ │ └── pins_arduino.h │ └── libraries │ ├── LiquidCrystal │ ├── LiquidCrystal.cpp │ ├── LiquidCrystal.h │ └── keywords.txt │ ├── SPI │ ├── SPI.cpp │ ├── SPI.h │ └── keywords.txt │ └── U8glib │ ├── ChangeLog │ ├── INSTALL.TXT │ ├── U8glib.cpp │ ├── U8glib.h │ ├── examples │ ├── Bitmap │ │ └── Bitmap.pde │ ├── Chess │ │ └── Chess.pde │ ├── Console │ │ └── Console.pde │ ├── F │ │ └── F.pde │ ├── GraphicsTest │ │ └── GraphicsTest.pde │ ├── HelloWorld │ │ └── HelloWorld.pde │ ├── Menu │ │ └── Menu.pde │ ├── PrintTest │ │ └── PrintTest.pde │ ├── Rotation │ │ └── Rotation.pde │ ├── Scale │ │ └── Scale.pde │ ├── TextRotX │ │ └── TextRotX.pde │ ├── U8gLogo │ │ └── U8gLogo.pde │ └── XBM │ │ └── XBM.pde │ ├── 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_common.c │ ├── u8g_com_arduino_fast_parallel.c │ ├── u8g_com_arduino_hw_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_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_flipdisc_2x7.c │ ├── u8g_dev_gprof.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_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_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_128x64.c │ ├── u8g_dev_t6963_240x128.c │ ├── u8g_dev_t6963_240x64.c │ ├── u8g_dev_tls8204_84x48.c │ ├── u8g_dev_uc1610_dogxl160.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_rect.c │ ├── u8g_rot.c │ ├── u8g_scale.c │ ├── u8g_state.c │ ├── u8g_u16toa.c │ ├── u8g_u8toa.c │ └── u8g_virtual_screen.c ├── Mackerel ├── BlinkM.cpp ├── BlinkM.h ├── COPYING ├── Configuration.h ├── ConfigurationStore.cpp ├── ConfigurationStore.h ├── Configuration_adv.h ├── DOGMbitmaps.h ├── LiquidCrystalRus.cpp ├── LiquidCrystalRus.h ├── Mackerel.h ├── Mackerel.ino ├── Mackerel_main.cpp ├── Makefile ├── MarlinSerial.cpp ├── MarlinSerial.h ├── Menu Plans.xlsx ├── Sd2Card.cpp ├── Sd2Card.h ├── Sd2PinMap.h ├── SdBaseFile.cpp ├── SdBaseFile.h ├── SdFatConfig.h ├── SdFatStructs.h ├── SdFatUtil.cpp ├── SdFatUtil.h ├── SdFile.cpp ├── SdFile.h ├── SdInfo.h ├── SdVolume.cpp ├── SdVolume.h ├── Servo.cpp ├── Servo.h ├── cardreader.cpp ├── cardreader.h ├── createTemperatureLookupMarlin.py ├── create_speed_lookuptable.py ├── digipot_mcp4451.cpp ├── dogm_font_data_marlin.h ├── dogm_lcd_implementation.h ├── fastio.h ├── language.h ├── motion_control.cpp ├── motion_control.h ├── pins.h ├── planner.cpp ├── planner.h ├── qr_solve.cpp ├── qr_solve.h ├── speed_lookuptable.h ├── stepper.cpp ├── stepper.h ├── temperature.cpp ├── temperature.h ├── thermistortables.h ├── ultralcd.cpp ├── ultralcd.h ├── ultralcd_implementation_hitachi_HD44780.h ├── ultralcd_st7920_u8glib_rrd.h ├── vector_3.cpp ├── vector_3.h ├── watchdog.cpp └── watchdog.h ├── RAMPS wiring and instructions.pdf └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | applet/ 3 | *~ 4 | *.orig 5 | *.rej 6 | *.bak 7 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/boards.txt: -------------------------------------------------------------------------------- 1 | ############################################################## 2 | 3 | Generation_Series.name=Gen6 & Gen6 Deluxe 4 | Generation_Series.upload.protocol=stk500 5 | Generation_Series.upload.maximum_size=63488 6 | Generation_Series.upload.speed=38400 7 | Generation_Series.bootloader.low_fuses=0xFF 8 | Generation_Series.bootloader.high_fuses=0xDC 9 | Generation_Series.bootloader.extended_fuses=0xFD 10 | Generation_Series.bootloader.path=atmega644p 11 | Generation_Series.bootloader.file=ATmegaBOOT_644P.hex 12 | Generation_Series.bootloader.unlock_bits=0x3F 13 | Generation_Series.bootloader.lock_bits=0x0F 14 | Generation_Series.build.mcu=atmega644p 15 | Generation_Series.build.f_cpu=16000000L 16 | Generation_Series.build.core=arduino 17 | 18 | 19 | ############################################################## 20 | 21 | 22 | Sanguinololu.name=Sanguinololu 1.2 and above 23 | Sanguinololu.upload.protocol=stk500 24 | Sanguinololu.upload.maximum_size=63488 25 | Sanguinololu.upload.speed=38400 26 | Sanguinololu.bootloader.low_fuses=0xFF 27 | Sanguinololu.bootloader.high_fuses=0xDC 28 | Sanguinololu.bootloader.extended_fuses=0xFD 29 | Sanguinololu.bootloader.path=atmega644p 30 | Sanguinololu.bootloader.file=ATmegaBOOT_644P.hex 31 | Sanguinololu.bootloader.unlock_bits=0x3F 32 | Sanguinololu.bootloader.lock_bits=0x0F 33 | Sanguinololu.build.mcu=atmega644p 34 | Sanguinololu.build.f_cpu=16000000L 35 | Sanguinololu.build.core=arduino 36 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/bootloaders/atmega644p/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for ATmegaBOOT 2 | # E.Lins, 18.7.2005 3 | # $Id$ 4 | 5 | 6 | # program name should not be changed... 7 | PROGRAM = ATmegaBOOT_644P 8 | 9 | # enter the target CPU frequency 10 | AVR_FREQ = 16000000L 11 | 12 | MCU_TARGET = atmega644p 13 | LDSECTION = --section-start=.text=0xF800 14 | 15 | OBJ = $(PROGRAM).o 16 | OPTIMIZE = -O2 17 | 18 | DEFS = 19 | LIBS = 20 | 21 | CC = avr-gcc 22 | 23 | 24 | # Override is only needed by avr-lib build system. 25 | 26 | override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) 27 | override LDFLAGS = -Wl,$(LDSECTION) 28 | #override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION) 29 | 30 | OBJCOPY = avr-objcopy 31 | OBJDUMP = avr-objdump 32 | 33 | all: CFLAGS += '-DMAX_TIME_COUNT=8000000L>>1' -DADABOOT 34 | all: $(PROGRAM).hex 35 | 36 | $(PROGRAM).hex: $(PROGRAM).elf 37 | $(OBJCOPY) -j .text -j .data -O ihex $< $@ 38 | 39 | $(PROGRAM).elf: $(OBJ) 40 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 41 | 42 | $(OBJ): ATmegaBOOT.c 43 | avr-gcc $(CFLAGS) $(LDFLAGS) -c -g -O2 -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o 44 | 45 | %.lst: %.elf 46 | $(OBJDUMP) -h -S $< > $@ 47 | 48 | %.srec: %.elf 49 | $(OBJCOPY) -j .text -j .data -O srec $< $@ 50 | 51 | %.bin: %.elf 52 | $(OBJCOPY) -j .text -j .data -O binary $< $@ 53 | 54 | clean: 55 | rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex 56 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/bootloaders/atmega644p/README.txt: -------------------------------------------------------------------------------- 1 | Note: This bootloader support ATmega644, ATmega644P and ATmega324P. 2 | To build, set PROGRAM and MCU_TARGET in the Makefile according to your target device. 3 | 4 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | #include "WProgram.h" 2 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | HardwareSerial.h - Hardware serial library for Wiring 3 | Copyright (c) 2006 Nicholas Zambetti. 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 | Modified 28 September 2010 by Mark Sproul 20 | */ 21 | 22 | #ifndef HardwareSerial_h 23 | #define HardwareSerial_h 24 | 25 | #include 26 | 27 | #include "Stream.h" 28 | 29 | struct ring_buffer; 30 | 31 | class HardwareSerial : public Stream 32 | { 33 | private: 34 | ring_buffer *_rx_buffer; 35 | volatile uint8_t *_ubrrh; 36 | volatile uint8_t *_ubrrl; 37 | volatile uint8_t *_ucsra; 38 | volatile uint8_t *_ucsrb; 39 | volatile uint8_t *_udr; 40 | uint8_t _rxen; 41 | uint8_t _txen; 42 | uint8_t _rxcie; 43 | uint8_t _udre; 44 | uint8_t _u2x; 45 | public: 46 | HardwareSerial(ring_buffer *rx_buffer, 47 | volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, 48 | volatile uint8_t *ucsra, volatile uint8_t *ucsrb, 49 | volatile uint8_t *udr, 50 | uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); 51 | void begin(long); 52 | void end(); 53 | virtual int available(void); 54 | virtual int peek(void); 55 | virtual int read(void); 56 | virtual void flush(void); 57 | 58 | // 59 | // Drakelive 2012-09-04 60 | // 61 | #if ARDUINO >= 100 62 | virtual size_t write(uint8_t); 63 | #else 64 | virtual void write(uint8_t); 65 | #endif 66 | 67 | // Drakelive 2012-09-04 68 | 69 | using Print::write; // pull in write(str) and write(buf, size) from Print 70 | }; 71 | 72 | #if defined(UBRRH) || defined(UBRR0H) 73 | extern HardwareSerial Serial; 74 | #elif defined(USBCON) 75 | #include "usb_api.h" 76 | #endif 77 | #if defined(UBRR1H) 78 | extern HardwareSerial Serial1; 79 | #endif 80 | #if defined(UBRR2H) 81 | extern HardwareSerial Serial2; 82 | #endif 83 | #if defined(UBRR3H) 84 | extern HardwareSerial Serial3; 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Print.h - Base class that provides print() and println() 3 | Copyright (c) 2008 David A. Mellis. 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 | 20 | #ifndef Print_h 21 | #define Print_h 22 | 23 | #include 24 | #include // for size_t 25 | 26 | #include "WString.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | #define BYTE 0 33 | 34 | class Print 35 | { 36 | private: 37 | void printNumber(unsigned long, uint8_t); 38 | void printFloat(double, uint8_t); 39 | public: 40 | 41 | // 42 | // Drakelive 2012-09-04 43 | // 44 | #if ARDUINO >= 100 45 | virtual size_t write(uint8_t) = 0; 46 | #else 47 | virtual void write(uint8_t) = 0; 48 | #endif 49 | 50 | // Drakelive 2012-09-04 51 | 52 | virtual void write(const char *str); 53 | virtual void write(const uint8_t *buffer, size_t size); 54 | 55 | void print(const String &); 56 | void print(const char[]); 57 | void print(char, int = BYTE); 58 | void print(unsigned char, int = BYTE); 59 | void print(int, int = DEC); 60 | void print(unsigned int, int = DEC); 61 | void print(long, int = DEC); 62 | void print(unsigned long, int = DEC); 63 | void print(double, int = 2); 64 | 65 | void println(const String &s); 66 | void println(const char[]); 67 | void println(char, int = BYTE); 68 | void println(unsigned char, int = BYTE); 69 | void println(int, int = DEC); 70 | void println(unsigned int, int = DEC); 71 | void println(long, int = DEC); 72 | void println(unsigned long, int = DEC); 73 | void println(double, int = 2); 74 | void println(void); 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | Stream.h - base class for character-based streams. 3 | Copyright (c) 2010 David A. Mellis. 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 | 20 | #ifndef Stream_h 21 | #define Stream_h 22 | 23 | #include 24 | #include "Print.h" 25 | 26 | class Stream : public Print 27 | { 28 | public: 29 | virtual int available() = 0; 30 | virtual int read() = 0; 31 | virtual int peek() = 0; 32 | virtual void flush() = 0; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/WConstants.h: -------------------------------------------------------------------------------- 1 | #include "wiring.h" 2 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | $Id$ 24 | */ 25 | 26 | extern "C" { 27 | #include "stdlib.h" 28 | } 29 | 30 | void randomSeed(unsigned int seed) 31 | { 32 | if (seed != 0) { 33 | srandom(seed); 34 | } 35 | } 36 | 37 | long random(long howbig) 38 | { 39 | if (howbig == 0) { 40 | return 0; 41 | } 42 | return random() % howbig; 43 | } 44 | 45 | long random(long howsmall, long howbig) 46 | { 47 | if (howsmall >= howbig) { 48 | return howsmall; 49 | } 50 | long diff = howbig - howsmall; 51 | return random(diff) + howsmall; 52 | } 53 | 54 | long map(long x, long in_min, long in_max, long out_min, long out_max) 55 | { 56 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 57 | } 58 | 59 | unsigned int makeWord(unsigned int w) { return w; } 60 | unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/WProgram.h: -------------------------------------------------------------------------------- 1 | #ifndef WProgram_h 2 | #define WProgram_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "wiring.h" 11 | 12 | #ifdef __cplusplus 13 | #include "WCharacter.h" 14 | #include "WString.h" 15 | #include "HardwareSerial.h" 16 | 17 | uint16_t makeWord(uint16_t w); 18 | uint16_t makeWord(byte h, byte l); 19 | 20 | #define word(...) makeWord(__VA_ARGS__) 21 | 22 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); 23 | 24 | void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); 25 | void noTone(uint8_t _pin); 26 | 27 | // WMath prototypes 28 | long random(long); 29 | long random(long, long); 30 | void randomSeed(unsigned int); 31 | long map(long, long, long, long, long); 32 | 33 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 34 | const static uint8_t A0 = 54; 35 | const static uint8_t A1 = 55; 36 | const static uint8_t A2 = 56; 37 | const static uint8_t A3 = 57; 38 | const static uint8_t A4 = 58; 39 | const static uint8_t A5 = 59; 40 | const static uint8_t A6 = 60; 41 | const static uint8_t A7 = 61; 42 | const static uint8_t A8 = 62; 43 | const static uint8_t A9 = 63; 44 | const static uint8_t A10 = 64; 45 | const static uint8_t A11 = 65; 46 | const static uint8_t A12 = 66; 47 | const static uint8_t A13 = 67; 48 | const static uint8_t A14 = 68; 49 | const static uint8_t A15 = 69; 50 | #else 51 | const static uint8_t A0 = 14; 52 | const static uint8_t A1 = 15; 53 | const static uint8_t A2 = 16; 54 | const static uint8_t A3 = 17; 55 | const static uint8_t A4 = 18; 56 | const static uint8_t A5 = 19; 57 | const static uint8_t A6 = 20; 58 | const static uint8_t A7 = 21; 59 | #endif 60 | 61 | #endif 62 | 63 | #endif -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | init(); 6 | 7 | setup(); 8 | 9 | for (;;) 10 | loop(); 11 | 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | pins_arduino.h - Pin definition functions for Arduino 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2007 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ 23 | */ 24 | 25 | #ifndef Pins_Arduino_h 26 | #define Pins_Arduino_h 27 | 28 | #include 29 | 30 | #define NOT_A_PIN 0 31 | #define NOT_A_PORT 0 32 | 33 | #define NOT_ON_TIMER 0 34 | #define TIMER0A 1 35 | #define TIMER0B 2 36 | #define TIMER1A 3 37 | #define TIMER1B 4 38 | #define TIMER2 5 39 | #define TIMER2A 6 40 | #define TIMER2B 7 41 | 42 | extern const uint8_t PROGMEM port_to_mode_PGM[]; 43 | extern const uint8_t PROGMEM port_to_input_PGM[]; 44 | extern const uint8_t PROGMEM port_to_output_PGM[]; 45 | 46 | extern const uint8_t PROGMEM digital_pin_to_port_PGM[]; 47 | extern const uint8_t PROGMEM digital_pin_to_bit_PGM[]; 48 | extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]; 49 | 50 | extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; 51 | 52 | // Get the bit location within the hardware port of the given virtual pin. 53 | // This comes from the pins_*.c file for the active board configuration. 54 | // 55 | // These perform slightly better as macros compared to inline functions 56 | // 57 | #define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) 58 | #define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) ) 59 | #define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) ) 60 | #define analogInPinToBit(P) (P) 61 | #define portOutputRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_output_PGM + (P))) ) 62 | #define portInputRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_input_PGM + (P))) ) 63 | #define portModeRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_mode_PGM + (P))) ) 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_private.h - Internal header file. 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ 23 | */ 24 | 25 | #ifndef WiringPrivate_h 26 | #define WiringPrivate_h 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "wiring.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C"{ 38 | #endif 39 | 40 | #ifndef cbi 41 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 42 | #endif 43 | #ifndef sbi 44 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 45 | #endif 46 | 47 | #define EXTERNAL_INT_0 0 48 | #define EXTERNAL_INT_1 1 49 | #define EXTERNAL_INT_2 2 50 | #define EXTERNAL_INT_3 3 51 | #define EXTERNAL_INT_4 4 52 | #define EXTERNAL_INT_5 5 53 | #define EXTERNAL_INT_6 6 54 | #define EXTERNAL_INT_7 7 55 | 56 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 57 | #define EXTERNAL_NUM_INTERRUPTS 8 58 | #else 59 | #define EXTERNAL_NUM_INTERRUPTS 2 60 | #endif 61 | 62 | typedef void (*voidFuncPtr)(void); 63 | 64 | #ifdef __cplusplus 65 | } // extern "C" 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/wiring_pulse.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_pulse.c - pulseIn() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 29 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 30 | * to 3 minutes in length, but must be called at least a few dozen microseconds 31 | * before the start of the pulse. */ 32 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) 33 | { 34 | // cache the port and bit of the pin in order to speed up the 35 | // pulse width measuring loop and achieve finer resolution. calling 36 | // digitalRead() instead yields much coarser resolution. 37 | uint8_t bit = digitalPinToBitMask(pin); 38 | uint8_t port = digitalPinToPort(pin); 39 | uint8_t stateMask = (state ? bit : 0); 40 | unsigned long width = 0; // keep initialization out of time critical area 41 | 42 | // convert the timeout from microseconds to a number of times through 43 | // the initial loop; it takes 16 clock cycles per iteration. 44 | unsigned long numloops = 0; 45 | unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; 46 | 47 | // wait for any previous pulse to end 48 | while ((*portInputRegister(port) & bit) == stateMask) 49 | if (numloops++ == maxloops) 50 | return 0; 51 | 52 | // wait for the pulse to start 53 | while ((*portInputRegister(port) & bit) != stateMask) 54 | if (numloops++ == maxloops) 55 | return 0; 56 | 57 | // wait for the pulse to stop 58 | while ((*portInputRegister(port) & bit) == stateMask) { 59 | if (numloops++ == maxloops) 60 | return 0; 61 | width++; 62 | } 63 | 64 | // convert the reading to microseconds. The loop has been determined 65 | // to be 20 clock cycles long and have about 16 clocks between the edge 66 | // and the start of the loop. There will be some error introduced by 67 | // the interrupt handlers. 68 | return clockCyclesToMicroseconds(width * 21 + 16); 69 | } 70 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen6/cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | 27 | uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { 28 | uint8_t value = 0; 29 | uint8_t i; 30 | 31 | for (i = 0; i < 8; ++i) { 32 | digitalWrite(clockPin, HIGH); 33 | if (bitOrder == LSBFIRST) 34 | value |= digitalRead(dataPin) << i; 35 | else 36 | value |= digitalRead(dataPin) << (7 - i); 37 | digitalWrite(clockPin, LOW); 38 | } 39 | return value; 40 | } 41 | 42 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) 43 | { 44 | uint8_t i; 45 | 46 | for (i = 0; i < 8; i++) { 47 | if (bitOrder == LSBFIRST) 48 | digitalWrite(dataPin, !!(val & (1 << i))); 49 | else 50 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 51 | 52 | digitalWrite(clockPin, HIGH); 53 | digitalWrite(clockPin, LOW); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | HardwareSerial.h - Hardware serial library for Wiring 3 | Copyright (c) 2006 Nicholas Zambetti. 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 | 20 | #ifndef HardwareSerial_h 21 | #define HardwareSerial_h 22 | 23 | #include 24 | 25 | #include "Print.h" 26 | 27 | struct ring_buffer; 28 | 29 | class HardwareSerial : public Print 30 | { 31 | private: 32 | ring_buffer *_rx_buffer; 33 | volatile uint8_t *_ubrrh; 34 | volatile uint8_t *_ubrrl; 35 | volatile uint8_t *_ucsra; 36 | volatile uint8_t *_ucsrb; 37 | volatile uint8_t *_udr; 38 | uint8_t _rxen; 39 | uint8_t _txen; 40 | uint8_t _rxcie; 41 | uint8_t _udre; 42 | uint8_t _u2x; 43 | public: 44 | HardwareSerial(ring_buffer *rx_buffer, 45 | volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, 46 | volatile uint8_t *ucsra, volatile uint8_t *ucsrb, 47 | volatile uint8_t *udr, 48 | uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); 49 | void begin(long); 50 | void end(); 51 | uint8_t available(void); 52 | int read(void); 53 | void flush(void); 54 | virtual void write(uint8_t); 55 | using Print::write; // pull in write(str) and write(buf, size) from Print 56 | }; 57 | 58 | extern HardwareSerial Serial; 59 | 60 | #if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1280__) 61 | extern HardwareSerial Serial1; 62 | #endif 63 | 64 | #if defined(__AVR_ATmega1280__) 65 | extern HardwareSerial Serial2; 66 | extern HardwareSerial Serial3; 67 | #endif 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Print.h - Base class that provides print() and println() 3 | Copyright (c) 2008 David A. Mellis. 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 | 20 | #ifndef Print_h 21 | #define Print_h 22 | 23 | #include 24 | 25 | #define DEC 10 26 | #define HEX 16 27 | #define OCT 8 28 | #define BIN 2 29 | #define BYTE 0 30 | 31 | class Print 32 | { 33 | private: 34 | void printNumber(unsigned long, uint8_t); 35 | void printFloat(double, uint8_t); 36 | public: 37 | virtual void write(uint8_t); 38 | void print(char); 39 | void print(const char[]); 40 | void print(uint8_t); 41 | void print(int); 42 | void print(unsigned int); 43 | void print(long); 44 | void print(unsigned long); 45 | void print(long, int); 46 | void print(double); 47 | void println(void); 48 | void println(char); 49 | void println(const char[]); 50 | void println(uint8_t); 51 | void println(int); 52 | void println(unsigned int); 53 | void println(long); 54 | void println(unsigned long); 55 | void println(long, int); 56 | void println(double); 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/WConstants.h: -------------------------------------------------------------------------------- 1 | #include "wiring.h" 2 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/WInterrupts.c: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.uniandes.edu.co 5 | 6 | Copyright (c) 2004-05 Hernando Barragan 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | Modified 24 November 2006 by David A. Mellis 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "WConstants.h" 33 | #include "wiring_private.h" 34 | 35 | volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; 36 | // volatile static voidFuncPtr twiIntFunc; 37 | 38 | void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) 39 | { 40 | if(interruptNum < EXTERNAL_NUM_INTERRUPTS) 41 | { 42 | intFunc[interruptNum] = userFunc; 43 | 44 | //clear the config for the change settings 45 | EICRA &= ~(B00000011 << (interruptNum * 2)); 46 | 47 | //set our mode. 48 | EICRA |= (mode << (interruptNum * 2)); 49 | 50 | // Enable the interrupt. 51 | EIMSK |= (1 << interruptNum); 52 | } 53 | } 54 | 55 | void detachInterrupt(uint8_t interruptNum) 56 | { 57 | if(interruptNum < EXTERNAL_NUM_INTERRUPTS) 58 | { 59 | // Disable the interrupt. 60 | EIMSK &= ~(1 << interruptNum); 61 | 62 | intFunc[interruptNum] = 0; 63 | } 64 | } 65 | 66 | ISR(INT0_vect) { 67 | if(intFunc[EXTERNAL_INT_0]) 68 | intFunc[EXTERNAL_INT_0](); 69 | } 70 | 71 | ISR(INT1_vect) { 72 | if(intFunc[EXTERNAL_INT_1]) 73 | intFunc[EXTERNAL_INT_1](); 74 | } 75 | 76 | ISR(INT2_vect) { 77 | if(intFunc[EXTERNAL_INT_2]) 78 | intFunc[EXTERNAL_INT_2](); 79 | } 80 | 81 | /* 82 | SIGNAL(SIG_2WIRE_SERIAL) { 83 | if(twiIntFunc) 84 | twiIntFunc(); 85 | } 86 | */ 87 | 88 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | $Id$ 24 | */ 25 | 26 | extern "C" { 27 | #include "stdlib.h" 28 | } 29 | 30 | void randomSeed(unsigned int seed) 31 | { 32 | if (seed != 0){ 33 | srandom(seed); 34 | } 35 | } 36 | 37 | long random(long howbig) 38 | { 39 | if (howbig == 0) { 40 | return 0; 41 | } 42 | return random() % howbig; 43 | } 44 | 45 | long random(long howsmall, long howbig) 46 | { 47 | if (howsmall >= howbig) { 48 | return howsmall; 49 | } 50 | long diff = howbig - howsmall; 51 | return random(diff) + howsmall; 52 | } 53 | 54 | long map(long x, long in_min, long in_max, long out_min, long out_max) 55 | { 56 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 57 | } 58 | 59 | unsigned int makeWord(unsigned int w) { return w; } 60 | unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } 61 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/WProgram.h: -------------------------------------------------------------------------------- 1 | #ifndef WProgram_h 2 | #define WProgram_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "wiring.h" 11 | 12 | #ifdef __cplusplus 13 | #include "WCharacter.h" 14 | #include "WString.h" 15 | #include "HardwareSerial.h" 16 | 17 | uint16_t makeWord(uint16_t w); 18 | uint16_t makeWord(byte h, byte l); 19 | 20 | #define word(...) makeWord(__VA_ARGS__) 21 | 22 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); 23 | 24 | void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); 25 | void noTone(uint8_t _pin); 26 | 27 | // WMath prototypes 28 | long random(long); 29 | long random(long, long); 30 | void randomSeed(unsigned int); 31 | long map(long, long, long, long, long); 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | init(); 6 | 7 | setup(); 8 | 9 | for (;;) 10 | loop(); 11 | 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/main.cxx: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | init(); 4 | 5 | setup(); 6 | 7 | for (;;) 8 | loop(); 9 | 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | pins_arduino.h - Pin definition functions for Arduino 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2007 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ 23 | */ 24 | 25 | #ifndef Pins_Arduino_h 26 | #define Pins_Arduino_h 27 | 28 | #include 29 | 30 | #define NOT_A_PIN 0 31 | #define NOT_A_PORT 0 32 | 33 | #define NOT_ON_TIMER 0 34 | #define TIMER0A 1 35 | #define TIMER0B 2 36 | #define TIMER1A 3 37 | #define TIMER1B 4 38 | #define TIMER2 5 39 | #define TIMER2A 6 40 | #define TIMER2B 7 41 | 42 | extern const uint8_t PROGMEM port_to_mode_PGM[]; 43 | extern const uint8_t PROGMEM port_to_input_PGM[]; 44 | extern const uint8_t PROGMEM port_to_output_PGM[]; 45 | 46 | extern const uint8_t PROGMEM digital_pin_to_port_PGM[]; 47 | extern const uint8_t PROGMEM digital_pin_to_bit_PGM[]; 48 | extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]; 49 | 50 | extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; 51 | 52 | // Get the bit location within the hardware port of the given virtual pin. 53 | // This comes from the pins_*.c file for the active board configuration. 54 | // 55 | // These perform slightly better as macros compared to inline functions 56 | // 57 | #define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) 58 | #define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) ) 59 | #define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) ) 60 | #define analogInPinToBit(P) (P) 61 | #define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_output_PGM + (P))) ) 62 | #define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_input_PGM + (P))) ) 63 | #define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_mode_PGM + (P))) ) 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/wiring_digital.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_digital.c - digital input and output functions 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | void pinMode(uint8_t pin, uint8_t mode) 29 | { 30 | uint8_t bit = digitalPinToBitMask(pin); 31 | uint8_t port = digitalPinToPort(pin); 32 | volatile uint8_t *reg; 33 | 34 | if (port == NOT_A_PIN) return; 35 | 36 | // JWS: can I let the optimizer do this? 37 | reg = portModeRegister(port); 38 | 39 | if (mode == INPUT) *reg &= ~bit; 40 | else *reg |= bit; 41 | } 42 | 43 | // Forcing this inline keeps the callers from having to push their own stuff 44 | // on the stack. It is a good performance win and only takes 1 more byte per 45 | // user than calling. (It will take more bytes on the 168.) 46 | // 47 | // But shouldn't this be moved into pinMode? Seems silly to check and do on 48 | // each digitalread or write. 49 | // 50 | static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline)); 51 | static inline void turnOffPWM(uint8_t timer) 52 | { 53 | if (timer == TIMER0A) cbi(TCCR0A, COM0A1); 54 | if (timer == TIMER0B) cbi(TCCR0A, COM0B1); 55 | if (timer == TIMER1A) cbi(TCCR1A, COM1A1); 56 | if (timer == TIMER1B) cbi(TCCR1A, COM1B1); 57 | if (timer == TIMER2A) cbi(TCCR2A, COM2A1); 58 | if (timer == TIMER2B) cbi(TCCR2A, COM2B1); 59 | } 60 | 61 | void digitalWrite(uint8_t pin, uint8_t val) 62 | { 63 | uint8_t timer = digitalPinToTimer(pin); 64 | uint8_t bit = digitalPinToBitMask(pin); 65 | uint8_t port = digitalPinToPort(pin); 66 | volatile uint8_t *out; 67 | 68 | if (port == NOT_A_PIN) return; 69 | 70 | // If the pin that support PWM output, we need to turn it off 71 | // before doing a digital write. 72 | if (timer != NOT_ON_TIMER) turnOffPWM(timer); 73 | 74 | out = portOutputRegister(port); 75 | 76 | if (val == LOW) *out &= ~bit; 77 | else *out |= bit; 78 | } 79 | 80 | int digitalRead(uint8_t pin) 81 | { 82 | uint8_t timer = digitalPinToTimer(pin); 83 | uint8_t bit = digitalPinToBitMask(pin); 84 | uint8_t port = digitalPinToPort(pin); 85 | 86 | if (port == NOT_A_PIN) return LOW; 87 | 88 | // If the pin that support PWM output, we need to turn it off 89 | // before getting a digital reading. 90 | if (timer != NOT_ON_TIMER) turnOffPWM(timer); 91 | 92 | if (*portInputRegister(port) & bit) return HIGH; 93 | 94 | return LOW; 95 | } 96 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_private.h - Internal header file. 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ 23 | */ 24 | 25 | #ifndef WiringPrivate_h 26 | #define WiringPrivate_h 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include "wiring.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C"{ 39 | #endif 40 | 41 | #ifndef cbi 42 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 43 | #endif 44 | #ifndef sbi 45 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 46 | #endif 47 | 48 | #define EXTERNAL_INT_0 0 49 | #define EXTERNAL_INT_1 1 50 | #define EXTERNAL_INT_2 2 51 | 52 | #define EXTERNAL_NUM_INTERRUPTS 3 53 | 54 | typedef void (*voidFuncPtr)(void); 55 | 56 | #ifdef __cplusplus 57 | } // extern "C" 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/wiring_pulse.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_pulse.c - pulseIn() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 29 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 30 | * to 3 minutes in length, but must be called at least a few dozen microseconds 31 | * before the start of the pulse. */ 32 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) 33 | { 34 | // cache the port and bit of the pin in order to speed up the 35 | // pulse width measuring loop and achieve finer resolution. calling 36 | // digitalRead() instead yields much coarser resolution. 37 | uint8_t bit = digitalPinToBitMask(pin); 38 | uint8_t port = digitalPinToPort(pin); 39 | uint8_t stateMask = (state ? bit : 0); 40 | unsigned long width = 0; // keep initialization out of time critical area 41 | 42 | // convert the timeout from microseconds to a number of times through 43 | // the initial loop; it takes 16 clock cycles per iteration. 44 | unsigned long numloops = 0; 45 | unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; 46 | 47 | // wait for any previous pulse to end 48 | while ((*portInputRegister(port) & bit) == stateMask) 49 | if (numloops++ == maxloops) 50 | return 0; 51 | 52 | // wait for the pulse to start 53 | while ((*portInputRegister(port) & bit) != stateMask) 54 | if (numloops++ == maxloops) 55 | return 0; 56 | 57 | // wait for the pulse to stop 58 | while ((*portInputRegister(port) & bit) == stateMask) 59 | width++; 60 | 61 | // convert the reading to microseconds. The loop has been determined 62 | // to be 10 clock cycles long and have about 16 clocks between the edge 63 | // and the start of the loop. There will be some error introduced by 64 | // the interrupt handlers. 65 | return clockCyclesToMicroseconds(width * 10 + 16); 66 | } 67 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Gen7/cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | 27 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val) 28 | { 29 | int i; 30 | 31 | for (i = 0; i < 8; i++) { 32 | if (bitOrder == LSBFIRST) 33 | digitalWrite(dataPin, !!(val & (1 << i))); 34 | else 35 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 36 | 37 | digitalWrite(clockPin, HIGH); 38 | digitalWrite(clockPin, LOW); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega1284p/optiboot_1284P_20MHz_57k6_baud.hex: -------------------------------------------------------------------------------- 1 | :020000021000EC 2 | :10FE00000F92CDB7DEB7112484B714BE81FFDFD0C7 3 | :10FE100082E08093C00088E18093C10086E08093F7 4 | :10FE2000C2008AE28093C4008EE0BBD0209A00E03A 5 | :10FE300010E0EE24E394E1E1DE2EF3E0FF2EA5D006 6 | :10FE4000813471F4A2D08983B2D08981823809F4D7 7 | :10FE50008BC0813811F484E001C083E08FD08BC067 8 | :10FE6000823411F484E103C0853419F485E0A7D00D 9 | :10FE700082C0853591F489D0A82EBB2486D0082F66 10 | :10FE800010E0102F00270A291B29812F881F88279F 11 | :10FE9000881F8BBF000F111F6DC0863521F484E0D1 12 | :10FEA0008ED080E0DBCF843609F040C06ED06DD0BC 13 | :10FEB000C82E6BD080EE0030180718F4F801F7BE9A 14 | :10FEC000E895A12C51E0B52E60D0F50181935F013A 15 | :10FED000CE16D1F7F0EE00301F0718F0F801F7BE8C 16 | :10FEE000E89565D007B600FCFDCFF801A0E0B1E0D1 17 | :10FEF0002C9130E011968C91119790E0982F8827E3 18 | :10FF0000822B932B12960C01E7BEE89511243296B2 19 | :10FF100082E0A030B80761F785E0F80187BFE89577 20 | :10FF200007B600FCFDCFD7BEE89525C08437A9F4FD 21 | :10FF30002CD02BD0B82E29D03AD0CB2C4801F401AC 22 | :10FF400086911CD00894811C911CCA94C1F70F5F44 23 | :10FF50001F4FBA940B0D111D0EC0853739F427D0F1 24 | :10FF60008EE10CD087E90AD085E078CF813511F495 25 | :10FF700088E017D01CD080E101D061CF9091C00003 26 | :10FF800095FFFCCF8093C60008958091C00087FF45 27 | :10FF9000FCCF8091C00084FD01C0A8958091C6006F 28 | :10FFA0000895E0E6F0E098E1908380830895EDDF26 29 | :10FFB000803219F088E0F5DFFFCF84E1DFCFCF9307 30 | :10FFC000C82FE3DFC150E9F7F2DFCF91089580E059 31 | :08FFD000E8DFEE27FF2709948A 32 | :040000031000FE00EB 33 | :00000001FF 34 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega1284p/pin_defs.h: -------------------------------------------------------------------------------- 1 | #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) 2 | /* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */ 3 | #define LED_DDR DDRB 4 | #define LED_PORT PORTB 5 | #define LED_PIN PINB 6 | #define LED PINB5 7 | 8 | /* Ports for soft UART */ 9 | #ifdef SOFT_UART 10 | #define UART_PORT PORTD 11 | #define UART_PIN PIND 12 | #define UART_DDR DDRD 13 | #define UART_TX_BIT 1 14 | #define UART_RX_BIT 0 15 | #endif 16 | #endif 17 | 18 | #if defined(__AVR_ATmega8__) 19 | //Name conversion R.Wiersma 20 | #define UCSR0A UCSRA 21 | #define UDR0 UDR 22 | #define UDRE0 UDRE 23 | #define RXC0 RXC 24 | #define FE0 FE 25 | #define TIFR1 TIFR 26 | #define WDTCSR WDTCR 27 | #endif 28 | 29 | /* Luminet support */ 30 | #if defined(__AVR_ATtiny84__) 31 | /* Red LED is connected to pin PA4 */ 32 | #define LED_DDR DDRA 33 | #define LED_PORT PORTA 34 | #define LED_PIN PINA 35 | #define LED PINA4 36 | /* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */ 37 | #ifdef SOFT_UART 38 | #define UART_PORT PORTA 39 | #define UART_PIN PINA 40 | #define UART_DDR DDRA 41 | #define UART_TX_BIT 2 42 | #define UART_RX_BIT 3 43 | #endif 44 | #endif 45 | 46 | /* Sanguino support */ 47 | #if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__) 48 | /* Onboard LED is connected to pin PB0 on Sanguino */ 49 | #define LED_DDR DDRB 50 | #define LED_PORT PORTB 51 | #define LED_PIN PINB 52 | #define LED PINB0 53 | 54 | /* Ports for soft UART */ 55 | #ifdef SOFT_UART 56 | #define UART_PORT PORTD 57 | #define UART_PIN PIND 58 | #define UART_DDR DDRD 59 | #define UART_TX_BIT 1 60 | #define UART_RX_BIT 0 61 | #endif 62 | #endif 63 | 64 | /* Mega support */ 65 | #if defined(__AVR_ATmega1280__) 66 | /* Onboard LED is connected to pin PB7 on Arduino Mega */ 67 | #define LED_DDR DDRB 68 | #define LED_PORT PORTB 69 | #define LED_PIN PINB 70 | #define LED PINB7 71 | 72 | /* Ports for soft UART */ 73 | #ifdef SOFT_UART 74 | #define UART_PORT PORTE 75 | #define UART_PIN PINE 76 | #define UART_DDR DDRE 77 | #define UART_TX_BIT 1 78 | #define UART_RX_BIT 0 79 | #endif 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega1284p/stk500.h: -------------------------------------------------------------------------------- 1 | /* STK500 constants list, from AVRDUDE */ 2 | #define STK_OK 0x10 3 | #define STK_FAILED 0x11 // Not used 4 | #define STK_UNKNOWN 0x12 // Not used 5 | #define STK_NODEVICE 0x13 // Not used 6 | #define STK_INSYNC 0x14 // ' ' 7 | #define STK_NOSYNC 0x15 // Not used 8 | #define ADC_CHANNEL_ERROR 0x16 // Not used 9 | #define ADC_MEASURE_OK 0x17 // Not used 10 | #define PWM_CHANNEL_ERROR 0x18 // Not used 11 | #define PWM_ADJUST_OK 0x19 // Not used 12 | #define CRC_EOP 0x20 // 'SPACE' 13 | #define STK_GET_SYNC 0x30 // '0' 14 | #define STK_GET_SIGN_ON 0x31 // '1' 15 | #define STK_SET_PARAMETER 0x40 // '@' 16 | #define STK_GET_PARAMETER 0x41 // 'A' 17 | #define STK_SET_DEVICE 0x42 // 'B' 18 | #define STK_SET_DEVICE_EXT 0x45 // 'E' 19 | #define STK_ENTER_PROGMODE 0x50 // 'P' 20 | #define STK_LEAVE_PROGMODE 0x51 // 'Q' 21 | #define STK_CHIP_ERASE 0x52 // 'R' 22 | #define STK_CHECK_AUTOINC 0x53 // 'S' 23 | #define STK_LOAD_ADDRESS 0x55 // 'U' 24 | #define STK_UNIVERSAL 0x56 // 'V' 25 | #define STK_PROG_FLASH 0x60 // '`' 26 | #define STK_PROG_DATA 0x61 // 'a' 27 | #define STK_PROG_FUSE 0x62 // 'b' 28 | #define STK_PROG_LOCK 0x63 // 'c' 29 | #define STK_PROG_PAGE 0x64 // 'd' 30 | #define STK_PROG_FUSE_EXT 0x65 // 'e' 31 | #define STK_READ_FLASH 0x70 // 'p' 32 | #define STK_READ_DATA 0x71 // 'q' 33 | #define STK_READ_FUSE 0x72 // 'r' 34 | #define STK_READ_LOCK 0x73 // 's' 35 | #define STK_READ_PAGE 0x74 // 't' 36 | #define STK_READ_SIGN 0x75 // 'u' 37 | #define STK_READ_OSCCAL 0x76 // 'v' 38 | #define STK_READ_FUSE_EXT 0x77 // 'w' 39 | #define STK_READ_OSCCAL_EXT 0x78 // 'x' 40 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega644p/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for ATmegaBOOT 2 | # E.Lins, 18.7.2005 3 | # $Id$ 4 | 5 | 6 | # program name should not be changed... 7 | PROGRAM = ATmegaBOOT_644P 8 | 9 | # enter the target CPU frequency 10 | AVR_FREQ = 16000000L 11 | 12 | MCU_TARGET = atmega644p 13 | LDSECTION = --section-start=.text=0xF800 14 | 15 | OBJ = $(PROGRAM).o 16 | OPTIMIZE = -O2 17 | 18 | DEFS = 19 | LIBS = 20 | 21 | CC = avr-gcc 22 | 23 | 24 | # Override is only needed by avr-lib build system. 25 | 26 | override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) 27 | override LDFLAGS = -Wl,$(LDSECTION) 28 | #override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION) 29 | 30 | OBJCOPY = avr-objcopy 31 | OBJDUMP = avr-objdump 32 | 33 | all: CFLAGS += '-DMAX_TIME_COUNT=8000000L>>1' -DADABOOT 34 | all: $(PROGRAM).hex 35 | 36 | $(PROGRAM).hex: $(PROGRAM).elf 37 | $(OBJCOPY) -j .text -j .data -O ihex $< $@ 38 | 39 | $(PROGRAM).elf: $(OBJ) 40 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 41 | 42 | $(OBJ): ATmegaBOOT.c 43 | avr-gcc $(CFLAGS) $(LDFLAGS) -c -g -O2 -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o 44 | 45 | %.lst: %.elf 46 | $(OBJDUMP) -h -S $< > $@ 47 | 48 | %.srec: %.elf 49 | $(OBJCOPY) -j .text -j .data -O srec $< $@ 50 | 51 | %.bin: %.elf 52 | $(OBJCOPY) -j .text -j .data -O binary $< $@ 53 | 54 | clean: 55 | rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex 56 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega644p/README.txt: -------------------------------------------------------------------------------- 1 | Note: This bootloader support ATmega644, ATmega644P and ATmega324P. 2 | To build, set PROGRAM and MCU_TARGET in the Makefile according to your target device. 3 | 4 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | HardwareSerial.h - Hardware serial library for Wiring 3 | Copyright (c) 2006 Nicholas Zambetti. 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 | Modified 28 September 2010 by Mark Sproul 20 | */ 21 | 22 | #ifndef HardwareSerial_h 23 | #define HardwareSerial_h 24 | 25 | #include 26 | 27 | #include "Stream.h" 28 | 29 | struct ring_buffer; 30 | 31 | class HardwareSerial : public Stream 32 | { 33 | private: 34 | ring_buffer *_rx_buffer; 35 | volatile uint8_t *_ubrrh; 36 | volatile uint8_t *_ubrrl; 37 | volatile uint8_t *_ucsra; 38 | volatile uint8_t *_ucsrb; 39 | volatile uint8_t *_udr; 40 | uint8_t _rxen; 41 | uint8_t _txen; 42 | uint8_t _rxcie; 43 | uint8_t _udre; 44 | uint8_t _u2x; 45 | public: 46 | HardwareSerial(ring_buffer *rx_buffer, 47 | volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, 48 | volatile uint8_t *ucsra, volatile uint8_t *ucsrb, 49 | volatile uint8_t *udr, 50 | uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); 51 | void begin(long); 52 | void end(); 53 | virtual int available(void); 54 | virtual int peek(void); 55 | virtual int read(void); 56 | virtual void flush(void); 57 | virtual void write(uint8_t); 58 | using Print::write; // pull in write(str) and write(buf, size) from Print 59 | }; 60 | 61 | #if defined(UBRRH) || defined(UBRR0H) 62 | extern HardwareSerial Serial; 63 | #elif defined(USBCON) 64 | #include "usb_api.h" 65 | #endif 66 | #if defined(UBRR1H) 67 | extern HardwareSerial Serial1; 68 | #endif 69 | #if defined(UBRR2H) 70 | extern HardwareSerial Serial2; 71 | #endif 72 | #if defined(UBRR3H) 73 | extern HardwareSerial Serial3; 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Print.h - Base class that provides print() and println() 3 | Copyright (c) 2008 David A. Mellis. 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 | 20 | #ifndef Print_h 21 | #define Print_h 22 | 23 | #include 24 | #include // for size_t 25 | 26 | #include "WString.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | #define BYTE 0 33 | 34 | class Print 35 | { 36 | private: 37 | void printNumber(unsigned long, uint8_t); 38 | void printFloat(double, uint8_t); 39 | public: 40 | virtual void write(uint8_t) = 0; 41 | virtual void write(const char *str); 42 | virtual void write(const uint8_t *buffer, size_t size); 43 | 44 | void print(const String &); 45 | void print(const char[]); 46 | void print(char, int = BYTE); 47 | void print(unsigned char, int = BYTE); 48 | void print(int, int = DEC); 49 | void print(unsigned int, int = DEC); 50 | void print(long, int = DEC); 51 | void print(unsigned long, int = DEC); 52 | void print(double, int = 2); 53 | 54 | void println(const String &s); 55 | void println(const char[]); 56 | void println(char, int = BYTE); 57 | void println(unsigned char, int = BYTE); 58 | void println(int, int = DEC); 59 | void println(unsigned int, int = DEC); 60 | void println(long, int = DEC); 61 | void println(unsigned long, int = DEC); 62 | void println(double, int = 2); 63 | void println(void); 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | Stream.h - base class for character-based streams. 3 | Copyright (c) 2010 David A. Mellis. 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 | 20 | #ifndef Stream_h 21 | #define Stream_h 22 | 23 | #include 24 | #include "Print.h" 25 | 26 | class Stream : public Print 27 | { 28 | public: 29 | virtual int available() = 0; 30 | virtual int read() = 0; 31 | virtual int peek() = 0; 32 | virtual void flush() = 0; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/WConstants.h: -------------------------------------------------------------------------------- 1 | #include "wiring.h" 2 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | $Id$ 24 | */ 25 | 26 | extern "C" { 27 | #include "stdlib.h" 28 | } 29 | 30 | void randomSeed(unsigned int seed) 31 | { 32 | if (seed != 0) { 33 | srandom(seed); 34 | } 35 | } 36 | 37 | long random(long howbig) 38 | { 39 | if (howbig == 0) { 40 | return 0; 41 | } 42 | return random() % howbig; 43 | } 44 | 45 | long random(long howsmall, long howbig) 46 | { 47 | if (howsmall >= howbig) { 48 | return howsmall; 49 | } 50 | long diff = howbig - howsmall; 51 | return random(diff) + howsmall; 52 | } 53 | 54 | long map(long x, long in_min, long in_max, long out_min, long out_max) 55 | { 56 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 57 | } 58 | 59 | unsigned int makeWord(unsigned int w) { return w; } 60 | unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/WProgram.h: -------------------------------------------------------------------------------- 1 | #ifndef WProgram_h 2 | #define WProgram_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "wiring.h" 11 | 12 | #ifdef __cplusplus 13 | #include "WCharacter.h" 14 | #include "WString.h" 15 | #include "HardwareSerial.h" 16 | 17 | uint16_t makeWord(uint16_t w); 18 | uint16_t makeWord(byte h, byte l); 19 | 20 | #define word(...) makeWord(__VA_ARGS__) 21 | 22 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); 23 | 24 | void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); 25 | void noTone(uint8_t _pin); 26 | 27 | // WMath prototypes 28 | long random(long); 29 | long random(long, long); 30 | void randomSeed(unsigned int); 31 | long map(long, long, long, long, long); 32 | 33 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 34 | const static uint8_t A0 = 54; 35 | const static uint8_t A1 = 55; 36 | const static uint8_t A2 = 56; 37 | const static uint8_t A3 = 57; 38 | const static uint8_t A4 = 58; 39 | const static uint8_t A5 = 59; 40 | const static uint8_t A6 = 60; 41 | const static uint8_t A7 = 61; 42 | const static uint8_t A8 = 62; 43 | const static uint8_t A9 = 63; 44 | const static uint8_t A10 = 64; 45 | const static uint8_t A11 = 65; 46 | const static uint8_t A12 = 66; 47 | const static uint8_t A13 = 67; 48 | const static uint8_t A14 = 68; 49 | const static uint8_t A15 = 69; 50 | #else 51 | const static uint8_t A0 = 14; 52 | const static uint8_t A1 = 15; 53 | const static uint8_t A2 = 16; 54 | const static uint8_t A3 = 17; 55 | const static uint8_t A4 = 18; 56 | const static uint8_t A5 = 19; 57 | const static uint8_t A6 = 20; 58 | const static uint8_t A7 = 21; 59 | #endif 60 | 61 | #endif 62 | 63 | #endif -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | init(); 6 | 7 | setup(); 8 | 9 | for (;;) 10 | loop(); 11 | 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_private.h - Internal header file. 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ 23 | */ 24 | 25 | #ifndef WiringPrivate_h 26 | #define WiringPrivate_h 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "wiring.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C"{ 38 | #endif 39 | 40 | #ifndef cbi 41 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 42 | #endif 43 | #ifndef sbi 44 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 45 | #endif 46 | 47 | #define EXTERNAL_INT_0 0 48 | #define EXTERNAL_INT_1 1 49 | #define EXTERNAL_INT_2 2 50 | #define EXTERNAL_INT_3 3 51 | #define EXTERNAL_INT_4 4 52 | #define EXTERNAL_INT_5 5 53 | #define EXTERNAL_INT_6 6 54 | #define EXTERNAL_INT_7 7 55 | 56 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 57 | #define EXTERNAL_NUM_INTERRUPTS 8 58 | #elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__) 59 | #define EXTERNAL_NUM_INTERRUPTS 3 60 | #else 61 | #define EXTERNAL_NUM_INTERRUPTS 2 62 | #endif 63 | 64 | typedef void (*voidFuncPtr)(void); 65 | 66 | #ifdef __cplusplus 67 | } // extern "C" 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/wiring_pulse.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_pulse.c - pulseIn() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 29 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 30 | * to 3 minutes in length, but must be called at least a few dozen microseconds 31 | * before the start of the pulse. */ 32 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) 33 | { 34 | // cache the port and bit of the pin in order to speed up the 35 | // pulse width measuring loop and achieve finer resolution. calling 36 | // digitalRead() instead yields much coarser resolution. 37 | uint8_t bit = digitalPinToBitMask(pin); 38 | uint8_t port = digitalPinToPort(pin); 39 | uint8_t stateMask = (state ? bit : 0); 40 | unsigned long width = 0; // keep initialization out of time critical area 41 | 42 | // convert the timeout from microseconds to a number of times through 43 | // the initial loop; it takes 16 clock cycles per iteration. 44 | unsigned long numloops = 0; 45 | unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; 46 | 47 | // wait for any previous pulse to end 48 | while ((*portInputRegister(port) & bit) == stateMask) 49 | if (numloops++ == maxloops) 50 | return 0; 51 | 52 | // wait for the pulse to start 53 | while ((*portInputRegister(port) & bit) != stateMask) 54 | if (numloops++ == maxloops) 55 | return 0; 56 | 57 | // wait for the pulse to stop 58 | while ((*portInputRegister(port) & bit) == stateMask) { 59 | if (numloops++ == maxloops) 60 | return 0; 61 | width++; 62 | } 63 | 64 | // convert the reading to microseconds. The loop has been determined 65 | // to be 20 clock cycles long and have about 16 clocks between the edge 66 | // and the start of the loop. There will be some error introduced by 67 | // the interrupt handlers. 68 | return clockCyclesToMicroseconds(width * 21 + 16); 69 | } 70 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | 27 | uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { 28 | uint8_t value = 0; 29 | uint8_t i; 30 | 31 | for (i = 0; i < 8; ++i) { 32 | digitalWrite(clockPin, HIGH); 33 | if (bitOrder == LSBFIRST) 34 | value |= digitalRead(dataPin) << i; 35 | else 36 | value |= digitalRead(dataPin) << (7 - i); 37 | digitalWrite(clockPin, LOW); 38 | } 39 | return value; 40 | } 41 | 42 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) 43 | { 44 | uint8_t i; 45 | 46 | for (i = 0; i < 8; i++) { 47 | if (bitOrder == LSBFIRST) 48 | digitalWrite(dataPin, !!(val & (1 << i))); 49 | else 50 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 51 | 52 | digitalWrite(clockPin, HIGH); 53 | digitalWrite(clockPin, LOW); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/Sanguino/programmers.txt: -------------------------------------------------------------------------------- 1 | avrisp.name=AVR ISP 2 | avrisp.communication=serial 3 | avrisp.protocol=stk500v1 4 | 5 | avrispmkii.name=AVRISP mkII 6 | avrispmkii.communication=usb 7 | avrispmkii.protocol=stk500v2 8 | 9 | usbtinyisp.name=USBtinyISP 10 | usbtinyisp.protocol=usbtiny 11 | 12 | parallel.name=Parallel Programmer 13 | parallel.protocol=dapa 14 | parallel.force=true 15 | # parallel.delay=200 16 | 17 | arduinoisp.name=Arduino as ISP 18 | arduinoisp.communication=serial 19 | arduinoisp.protocol=stk500v1 20 | arduinoisp.speed=19200 21 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal/LiquidCrystal.h: -------------------------------------------------------------------------------- 1 | #ifndef LiquidCrystal_h 2 | #define LiquidCrystal_h 3 | 4 | #include 5 | #include "Print.h" 6 | 7 | // commands 8 | #define LCD_CLEARDISPLAY 0x01 9 | #define LCD_RETURNHOME 0x02 10 | #define LCD_ENTRYMODESET 0x04 11 | #define LCD_DISPLAYCONTROL 0x08 12 | #define LCD_CURSORSHIFT 0x10 13 | #define LCD_FUNCTIONSET 0x20 14 | #define LCD_SETCGRAMADDR 0x40 15 | #define LCD_SETDDRAMADDR 0x80 16 | 17 | // flags for display entry mode 18 | #define LCD_ENTRYRIGHT 0x00 19 | #define LCD_ENTRYLEFT 0x02 20 | #define LCD_ENTRYSHIFTINCREMENT 0x01 21 | #define LCD_ENTRYSHIFTDECREMENT 0x00 22 | 23 | // flags for display on/off control 24 | #define LCD_DISPLAYON 0x04 25 | #define LCD_DISPLAYOFF 0x00 26 | #define LCD_CURSORON 0x02 27 | #define LCD_CURSOROFF 0x00 28 | #define LCD_BLINKON 0x01 29 | #define LCD_BLINKOFF 0x00 30 | 31 | // flags for display/cursor shift 32 | #define LCD_DISPLAYMOVE 0x08 33 | #define LCD_CURSORMOVE 0x00 34 | #define LCD_MOVERIGHT 0x04 35 | #define LCD_MOVELEFT 0x00 36 | 37 | // flags for function set 38 | #define LCD_8BITMODE 0x10 39 | #define LCD_4BITMODE 0x00 40 | #define LCD_2LINE 0x08 41 | #define LCD_1LINE 0x00 42 | #define LCD_5x10DOTS 0x04 43 | #define LCD_5x8DOTS 0x00 44 | 45 | class LiquidCrystal : public Print { 46 | public: 47 | LiquidCrystal(uint8_t rs, uint8_t enable, 48 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 49 | uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 50 | LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 51 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 52 | uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 53 | LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 54 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 55 | LiquidCrystal(uint8_t rs, uint8_t enable, 56 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 57 | 58 | void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, 59 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 60 | uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 61 | 62 | void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); 63 | 64 | void clear(); 65 | void home(); 66 | 67 | void noDisplay(); 68 | void display(); 69 | void noBlink(); 70 | void blink(); 71 | void noCursor(); 72 | void cursor(); 73 | void scrollDisplayLeft(); 74 | void scrollDisplayRight(); 75 | void leftToRight(); 76 | void rightToLeft(); 77 | void autoscroll(); 78 | void noAutoscroll(); 79 | 80 | void createChar(uint8_t, uint8_t[]); 81 | void setCursor(uint8_t, uint8_t); 82 | virtual void write(uint8_t); 83 | void command(uint8_t); 84 | private: 85 | void send(uint8_t, uint8_t); 86 | void write4bits(uint8_t); 87 | void write8bits(uint8_t); 88 | void pulseEnable(); 89 | 90 | uint8_t _rs_pin; // LOW: command. HIGH: character. 91 | uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD. 92 | uint8_t _enable_pin; // activated by a HIGH pulse. 93 | uint8_t _data_pins[8]; 94 | 95 | uint8_t _displayfunction; 96 | uint8_t _displaycontrol; 97 | uint8_t _displaymode; 98 | 99 | uint8_t _initialized; 100 | 101 | uint8_t _numlines,_currline; 102 | }; 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For LiquidCrystal 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | LiquidCrystal KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | clear KEYWORD2 17 | home KEYWORD2 18 | print KEYWORD2 19 | setCursor KEYWORD2 20 | cursor KEYWORD2 21 | noCursor KEYWORD2 22 | blink KEYWORD2 23 | noBlink KEYWORD2 24 | display KEYWORD2 25 | noDisplay KEYWORD2 26 | autoscroll KEYWORD2 27 | noAutoscroll KEYWORD2 28 | leftToRight KEYWORD2 29 | rightToLeft KEYWORD2 30 | scrollDisplayLeft KEYWORD2 31 | scrollDisplayRight KEYWORD2 32 | createChar KEYWORD2 33 | 34 | ####################################### 35 | # Constants (LITERAL1) 36 | ####################################### 37 | 38 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/SPI/SPI.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 by Cristian Maglie 3 | * SPI Master library for arduino. 4 | * 5 | * This file is free software; you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or the GNU Lesser General Public License version 2.1, both as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #include "pins_arduino.h" 12 | #include "SPI.h" 13 | 14 | SPIClass SPI; 15 | 16 | void SPIClass::begin() { 17 | // Set direction register for SCK and MOSI pin. 18 | // MISO pin automatically overrides to INPUT. 19 | // When the SS pin is set as OUTPUT, it can be used as 20 | // a general purpose output port (it doesn't influence 21 | // SPI operations). 22 | 23 | pinMode(SCK, OUTPUT); 24 | pinMode(MOSI, OUTPUT); 25 | pinMode(SS, OUTPUT); 26 | 27 | digitalWrite(SCK, LOW); 28 | digitalWrite(MOSI, LOW); 29 | digitalWrite(SS, HIGH); 30 | 31 | // Warning: if the SS pin ever becomes a LOW INPUT then SPI 32 | // automatically switches to Slave, so the data direction of 33 | // the SS pin MUST be kept as OUTPUT. 34 | SPCR |= _BV(MSTR); 35 | SPCR |= _BV(SPE); 36 | } 37 | 38 | void SPIClass::end() { 39 | SPCR &= ~_BV(SPE); 40 | } 41 | 42 | void SPIClass::setBitOrder(uint8_t bitOrder) 43 | { 44 | if(bitOrder == LSBFIRST) { 45 | SPCR |= _BV(DORD); 46 | } else { 47 | SPCR &= ~(_BV(DORD)); 48 | } 49 | } 50 | 51 | void SPIClass::setDataMode(uint8_t mode) 52 | { 53 | SPCR = (SPCR & ~SPI_MODE_MASK) | mode; 54 | } 55 | 56 | void SPIClass::setClockDivider(uint8_t rate) 57 | { 58 | SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK); 59 | SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((rate >> 2) & SPI_2XCLOCK_MASK); 60 | } 61 | 62 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/SPI/SPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 by Cristian Maglie 3 | * SPI Master library for arduino. 4 | * 5 | * This file is free software; you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or the GNU Lesser General Public License version 2.1, both as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #ifndef _SPI_H_INCLUDED 12 | #define _SPI_H_INCLUDED 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #define SPI_CLOCK_DIV4 0x00 19 | #define SPI_CLOCK_DIV16 0x01 20 | #define SPI_CLOCK_DIV64 0x02 21 | #define SPI_CLOCK_DIV128 0x03 22 | #define SPI_CLOCK_DIV2 0x04 23 | #define SPI_CLOCK_DIV8 0x05 24 | #define SPI_CLOCK_DIV32 0x06 25 | #define SPI_CLOCK_DIV64 0x07 26 | 27 | #define SPI_MODE0 0x00 28 | #define SPI_MODE1 0x04 29 | #define SPI_MODE2 0x08 30 | #define SPI_MODE3 0x0C 31 | 32 | #define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR 33 | #define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR 34 | #define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR 35 | 36 | class SPIClass { 37 | public: 38 | inline static byte transfer(byte _data); 39 | 40 | // SPI Configuration methods 41 | 42 | inline static void attachInterrupt(); 43 | inline static void detachInterrupt(); // Default 44 | 45 | static void begin(); // Default 46 | static void end(); 47 | 48 | static void setBitOrder(uint8_t); 49 | static void setDataMode(uint8_t); 50 | static void setClockDivider(uint8_t); 51 | }; 52 | 53 | extern SPIClass SPI; 54 | 55 | byte SPIClass::transfer(byte _data) { 56 | SPDR = _data; 57 | while (!(SPSR & _BV(SPIF))) 58 | ; 59 | return SPDR; 60 | } 61 | 62 | void SPIClass::attachInterrupt() { 63 | SPCR |= _BV(SPIE); 64 | } 65 | 66 | void SPIClass::detachInterrupt() { 67 | SPCR &= ~_BV(SPIE); 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/SPI/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SPI KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | end KEYWORD2 16 | transfer KEYWORD2 17 | setBitOrder KEYWORD2 18 | setDataMode KEYWORD2 19 | setClockDivider KEYWORD2 20 | 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | SPI_CLOCK_DIV4 LITERAL1 26 | SPI_CLOCK_DIV16 LITERAL1 27 | SPI_CLOCK_DIV64 LITERAL1 28 | SPI_CLOCK_DIV128 LITERAL1 29 | SPI_CLOCK_DIV2 LITERAL1 30 | SPI_CLOCK_DIV8 LITERAL1 31 | SPI_CLOCK_DIV32 LITERAL1 32 | SPI_CLOCK_DIV64 LITERAL1 33 | SPI_MODE0 LITERAL1 34 | SPI_MODE1 LITERAL1 35 | SPI_MODE2 LITERAL1 36 | SPI_MODE3 LITERAL1 -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/U8glib/INSTALL.TXT: -------------------------------------------------------------------------------- 1 | 2 | U8GLIB 3 | http://code.google.com/p/u8glib/ 4 | 5 | 6 | Install instructions for the Arduino environment. 7 | 8 | 1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder 9 | 2. Start Arduino IDE 10 | 11 | Install instructions for the Chipkit (Arduino) environment. 12 | 13 | 1. cd /libraries 14 | 2. unzip u8glib_arduino_vX.XX.zip 15 | 3. cd ///hardware/pic32/libraries 16 | 4. again: u8glib_arduino_vX.XX.zip 17 | 5. Open hardware/pic32/cores/pic32/Print.h 18 | Remove line 19 | #define BYTE 0 20 | from the file, use PRINT_BYTE instead of BYTE. 21 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/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_0.xx/libraries/U8glib/utility/chessengine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/chessengine.c -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/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_0.xx/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_0.xx/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_INDEX: 62 | break; 63 | case U8G_DEV_MSG_SET_XY_CB: 64 | break; 65 | } 66 | return 1; 67 | } 68 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/u8g_ellipse.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_ellipse.c 4 | 5 | Utility to draw empty and filled ellipses. 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, bjthom@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 | Addition to the U8G Library as of 02/29/12 37 | Adapted from Bresenham's Algorithm and the following websites: 38 | http://free.pages.at/easyfilter/bresenham.html 39 | http://homepage.smc.edu/kennedy_john/belipse.pdf 40 | 41 | */ 42 | 43 | #include "u8g.h" 44 | 45 | 46 | #ifdef WORK_IN_PROGRESS 47 | 48 | void u8g_DrawEllipseRect(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t x1, u8g_uint_t y1) 49 | { 50 | int a = abs(x1 - x0); 51 | int b = abs(y1 - y0); //get diameters 52 | int b1 = b&1; 53 | long dx = 4*(1-a)*b*b; 54 | long dy = 4*(b1+1)*a*a; 55 | long err = dx+dy+b1*a*a; 56 | long e2; 57 | 58 | if (x0 > x1) { x0 = x1; x1 += a; } 59 | if (y0 > y1) { y0 = y1; } 60 | y0 += (b+1)/2; 61 | y1 = y0-b1; 62 | a *= 8*a; 63 | b1 = 8*b*b; 64 | 65 | do { 66 | u8g_DrawPixel(u8g, x1, y0); 67 | u8g_DrawPixel(u8g, x0, y0); 68 | u8g_DrawPixel(u8g, x0, y1); 69 | u8g_DrawPixel(u8g, x1, y1); 70 | e2 = 2*err; 71 | if (e2 >= dx) { 72 | x0++; 73 | x1--; 74 | err += dx += b1; 75 | } 76 | if (e2 <= dy) { 77 | y0++; 78 | y1--; 79 | err += dy += a; 80 | } 81 | } while (x0 <= x1); 82 | 83 | while (y0-y1 < b) { 84 | u8g_DrawPixel(u8g, x0-1, y0); 85 | u8g_DrawPixel(u8g, x1+1, y0++); 86 | u8g_DrawPixel(u8g, x0-1, y1); 87 | u8g_DrawPixel(u8g, x1+1, y1--); 88 | } 89 | } 90 | 91 | void u8g_DrawEllipse(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t xr, u8g_uint_t yr) 92 | { 93 | u8g_DrawPixel(u8g, x0, y0+yr); 94 | u8g_DrawPixel(u8g, x0, y0-yr); 95 | u8g_DrawPixel(u8g, x0+xr, y0); 96 | u8g_DrawPixel(u8g, x0-xr, y0); 97 | } 98 | 99 | #endif 100 | 101 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/u8g_font_data.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/u8g_font_data.c -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/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_0.xx/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_0.xx/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 | /* AVR */ 68 | 69 | #if defined(__AVR__) 70 | #define U8G_ATMEGA_HW_SPI 71 | 72 | /* remove the definition for attiny */ 73 | #if __AVR_ARCH__ == 2 74 | #undef U8G_ATMEGA_HW_SPI 75 | #endif 76 | #if __AVR_ARCH__ == 25 77 | #undef U8G_ATMEGA_HW_SPI 78 | #endif 79 | #endif 80 | 81 | #if defined(U8G_ATMEGA_HW_SPI) 82 | #include 83 | static uint8_t u8g_state_avr_spi_memory[2]; 84 | 85 | void u8g_backup_avr_spi(uint8_t msg) 86 | { 87 | if ( U8G_STATE_MSG_IS_BACKUP(msg) ) 88 | { 89 | u8g_state_avr_spi_memory[U8G_STATE_MSG_GET_IDX(msg)] = SPCR; 90 | } 91 | else 92 | { 93 | uint8_t tmp = SREG; 94 | cli(); 95 | SPCR = 0; 96 | SPCR = u8g_state_avr_spi_memory[U8G_STATE_MSG_GET_IDX(msg)]; 97 | SREG = tmp; 98 | } 99 | } 100 | 101 | #endif 102 | 103 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_0.xx/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_0.xx/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 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/boards.txt: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | 3 | atmega644.name=Sanguino W/ ATmega644P 4 | 5 | atmega644.upload.protocol=stk500 6 | atmega644.upload.maximum_size=63488 7 | atmega644.upload.speed=57600 8 | 9 | atmega644.bootloader.low_fuses=0xFF 10 | atmega644.bootloader.high_fuses=0x9A 11 | atmega644.bootloader.extended_fuses=0xFF 12 | atmega644.bootloader.path=atmega 13 | atmega644.bootloader.file=ATmegaBOOT_168_atmega644p.hex 14 | #atmega644.bootloader.file=ATmegaBOOT_644P.hex 15 | atmega644.bootloader.unlock_bits=0x3F 16 | atmega644.bootloader.lock_bits=0x0F 17 | 18 | atmega644.build.mcu=atmega644p 19 | atmega644.build.f_cpu=16000000L 20 | atmega644.build.core=arduino 21 | atmega644.build.variant=standard 22 | ############################################################## 23 | 24 | atmega12848m.name=Sanguino W/ ATmega1284p 8mhz 25 | 26 | atmega12848m.upload.protocol=stk500 27 | atmega12848m.upload.maximum_size=131072 28 | atmega12848m.upload.speed=19200 29 | 30 | atmega1284.bootloader.low_fuses=0xD6 31 | atmega1284.bootloader.high_fuses=0xDA 32 | atmega1284.bootloader.extended_fuses=0xFD 33 | atmega12848m.bootloader.path=atmega 34 | atmega12848m.bootloader.file=ATmegaBOOT_168_atmega1284p_8m.hex 35 | atmega12848m.bootloader.unlock_bits=0x3F 36 | atmega12848m.bootloader.lock_bits=0x0F 37 | 38 | atmega12848m.build.mcu=atmega1284p 39 | atmega12848m.build.f_cpu=8000000L 40 | atmega12848m.build.core=arduino 41 | atmega12848m.build.variant=standard 42 | 43 | ############################################################## 44 | 45 | atmega1284.name=Sanguino W/ ATmega1284p 16mhz 46 | 47 | atmega1284.upload.protocol=stk500 48 | atmega1284.upload.maximum_size=131072 49 | atmega1284.upload.speed=57600 50 | 51 | atmega1284.bootloader.low_fuses=0xD6 52 | atmega1284.bootloader.high_fuses=0xDA 53 | atmega1284.bootloader.extended_fuses=0xFD 54 | atmega1284.bootloader.path=atmega 55 | atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex 56 | atmega1284.bootloader.unlock_bits=0x3F 57 | atmega1284.bootloader.lock_bits=0x0F 58 | 59 | atmega1284.build.mcu=atmega1284p 60 | atmega1284.build.f_cpu=16000000L 61 | atmega1284.build.core=arduino 62 | atmega1284.build.variant=standard 63 | ############################################################## 64 | 65 | atmega1284m.name=Sanguino W/ ATmega1284p 20mhz 66 | 67 | atmega1284m.upload.protocol=stk500 68 | atmega1284m.upload.maximum_size=131072 69 | atmega1284m.upload.speed=57600 70 | 71 | atmega1284m.bootloader.low_fuses=0xD6 72 | atmega1284m.bootloader.high_fuses=0xDA 73 | atmega1284m.bootloader.extended_fuses=0xFD 74 | atmega1284m.bootloader.path=atmega 75 | atmega1284m.bootloader.file=ATmegaBOOT_168_atmega1284p.hex 76 | atmega1284m.bootloader.unlock_bits=0x3F 77 | atmega1284m.bootloader.lock_bits=0x0F 78 | 79 | atmega1284m.build.mcu=atmega1284p 80 | atmega1284m.build.f_cpu=20000000L 81 | atmega1284m.build.core=arduino 82 | atmega1284m.build.variant=standard 83 | # 84 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.elf -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/bootloaders/atmega644p/Makefile: -------------------------------------------------------------------------------- 1 | #Makefile for ATmegaBOOT 2 | # E.Lins, 18.7.2005 3 | # $Id$ 4 | 5 | 6 | # program name should not be changed... 7 | PROGRAM = ATmegaBOOT_644P 8 | 9 | # enter the target CPU frequency 10 | AVR_FREQ = 16000000L 11 | 12 | MCU_TARGET = atmega644p 13 | LDSECTION = --section-start=.text=0x1F000 14 | 15 | OBJ = $(PROGRAM).o 16 | OPTIMIZE = -Os 17 | 18 | DEFS = 19 | LIBS = 20 | 21 | CC = avr-gcc 22 | 23 | 24 | # Override is only needed by avr-lib build system. 25 | 26 | override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) 27 | override LDFLAGS = -Wl,$(LDSECTION) 28 | #override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION) 29 | 30 | OBJCOPY = avr-objcopy 31 | OBJDUMP = avr-objdump 32 | 33 | all: CFLAGS += '-DMAX_TIME_COUNT=8000000L>>1' -DADABOOT 34 | all: $(PROGRAM).hex 35 | 36 | $(PROGRAM).hex: $(PROGRAM).elf 37 | $(OBJCOPY) -j .text -j .data -O ihex $< $@ 38 | 39 | $(PROGRAM).elf: $(OBJ) 40 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 41 | 42 | $(OBJ): ATmegaBOOT.c 43 | avr-gcc $(CFLAGS) $(LDFLAGS) -c -g -Os -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o 44 | 45 | %.lst: %.elf 46 | $(OBJDUMP) -h -S $< > $@ 47 | 48 | %.srec: %.elf 49 | $(OBJCOPY) -j .text -j .data -O srec $< $@ 50 | 51 | %.bin: %.elf 52 | $(OBJCOPY) -j .text -j .data -O binary $< $@ 53 | 54 | clean: 55 | rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex 56 | 57 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/bootloaders/atmega644p/README.txt: -------------------------------------------------------------------------------- 1 | Note: This bootloader support ATmega644, ATmega644P and ATmega324P. 2 | To build, set PROGRAM and MCU_TARGET in the Makefile according to your target device. 3 | 4 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/Client.h: -------------------------------------------------------------------------------- 1 | #ifndef client_h 2 | #define client_h 3 | #include "Print.h" 4 | #include "Stream.h" 5 | #include "IPAddress.h" 6 | 7 | class Client : public Stream { 8 | 9 | public: 10 | virtual int connect(IPAddress ip, uint16_t port) =0; 11 | virtual int connect(const char *host, uint16_t port) =0; 12 | virtual size_t write(uint8_t) =0; 13 | virtual size_t write(const uint8_t *buf, size_t size) =0; 14 | virtual int available() = 0; 15 | virtual int read() = 0; 16 | virtual int read(uint8_t *buf, size_t size) = 0; 17 | virtual int peek() = 0; 18 | virtual void flush() = 0; 19 | virtual void stop() = 0; 20 | virtual uint8_t connected() = 0; 21 | virtual operator bool() = 0; 22 | protected: 23 | uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/IPAddress.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | IPAddress::IPAddress() 6 | { 7 | memset(_address, 0, sizeof(_address)); 8 | } 9 | 10 | IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) 11 | { 12 | _address[0] = first_octet; 13 | _address[1] = second_octet; 14 | _address[2] = third_octet; 15 | _address[3] = fourth_octet; 16 | } 17 | 18 | IPAddress::IPAddress(uint32_t address) 19 | { 20 | memcpy(_address, &address, sizeof(_address)); 21 | } 22 | 23 | IPAddress::IPAddress(const uint8_t *address) 24 | { 25 | memcpy(_address, address, sizeof(_address)); 26 | } 27 | 28 | IPAddress& IPAddress::operator=(const uint8_t *address) 29 | { 30 | memcpy(_address, address, sizeof(_address)); 31 | return *this; 32 | } 33 | 34 | IPAddress& IPAddress::operator=(uint32_t address) 35 | { 36 | memcpy(_address, (const uint8_t *)&address, sizeof(_address)); 37 | return *this; 38 | } 39 | 40 | bool IPAddress::operator==(const uint8_t* addr) 41 | { 42 | return memcmp(addr, _address, sizeof(_address)) == 0; 43 | } 44 | 45 | size_t IPAddress::printTo(Print& p) const 46 | { 47 | size_t n = 0; 48 | for (int i =0; i < 3; i++) 49 | { 50 | n += p.print(_address[i], DEC); 51 | n += p.print('.'); 52 | } 53 | n += p.print(_address[3], DEC); 54 | return n; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/IPAddress.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * MIT License: 4 | * Copyright (c) 2011 Adrian McEwen 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | * adrianm@mcqn.com 1/1/2011 24 | */ 25 | 26 | #ifndef IPAddress_h 27 | #define IPAddress_h 28 | 29 | #include 30 | 31 | // A class to make it easier to handle and pass around IP addresses 32 | 33 | class IPAddress : public Printable { 34 | private: 35 | uint8_t _address[4]; // IPv4 address 36 | // Access the raw byte array containing the address. Because this returns a pointer 37 | // to the internal structure rather than a copy of the address this function should only 38 | // be used when you know that the usage of the returned uint8_t* will be transient and not 39 | // stored. 40 | uint8_t* raw_address() { return _address; }; 41 | 42 | public: 43 | // Constructors 44 | IPAddress(); 45 | IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); 46 | IPAddress(uint32_t address); 47 | IPAddress(const uint8_t *address); 48 | 49 | // Overloaded cast operator to allow IPAddress objects to be used where a pointer 50 | // to a four-byte uint8_t array is expected 51 | operator uint32_t() { return *((uint32_t*)_address); }; 52 | bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); }; 53 | bool operator==(const uint8_t* addr); 54 | 55 | // Overloaded index operator to allow getting and setting individual octets of the address 56 | uint8_t operator[](int index) const { return _address[index]; }; 57 | uint8_t& operator[](int index) { return _address[index]; }; 58 | 59 | // Overloaded copy operators to allow initialisation of IPAddress objects from other types 60 | IPAddress& operator=(const uint8_t *address); 61 | IPAddress& operator=(uint32_t address); 62 | 63 | virtual size_t printTo(Print& p) const; 64 | 65 | friend class EthernetClass; 66 | friend class UDP; 67 | friend class Client; 68 | friend class Server; 69 | friend class DhcpClass; 70 | friend class DNSClient; 71 | }; 72 | 73 | const IPAddress INADDR_NONE(0,0,0,0); 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/Platform.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __PLATFORM_H__ 3 | #define __PLATFORM_H__ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | typedef unsigned char u8; 12 | typedef unsigned short u16; 13 | typedef unsigned long u32; 14 | 15 | #include "Arduino.h" 16 | 17 | #if defined(USBCON) 18 | #include "USBDesc.h" 19 | #include "USBCore.h" 20 | #include "USBAPI.h" 21 | #endif /* if defined(USBCON) */ 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Print.h - Base class that provides print() and println() 3 | Copyright (c) 2008 David A. Mellis. 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 | 20 | #ifndef Print_h 21 | #define Print_h 22 | 23 | #include 24 | #include // for size_t 25 | 26 | #include "WString.h" 27 | #include "Printable.h" 28 | 29 | #define DEC 10 30 | #define HEX 16 31 | #define OCT 8 32 | #define BIN 2 33 | 34 | class Print 35 | { 36 | private: 37 | int write_error; 38 | size_t printNumber(unsigned long, uint8_t); 39 | size_t printFloat(double, uint8_t); 40 | protected: 41 | void setWriteError(int err = 1) { write_error = err; } 42 | public: 43 | Print() : write_error(0) {} 44 | 45 | int getWriteError() { return write_error; } 46 | void clearWriteError() { setWriteError(0); } 47 | 48 | virtual size_t write(uint8_t) = 0; 49 | size_t write(const char *str) { 50 | if (str == NULL) return 0; 51 | return write((const uint8_t *)str, strlen(str)); 52 | } 53 | virtual size_t write(const uint8_t *buffer, size_t size); 54 | 55 | size_t print(const __FlashStringHelper *); 56 | size_t print(const String &); 57 | size_t print(const char[]); 58 | size_t print(char); 59 | size_t print(unsigned char, int = DEC); 60 | size_t print(int, int = DEC); 61 | size_t print(unsigned int, int = DEC); 62 | size_t print(long, int = DEC); 63 | size_t print(unsigned long, int = DEC); 64 | size_t print(double, int = 2); 65 | size_t print(const Printable&); 66 | 67 | size_t println(const __FlashStringHelper *); 68 | size_t println(const String &s); 69 | size_t println(const char[]); 70 | size_t println(char); 71 | size_t println(unsigned char, int = DEC); 72 | size_t println(int, int = DEC); 73 | size_t println(unsigned int, int = DEC); 74 | size_t println(long, int = DEC); 75 | size_t println(unsigned long, int = DEC); 76 | size_t println(double, int = 2); 77 | size_t println(const Printable&); 78 | size_t println(void); 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/Printable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Printable.h - Interface class that allows printing of complex types 3 | Copyright (c) 2011 Adrian McEwen. 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 | 20 | #ifndef Printable_h 21 | #define Printable_h 22 | 23 | #include 24 | 25 | class Print; 26 | 27 | /** The Printable class provides a way for new classes to allow themselves to be printed. 28 | By deriving from Printable and implementing the printTo method, it will then be possible 29 | for users to print out instances of this class by passing them into the usual 30 | Print::print and Print::println methods. 31 | */ 32 | 33 | class Printable 34 | { 35 | public: 36 | virtual size_t printTo(Print& p) const = 0; 37 | }; 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/Server.h: -------------------------------------------------------------------------------- 1 | #ifndef server_h 2 | #define server_h 3 | 4 | class Server : public Print { 5 | public: 6 | virtual void begin() =0; 7 | }; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/USBDesc.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright (c) 2011, Peter Barrett 4 | ** 5 | ** Permission to use, copy, modify, and/or distribute this software for 6 | ** any purpose with or without fee is hereby granted, provided that the 7 | ** above copyright notice and this permission notice appear in all copies. 8 | ** 9 | ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 | ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 12 | ** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES 13 | ** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 14 | ** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 15 | ** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 16 | ** SOFTWARE. 17 | */ 18 | 19 | #define CDC_ENABLED 20 | #define HID_ENABLED 21 | 22 | 23 | #ifdef CDC_ENABLED 24 | #define CDC_INTERFACE_COUNT 2 25 | #define CDC_ENPOINT_COUNT 3 26 | #else 27 | #define CDC_INTERFACE_COUNT 0 28 | #define CDC_ENPOINT_COUNT 0 29 | #endif 30 | 31 | #ifdef HID_ENABLED 32 | #define HID_INTERFACE_COUNT 1 33 | #define HID_ENPOINT_COUNT 1 34 | #else 35 | #define HID_INTERFACE_COUNT 0 36 | #define HID_ENPOINT_COUNT 0 37 | #endif 38 | 39 | #define CDC_ACM_INTERFACE 0 // CDC ACM 40 | #define CDC_DATA_INTERFACE 1 // CDC Data 41 | #define CDC_FIRST_ENDPOINT 1 42 | #define CDC_ENDPOINT_ACM (CDC_FIRST_ENDPOINT) // CDC First 43 | #define CDC_ENDPOINT_OUT (CDC_FIRST_ENDPOINT+1) 44 | #define CDC_ENDPOINT_IN (CDC_FIRST_ENDPOINT+2) 45 | 46 | #define HID_INTERFACE (CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT) // HID Interface 47 | #define HID_FIRST_ENDPOINT (CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT) 48 | #define HID_ENDPOINT_INT (HID_FIRST_ENDPOINT) 49 | 50 | #define INTERFACE_COUNT (MSC_INTERFACE + MSC_INTERFACE_COUNT) 51 | 52 | #ifdef CDC_ENABLED 53 | #define CDC_RX CDC_ENDPOINT_OUT 54 | #define CDC_TX CDC_ENDPOINT_IN 55 | #endif 56 | 57 | #ifdef HID_ENABLED 58 | #define HID_TX HID_ENDPOINT_INT 59 | #endif 60 | 61 | #define IMANUFACTURER 1 62 | #define IPRODUCT 2 63 | 64 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | $Id$ 24 | */ 25 | 26 | extern "C" { 27 | #include "stdlib.h" 28 | } 29 | 30 | void randomSeed(unsigned int seed) 31 | { 32 | if (seed != 0) { 33 | srandom(seed); 34 | } 35 | } 36 | 37 | long random(long howbig) 38 | { 39 | if (howbig == 0) { 40 | return 0; 41 | } 42 | return random() % howbig; 43 | } 44 | 45 | long random(long howsmall, long howbig) 46 | { 47 | if (howsmall >= howbig) { 48 | return howsmall; 49 | } 50 | long diff = howbig - howsmall; 51 | return random(diff) + howsmall; 52 | } 53 | 54 | long map(long x, long in_min, long in_max, long out_min, long out_max) 55 | { 56 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 57 | } 58 | 59 | unsigned int makeWord(unsigned int w) { return w; } 60 | unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | init(); 6 | 7 | #if defined(USBCON) 8 | USBDevice.attach(); 9 | #endif 10 | 11 | setup(); 12 | 13 | for (;;) { 14 | loop(); 15 | if (serialEventRun) serialEventRun(); 16 | } 17 | 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/new.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void * operator new(size_t size) 4 | { 5 | return malloc(size); 6 | } 7 | 8 | void operator delete(void * ptr) 9 | { 10 | free(ptr); 11 | } 12 | 13 | int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}; 14 | void __cxa_guard_release (__guard *g) {*(char *)g = 1;}; 15 | void __cxa_guard_abort (__guard *) {}; 16 | 17 | void __cxa_pure_virtual(void) {}; 18 | 19 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/new.h: -------------------------------------------------------------------------------- 1 | /* Header to define new/delete operators as they aren't provided by avr-gcc by default 2 | Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 3 | */ 4 | 5 | #ifndef NEW_H 6 | #define NEW_H 7 | 8 | #include 9 | 10 | void * operator new(size_t size); 11 | void operator delete(void * ptr); 12 | 13 | __extension__ typedef int __guard __attribute__((mode (__DI__))); 14 | 15 | extern "C" int __cxa_guard_acquire(__guard *); 16 | extern "C" void __cxa_guard_release (__guard *); 17 | extern "C" void __cxa_guard_abort (__guard *); 18 | 19 | extern "C" void __cxa_pure_virtual(void); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_private.h - Internal header file. 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ 23 | */ 24 | 25 | #ifndef WiringPrivate_h 26 | #define WiringPrivate_h 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "Arduino.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C"{ 37 | #endif 38 | 39 | #ifndef cbi 40 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 41 | #endif 42 | #ifndef sbi 43 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 44 | #endif 45 | 46 | #define EXTERNAL_INT_0 0 47 | #define EXTERNAL_INT_1 1 48 | #define EXTERNAL_INT_2 2 49 | #define EXTERNAL_INT_3 3 50 | #define EXTERNAL_INT_4 4 51 | #define EXTERNAL_INT_5 5 52 | #define EXTERNAL_INT_6 6 53 | #define EXTERNAL_INT_7 7 54 | 55 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 56 | #define EXTERNAL_NUM_INTERRUPTS 8 57 | #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) 58 | #define EXTERNAL_NUM_INTERRUPTS 3 59 | #elif defined(__AVR_ATmega32U4__) 60 | #define EXTERNAL_NUM_INTERRUPTS 4 61 | #else 62 | #define EXTERNAL_NUM_INTERRUPTS 2 63 | #endif 64 | 65 | typedef void (*voidFuncPtr)(void); 66 | 67 | #ifdef __cplusplus 68 | } // extern "C" 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/wiring_pulse.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_pulse.c - pulseIn() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 29 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 30 | * to 3 minutes in length, but must be called at least a few dozen microseconds 31 | * before the start of the pulse. */ 32 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) 33 | { 34 | // cache the port and bit of the pin in order to speed up the 35 | // pulse width measuring loop and achieve finer resolution. calling 36 | // digitalRead() instead yields much coarser resolution. 37 | uint8_t bit = digitalPinToBitMask(pin); 38 | uint8_t port = digitalPinToPort(pin); 39 | uint8_t stateMask = (state ? bit : 0); 40 | unsigned long width = 0; // keep initialization out of time critical area 41 | 42 | // convert the timeout from microseconds to a number of times through 43 | // the initial loop; it takes 16 clock cycles per iteration. 44 | unsigned long numloops = 0; 45 | unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; 46 | 47 | // wait for any previous pulse to end 48 | while ((*portInputRegister(port) & bit) == stateMask) 49 | if (numloops++ == maxloops) 50 | return 0; 51 | 52 | // wait for the pulse to start 53 | while ((*portInputRegister(port) & bit) != stateMask) 54 | if (numloops++ == maxloops) 55 | return 0; 56 | 57 | // wait for the pulse to stop 58 | while ((*portInputRegister(port) & bit) == stateMask) { 59 | if (numloops++ == maxloops) 60 | return 0; 61 | width++; 62 | } 63 | 64 | // convert the reading to microseconds. The loop has been determined 65 | // to be 20 clock cycles long and have about 16 clocks between the edge 66 | // and the start of the loop. There will be some error introduced by 67 | // the interrupt handlers. 68 | return clockCyclesToMicroseconds(width * 21 + 16); 69 | } 70 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | 27 | uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { 28 | uint8_t value = 0; 29 | uint8_t i; 30 | 31 | for (i = 0; i < 8; ++i) { 32 | digitalWrite(clockPin, HIGH); 33 | if (bitOrder == LSBFIRST) 34 | value |= digitalRead(dataPin) << i; 35 | else 36 | value |= digitalRead(dataPin) << (7 - i); 37 | digitalWrite(clockPin, LOW); 38 | } 39 | return value; 40 | } 41 | 42 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) 43 | { 44 | uint8_t i; 45 | 46 | for (i = 0; i < 8; i++) { 47 | if (bitOrder == LSBFIRST) 48 | digitalWrite(dataPin, !!(val & (1 << i))); 49 | else 50 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 51 | 52 | digitalWrite(clockPin, HIGH); 53 | digitalWrite(clockPin, LOW); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/boards.txt: -------------------------------------------------------------------------------- 1 | # See: http://code.google.com/p/arduino/wiki/Platforms 2 | 3 | ############################################################## 4 | 5 | mega2560.name=RAMBo 6 | 7 | mega2560.upload.protocol=wiring 8 | mega2560.upload.maximum_size=258048 9 | mega2560.upload.speed=115200 10 | 11 | mega2560.bootloader.low_fuses=0xFF 12 | mega2560.bootloader.high_fuses=0xD8 13 | mega2560.bootloader.extended_fuses=0xFD 14 | mega2560.bootloader.path=stk500v2 15 | mega2560.bootloader.file=stk500boot_v2_mega2560.hex 16 | mega2560.bootloader.unlock_bits=0x3F 17 | mega2560.bootloader.lock_bits=0x0F 18 | 19 | mega2560.build.mcu=atmega2560 20 | mega2560.build.f_cpu=16000000L 21 | mega2560.build.core=arduino 22 | mega2560.build.variant=standard 23 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/Client.h: -------------------------------------------------------------------------------- 1 | #ifndef client_h 2 | #define client_h 3 | #include "Print.h" 4 | #include "Stream.h" 5 | #include "IPAddress.h" 6 | 7 | class Client : public Stream { 8 | 9 | public: 10 | virtual int connect(IPAddress ip, uint16_t port) =0; 11 | virtual int connect(const char *host, uint16_t port) =0; 12 | virtual size_t write(uint8_t) =0; 13 | virtual size_t write(const uint8_t *buf, size_t size) =0; 14 | virtual int available() = 0; 15 | virtual int read() = 0; 16 | virtual int read(uint8_t *buf, size_t size) = 0; 17 | virtual int peek() = 0; 18 | virtual void flush() = 0; 19 | virtual void stop() = 0; 20 | virtual uint8_t connected() = 0; 21 | virtual operator bool() = 0; 22 | protected: 23 | uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/IPAddress.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | IPAddress::IPAddress() 6 | { 7 | memset(_address, 0, sizeof(_address)); 8 | } 9 | 10 | IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) 11 | { 12 | _address[0] = first_octet; 13 | _address[1] = second_octet; 14 | _address[2] = third_octet; 15 | _address[3] = fourth_octet; 16 | } 17 | 18 | IPAddress::IPAddress(uint32_t address) 19 | { 20 | memcpy(_address, &address, sizeof(_address)); 21 | } 22 | 23 | IPAddress::IPAddress(const uint8_t *address) 24 | { 25 | memcpy(_address, address, sizeof(_address)); 26 | } 27 | 28 | IPAddress& IPAddress::operator=(const uint8_t *address) 29 | { 30 | memcpy(_address, address, sizeof(_address)); 31 | return *this; 32 | } 33 | 34 | IPAddress& IPAddress::operator=(uint32_t address) 35 | { 36 | memcpy(_address, (const uint8_t *)&address, sizeof(_address)); 37 | return *this; 38 | } 39 | 40 | bool IPAddress::operator==(const uint8_t* addr) 41 | { 42 | return memcmp(addr, _address, sizeof(_address)) == 0; 43 | } 44 | 45 | size_t IPAddress::printTo(Print& p) const 46 | { 47 | size_t n = 0; 48 | for (int i =0; i < 3; i++) 49 | { 50 | n += p.print(_address[i], DEC); 51 | n += p.print('.'); 52 | } 53 | n += p.print(_address[3], DEC); 54 | return n; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/IPAddress.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * MIT License: 4 | * Copyright (c) 2011 Adrian McEwen 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | * adrianm@mcqn.com 1/1/2011 24 | */ 25 | 26 | #ifndef IPAddress_h 27 | #define IPAddress_h 28 | 29 | #include 30 | 31 | // A class to make it easier to handle and pass around IP addresses 32 | 33 | class IPAddress : public Printable { 34 | private: 35 | uint8_t _address[4]; // IPv4 address 36 | // Access the raw byte array containing the address. Because this returns a pointer 37 | // to the internal structure rather than a copy of the address this function should only 38 | // be used when you know that the usage of the returned uint8_t* will be transient and not 39 | // stored. 40 | uint8_t* raw_address() { return _address; }; 41 | 42 | public: 43 | // Constructors 44 | IPAddress(); 45 | IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); 46 | IPAddress(uint32_t address); 47 | IPAddress(const uint8_t *address); 48 | 49 | // Overloaded cast operator to allow IPAddress objects to be used where a pointer 50 | // to a four-byte uint8_t array is expected 51 | operator uint32_t() { return *((uint32_t*)_address); }; 52 | bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); }; 53 | bool operator==(const uint8_t* addr); 54 | 55 | // Overloaded index operator to allow getting and setting individual octets of the address 56 | uint8_t operator[](int index) const { return _address[index]; }; 57 | uint8_t& operator[](int index) { return _address[index]; }; 58 | 59 | // Overloaded copy operators to allow initialisation of IPAddress objects from other types 60 | IPAddress& operator=(const uint8_t *address); 61 | IPAddress& operator=(uint32_t address); 62 | 63 | virtual size_t printTo(Print& p) const; 64 | 65 | friend class EthernetClass; 66 | friend class UDP; 67 | friend class Client; 68 | friend class Server; 69 | friend class DhcpClass; 70 | friend class DNSClient; 71 | }; 72 | 73 | const IPAddress INADDR_NONE(0,0,0,0); 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/Platform.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __PLATFORM_H__ 3 | #define __PLATFORM_H__ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | typedef unsigned char u8; 12 | typedef unsigned short u16; 13 | typedef unsigned long u32; 14 | 15 | #include "Arduino.h" 16 | 17 | #if defined(USBCON) 18 | #include "USBDesc.h" 19 | #include "USBCore.h" 20 | #include "USBAPI.h" 21 | #endif /* if defined(USBCON) */ 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Print.h - Base class that provides print() and println() 3 | Copyright (c) 2008 David A. Mellis. 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 | 20 | #ifndef Print_h 21 | #define Print_h 22 | 23 | #include 24 | #include // for size_t 25 | 26 | #include "WString.h" 27 | #include "Printable.h" 28 | 29 | #define DEC 10 30 | #define HEX 16 31 | #define OCT 8 32 | #define BIN 2 33 | 34 | class Print 35 | { 36 | private: 37 | int write_error; 38 | size_t printNumber(unsigned long, uint8_t); 39 | size_t printFloat(double, uint8_t); 40 | protected: 41 | void setWriteError(int err = 1) { write_error = err; } 42 | public: 43 | Print() : write_error(0) {} 44 | 45 | int getWriteError() { return write_error; } 46 | void clearWriteError() { setWriteError(0); } 47 | 48 | virtual size_t write(uint8_t) = 0; 49 | size_t write(const char *str) { 50 | if (str == NULL) return 0; 51 | return write((const uint8_t *)str, strlen(str)); 52 | } 53 | virtual size_t write(const uint8_t *buffer, size_t size); 54 | 55 | size_t print(const __FlashStringHelper *); 56 | size_t print(const String &); 57 | size_t print(const char[]); 58 | size_t print(char); 59 | size_t print(unsigned char, int = DEC); 60 | size_t print(int, int = DEC); 61 | size_t print(unsigned int, int = DEC); 62 | size_t print(long, int = DEC); 63 | size_t print(unsigned long, int = DEC); 64 | size_t print(double, int = 2); 65 | size_t print(const Printable&); 66 | 67 | size_t println(const __FlashStringHelper *); 68 | size_t println(const String &s); 69 | size_t println(const char[]); 70 | size_t println(char); 71 | size_t println(unsigned char, int = DEC); 72 | size_t println(int, int = DEC); 73 | size_t println(unsigned int, int = DEC); 74 | size_t println(long, int = DEC); 75 | size_t println(unsigned long, int = DEC); 76 | size_t println(double, int = 2); 77 | size_t println(const Printable&); 78 | size_t println(void); 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/Printable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Printable.h - Interface class that allows printing of complex types 3 | Copyright (c) 2011 Adrian McEwen. 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 | 20 | #ifndef Printable_h 21 | #define Printable_h 22 | 23 | #include 24 | 25 | class Print; 26 | 27 | /** The Printable class provides a way for new classes to allow themselves to be printed. 28 | By deriving from Printable and implementing the printTo method, it will then be possible 29 | for users to print out instances of this class by passing them into the usual 30 | Print::print and Print::println methods. 31 | */ 32 | 33 | class Printable 34 | { 35 | public: 36 | virtual size_t printTo(Print& p) const = 0; 37 | }; 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/Server.h: -------------------------------------------------------------------------------- 1 | #ifndef server_h 2 | #define server_h 3 | 4 | class Server : public Print { 5 | public: 6 | virtual void begin() =0; 7 | }; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/USBDesc.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright (c) 2011, Peter Barrett 4 | ** 5 | ** Permission to use, copy, modify, and/or distribute this software for 6 | ** any purpose with or without fee is hereby granted, provided that the 7 | ** above copyright notice and this permission notice appear in all copies. 8 | ** 9 | ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 | ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 12 | ** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES 13 | ** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 14 | ** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 15 | ** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 16 | ** SOFTWARE. 17 | */ 18 | 19 | #define CDC_ENABLED 20 | #define HID_ENABLED 21 | 22 | 23 | #ifdef CDC_ENABLED 24 | #define CDC_INTERFACE_COUNT 2 25 | #define CDC_ENPOINT_COUNT 3 26 | #else 27 | #define CDC_INTERFACE_COUNT 0 28 | #define CDC_ENPOINT_COUNT 0 29 | #endif 30 | 31 | #ifdef HID_ENABLED 32 | #define HID_INTERFACE_COUNT 1 33 | #define HID_ENPOINT_COUNT 1 34 | #else 35 | #define HID_INTERFACE_COUNT 0 36 | #define HID_ENPOINT_COUNT 0 37 | #endif 38 | 39 | #define CDC_ACM_INTERFACE 0 // CDC ACM 40 | #define CDC_DATA_INTERFACE 1 // CDC Data 41 | #define CDC_FIRST_ENDPOINT 1 42 | #define CDC_ENDPOINT_ACM (CDC_FIRST_ENDPOINT) // CDC First 43 | #define CDC_ENDPOINT_OUT (CDC_FIRST_ENDPOINT+1) 44 | #define CDC_ENDPOINT_IN (CDC_FIRST_ENDPOINT+2) 45 | 46 | #define HID_INTERFACE (CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT) // HID Interface 47 | #define HID_FIRST_ENDPOINT (CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT) 48 | #define HID_ENDPOINT_INT (HID_FIRST_ENDPOINT) 49 | 50 | #define INTERFACE_COUNT (MSC_INTERFACE + MSC_INTERFACE_COUNT) 51 | 52 | #ifdef CDC_ENABLED 53 | #define CDC_RX CDC_ENDPOINT_OUT 54 | #define CDC_TX CDC_ENDPOINT_IN 55 | #endif 56 | 57 | #ifdef HID_ENABLED 58 | #define HID_TX HID_ENDPOINT_INT 59 | #endif 60 | 61 | #define IMANUFACTURER 1 62 | #define IPRODUCT 2 63 | 64 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | $Id$ 24 | */ 25 | 26 | extern "C" { 27 | #include "stdlib.h" 28 | } 29 | 30 | void randomSeed(unsigned int seed) 31 | { 32 | if (seed != 0) { 33 | srandom(seed); 34 | } 35 | } 36 | 37 | long random(long howbig) 38 | { 39 | if (howbig == 0) { 40 | return 0; 41 | } 42 | return random() % howbig; 43 | } 44 | 45 | long random(long howsmall, long howbig) 46 | { 47 | if (howsmall >= howbig) { 48 | return howsmall; 49 | } 50 | long diff = howbig - howsmall; 51 | return random(diff) + howsmall; 52 | } 53 | 54 | long map(long x, long in_min, long in_max, long out_min, long out_max) 55 | { 56 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 57 | } 58 | 59 | unsigned int makeWord(unsigned int w) { return w; } 60 | unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | init(); 6 | 7 | #if defined(USBCON) 8 | USBDevice.attach(); 9 | #endif 10 | 11 | setup(); 12 | 13 | for (;;) { 14 | loop(); 15 | if (serialEventRun) serialEventRun(); 16 | } 17 | 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/new.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void * operator new(size_t size) 4 | { 5 | return malloc(size); 6 | } 7 | 8 | void operator delete(void * ptr) 9 | { 10 | free(ptr); 11 | } 12 | 13 | int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}; 14 | void __cxa_guard_release (__guard *g) {*(char *)g = 1;}; 15 | void __cxa_guard_abort (__guard *) {}; 16 | 17 | void __cxa_pure_virtual(void) {}; 18 | 19 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/new.h: -------------------------------------------------------------------------------- 1 | /* Header to define new/delete operators as they aren't provided by avr-gcc by default 2 | Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 3 | */ 4 | 5 | #ifndef NEW_H 6 | #define NEW_H 7 | 8 | #include 9 | 10 | void * operator new(size_t size); 11 | void operator delete(void * ptr); 12 | 13 | __extension__ typedef int __guard __attribute__((mode (__DI__))); 14 | 15 | extern "C" int __cxa_guard_acquire(__guard *); 16 | extern "C" void __cxa_guard_release (__guard *); 17 | extern "C" void __cxa_guard_abort (__guard *); 18 | 19 | extern "C" void __cxa_pure_virtual(void); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_private.h - Internal header file. 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ 23 | */ 24 | 25 | #ifndef WiringPrivate_h 26 | #define WiringPrivate_h 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "Arduino.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C"{ 37 | #endif 38 | 39 | #ifndef cbi 40 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 41 | #endif 42 | #ifndef sbi 43 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 44 | #endif 45 | 46 | #define EXTERNAL_INT_0 0 47 | #define EXTERNAL_INT_1 1 48 | #define EXTERNAL_INT_2 2 49 | #define EXTERNAL_INT_3 3 50 | #define EXTERNAL_INT_4 4 51 | #define EXTERNAL_INT_5 5 52 | #define EXTERNAL_INT_6 6 53 | #define EXTERNAL_INT_7 7 54 | 55 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 56 | #define EXTERNAL_NUM_INTERRUPTS 8 57 | #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) 58 | #define EXTERNAL_NUM_INTERRUPTS 3 59 | #elif defined(__AVR_ATmega32U4__) 60 | #define EXTERNAL_NUM_INTERRUPTS 4 61 | #else 62 | #define EXTERNAL_NUM_INTERRUPTS 2 63 | #endif 64 | 65 | typedef void (*voidFuncPtr)(void); 66 | 67 | #ifdef __cplusplus 68 | } // extern "C" 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/wiring_pulse.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_pulse.c - pulseIn() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 29 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 30 | * to 3 minutes in length, but must be called at least a few dozen microseconds 31 | * before the start of the pulse. */ 32 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) 33 | { 34 | // cache the port and bit of the pin in order to speed up the 35 | // pulse width measuring loop and achieve finer resolution. calling 36 | // digitalRead() instead yields much coarser resolution. 37 | uint8_t bit = digitalPinToBitMask(pin); 38 | uint8_t port = digitalPinToPort(pin); 39 | uint8_t stateMask = (state ? bit : 0); 40 | unsigned long width = 0; // keep initialization out of time critical area 41 | 42 | // convert the timeout from microseconds to a number of times through 43 | // the initial loop; it takes 16 clock cycles per iteration. 44 | unsigned long numloops = 0; 45 | unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; 46 | 47 | // wait for any previous pulse to end 48 | while ((*portInputRegister(port) & bit) == stateMask) 49 | if (numloops++ == maxloops) 50 | return 0; 51 | 52 | // wait for the pulse to start 53 | while ((*portInputRegister(port) & bit) != stateMask) 54 | if (numloops++ == maxloops) 55 | return 0; 56 | 57 | // wait for the pulse to stop 58 | while ((*portInputRegister(port) & bit) == stateMask) { 59 | if (numloops++ == maxloops) 60 | return 0; 61 | width++; 62 | } 63 | 64 | // convert the reading to microseconds. The loop has been determined 65 | // to be 20 clock cycles long and have about 16 clocks between the edge 66 | // and the start of the loop. There will be some error introduced by 67 | // the interrupt handlers. 68 | return clockCyclesToMicroseconds(width * 21 + 16); 69 | } 70 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/hardware/rambo/cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library 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 GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | 27 | uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { 28 | uint8_t value = 0; 29 | uint8_t i; 30 | 31 | for (i = 0; i < 8; ++i) { 32 | digitalWrite(clockPin, HIGH); 33 | if (bitOrder == LSBFIRST) 34 | value |= digitalRead(dataPin) << i; 35 | else 36 | value |= digitalRead(dataPin) << (7 - i); 37 | digitalWrite(clockPin, LOW); 38 | } 39 | return value; 40 | } 41 | 42 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) 43 | { 44 | uint8_t i; 45 | 46 | for (i = 0; i < 8; i++) { 47 | if (bitOrder == LSBFIRST) 48 | digitalWrite(dataPin, !!(val & (1 << i))); 49 | else 50 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 51 | 52 | digitalWrite(clockPin, HIGH); 53 | digitalWrite(clockPin, LOW); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal/LiquidCrystal.h: -------------------------------------------------------------------------------- 1 | #ifndef LiquidCrystal_h 2 | #define LiquidCrystal_h 3 | 4 | #include 5 | #include "Print.h" 6 | 7 | // commands 8 | #define LCD_CLEARDISPLAY 0x01 9 | #define LCD_RETURNHOME 0x02 10 | #define LCD_ENTRYMODESET 0x04 11 | #define LCD_DISPLAYCONTROL 0x08 12 | #define LCD_CURSORSHIFT 0x10 13 | #define LCD_FUNCTIONSET 0x20 14 | #define LCD_SETCGRAMADDR 0x40 15 | #define LCD_SETDDRAMADDR 0x80 16 | 17 | // flags for display entry mode 18 | #define LCD_ENTRYRIGHT 0x00 19 | #define LCD_ENTRYLEFT 0x02 20 | #define LCD_ENTRYSHIFTINCREMENT 0x01 21 | #define LCD_ENTRYSHIFTDECREMENT 0x00 22 | 23 | // flags for display on/off control 24 | #define LCD_DISPLAYON 0x04 25 | #define LCD_DISPLAYOFF 0x00 26 | #define LCD_CURSORON 0x02 27 | #define LCD_CURSOROFF 0x00 28 | #define LCD_BLINKON 0x01 29 | #define LCD_BLINKOFF 0x00 30 | 31 | // flags for display/cursor shift 32 | #define LCD_DISPLAYMOVE 0x08 33 | #define LCD_CURSORMOVE 0x00 34 | #define LCD_MOVERIGHT 0x04 35 | #define LCD_MOVELEFT 0x00 36 | 37 | // flags for function set 38 | #define LCD_8BITMODE 0x10 39 | #define LCD_4BITMODE 0x00 40 | #define LCD_2LINE 0x08 41 | #define LCD_1LINE 0x00 42 | #define LCD_5x10DOTS 0x04 43 | #define LCD_5x8DOTS 0x00 44 | 45 | class LiquidCrystal : public Print { 46 | public: 47 | LiquidCrystal(uint8_t rs, uint8_t enable, 48 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 49 | uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 50 | LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 51 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 52 | uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 53 | LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 54 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 55 | LiquidCrystal(uint8_t rs, uint8_t enable, 56 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 57 | 58 | void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, 59 | uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 60 | uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 61 | 62 | void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); 63 | 64 | void clear(); 65 | void home(); 66 | 67 | void noDisplay(); 68 | void display(); 69 | void noBlink(); 70 | void blink(); 71 | void noCursor(); 72 | void cursor(); 73 | void scrollDisplayLeft(); 74 | void scrollDisplayRight(); 75 | void leftToRight(); 76 | void rightToLeft(); 77 | void autoscroll(); 78 | void noAutoscroll(); 79 | 80 | void createChar(uint8_t, uint8_t[]); 81 | void setCursor(uint8_t, uint8_t); 82 | virtual size_t write(uint8_t); 83 | void command(uint8_t); 84 | 85 | using Print::write; 86 | private: 87 | void send(uint8_t, uint8_t); 88 | void write4bits(uint8_t); 89 | void write8bits(uint8_t); 90 | void pulseEnable(); 91 | 92 | uint8_t _rs_pin; // LOW: command. HIGH: character. 93 | uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD. 94 | uint8_t _enable_pin; // activated by a HIGH pulse. 95 | uint8_t _data_pins[8]; 96 | 97 | uint8_t _displayfunction; 98 | uint8_t _displaycontrol; 99 | uint8_t _displaymode; 100 | 101 | uint8_t _initialized; 102 | 103 | uint8_t _numlines,_currline; 104 | }; 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For LiquidCrystal 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | LiquidCrystal KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | clear KEYWORD2 17 | home KEYWORD2 18 | print KEYWORD2 19 | setCursor KEYWORD2 20 | cursor KEYWORD2 21 | noCursor KEYWORD2 22 | blink KEYWORD2 23 | noBlink KEYWORD2 24 | display KEYWORD2 25 | noDisplay KEYWORD2 26 | autoscroll KEYWORD2 27 | noAutoscroll KEYWORD2 28 | leftToRight KEYWORD2 29 | rightToLeft KEYWORD2 30 | scrollDisplayLeft KEYWORD2 31 | scrollDisplayRight KEYWORD2 32 | createChar KEYWORD2 33 | 34 | ####################################### 35 | # Constants (LITERAL1) 36 | ####################################### 37 | 38 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/SPI/SPI.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 by Cristian Maglie 3 | * SPI Master library for arduino. 4 | * 5 | * This file is free software; you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or the GNU Lesser General Public License version 2.1, both as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #include "pins_arduino.h" 12 | #include "SPI.h" 13 | 14 | SPIClass SPI; 15 | 16 | void SPIClass::begin() { 17 | 18 | // Set SS to high so a connected chip will be "deselected" by default 19 | digitalWrite(SS, HIGH); 20 | 21 | // When the SS pin is set as OUTPUT, it can be used as 22 | // a general purpose output port (it doesn't influence 23 | // SPI operations). 24 | pinMode(SS, OUTPUT); 25 | 26 | // Warning: if the SS pin ever becomes a LOW INPUT then SPI 27 | // automatically switches to Slave, so the data direction of 28 | // the SS pin MUST be kept as OUTPUT. 29 | SPCR |= _BV(MSTR); 30 | SPCR |= _BV(SPE); 31 | 32 | // Set direction register for SCK and MOSI pin. 33 | // MISO pin automatically overrides to INPUT. 34 | // By doing this AFTER enabling SPI, we avoid accidentally 35 | // clocking in a single bit since the lines go directly 36 | // from "input" to SPI control. 37 | // http://code.google.com/p/arduino/issues/detail?id=888 38 | pinMode(SCK, OUTPUT); 39 | pinMode(MOSI, OUTPUT); 40 | } 41 | 42 | 43 | void SPIClass::end() { 44 | SPCR &= ~_BV(SPE); 45 | } 46 | 47 | void SPIClass::setBitOrder(uint8_t bitOrder) 48 | { 49 | if(bitOrder == LSBFIRST) { 50 | SPCR |= _BV(DORD); 51 | } else { 52 | SPCR &= ~(_BV(DORD)); 53 | } 54 | } 55 | 56 | void SPIClass::setDataMode(uint8_t mode) 57 | { 58 | SPCR = (SPCR & ~SPI_MODE_MASK) | mode; 59 | } 60 | 61 | void SPIClass::setClockDivider(uint8_t rate) 62 | { 63 | SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK); 64 | SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((rate >> 2) & SPI_2XCLOCK_MASK); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/SPI/SPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 by Cristian Maglie 3 | * SPI Master library for arduino. 4 | * 5 | * This file is free software; you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or the GNU Lesser General Public License version 2.1, both as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #ifndef _SPI_H_INCLUDED 12 | #define _SPI_H_INCLUDED 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #define SPI_CLOCK_DIV4 0x00 19 | #define SPI_CLOCK_DIV16 0x01 20 | #define SPI_CLOCK_DIV64 0x02 21 | #define SPI_CLOCK_DIV128 0x03 22 | #define SPI_CLOCK_DIV2 0x04 23 | #define SPI_CLOCK_DIV8 0x05 24 | #define SPI_CLOCK_DIV32 0x06 25 | //#define SPI_CLOCK_DIV64 0x07 26 | 27 | #define SPI_MODE0 0x00 28 | #define SPI_MODE1 0x04 29 | #define SPI_MODE2 0x08 30 | #define SPI_MODE3 0x0C 31 | 32 | #define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR 33 | #define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR 34 | #define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR 35 | 36 | class SPIClass { 37 | public: 38 | inline static byte transfer(byte _data); 39 | 40 | // SPI Configuration methods 41 | 42 | inline static void attachInterrupt(); 43 | inline static void detachInterrupt(); // Default 44 | 45 | static void begin(); // Default 46 | static void end(); 47 | 48 | static void setBitOrder(uint8_t); 49 | static void setDataMode(uint8_t); 50 | static void setClockDivider(uint8_t); 51 | }; 52 | 53 | extern SPIClass SPI; 54 | 55 | byte SPIClass::transfer(byte _data) { 56 | SPDR = _data; 57 | while (!(SPSR & _BV(SPIF))) 58 | ; 59 | return SPDR; 60 | } 61 | 62 | void SPIClass::attachInterrupt() { 63 | SPCR |= _BV(SPIE); 64 | } 65 | 66 | void SPIClass::detachInterrupt() { 67 | SPCR &= ~_BV(SPIE); 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/SPI/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SPI KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | end KEYWORD2 16 | transfer KEYWORD2 17 | setBitOrder KEYWORD2 18 | setDataMode KEYWORD2 19 | setClockDivider KEYWORD2 20 | 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | SPI_CLOCK_DIV4 LITERAL1 26 | SPI_CLOCK_DIV16 LITERAL1 27 | SPI_CLOCK_DIV64 LITERAL1 28 | SPI_CLOCK_DIV128 LITERAL1 29 | SPI_CLOCK_DIV2 LITERAL1 30 | SPI_CLOCK_DIV8 LITERAL1 31 | SPI_CLOCK_DIV32 LITERAL1 32 | SPI_CLOCK_DIV64 LITERAL1 33 | SPI_MODE0 LITERAL1 34 | SPI_MODE1 LITERAL1 35 | SPI_MODE2 LITERAL1 36 | SPI_MODE3 LITERAL1 -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/U8glib/INSTALL.TXT: -------------------------------------------------------------------------------- 1 | 2 | U8GLIB 3 | http://code.google.com/p/u8glib/ 4 | 5 | 6 | Install instructions for the Arduino environment. 7 | 8 | 1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder 9 | 2. Start Arduino IDE 10 | 11 | Install instructions for the Chipkit (Arduino) environment. 12 | 13 | 1. cd /libraries 14 | 2. unzip u8glib_arduino_vX.XX.zip 15 | 3. cd ///hardware/pic32/libraries 16 | 4. again: u8glib_arduino_vX.XX.zip 17 | 5. Open hardware/pic32/cores/pic32/Print.h 18 | Remove line 19 | #define BYTE 0 20 | from the file, use PRINT_BYTE instead of BYTE. 21 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.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.x.x/libraries/U8glib/utility/chessengine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/chessengine.c -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.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.x.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.x.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_INDEX: 62 | break; 63 | case U8G_DEV_MSG_SET_XY_CB: 64 | break; 65 | } 66 | return 1; 67 | } 68 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/u8g_ellipse.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | u8g_ellipse.c 4 | 5 | Utility to draw empty and filled ellipses. 6 | 7 | Universal 8bit Graphics Library 8 | 9 | Copyright (c) 2011, bjthom@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 | Addition to the U8G Library as of 02/29/12 37 | Adapted from Bresenham's Algorithm and the following websites: 38 | http://free.pages.at/easyfilter/bresenham.html 39 | http://homepage.smc.edu/kennedy_john/belipse.pdf 40 | 41 | */ 42 | 43 | #include "u8g.h" 44 | 45 | 46 | #ifdef WORK_IN_PROGRESS 47 | 48 | void u8g_DrawEllipseRect(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t x1, u8g_uint_t y1) 49 | { 50 | int a = abs(x1 - x0); 51 | int b = abs(y1 - y0); //get diameters 52 | int b1 = b&1; 53 | long dx = 4*(1-a)*b*b; 54 | long dy = 4*(b1+1)*a*a; 55 | long err = dx+dy+b1*a*a; 56 | long e2; 57 | 58 | if (x0 > x1) { x0 = x1; x1 += a; } 59 | if (y0 > y1) { y0 = y1; } 60 | y0 += (b+1)/2; 61 | y1 = y0-b1; 62 | a *= 8*a; 63 | b1 = 8*b*b; 64 | 65 | do { 66 | u8g_DrawPixel(u8g, x1, y0); 67 | u8g_DrawPixel(u8g, x0, y0); 68 | u8g_DrawPixel(u8g, x0, y1); 69 | u8g_DrawPixel(u8g, x1, y1); 70 | e2 = 2*err; 71 | if (e2 >= dx) { 72 | x0++; 73 | x1--; 74 | err += dx += b1; 75 | } 76 | if (e2 <= dy) { 77 | y0++; 78 | y1--; 79 | err += dy += a; 80 | } 81 | } while (x0 <= x1); 82 | 83 | while (y0-y1 < b) { 84 | u8g_DrawPixel(u8g, x0-1, y0); 85 | u8g_DrawPixel(u8g, x1+1, y0++); 86 | u8g_DrawPixel(u8g, x0-1, y1); 87 | u8g_DrawPixel(u8g, x1+1, y1--); 88 | } 89 | } 90 | 91 | void u8g_DrawEllipse(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t xr, u8g_uint_t yr) 92 | { 93 | u8g_DrawPixel(u8g, x0, y0+yr); 94 | u8g_DrawPixel(u8g, x0, y0-yr); 95 | u8g_DrawPixel(u8g, x0+xr, y0); 96 | u8g_DrawPixel(u8g, x0-xr, y0); 97 | } 98 | 99 | #endif 100 | 101 | -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/u8g_font_data.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/u8g_font_data.c -------------------------------------------------------------------------------- /ArduinoAddons/Arduino_1.x.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.x.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.x.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.x.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 | -------------------------------------------------------------------------------- /Mackerel/BlinkM.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | BlinkM.cpp - Library for controlling a BlinkM over i2c 3 | Created by Tim Koster, August 21 2013. 4 | */ 5 | #include "Mackerel.h" 6 | #ifdef BLINKM 7 | 8 | #if (ARDUINO >= 100) 9 | # include "Arduino.h" 10 | #else 11 | # include "WProgram.h" 12 | #endif 13 | 14 | #include "BlinkM.h" 15 | 16 | void SendColors(byte red, byte grn, byte blu) 17 | { 18 | Wire.begin(); 19 | Wire.beginTransmission(0x09); 20 | Wire.write('o'); //to disable ongoing script, only needs to be used once 21 | Wire.write('n'); 22 | Wire.write(red); 23 | Wire.write(grn); 24 | Wire.write(blu); 25 | Wire.endTransmission(); 26 | } 27 | 28 | #endif //BLINKM 29 | 30 | 31 | -------------------------------------------------------------------------------- /Mackerel/BlinkM.h: -------------------------------------------------------------------------------- 1 | /* 2 | BlinkM.h 3 | Library header file for BlinkM library 4 | */ 5 | #if (ARDUINO >= 100) 6 | # include "Arduino.h" 7 | #else 8 | # include "WProgram.h" 9 | #endif 10 | 11 | #include "Wire.h" 12 | 13 | void SendColors(byte red, byte grn, byte blu); 14 | 15 | 16 | -------------------------------------------------------------------------------- /Mackerel/COPYING: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/Mackerel/COPYING -------------------------------------------------------------------------------- /Mackerel/ConfigurationStore.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_STORE_H 2 | #define CONFIG_STORE_H 3 | 4 | #include "Configuration.h" 5 | 6 | void Config_ResetDefault(); 7 | 8 | #ifndef DISABLE_M503 9 | void Config_PrintSettings(); 10 | #else 11 | FORCE_INLINE void Config_PrintSettings() {} 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//CONFIG_STORE_H 23 | 24 | -------------------------------------------------------------------------------- /Mackerel/Mackerel.ino: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | 3 | /* 4 | Reprap firmware 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 | 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 defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 51 | #include 52 | #endif 53 | 54 | #if defined(DIGIPOT_I2C) 55 | #include 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /Mackerel/Menu Plans.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/Mackerel/Menu Plans.xlsx -------------------------------------------------------------------------------- /Mackerel/SdFatUtil.cpp: -------------------------------------------------------------------------------- 1 | /* Arduino SdFat Library 2 | * Copyright (C) 2008 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 "Mackerel.h" 21 | 22 | #ifdef SDSUPPORT 23 | #include "SdFatUtil.h" 24 | 25 | //------------------------------------------------------------------------------ 26 | /** Amount of free RAM 27 | * \return The number of free bytes. 28 | */ 29 | int SdFatUtil::FreeRam() { 30 | extern int __bss_end; 31 | extern int* __brkval; 32 | int free_memory; 33 | if (reinterpret_cast(__brkval) == 0) { 34 | // if no heap use from end of bss section 35 | free_memory = reinterpret_cast(&free_memory) 36 | - reinterpret_cast(&__bss_end); 37 | } else { 38 | // use from top of stack to heap 39 | free_memory = reinterpret_cast(&free_memory) 40 | - reinterpret_cast(__brkval); 41 | } 42 | return free_memory; 43 | } 44 | //------------------------------------------------------------------------------ 45 | /** %Print a string in flash memory. 46 | * 47 | * \param[in] pr Print object for output. 48 | * \param[in] str Pointer to string stored in flash memory. 49 | */ 50 | void SdFatUtil::print_P( PGM_P str) { 51 | for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c); 52 | } 53 | //------------------------------------------------------------------------------ 54 | /** %Print a string in flash memory followed by a CR/LF. 55 | * 56 | * \param[in] pr Print object for output. 57 | * \param[in] str Pointer to string stored in flash memory. 58 | */ 59 | void SdFatUtil::println_P( PGM_P str) { 60 | print_P( str); 61 | MYSERIAL.println(); 62 | } 63 | //------------------------------------------------------------------------------ 64 | /** %Print a string in flash memory to Serial. 65 | * 66 | * \param[in] str Pointer to string stored in flash memory. 67 | */ 68 | void SdFatUtil::SerialPrint_P(PGM_P str) { 69 | print_P(str); 70 | } 71 | //------------------------------------------------------------------------------ 72 | /** %Print a string in flash memory to Serial followed by a CR/LF. 73 | * 74 | * \param[in] str Pointer to string stored in flash memory. 75 | */ 76 | void SdFatUtil::SerialPrintln_P(PGM_P str) { 77 | println_P( str); 78 | } 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /Mackerel/SdFatUtil.h: -------------------------------------------------------------------------------- 1 | /* Arduino SdFat Library 2 | * Copyright (C) 2008 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 "Mackerel.h" 21 | #ifdef SDSUPPORT 22 | 23 | #ifndef SdFatUtil_h 24 | #define SdFatUtil_h 25 | /** 26 | * \file 27 | * \brief Useful utility functions. 28 | */ 29 | #include "Mackerel.h" 30 | #include "MarlinSerial.h" 31 | /** Store and print a string in flash memory.*/ 32 | #define PgmPrint(x) SerialPrint_P(PSTR(x)) 33 | /** Store and print a string in flash memory followed by a CR/LF.*/ 34 | #define PgmPrintln(x) SerialPrintln_P(PSTR(x)) 35 | 36 | namespace SdFatUtil { 37 | int FreeRam(); 38 | void print_P( PGM_P str); 39 | void println_P( PGM_P str); 40 | void SerialPrint_P(PGM_P str); 41 | void SerialPrintln_P(PGM_P str); 42 | } 43 | 44 | using namespace SdFatUtil; // NOLINT 45 | #endif // #define SdFatUtil_h 46 | 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /Mackerel/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 "Mackerel.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 55 | 56 | -------------------------------------------------------------------------------- /Mackerel/create_speed_lookuptable.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ Generate the stepper delay lookup table for Marlin firmware. """ 4 | 5 | import argparse 6 | 7 | __author__ = "Ben Gamari " 8 | __copyright__ = "Copyright 2012, Ben Gamari" 9 | __license__ = "GPL" 10 | 11 | parser = argparse.ArgumentParser(description=__doc__) 12 | parser.add_argument('-f', '--cpu-freq', type=int, default=16, help='CPU clockrate in MHz (default=16)') 13 | parser.add_argument('-d', '--divider', type=int, default=8, help='Timer/counter pre-scale divider (default=8)') 14 | args = parser.parse_args() 15 | 16 | cpu_freq = args.cpu_freq * 1000000 17 | timer_freq = cpu_freq / args.divider 18 | 19 | print "#ifndef SPEED_LOOKUPTABLE_H" 20 | print "#define SPEED_LOOKUPTABLE_H" 21 | print 22 | print '#include "Marlin.h"' 23 | print 24 | 25 | print "const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {" 26 | a = [ timer_freq / ((i*256)+(args.cpu_freq*2)) for i in range(256) ] 27 | b = [ a[i] - a[i+1] for i in range(255) ] 28 | b.append(b[-1]) 29 | for i in range(32): 30 | print " ", 31 | for j in range(8): 32 | print "{%d, %d}," % (a[8*i+j], b[8*i+j]), 33 | print 34 | print "};" 35 | print 36 | 37 | print "const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {" 38 | a = [ timer_freq / ((i*8)+(args.cpu_freq*2)) for i in range(256) ] 39 | b = [ a[i] - a[i+1] for i in range(255) ] 40 | b.append(b[-1]) 41 | for i in range(32): 42 | print " ", 43 | for j in range(8): 44 | print "{%d, %d}," % (a[8*i+j], b[8*i+j]), 45 | print 46 | print "};" 47 | print 48 | 49 | print "#endif" 50 | 51 | -------------------------------------------------------------------------------- /Mackerel/digipot_mcp4451.cpp: -------------------------------------------------------------------------------- 1 | #include "Configuration.h" 2 | 3 | #ifdef DIGIPOT_I2C 4 | #include "Stream.h" 5 | #include "utility/twi.h" 6 | #include "Wire.h" 7 | 8 | // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro 9 | #define DIGIPOT_I2C_FACTOR 106.7 10 | #define DIGIPOT_I2C_MAX_CURRENT 2.5 11 | 12 | static byte current_to_wiper( float current ){ 13 | return byte(ceil(float((DIGIPOT_I2C_FACTOR*current)))); 14 | } 15 | 16 | static void i2c_send(byte addr, byte a, byte b) 17 | { 18 | Wire.beginTransmission(addr); 19 | Wire.write(a); 20 | Wire.write(b); 21 | Wire.endTransmission(); 22 | } 23 | 24 | // This is for the MCP4451 I2C based digipot 25 | void digipot_i2c_set_current( int channel, float current ) 26 | { 27 | current = min( (float) max( current, 0.0f ), DIGIPOT_I2C_MAX_CURRENT); 28 | // these addresses are specific to Azteeg X3 Pro, can be set to others, 29 | // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1 30 | byte addr= 0x2C; // channel 0-3 31 | if(channel >= 4) { 32 | addr= 0x2E; // channel 4-7 33 | channel-= 4; 34 | } 35 | 36 | // Initial setup 37 | i2c_send( addr, 0x40, 0xff ); 38 | i2c_send( addr, 0xA0, 0xff ); 39 | 40 | // Set actual wiper value 41 | byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 }; 42 | i2c_send( addr, addresses[channel], current_to_wiper(current) ); 43 | } 44 | 45 | void digipot_i2c_init() 46 | { 47 | const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS; 48 | Wire.begin(); 49 | // setup initial currents as defined in Configuration_adv.h 50 | for(int i=0;i<=sizeof(digipot_motor_current)/sizeof(float);i++) { 51 | digipot_i2c_set_current(i, digipot_motor_current[i]); 52 | } 53 | } 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /Mackerel/motion_control.h: -------------------------------------------------------------------------------- 1 | /* 2 | motion_control.h - high level interface for issuing motion commands 3 | Part of Grbl 4 | 5 | Copyright (c) 2009-2011 Simen Svale Skogsrud 6 | Copyright (c) 2011 Sungeun K. Jeon 7 | 8 | Grbl is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | Grbl is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with Grbl. If not, see . 20 | */ 21 | 22 | #ifndef motion_control_h 23 | #define motion_control_h 24 | 25 | // Execute an arc in offset mode format. position == current xyz, target == target xyz, 26 | // offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is 27 | // the direction of helical travel, radius == circle radius, isclockwise boolean. Used 28 | // for vector transformation direction. 29 | void mc_arc(float *position, float *target, float *offset, unsigned char axis_0, unsigned char axis_1, 30 | unsigned char axis_linear, float feed_rate, float radius, unsigned char isclockwise, uint8_t extruder); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /Mackerel/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 | 24 | -------------------------------------------------------------------------------- /Mackerel/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(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(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 | 64 | -------------------------------------------------------------------------------- /Mackerel/watchdog.cpp: -------------------------------------------------------------------------------- 1 | #include "Mackerel.h" 2 | 3 | #ifdef USE_WATCHDOG 4 | #include 5 | 6 | #include "watchdog.h" 7 | #include "ultralcd.h" 8 | 9 | //=========================================================================== 10 | //=============================private variables ============================ 11 | //=========================================================================== 12 | 13 | //=========================================================================== 14 | //=============================functinos ============================ 15 | //=========================================================================== 16 | 17 | 18 | /// intialise watch dog with a 4 sec interrupt time 19 | void watchdog_init() 20 | { 21 | #ifdef WATCHDOG_RESET_MANUAL 22 | //We enable the watchdog timer, but only for the interrupt. 23 | //Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details. 24 | wdt_reset(); 25 | _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); 26 | _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S; 27 | #else 28 | wdt_enable(WDTO_4S); 29 | #endif 30 | } 31 | 32 | /// reset watchdog. MUST be called every 1s after init or avr will reset. 33 | void watchdog_reset() 34 | { 35 | wdt_reset(); 36 | } 37 | 38 | //=========================================================================== 39 | //=============================ISR ============================ 40 | //=========================================================================== 41 | 42 | //Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled. 43 | #ifdef WATCHDOG_RESET_MANUAL 44 | ISR(WDT_vect) 45 | { 46 | //TODO: This message gets overwritten by the kill() call 47 | LCD_ALERTMESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display 48 | lcd_update(); 49 | SERIAL_ERROR_START; 50 | SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer."); 51 | kill(); //kill blocks 52 | while(1); //wait for user or serial reset 53 | } 54 | #endif//RESET_MANUAL 55 | 56 | #endif//USE_WATCHDOG 57 | 58 | -------------------------------------------------------------------------------- /Mackerel/watchdog.h: -------------------------------------------------------------------------------- 1 | #ifndef WATCHDOG_H 2 | #define WATCHDOG_H 3 | 4 | #include "Mackerel.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 | 19 | -------------------------------------------------------------------------------- /RAMPS wiring and instructions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/filipmu/Marlin-Mackerel/83e9f01670928fa9f33b1ab38321936992a39c99/RAMPS wiring and instructions.pdf --------------------------------------------------------------------------------