Browse Source

Apply some formatting

pull/1/head
Scott Lahteine 7 years ago
parent
commit
32512332df
  1. 38
      Marlin/src/HAL/HAL_AVR/ServoTimers.h
  2. 4
      Marlin/src/HAL/HAL_AVR/fastio_AVR.h
  3. 33
      Marlin/src/HAL/HAL_DUE/fastio_Due.h
  4. 34
      Marlin/src/HAL/HAL_DUE/servotimers.h
  5. 8
      Marlin/src/HAL/HAL_LPC1768/HAL_LPC1768_LCD_defines.h
  6. 3
      Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp
  7. 4
      Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h
  8. 59
      Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp
  9. 59
      Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h
  10. 34
      Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp
  11. 18
      Marlin/src/HAL/HAL_LPC1768/fastio.h
  12. 63
      Marlin/src/HAL/HAL_LPC1768/include/Wire.h
  13. 269
      Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c
  14. 4
      Marlin/src/HAL/HAL_LPC1768/main.cpp
  15. 4
      Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h
  16. 35
      Marlin/src/HAL/HAL_LPC1768/servo_private.h
  17. 18
      Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp
  18. 34
      Marlin/src/HAL/HAL_STM32F1/spi_pins.h
  19. 40
      Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp
  20. 42
      Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h
  21. 2
      Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h
  22. 82
      Marlin/src/HAL/servo.h
  23. 34
      Marlin/src/HAL/servo_private.h
  24. 16
      Marlin/src/feature/Max7219_Debug_LEDs.cpp
  25. 5
      Marlin/src/feature/dac/dac_mcp4728.cpp
  26. 38
      Marlin/src/feature/dac/stepper_dac.cpp
  27. 38
      Marlin/src/feature/dac/stepper_dac.h
  28. 33
      Marlin/src/gcode/feature/leds/M150.cpp
  29. 34
      Marlin/src/libs/vector_3.cpp
  30. 34
      Marlin/src/libs/vector_3.h
  31. 3
      Marlin/src/module/planner_bezier.cpp
  32. 38
      Marlin/src/module/stepper_indirection.h
  33. 2
      Marlin/src/pins/pins_ANET_10.h

38
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 * ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved. * Copyright (c) 2009 Michael Margolis. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _SERVOTIMERS_H_ #ifndef _SERVOTIMERS_H_
#define _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 #define PRESCALER 8 // timer prescaler
// Say which 16 bit timers can be used and in what order // Say which 16 bit timers can be used and in what order

4
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. * 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_ #ifndef _FASTIO_ARDUINO_H_

33
Marlin/src/HAL/HAL_DUE/fastio_Due.h

@ -21,9 +21,10 @@
*/ */
/** /**
This code contributed by Triffid_Hunter and modified by Kliment * Fast I/O Routines for SAM3X8E
why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html * 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) * Description: Fast IO functions for Arduino Due and compatible (SAM3X8E)
@ -35,17 +36,20 @@
#define _FASTIO_DUE_H #define _FASTIO_DUE_H
/** /**
utility functions * Utility functions
*/ */
#ifndef MASK #ifndef MASK
#define MASK(PIN) (1 << PIN) #define MASK(PIN) (1 << PIN)
#endif #endif
/** /**
magic I/O routines * Magic I/O routines
now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0); *
*/ * 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 /// Read a pin
#define _READ(IO) ((bool)(DIO ## IO ## _WPORT -> PIO_PDSR & (MASK(DIO ## IO ## _PIN)))) #define _READ(IO) ((bool)(DIO ## IO ## _WPORT -> PIO_PDSR & (MASK(DIO ## IO ## _PIN))))
@ -80,8 +84,6 @@
/// check if pin is an timer /// check if pin is an timer
#define _GET_TIMER(IO) #define _GET_TIMER(IO)
// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
/// Read a pin wrapper /// Read a pin wrapper
#define READ(IO) _READ(IO) #define READ(IO) _READ(IO)
@ -111,10 +113,9 @@
#define OUT_WRITE(IO, v) { SET_OUTPUT(IO); WRITE(IO, v); } #define OUT_WRITE(IO, v) { SET_OUTPUT(IO); WRITE(IO, v); }
/** /**
ports and functions * Ports and functions
* Added as necessary or if I feel like it- not a comprehensive list!
added as necessary or if I feel like it- not a comprehensive list! */
*/
// UART // UART
#define RXD DIO0 #define RXD DIO0
@ -125,8 +126,8 @@
#define SDA DIO20 #define SDA DIO20
/** /**
pins * pins
*/ */
#define DIO0_PIN 8 #define DIO0_PIN 8
#define DIO0_WPORT PIOA #define DIO0_WPORT PIOA

