diff --git a/Marlin/src/HAL/HAL_AVR/ServoTimers.h b/Marlin/src/HAL/HAL_AVR/ServoTimers.h index 7d7c27515..4af997f1e 100644 --- a/Marlin/src/HAL/HAL_AVR/ServoTimers.h +++ b/Marlin/src/HAL/HAL_AVR/ServoTimers.h @@ -20,24 +20,24 @@ * */ -/* - ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 - Copyright (c) 2009 Michael Margolis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ +/** + * ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + * Copyright (c) 2009 Michael Margolis. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef _SERVOTIMERS_H_ #define _SERVOTIMERS_H_ @@ -55,7 +55,7 @@ * -------------------- */ -#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays +#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays #define PRESCALER 8 // timer prescaler // Say which 16 bit timers can be used and in what order diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h index eb4e883b6..71c7c4781 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -21,9 +21,9 @@ */ /** - * Fast I/O Routines + * Fast I/O Routines for AVR * Use direct port manipulation to save scads of processor time. - * Contributed by Triffid_Hunter. Modified by Kliment and the Marlin team. + * Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al. */ #ifndef _FASTIO_ARDUINO_H_ diff --git a/Marlin/src/HAL/HAL_DUE/fastio_Due.h b/Marlin/src/HAL/HAL_DUE/fastio_Due.h index 552325192..791dcd4d7 100644 --- a/Marlin/src/HAL/HAL_DUE/fastio_Due.h +++ b/Marlin/src/HAL/HAL_DUE/fastio_Due.h @@ -21,9 +21,10 @@ */ /** - This code contributed by Triffid_Hunter and modified by Kliment - why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html -*/ + * Fast I/O Routines for SAM3X8E + * Use direct port manipulation to save scads of processor time. + * Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al. + */ /** * Description: Fast IO functions for Arduino Due and compatible (SAM3X8E) @@ -35,17 +36,20 @@ #define _FASTIO_DUE_H /** - utility functions -*/ + * Utility functions + */ #ifndef MASK #define MASK(PIN) (1 << PIN) #endif /** - magic I/O routines - now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0); -*/ + * Magic I/O routines + * + * Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW); + * + * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html + */ /// Read a pin #define _READ(IO) ((bool)(DIO ## IO ## _WPORT -> PIO_PDSR & (MASK(DIO ## IO ## _PIN)))) @@ -80,8 +84,6 @@ /// check if pin is an timer #define _GET_TIMER(IO) -// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html - /// Read a pin wrapper #define READ(IO) _READ(IO) @@ -111,10 +113,9 @@ #define OUT_WRITE(IO, v) { SET_OUTPUT(IO); WRITE(IO, v); } /** - ports and functions - - added as necessary or if I feel like it- not a comprehensive list! -*/ + * Ports and functions + * Added as necessary or if I feel like it- not a comprehensive list! + */ // UART #define RXD DIO0 @@ -125,8 +126,8 @@ #define SDA DIO20 /** -pins -*/ + * pins + */ #define DIO0_PIN 8 #define DIO0_WPORT PIOA diff --git a/Marlin/src/HAL/HAL_DUE/servotimers.h b/Marlin/src/HAL/HAL_DUE/servotimers.h index 1ba5aaac4..8d5d0fa58 100644 --- a/Marlin/src/HAL/HAL_DUE/servotimers.h +++ b/Marlin/src/HAL/HAL_DUE/servotimers.h @@ -1,20 +1,20 @@ -/* - Copyright (c) 2013 Arduino LLC. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ +/** + * Copyright (c) 2013 Arduino LLC. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ /** * Defines for 16 bit timers used with Servo library diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_LPC1768_LCD_defines.h b/Marlin/src/HAL/HAL_LPC1768/HAL_LPC1768_LCD_defines.h index ddc0c6bf4..7347164d6 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_LPC1768_LCD_defines.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_LPC1768_LCD_defines.h @@ -21,13 +21,13 @@ */ /** -* LPC1768 LCD specific defines -*/ + * LPC1768 LCD-specific defines + */ -#if defined(TARGET_LPC1768) +#ifdef TARGET_LPC1768 // pointers to low level routines - must always supply these -// #define U8G_HAL_LINKS + //#define U8G_HAL_LINKS #define HAL_LCD_pin_routines "HAL_LPC1768/HAL_LCD_pin_routines.h" #define HAL_LCD_I2C_routines "HAL_LPC1768/HAL_LCD_I2C_routines.h" #define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h" diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp index 7b2101b2a..607d3978e 100644 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp @@ -24,7 +24,7 @@ * The class Servo uses the PWM class to implement its functions * * All PWMs use the same repetition rate - 20mS because that's the normal servo rate -*/ + */ /** * This is a hybrid system. @@ -60,7 +60,6 @@ * See the end of this file for details on the hardware/firmware interaction */ - #ifdef TARGET_LPC1768 #include #include "LPC1768_PWM.h" diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h index 6dec0b7e9..08fe83ee7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h +++ b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h @@ -24,7 +24,7 @@ * The class Servo uses the PWM class to implement its functions * * All PWMs use the same repetition rate - 20mS because that's the normal servo rate -*/ + */ /** * This is a hybrid system. @@ -60,7 +60,7 @@ * See the end of this file for details on the hardware/firmware interaction */ - #include "fastio.h" +#include "fastio.h" #define LPC_PWM1_MR0 19999 // base repetition rate minus one count - 20mS #define LPC_PWM1_PR 24 // prescaler value - prescaler divide by 24 + 1 - 1 MHz output diff --git a/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp index a29340288..1ea90310f 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp @@ -1,33 +1,34 @@ /* -SoftwareSerial.cpp (formerly NewSoftSerial.cpp) - -Multi-instance software serial library for Arduino/Wiring --- Interrupt-driven receive and other improvements by ladyada - (http://ladyada.net) --- Tuning, circular buffer, derivation from class Print/Stream, - multi-instance support, porting to 8MHz processors, - various optimizations, PROGMEM delay tables, inverse logic and - direct port writing by Mikal Hart (http://www.arduiniana.org) --- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) --- 20MHz processor support by Garrett Mace (http://www.macetech.com) --- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -The latest version of this library can always be found at -http://arduiniana.org. -*/ + * SoftwareSerial.cpp (formerly NewSoftSerial.cpp) + * + * Multi-instance software serial library for Arduino/Wiring + * -- Interrupt-driven receive and other improvements by ladyada + * (http://ladyada.net) + * -- Tuning, circular buffer, derivation from class Print/Stream, + * multi-instance support, porting to 8MHz processors, + * various optimizations, PROGMEM delay tables, inverse logic and + * direct port writing by Mikal Hart (http://www.arduiniana.org) + * -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) + * -- 20MHz processor support by Garrett Mace (http://www.macetech.com) + * -- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * The latest version of this library can always be found at + * http://arduiniana.org. + */ #ifdef TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h b/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h index 2b8c306ce..fe01e8147 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h +++ b/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h @@ -1,33 +1,34 @@ /* -SoftwareSerial.h (formerly NewSoftSerial.h) - -Multi-instance software serial library for Arduino/Wiring --- Interrupt-driven receive and other improvements by ladyada - (http://ladyada.net) --- Tuning, circular buffer, derivation from class Print/Stream, - multi-instance support, porting to 8MHz processors, - various optimizations, PROGMEM delay tables, inverse logic and - direct port writing by Mikal Hart (http://www.arduiniana.org) --- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) --- 20MHz processor support by Garrett Mace (http://www.macetech.com) --- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/) - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -The latest version of this library can always be found at -http://arduiniana.org. -*/ + * SoftwareSerial.h (formerly NewSoftSerial.h) + * + * Multi-instance software serial library for Arduino/Wiring + * -- Interrupt-driven receive and other improvements by ladyada + * (http://ladyada.net) + * -- Tuning, circular buffer, derivation from class Print/Stream, + * multi-instance support, porting to 8MHz processors, + * various optimizations, PROGMEM delay tables, inverse logic and + * direct port writing by Mikal Hart (http://www.arduiniana.org) + * -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) + * -- 20MHz processor support by Garrett Mace (http://www.macetech.com) + * -- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * The latest version of this library can always be found at + * http://arduiniana.org. + */ #ifndef SOFTWARESERIAL_H #define SOFTWARESERIAL_H diff --git a/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp b/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp index 3c7a469fd..8c47092b2 100644 --- a/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp @@ -1,20 +1,20 @@ -/* - Copyright (c) 2011-2012 Arduino. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ +/** + * Copyright (c) 2011-2012 Arduino. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifdef TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index 6f0b36146..c2d254994 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -21,9 +21,10 @@ */ /** - This code contributed by Triffid_Hunter and modified by Kliment - why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html -*/ + * Fast I/O Routines for LPC1768/9 + * Use direct port manipulation to save scads of processor time. + * Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al. + */ /** * Description: Fast IO functions LPC1768 @@ -57,9 +58,12 @@ bool useable_hardware_PWM(uint8_t pin); #define WRITE_PIN(IO, v) ((v) ? WRITE_PIN_SET(IO) : WRITE_PIN_CLR(IO)) /** - magic I/O routines - now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0); -*/ + * Magic I/O routines + * + * Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW); + * + * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html + */ /// Read a pin #define _READ(IO) READ_PIN(IO) @@ -89,8 +93,6 @@ bool useable_hardware_PWM(uint8_t pin); /// check if pin is an timer #define _GET_TIMER(IO) -// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html - /// Read a pin wrapper #define READ(IO) _READ(IO) diff --git a/Marlin/src/HAL/HAL_LPC1768/include/Wire.h b/Marlin/src/HAL/HAL_LPC1768/include/Wire.h index d6da3b231..491894b65 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/Wire.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/Wire.h @@ -1,23 +1,23 @@ /* - TwoWire.h - TWI/I2C library for Arduino & Wiring - Copyright (c) 2006 Nicholas Zambetti. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts -*/ + * TwoWire.h - TWI/I2C library for Arduino & Wiring + * Copyright (c) 2006 Nicholas Zambetti. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts + */ // Modified for use with the mcp4451 digipot routine @@ -28,31 +28,30 @@ #include -class TwoWire -{ - +class TwoWire { public: -// TwoWire(); + //TwoWire(); void begin(); void beginTransmission(uint8_t); uint8_t endTransmission(void); size_t write(uint8_t); }; -//extern TwoWire Wire;// +//extern TwoWire Wire; TwoWire Wire; - //////////////////////////////////////////////////////////////////////////////////////// - extern "C" uint8_t digipot_mcp4451_start(uint8_t sla); - extern "C" void digipot_mcp4451_init(void); - extern "C" uint8_t digipot_mcp4451_send_byte(uint8_t data); +//////////////////////////////////////////////////////////////////////////////////////// + +extern "C" uint8_t digipot_mcp4451_start(uint8_t sla); +extern "C" void digipot_mcp4451_init(void); +extern "C" uint8_t digipot_mcp4451_send_byte(uint8_t data); - void TwoWire::beginTransmission(uint8_t sla) { digipot_mcp4451_start(sla);} - void TwoWire::begin(void) {digipot_mcp4451_init();} - size_t TwoWire::write(uint8_t data) {return digipot_mcp4451_send_byte(data);} - uint8_t TwoWire::endTransmission(void) {return 1;} +void TwoWire::beginTransmission(uint8_t sla) { digipot_mcp4451_start(sla);} +void TwoWire::begin(void) {digipot_mcp4451_init();} +size_t TwoWire::write(uint8_t data) {return digipot_mcp4451_send_byte(data);} +uint8_t TwoWire::endTransmission(void) {return 1;} #endif #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c index a75b21c53..b7fe6e2ea 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c @@ -1,171 +1,162 @@ /** - * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * -*/ + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ // adapted from I2C/master/master.c example // https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html - - #ifdef TARGET_LPC1768 - #ifdef __cplusplus - extern "C" { - #endif +#ifdef __cplusplus + extern "C" { +#endif - #include - #include - #include +#include +#include +#include - ////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// - // These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to - // to the lpc17xx_i2c.c routines so had to copy them into this file & rename them. +// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to +// to the lpc17xx_i2c.c routines so had to copy them into this file & rename them. - static uint32_t _I2C_Start (LPC_I2C_TypeDef *I2Cx) - { - // Reset STA, STO, SI - I2Cx->I2CONCLR = I2C_I2CONCLR_SIC|I2C_I2CONCLR_STOC|I2C_I2CONCLR_STAC; +static uint32_t _I2C_Start (LPC_I2C_TypeDef *I2Cx) { + // Reset STA, STO, SI + I2Cx->I2CONCLR = I2C_I2CONCLR_SIC|I2C_I2CONCLR_STOC|I2C_I2CONCLR_STAC; - // Enter to Master Transmitter mode - I2Cx->I2CONSET = I2C_I2CONSET_STA; + // Enter to Master Transmitter mode + I2Cx->I2CONSET = I2C_I2CONSET_STA; - // Wait for complete - while (!(I2Cx->I2CONSET & I2C_I2CONSET_SI)); + // Wait for complete + while (!(I2Cx->I2CONSET & I2C_I2CONSET_SI)); + I2Cx->I2CONCLR = I2C_I2CONCLR_STAC; + return (I2Cx->I2STAT & I2C_STAT_CODE_BITMASK); +} + +static void _I2C_Stop (LPC_I2C_TypeDef *I2Cx) { + /* Make sure start bit is not active */ + if (I2Cx->I2CONSET & I2C_I2CONSET_STA) I2Cx->I2CONCLR = I2C_I2CONCLR_STAC; - return (I2Cx->I2STAT & I2C_STAT_CODE_BITMASK); - } - static void _I2C_Stop (LPC_I2C_TypeDef *I2Cx) - { - - /* Make sure start bit is not active */ - if (I2Cx->I2CONSET & I2C_I2CONSET_STA) - { - I2Cx->I2CONCLR = I2C_I2CONCLR_STAC; - } - - I2Cx->I2CONSET = I2C_I2CONSET_STO|I2C_I2CONSET_AA; - - I2Cx->I2CONCLR = I2C_I2CONCLR_SIC; - } + I2Cx->I2CONSET = I2C_I2CONSET_STO|I2C_I2CONSET_AA; + I2Cx->I2CONCLR = I2C_I2CONCLR_SIC; +} - ////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// - #define USEDI2CDEV_M 1 // use I2C1 controller +#define USEDI2CDEV_M 1 // use I2C1 controller - #if (USEDI2CDEV_M == 0) - #define I2CDEV_M LPC_I2C0 - #elif (USEDI2CDEV_M == 1) - #define I2CDEV_M LPC_I2C1 - #elif (USEDI2CDEV_M == 2) - #define I2CDEV_M LPC_I2C2 - #else - #error "Master I2C device not defined!" - #endif +#if (USEDI2CDEV_M == 0) + #define I2CDEV_M LPC_I2C0 +#elif (USEDI2CDEV_M == 1) + #define I2CDEV_M LPC_I2C1 +#elif (USEDI2CDEV_M == 2) + #define I2CDEV_M LPC_I2C2 +#else + #error "Master I2C device not defined!" +#endif - PINSEL_CFG_Type PinCfg; - I2C_M_SETUP_Type transferMCfg; +PINSEL_CFG_Type PinCfg; +I2C_M_SETUP_Type transferMCfg; - #define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK) +#define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK) - uint8_t digipot_mcp4451_start(uint8_t sla) { // send slave address and write bit - // Sometimes TX data ACK or NAK status is returned. That mean the start state didn't - // happen which means only the value of the slave address was send. Keep looping until - // the slave address and write bit are actually sent. - do{ - _I2C_Stop(I2CDEV_M); // output stop state on I2C bus - _I2C_Start(I2CDEV_M); // output start state on I2C bus - while ((I2C_status != I2C_I2STAT_M_TX_START) - && (I2C_status != I2C_I2STAT_M_TX_RESTART) - && (I2C_status != I2C_I2STAT_M_TX_DAT_ACK) - && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); //wait for start to be asserted +uint8_t digipot_mcp4451_start(uint8_t sla) { // send slave address and write bit + // Sometimes TX data ACK or NAK status is returned. That mean the start state didn't + // happen which means only the value of the slave address was send. Keep looping until + // the slave address and write bit are actually sent. + do{ + _I2C_Stop(I2CDEV_M); // output stop state on I2C bus + _I2C_Start(I2CDEV_M); // output start state on I2C bus + while ((I2C_status != I2C_I2STAT_M_TX_START) + && (I2C_status != I2C_I2STAT_M_TX_RESTART) + && (I2C_status != I2C_I2STAT_M_TX_DAT_ACK) + && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); //wait for start to be asserted - LPC_I2C1->I2CONCLR = I2C_I2CONCLR_STAC; // clear start state before tansmitting slave address - LPC_I2C1->I2DAT = (sla <<1) & I2C_I2DAT_BITMASK; // transmit slave address & write bit - LPC_I2C1->I2CONSET = I2C_I2CONSET_AA; - LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC; - while ((I2C_status != I2C_I2STAT_M_TX_SLAW_ACK) - && (I2C_status != I2C_I2STAT_M_TX_SLAW_NACK) - && (I2C_status != I2C_I2STAT_M_TX_DAT_ACK) - && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); //wait for slaw to finish - }while ( (I2C_status == I2C_I2STAT_M_TX_DAT_ACK) || (I2C_status == I2C_I2STAT_M_TX_DAT_NACK)); - return 1; - } - - - void digipot_mcp4451_init(void) { - - /* - * Init I2C pin connect - */ - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - #if ((USEDI2CDEV_M == 0)) - PinCfg.Funcnum = 1; - PinCfg.Pinnum = 27; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); // SDA0 / D57 AUX-1 - PinCfg.Pinnum = 28; - PINSEL_ConfigPin(&PinCfg); // SCL0 / D58 AUX-1 - #endif - #if ((USEDI2CDEV_M == 1)) - PinCfg.Funcnum = 3; - PinCfg.Pinnum = 0; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); // SDA1 / D20 SCA - PinCfg.Pinnum = 1; - PINSEL_ConfigPin(&PinCfg); // SCL1 / D21 SCL - #endif - #if ((USEDI2CDEV_M == 2)) - PinCfg.Funcnum = 2; - PinCfg.Pinnum = 10; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); // SDA2 / D38 X_ENABLE_PIN - PinCfg.Pinnum = 11; - PINSEL_ConfigPin(&PinCfg); // SCL2 / D55 X_DIR_PIN - #endif - // Initialize I2C peripheral - I2C_Init(I2CDEV_M, 400000); // hardwired to 400KHz bit rate, 100KHz is the other option - - /* Enable Master I2C operation */ - I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE); - } - - - uint8_t digipot_mcp4451_send_byte(uint8_t data) { - - LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data + LPC_I2C1->I2CONCLR = I2C_I2CONCLR_STAC; // clear start state before tansmitting slave address + LPC_I2C1->I2DAT = (sla <<1) & I2C_I2DAT_BITMASK; // transmit slave address & write bit LPC_I2C1->I2CONSET = I2C_I2CONSET_AA; LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC; - while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); // wait for xmit to finish - return 1; - } + while ((I2C_status != I2C_I2STAT_M_TX_SLAW_ACK) + && (I2C_status != I2C_I2STAT_M_TX_SLAW_NACK) + && (I2C_status != I2C_I2STAT_M_TX_DAT_ACK) + && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); //wait for slaw to finish + }while ( (I2C_status == I2C_I2STAT_M_TX_DAT_ACK) || (I2C_status == I2C_I2STAT_M_TX_DAT_NACK)); + return 1; +} - #ifdef __cplusplus - } +void digipot_mcp4451_init(void) { + + /** + * Init I2C pin connect + */ + PinCfg.OpenDrain = 0; + PinCfg.Pinmode = 0; + #if ((USEDI2CDEV_M == 0)) + PinCfg.Funcnum = 1; + PinCfg.Pinnum = 27; + PinCfg.Portnum = 0; + PINSEL_ConfigPin(&PinCfg); // SDA0 / D57 AUX-1 + PinCfg.Pinnum = 28; + PINSEL_ConfigPin(&PinCfg); // SCL0 / D58 AUX-1 #endif + #if ((USEDI2CDEV_M == 1)) + PinCfg.Funcnum = 3; + PinCfg.Pinnum = 0; + PinCfg.Portnum = 0; + PINSEL_ConfigPin(&PinCfg); // SDA1 / D20 SCA + PinCfg.Pinnum = 1; + PINSEL_ConfigPin(&PinCfg); // SCL1 / D21 SCL + #endif + #if ((USEDI2CDEV_M == 2)) + PinCfg.Funcnum = 2; + PinCfg.Pinnum = 10; + PinCfg.Portnum = 0; + PINSEL_ConfigPin(&PinCfg); // SDA2 / D38 X_ENABLE_PIN + PinCfg.Pinnum = 11; + PINSEL_ConfigPin(&PinCfg); // SCL2 / D55 X_DIR_PIN + #endif + // Initialize I2C peripheral + I2C_Init(I2CDEV_M, 400000); // hardwired to 400KHz bit rate, 100KHz is the other option + + /* Enable Master I2C operation */ + I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE); +} + + +uint8_t digipot_mcp4451_send_byte(uint8_t data) { + LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data + LPC_I2C1->I2CONSET = I2C_I2CONSET_AA; + LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC; + while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); // wait for xmit to finish + return 1; +} + +#ifdef __cplusplus + } #endif + +#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index a7f013de4..7fe2ba0bb 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -79,8 +79,8 @@ int main(void) { USB_Init(); // USB Initialization USB_Connect(TRUE); // USB Connect - volatile uint32_t usb_timeout = millis() + 2000; - while (!USB_Configuration && millis() < usb_timeout) { + const uint32_t usb_timeout = millis() + 2000; + while (!USB_Configuration && PENDING(millis(), usb_timeout)) { delay(50); #if PIN_EXISTS(LED) diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h index ae3d5e6f3..189216a7d 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h @@ -22,10 +22,10 @@ /** * Support routines for LPC1768 -*/ + */ /** - * translation of routines & variables used by pinsDebug.h + * Translation of routines & variables used by pinsDebug.h */ #define pwm_details(pin) pin = pin // do nothing // print PWM details diff --git a/Marlin/src/HAL/HAL_LPC1768/servo_private.h b/Marlin/src/HAL/HAL_LPC1768/servo_private.h index eb2a7a69c..451c487d7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/servo_private.h +++ b/Marlin/src/HAL/HAL_LPC1768/servo_private.h @@ -21,23 +21,23 @@ */ /** - servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 - Copyright (c) 2009 Michael Margolis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + * Copyright (c) 2009 Michael Margolis. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ /** * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - @@ -47,7 +47,6 @@ * */ - #ifndef SERVO_PRIVATE_H #define SERVO_PRIVATE_H diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp index eb002ab93..cdcfcd833 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp @@ -59,15 +59,15 @@ // -------------------------------------------------------------------------- /* VGPV const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = { -{ TC0, 0, TC0_IRQn, 0}, // 0 - [servo timer5] -{ TC0, 1, TC1_IRQn, 0}, // 1 -{ TC0, 2, TC2_IRQn, 0}, // 2 -{ TC1, 0, TC3_IRQn, 2}, // 3 - stepper -{ TC1, 1, TC4_IRQn, 15}, // 4 - temperature -{ TC1, 2, TC5_IRQn, 0}, // 5 - [servo timer3] -{ TC2, 0, TC6_IRQn, 0}, // 6 -{ TC2, 1, TC7_IRQn, 0}, // 7 -{ TC2, 2, TC8_IRQn, 0}, // 8 + { TC0, 0, TC0_IRQn, 0}, // 0 - [servo timer5] + { TC0, 1, TC1_IRQn, 0}, // 1 + { TC0, 2, TC2_IRQn, 0}, // 2 + { TC1, 0, TC3_IRQn, 2}, // 3 - stepper + { TC1, 1, TC4_IRQn, 15}, // 4 - temperature + { TC1, 2, TC5_IRQn, 0}, // 5 - [servo timer3] + { TC2, 0, TC6_IRQn, 0}, // 6 + { TC2, 1, TC7_IRQn, 0}, // 7 + { TC2, 2, TC8_IRQn, 0}, // 8 }; */ // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F1/spi_pins.h b/Marlin/src/HAL/HAL_STM32F1/spi_pins.h index 255c33c10..26a69080a 100644 --- a/Marlin/src/HAL/HAL_STM32F1/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F1/spi_pins.h @@ -1,21 +1,21 @@ /** -* Marlin 3D Printer Firmware -* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*/ + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) diff --git a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp index 787f53f4a..101ad5ca5 100644 --- a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp @@ -1,24 +1,24 @@ /** -* Marlin 3D Printer Firmware -* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] -* -* Based on Sprinter and grbl. -* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*/ + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) diff --git a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h index 6b71530ac..5add9e5ef 100644 --- a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h @@ -1,24 +1,24 @@ /** -* Marlin 3D Printer Firmware -* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] -* -* Based on Sprinter and grbl. -* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*/ + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) @@ -26,12 +26,12 @@ #ifndef WATCHDOG_STM32F1_H #define WATCHDOG_STM32F1_H + #include #include "../../../src/inc/MarlinConfig.h" #define STM32F1_WD_RELOAD 625 - // Arduino STM32F1 core now has watchdog support // Initialize watchdog with a 4 second countdown time diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h index bf2e8fdc7..ce31ed206 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h @@ -23,7 +23,7 @@ /** * Fast I/O Routines for Teensy 3.5 and Teensy 3.6 * Use direct port manipulation to save scads of processor time. - * Contributed by Triffid_Hunter. Modified by Kliment and the Marlin team. + * Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al. */ #ifndef _FASTIO_TEENSY_H diff --git a/Marlin/src/HAL/servo.h b/Marlin/src/HAL/servo.h index 879d18cc2..39bca93e1 100644 --- a/Marlin/src/HAL/servo.h +++ b/Marlin/src/HAL/servo.h @@ -21,49 +21,49 @@ */ /** - servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 - Copyright (c) 2009 Michael Margolis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + * Copyright (c) 2009 Michael Margolis. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ /** - - A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method. - The servos are pulsed in the background using the value most recently written using the write() method - - Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached. - Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four. - The sequence used to seize timers is defined in timers.h - - The methods are: - - Servo - Class for manipulating servo motors connected to Arduino pins. - - attach(pin ) - Attaches a servo motor to an i/o pin. - attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds - default min is 544, max is 2400 - - write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds) - writeMicroseconds() - Sets the servo pulse width in microseconds - read() - Gets the last written servo pulse width as an angle between 0 and 180. - readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release) - attached() - Returns true if there is a servo attached. - detach() - Stops an attached servos from pulsing its i/o pin. - move(angle) - Sequence of attach(0), write(angle), - With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY and detach. + * + * A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method. + * The servos are pulsed in the background using the value most recently written using the write() method + * + * Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached. + * Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four. + * The sequence used to seize timers is defined in timers.h + * + * The methods are: + * + * Servo - Class for manipulating servo motors connected to Arduino pins. + * + * attach(pin ) - Attaches a servo motor to an i/o pin. + * attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds + * default min is 544, max is 2400 + * + * write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds) + * writeMicroseconds() - Sets the servo pulse width in microseconds + * read() - Gets the last written servo pulse width as an angle between 0 and 180. + * readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release) + * attached() - Returns true if there is a servo attached. + * detach() - Stops an attached servos from pulsing its i/o pin. + * move(angle) - Sequence of attach(0), write(angle), + * With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY and detach. */ #ifndef SERVO_H diff --git a/Marlin/src/HAL/servo_private.h b/Marlin/src/HAL/servo_private.h index 7e8cd5f4f..3b1bcda58 100644 --- a/Marlin/src/HAL/servo_private.h +++ b/Marlin/src/HAL/servo_private.h @@ -21,23 +21,23 @@ */ /** - servo_private.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 - Copyright (c) 2009 Michael Margolis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + * servo_private.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + * Copyright (c) 2009 Michael Margolis. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef SERVO_PRIVATE_H #define SERVO_PRIVATE_H diff --git a/Marlin/src/feature/Max7219_Debug_LEDs.cpp b/Marlin/src/feature/Max7219_Debug_LEDs.cpp index 46755c080..811adb0de 100644 --- a/Marlin/src/feature/Max7219_Debug_LEDs.cpp +++ b/Marlin/src/feature/Max7219_Debug_LEDs.cpp @@ -263,14 +263,14 @@ void Max7219_init() { } /** -* These are sample debug features to demonstrate the usage of the 8x8 LED Matrix for debug purposes. -* There is very little CPU burden added to the system by displaying information within the idle() -* task. -* -* But with that said, if your debugging can be facilitated by making calls into the library from -* other places in the code, feel free to do it. The CPU burden for a few calls to toggle an LED -* or clear a row is not very significant. -*/ + * These are sample debug features to demonstrate the usage of the 8x8 LED Matrix for debug purposes. + * There is very little CPU burden added to the system by displaying information within the idle() + * task. + * + * But with that said, if your debugging can be facilitated by making calls into the library from + * other places in the code, feel free to do it. The CPU burden for a few calls to toggle an LED + * or clear a row is not very significant. + */ void Max7219_idle_tasks() { #if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE CRITICAL_SECTION_START diff --git a/Marlin/src/feature/dac/dac_mcp4728.cpp b/Marlin/src/feature/dac/dac_mcp4728.cpp index b10a61e9d..01568fb5c 100644 --- a/Marlin/src/feature/dac/dac_mcp4728.cpp +++ b/Marlin/src/feature/dac/dac_mcp4728.cpp @@ -100,17 +100,18 @@ uint8_t mcp4728_setGain_all(uint8_t value) { */ uint16_t mcp4728_getValue(uint8_t channel) { return mcp4728_values[channel]; } +#if 0 /** * Steph: Might be useful in the future * Return Vout - * + */ uint16_t mcp4728_getVout(uint8_t channel) { uint32_t vref = 2048, vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096; if (vOut > defaultVDD) vOut = defaultVDD; return vOut; } -*/ +#endif /** * Returns DAC values as a 0-100 percentage of drive strength diff --git a/Marlin/src/feature/dac/stepper_dac.cpp b/Marlin/src/feature/dac/stepper_dac.cpp index f43805350..33be396d2 100644 --- a/Marlin/src/feature/dac/stepper_dac.cpp +++ b/Marlin/src/feature/dac/stepper_dac.cpp @@ -21,25 +21,25 @@ */ /** - stepper_dac.cpp - To set stepper current via DAC - - Part of Marlin - - Copyright (c) 2016 MarlinFirmware - - Marlin is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Marlin is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Marlin. If not, see . -*/ + * stepper_dac.cpp - To set stepper current via DAC + * + * Part of Marlin + * + * Copyright (c) 2016 MarlinFirmware + * + * Marlin is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Marlin is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Marlin. If not, see . + */ #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/feature/dac/stepper_dac.h b/Marlin/src/feature/dac/stepper_dac.h index 588035040..e74bac5f1 100644 --- a/Marlin/src/feature/dac/stepper_dac.h +++ b/Marlin/src/feature/dac/stepper_dac.h @@ -21,25 +21,25 @@ */ /** - stepper_dac.h - To set stepper current via DAC - - Part of Marlin - - Copyright (c) 2016 MarlinFirmware - - Marlin is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Marlin is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Marlin. If not, see . -*/ + * stepper_dac.h - To set stepper current via DAC + * + * Part of Marlin + * + * Copyright (c) 2016 MarlinFirmware + * + * Marlin is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Marlin is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Marlin. If not, see . + */ #ifndef STEPPER_DAC_H #define STEPPER_DAC_H diff --git a/Marlin/src/gcode/feature/leds/M150.cpp b/Marlin/src/gcode/feature/leds/M150.cpp index 47c6e82ee..f5ea2113f 100644 --- a/Marlin/src/gcode/feature/leds/M150.cpp +++ b/Marlin/src/gcode/feature/leds/M150.cpp @@ -28,23 +28,22 @@ #include "../../../feature/leds/leds.h" /** -* M150: Set Status LED Color - Use R-U-B-W for R-G-B-W -* and Brightness - Use P (for NEOPIXEL only) -* -* Always sets all 3 or 4 components. If a component is left out, set to 0. -* If brightness is left out, no value changed -* -* Examples: -* -* M150 R255 ; Turn LED red -* M150 R255 U127 ; Turn LED orange (PWM only) -* M150 ; Turn LED off -* M150 R U B ; Turn LED white -* M150 W ; Turn LED white using a white LED -* M150 P127 ; Set LED 50% brightness -* M150 P ; Set LED full brightness -*/ - + * M150: Set Status LED Color - Use R-U-B-W for R-G-B-W + * and Brightness - Use P (for NEOPIXEL only) + * + * Always sets all 3 or 4 components. If a component is left out, set to 0. + * If brightness is left out, no value changed + * + * Examples: + * + * M150 R255 ; Turn LED red + * M150 R255 U127 ; Turn LED orange (PWM only) + * M150 ; Turn LED off + * M150 R U B ; Turn LED white + * M150 W ; Turn LED white using a white LED + * M150 P127 ; Set LED 50% brightness + * M150 P ; Set LED full brightness + */ void GcodeSuite::M150() { set_led_color( parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : 0, diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index 796085bb2..d60470972 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -21,23 +21,23 @@ */ /** - vector_3.cpp - Vector library for bed leveling - Copyright (c) 2012 Lars Brubaker. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + * vector_3.cpp - Vector library for bed leveling + * Copyright (c) 2012 Lars Brubaker. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include "../inc/MarlinConfig.h" diff --git a/Marlin/src/libs/vector_3.h b/Marlin/src/libs/vector_3.h index 14fb5b916..aed4364b9 100644 --- a/Marlin/src/libs/vector_3.h +++ b/Marlin/src/libs/vector_3.h @@ -21,23 +21,23 @@ */ /** - vector_3.cpp - Vector library for bed leveling - Copyright (c) 2012 Lars Brubaker. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + * vector_3.cpp - Vector library for bed leveling + * Copyright (c) 2012 Lars Brubaker. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef VECTOR_3_H #define VECTOR_3_H diff --git a/Marlin/src/module/planner_bezier.cpp b/Marlin/src/module/planner_bezier.cpp index 136362d34..14ac645bc 100644 --- a/Marlin/src/module/planner_bezier.cpp +++ b/Marlin/src/module/planner_bezier.cpp @@ -44,8 +44,7 @@ #define MAX_STEP 0.1 #define SIGMA 0.1 -/* Compute the linear interpolation between to real numbers. -*/ +// Compute the linear interpolation between two real numbers. inline static float interp(float a, float b, float t) { return (1.0 - t) * a + t * b; } /** diff --git a/Marlin/src/module/stepper_indirection.h b/Marlin/src/module/stepper_indirection.h index 81779746b..c5a880e22 100644 --- a/Marlin/src/module/stepper_indirection.h +++ b/Marlin/src/module/stepper_indirection.h @@ -21,25 +21,25 @@ */ /** - stepper_indirection.h - stepper motor driver indirection macros - to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation - Part of Marlin - - Copyright (c) 2015 Dominik Wenger - - Marlin is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Marlin is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Marlin. If not, see . -*/ + * stepper_indirection.h - stepper motor driver indirection macros + * to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation + * Part of Marlin + * + * Copyright (c) 2015 Dominik Wenger + * + * Marlin is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * Marlin is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Marlin. If not, see . + */ #ifndef STEPPER_INDIRECTION_H #define STEPPER_INDIRECTION_H diff --git a/Marlin/src/pins/pins_ANET_10.h b/Marlin/src/pins/pins_ANET_10.h index 1e37247c4..02c614c65 100644 --- a/Marlin/src/pins/pins_ANET_10.h +++ b/Marlin/src/pins/pins_ANET_10.h @@ -86,7 +86,7 @@ * Anet Users / Skynet SW on Facebook - https://www.facebook.com/skynet3ddevelopment/ * * Many thanks to Hans Raaf (@oderwat) for developing the Anet-specific software and supporting the Anet community. -*/ + */ #ifndef __AVR_ATmega1284P__ #error "Oops! Make sure you have 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' selected from the 'Tools -> Boards' menu."