[2.0.x] Enable hardware serial ports on LPC1768 (#8004)

* Enable hardware serial ports on LPC1768

* Fix compilation errors with other HALs

* FIx order of includes in LPC1768 HAL main.cpp

* Add support for RX_BUFFER_SIZE and TX_BUFFER_SIZE options in Configuration_adv.h
This commit is contained in:
Thomas Moore
2017-10-24 17:28:33 -05:00
committed by Roxy-3D
parent 46aae4c6e7
commit 51fafccc16
21 changed files with 498 additions and 667 deletions

View File

@ -491,4 +491,12 @@
#define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED))
// For Re-ARM boards, always use the USB Emulated Serial Port unless RE_ARM_FORCE_SERIAL_PORT is defined
#if MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_14_RE_ARM_EEB) || MB(RAMPS_14_RE_ARM_EFF) || MB(RAMPS_14_RE_ARM_EEF) || MB(RAMPS_14_RE_ARM_SF)
#ifndef RE_ARM_FORCE_SERIAL_PORT
#undef SERIAL_PORT
#define SERIAL_PORT -1
#endif
#endif
#endif // CONDITIONALS_LCD_H

View File

@ -0,0 +1,42 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* Conditionals_adv.h
* Defines that depend on advanced onfiguration.
*/
#ifndef CONDITIONALS_ADV_H
#define CONDITIONALS_ADV_H
#ifndef USBCON
// Define constants and variables for buffering incoming serial data.
// 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256)
#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
#endif
#ifndef TX_BUFFER_SIZE
#define TX_BUFFER_SIZE 32
#endif
#endif
#endif // CONDITIONALS_ADV_H

View File

@ -30,6 +30,7 @@
#include "../../Configuration.h"
#include "Conditionals_LCD.h"
#include "../../Configuration_adv.h"
#include "Conditionals_adv.h"
#include "../HAL/HAL.h"
#include "../pins/pins.h"
#if defined(__AVR__) && !defined(USBCON)

View File

@ -235,6 +235,24 @@
#error "WEBSITE_URL must be specified."
#endif
/**
* Serial
*/
#ifndef USBCON
#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
#error "XON/XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
#endif
#if !IS_POWER_OF_2(RX_BUFFER_SIZE) || RX_BUFFER_SIZE < 2
#error "RX_BUFFER_SIZE must be a power of 2 greater than 1."
#endif
// 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256)
#if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
#error "TX_BUFFER_SIZE must be 0 or a power of 2 greater than 1."
#endif
#endif
/**
* Dual Stepper Drivers
*/