34
Marlin/src/HAL/HAL_DUE/servotimers.h

@ -1,20 +1,20 @@
/* /**
Copyright (c) 2013 Arduino LLC. All right reserved. * Copyright (c) 2013 Arduino LLC. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/** /**
* Defines for 16 bit timers used with Servo library * Defines for 16 bit timers used with Servo library

8
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 // 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_pin_routines "HAL_LPC1768/HAL_LCD_pin_routines.h"
#define HAL_LCD_I2C_routines "HAL_LPC1768/HAL_LCD_I2C_routines.h" #define HAL_LCD_I2C_routines "HAL_LPC1768/HAL_LCD_I2C_routines.h"
#define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h" #define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h"

3
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp

@ -24,7 +24,7 @@
* The class Servo uses the PWM class to implement its functions * 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 * All PWMs use the same repetition rate - 20mS because that's the normal servo rate
*/ */
/** /**
* This is a hybrid system. * This is a hybrid system.
@ -60,7 +60,6 @@
* See the end of this file for details on the hardware/firmware interaction * See the end of this file for details on the hardware/firmware interaction
*/ */
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#include <lpc17xx_pinsel.h> #include <lpc17xx_pinsel.h>
#include "LPC1768_PWM.h" #include "LPC1768_PWM.h"

4
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h

@ -24,7 +24,7 @@
* The class Servo uses the PWM class to implement its functions * 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 * All PWMs use the same repetition rate - 20mS because that's the normal servo rate
*/ */
/** /**
* This is a hybrid system. * This is a hybrid system.
@ -60,7 +60,7 @@
* See the end of this file for details on the hardware/firmware interaction * 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_MR0 19999 // base repetition rate minus one count - 20mS
#define LPC_PWM1_PR 24 // prescaler value - prescaler divide by 24 + 1 - 1 MHz output #define LPC_PWM1_PR 24 // prescaler value - prescaler divide by 24 + 1 - 1 MHz output

59
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp

@ -1,33 +1,34 @@
/* /*
SoftwareSerial.cpp (formerly NewSoftSerial.cpp) - * SoftwareSerial.cpp (formerly NewSoftSerial.cpp)
Multi-instance software serial library for Arduino/Wiring *
-- Interrupt-driven receive and other improvements by ladyada * Multi-instance software serial library for Arduino/Wiring
(http://ladyada.net) * -- Interrupt-driven receive and other improvements by ladyada
-- Tuning, circular buffer, derivation from class Print/Stream, * (http://ladyada.net)
multi-instance support, porting to 8MHz processors, * -- Tuning, circular buffer, derivation from class Print/Stream,
various optimizations, PROGMEM delay tables, inverse logic and * multi-instance support, porting to 8MHz processors,
direct port writing by Mikal Hart (http://www.arduiniana.org) * various optimizations, PROGMEM delay tables, inverse logic and
-- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) * direct port writing by Mikal Hart (http://www.arduiniana.org)
-- 20MHz processor support by Garrett Mace (http://www.macetech.com) * -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com)
-- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.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 * This library is free software; you can redistribute it and/or
License as published by the Free Software Foundation; either * modify it under the terms of the GNU Lesser General Public
version 2.1 of the License, or (at your option) any later version. * 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 * This library is distributed in the hope that it will be useful,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details. * 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 * You should have received a copy of the GNU Lesser General Public
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 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. * The latest version of this library can always be found at
*/ * http://arduiniana.org.
*/
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768

59
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h

@ -1,33 +1,34 @@
/* /*
SoftwareSerial.h (formerly NewSoftSerial.h) - * SoftwareSerial.h (formerly NewSoftSerial.h)
Multi-instance software serial library for Arduino/Wiring *
-- Interrupt-driven receive and other improvements by ladyada * Multi-instance software serial library for Arduino/Wiring
(http://ladyada.net) * -- Interrupt-driven receive and other improvements by ladyada
-- Tuning, circular buffer, derivation from class Print/Stream, * (http://ladyada.net)
multi-instance support, porting to 8MHz processors, * -- Tuning, circular buffer, derivation from class Print/Stream,
various optimizations, PROGMEM delay tables, inverse logic and * multi-instance support, porting to 8MHz processors,
direct port writing by Mikal Hart (http://www.arduiniana.org) * various optimizations, PROGMEM delay tables, inverse logic and
-- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) * direct port writing by Mikal Hart (http://www.arduiniana.org)
-- 20MHz processor support by Garrett Mace (http://www.macetech.com) * -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com)
-- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.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 * This library is free software; you can redistribute it and/or
License as published by the Free Software Foundation; either * modify it under the terms of the GNU Lesser General Public
version 2.1 of the License, or (at your option) any later version. * 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 * This library is distributed in the hope that it will be useful,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details. * 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 * You should have received a copy of the GNU Lesser General Public
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 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. * The latest version of this library can always be found at
*/ * http://arduiniana.org.
*/
#ifndef SOFTWARESERIAL_H #ifndef SOFTWARESERIAL_H
#define SOFTWARESERIAL_H #define SOFTWARESERIAL_H

34
Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp

@ -1,20 +1,20 @@
/* /**
Copyright (c) 2011-2012 Arduino. All right reserved. * Copyright (c) 2011-2012 Arduino. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768

18
Marlin/src/HAL/HAL_LPC1768/fastio.h

@ -21,9 +21,10 @@
*/ */
/** /**
This code contributed by Triffid_Hunter and modified by Kliment * Fast I/O Routines for LPC1768/9
why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html * 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 * 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)) #define WRITE_PIN(IO, v) ((v) ? WRITE_PIN_SET(IO) : WRITE_PIN_CLR(IO))
/** /**
magic I/O routines * Magic I/O routines
now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0); *
*/ * 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 /// Read a pin
#define _READ(IO) READ_PIN(IO) #define _READ(IO) READ_PIN(IO)
@ -89,8 +93,6 @@ bool useable_hardware_PWM(uint8_t pin);
/// check if pin is an timer /// check if pin is an timer
#define _GET_TIMER(IO) #define _GET_TIMER(IO)
// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
/// Read a pin wrapper /// Read a pin wrapper
#define READ(IO) _READ(IO) #define READ(IO) _READ(IO)

63
Marlin/src/HAL/HAL_LPC1768/include/Wire.h

@ -1,23 +1,23 @@
/* /*
TwoWire.h - TWI/I2C library for Arduino & Wiring * TwoWire.h - TWI/I2C library for Arduino & Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved. * Copyright (c) 2006 Nicholas Zambetti. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 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 2012 by Todd Krein (todd@krein.org) to implement repeated starts
*/ */
// Modified for use with the mcp4451 digipot routine // Modified for use with the mcp4451 digipot routine
@ -28,31 +28,30 @@
#include <inttypes.h> #include <inttypes.h>
class TwoWire class TwoWire {
{
public: public:
// TwoWire(); //TwoWire();
void begin(); void begin();
void beginTransmission(uint8_t); void beginTransmission(uint8_t);
uint8_t endTransmission(void); uint8_t endTransmission(void);
size_t write(uint8_t); size_t write(uint8_t);
}; };
//extern TwoWire Wire;// //extern TwoWire Wire;
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_start(uint8_t sla);
extern "C" uint8_t digipot_mcp4451_send_byte(uint8_t data); 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::beginTransmission(uint8_t sla) { digipot_mcp4451_start(sla);}
void TwoWire::begin(void) {digipot_mcp4451_init();} void TwoWire::begin(void) {digipot_mcp4451_init();}
size_t TwoWire::write(uint8_t data) {return digipot_mcp4451_send_byte(data);} size_t TwoWire::write(uint8_t data) {return digipot_mcp4451_send_byte(data);}
uint8_t TwoWire::endTransmission(void) {return 1;} uint8_t TwoWire::endTransmission(void) {return 1;}
#endif #endif
#endif // TARGET_LPC1768 #endif // TARGET_LPC1768

269
Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c

@ -1,171 +1,162 @@
/** /**
* Marlin 3D Printer Firmware * Marlin 3D Printer Firmware
* Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* *
* Based on Sprinter and grbl. * Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
// adapted from I2C/master/master.c example // 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 // https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <lpc17xx_i2c.h>
#include <lpc17xx_pinsel.h>
#include <lpc17xx_libcfg_default.h>
#include <lpc17xx_i2c.h> //////////////////////////////////////////////////////////////////////////////////////
#include <lpc17xx_pinsel.h>
#include <lpc17xx_libcfg_default.h>
////////////////////////////////////////////////////////////////////////////////////// // 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 static uint32_t _I2C_Start (LPC_I2C_TypeDef *I2Cx) {
// to the lpc17xx_i2c.c routines so had to copy them into this file & rename them. // Reset STA, STO, SI
I2Cx->I2CONCLR = I2C_I2CONCLR_SIC|I2C_I2CONCLR_STOC|I2C_I2CONCLR_STAC;
static uint32_t _I2C_Start (LPC_I2C_TypeDef *I2Cx) // Enter to Master Transmitter mode
{ I2Cx->I2CONSET = I2C_I2CONSET_STA;
// Reset STA, STO, SI
I2Cx->I2CONCLR = I2C_I2CONCLR_SIC|I2C_I2CONCLR_STOC|I2C_I2CONCLR_STAC;
// Enter to Master Transmitter mode // Wait for complete
I2Cx->I2CONSET = I2C_I2CONSET_STA; while (!(I2Cx->I2CONSET & I2C_I2CONSET_SI));
I2Cx->I2CONCLR = I2C_I2CONCLR_STAC;
return (I2Cx->I2STAT & I2C_STAT_CODE_BITMASK);
}
// Wait for complete static void _I2C_Stop (LPC_I2C_TypeDef *I2Cx) {
while (!(I2Cx->I2CONSET & I2C_I2CONSET_SI)); /* Make sure start bit is not active */
if (I2Cx->I2CONSET & I2C_I2CONSET_STA)
I2Cx->I2CONCLR = I2C_I2CONCLR_STAC; I2Cx->I2CONCLR = I2C_I2CONCLR_STAC;
return (I2Cx->I2STAT & I2C_STAT_CODE_BITMASK);
}
static void _I2C_Stop (LPC_I2C_TypeDef *I2Cx) I2Cx->I2CONSET = I2C_I2CONSET_STO|I2C_I2CONSET_AA;
{ I2Cx->I2CONCLR = I2C_I2CONCLR_SIC;
}
/* 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;
}
#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
#define USEDI2CDEV_M 1 // use I2C1 controller PINSEL_CFG_Type PinCfg;
I2C_M_SETUP_Type transferMCfg;
#if (USEDI2CDEV_M == 0) #define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK)
#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; uint8_t digipot_mcp4451_start(uint8_t sla) { // send slave address and write bit
I2C_M_SETUP_Type transferMCfg; // 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
#define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK) // the slave address and write bit are actually sent.
do{
_I2C_Stop(I2CDEV_M); // output stop state on I2C bus
uint8_t digipot_mcp4451_start(uint8_t sla) { // send slave address and write bit _I2C_Start(I2CDEV_M); // output start state on I2C bus
// Sometimes TX data ACK or NAK status is returned. That mean the start state didn't while ((I2C_status != I2C_I2STAT_M_TX_START)
// happen which means only the value of the slave address was send. Keep looping until && (I2C_status != I2C_I2STAT_M_TX_RESTART)
// the slave address and write bit are actually sent. && (I2C_status != I2C_I2STAT_M_TX_DAT_ACK)
do{ && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK)); //wait for start to be asserted
_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;
}
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
void digipot_mcp4451_init(void) { /* Enable Master I2C operation */
I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE);
/* }
* 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) { 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;
}
LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data #ifdef __cplusplus
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 #endif
#endif // TARGET_LPC1768

4
Marlin/src/HAL/HAL_LPC1768/main.cpp

@ -79,8 +79,8 @@ int main(void) {
USB_Init(); // USB Initialization USB_Init(); // USB Initialization
USB_Connect(TRUE); // USB Connect USB_Connect(TRUE); // USB Connect
volatile uint32_t usb_timeout = millis() + 2000; const uint32_t usb_timeout = millis() + 2000;
while (!USB_Configuration && millis() < usb_timeout) { while (!USB_Configuration && PENDING(millis(), usb_timeout)) {
delay(50); delay(50);
#if PIN_EXISTS(LED) #if PIN_EXISTS(LED)

4
Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h

@ -22,10 +22,10 @@
/** /**
* Support routines for LPC1768 * 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 #define pwm_details(pin) pin = pin // do nothing // print PWM details

35
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 * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved. * Copyright (c) 2009 Michael Margolis. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 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 - * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
@ -47,7 +47,6 @@
* *
*/ */
#ifndef SERVO_PRIVATE_H #ifndef SERVO_PRIVATE_H
#define SERVO_PRIVATE_H #define SERVO_PRIVATE_H

18
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp

@ -59,15 +59,15 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/* VGPV /* VGPV
const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = { const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = {
{ TC0, 0, TC0_IRQn, 0}, // 0 - [servo timer5] { TC0, 0, TC0_IRQn, 0}, // 0 - [servo timer5]
{ TC0, 1, TC1_IRQn, 0}, // 1 { TC0, 1, TC1_IRQn, 0}, // 1
{ TC0, 2, TC2_IRQn, 0}, // 2 { TC0, 2, TC2_IRQn, 0}, // 2
{ TC1, 0, TC3_IRQn, 2}, // 3 - stepper { TC1, 0, TC3_IRQn, 2}, // 3 - stepper
{ TC1, 1, TC4_IRQn, 15}, // 4 - temperature { TC1, 1, TC4_IRQn, 15}, // 4 - temperature
{ TC1, 2, TC5_IRQn, 0}, // 5 - [servo timer3] { TC1, 2, TC5_IRQn, 0}, // 5 - [servo timer3]
{ TC2, 0, TC6_IRQn, 0}, // 6 { TC2, 0, TC6_IRQn, 0}, // 6
{ TC2, 1, TC7_IRQn, 0}, // 7 { TC2, 1, TC7_IRQn, 0}, // 7
{ TC2, 2, TC8_IRQn, 0}, // 8 { TC2, 2, TC8_IRQn, 0}, // 8
}; };
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

34
Marlin/src/HAL/HAL_STM32F1/spi_pins.h

@ -1,21 +1,21 @@
/** /**
* Marlin 3D Printer Firmware * Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/** /**
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) * HAL for stm32duino.com based on Libmaple and compatible (STM32F1)

40
Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp

@ -1,24 +1,24 @@
/** /**
* Marlin 3D Printer Firmware * Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* *
* Based on Sprinter and grbl. * Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/** /**
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) * HAL for stm32duino.com based on Libmaple and compatible (STM32F1)

42
Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h

@ -1,24 +1,24 @@
/** /**
* Marlin 3D Printer Firmware * Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* *
* Based on Sprinter and grbl. * Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
/** /**
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) * HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
@ -26,12 +26,12 @@
#ifndef WATCHDOG_STM32F1_H #ifndef WATCHDOG_STM32F1_H
#define WATCHDOG_STM32F1_H #define WATCHDOG_STM32F1_H
#include <libmaple/iwdg.h> #include <libmaple/iwdg.h>
#include "../../../src/inc/MarlinConfig.h" #include "../../../src/inc/MarlinConfig.h"
#define STM32F1_WD_RELOAD 625 #define STM32F1_WD_RELOAD 625
// Arduino STM32F1 core now has watchdog support // Arduino STM32F1 core now has watchdog support
// Initialize watchdog with a 4 second countdown time // Initialize watchdog with a 4 second countdown time

2
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 * Fast I/O Routines for Teensy 3.5 and Teensy 3.6
* Use direct port manipulation to save scads of processor time. * 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 #ifndef _FASTIO_TEENSY_H

82
Marlin/src/HAL/servo.h

@ -21,49 +21,49 @@
*/ */
/** /**
servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved. * Copyright (c) 2009 Michael Margolis. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 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. * 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 * 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. * 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. * 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 sequence used to seize timers is defined in timers.h
*
The methods are: * The methods are:
*
Servo - Class for manipulating servo motors connected to Arduino pins. * Servo - Class for manipulating servo motors connected to Arduino pins.
*
attach(pin ) - Attaches a servo motor to an i/o pin. * 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 * attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400 * 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) * 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 * writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180. * 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) * 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. * attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin. * detach() - Stops an attached servos from pulsing its i/o pin.
move(angle) - Sequence of attach(0), write(angle), * move(angle) - Sequence of attach(0), write(angle),
With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY and detach. * With DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY and detach.
*/ */
#ifndef SERVO_H #ifndef SERVO_H

34
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 * servo_private.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved. * Copyright (c) 2009 Michael Margolis. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef SERVO_PRIVATE_H #ifndef SERVO_PRIVATE_H
#define SERVO_PRIVATE_H #define SERVO_PRIVATE_H

16
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. * 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() * There is very little CPU burden added to the system by displaying information within the idle()
* task. * task.
* *
* But with that said, if your debugging can be facilitated by making calls into the library from * 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 * 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. * or clear a row is not very significant.
*/ */
void Max7219_idle_tasks() { void Max7219_idle_tasks() {
#if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE #if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
CRITICAL_SECTION_START CRITICAL_SECTION_START

5
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]; } uint16_t mcp4728_getValue(uint8_t channel) { return mcp4728_values[channel]; }
#if 0
/** /**
* Steph: Might be useful in the future * Steph: Might be useful in the future
* Return Vout * Return Vout
* */
uint16_t mcp4728_getVout(uint8_t channel) { uint16_t mcp4728_getVout(uint8_t channel) {
uint32_t vref = 2048, uint32_t vref = 2048,
vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096; vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
if (vOut > defaultVDD) vOut = defaultVDD; if (vOut > defaultVDD) vOut = defaultVDD;
return vOut; return vOut;
} }
*/ #endif
/** /**
* Returns DAC values as a 0-100 percentage of drive strength * Returns DAC values as a 0-100 percentage of drive strength

38
Marlin/src/feature/dac/stepper_dac.cpp

@ -21,25 +21,25 @@
*/ */
/** /**
stepper_dac.cpp - To set stepper current via DAC * stepper_dac.cpp - To set stepper current via DAC
*
Part of Marlin * Part of Marlin
*
Copyright (c) 2016 MarlinFirmware * Copyright (c) 2016 MarlinFirmware
*
Marlin is free software: you can redistribute it and/or modify * Marlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. * (at your option) any later version.
*
Marlin is distributed in the hope that it will be useful, * Marlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with Marlin. If not, see <http://www.gnu.org/licenses/>. * along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"

38
Marlin/src/feature/dac/stepper_dac.h

@ -21,25 +21,25 @@
*/ */
/** /**
stepper_dac.h - To set stepper current via DAC * stepper_dac.h - To set stepper current via DAC
*
Part of Marlin * Part of Marlin
*
Copyright (c) 2016 MarlinFirmware * Copyright (c) 2016 MarlinFirmware
*
Marlin is free software: you can redistribute it and/or modify * Marlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. * (at your option) any later version.
*
Marlin is distributed in the hope that it will be useful, * Marlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with Marlin. If not, see <http://www.gnu.org/licenses/>. * along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef STEPPER_DAC_H #ifndef STEPPER_DAC_H
#define STEPPER_DAC_H #define STEPPER_DAC_H

33
Marlin/src/gcode/feature/leds/M150.cpp

@ -28,23 +28,22 @@
#include "../../../feature/leds/leds.h" #include "../../../feature/leds/leds.h"
/** /**
* M150: Set Status LED Color - Use R-U-B-W for R-G-B-W * M150: Set Status LED Color - Use R-U-B-W for R-G-B-W
* and Brightness - Use P (for NEOPIXEL only) * and Brightness - Use P (for NEOPIXEL only)
* *
* Always sets all 3 or 4 components. If a component is left out, set to 0. * Always sets all 3 or 4 components. If a component is left out, set to 0.
* If brightness is left out, no value changed * If brightness is left out, no value changed
* *
* Examples: * Examples:
* *
* M150 R255 ; Turn LED red * M150 R255 ; Turn LED red
* M150 R255 U127 ; Turn LED orange (PWM only) * M150 R255 U127 ; Turn LED orange (PWM only)
* M150 ; Turn LED off * M150 ; Turn LED off
* M150 R U B ; Turn LED white * M150 R U B ; Turn LED white
* M150 W ; Turn LED white using a white LED * M150 W ; Turn LED white using a white LED
* M150 P127 ; Set LED 50% brightness * M150 P127 ; Set LED 50% brightness
* M150 P ; Set LED full brightness * M150 P ; Set LED full brightness
*/ */
void GcodeSuite::M150() { void GcodeSuite::M150() {
set_led_color( set_led_color(
parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : 0, parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : 0,

34
Marlin/src/libs/vector_3.cpp

@ -21,23 +21,23 @@
*/ */
/** /**
vector_3.cpp - Vector library for bed leveling * vector_3.cpp - Vector library for bed leveling
Copyright (c) 2012 Lars Brubaker. All right reserved. * Copyright (c) 2012 Lars Brubaker. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../inc/MarlinConfig.h" #include "../inc/MarlinConfig.h"

34
Marlin/src/libs/vector_3.h

@ -21,23 +21,23 @@
*/ */
/** /**
vector_3.cpp - Vector library for bed leveling * vector_3.cpp - Vector library for bed leveling
Copyright (c) 2012 Lars Brubaker. All right reserved. * Copyright (c) 2012 Lars Brubaker. All right reserved.
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. * Lesser General Public License for more details.
*
You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef VECTOR_3_H #ifndef VECTOR_3_H
#define VECTOR_3_H #define VECTOR_3_H

3
Marlin/src/module/planner_bezier.cpp

@ -44,8 +44,7 @@
#define MAX_STEP 0.1 #define MAX_STEP 0.1
#define SIGMA 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; } inline static float interp(float a, float b, float t) { return (1.0 - t) * a + t * b; }
/** /**

38
Marlin/src/module/stepper_indirection.h

@ -21,25 +21,25 @@
*/ */
/** /**
stepper_indirection.h - stepper motor driver indirection macros * stepper_indirection.h - stepper motor driver indirection macros
to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation * to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
Part of Marlin * Part of Marlin
*
Copyright (c) 2015 Dominik Wenger * Copyright (c) 2015 Dominik Wenger
*
Marlin is free software: you can redistribute it and/or modify * Marlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. * at your option) any later version.
*
Marlin is distributed in the hope that it will be useful, * Marlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with Marlin. If not, see <http://www.gnu.org/licenses/>. * along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef STEPPER_INDIRECTION_H #ifndef STEPPER_INDIRECTION_H
#define STEPPER_INDIRECTION_H #define STEPPER_INDIRECTION_H

2
Marlin/src/pins/pins_ANET_10.h

@ -86,7 +86,7 @@
* Anet Users / Skynet SW on Facebook - https://www.facebook.com/skynet3ddevelopment/ * 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. * Many thanks to Hans Raaf (@oderwat) for developing the Anet-specific software and supporting the Anet community.
*/ */
#ifndef __AVR_ATmega1284P__ #ifndef __AVR_ATmega1284P__
#error "Oops! Make sure you have 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' selected from the 'Tools -> Boards' menu." #error "Oops! Make sure you have 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' selected from the 'Tools -> Boards' menu."

Loading…
Cancel
Save