[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

@@ -24,6 +24,8 @@ extern "C" {
#include <chanfs/ff.h>
}
#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#include "fastio.h"
#include "HAL_timers.h"
#include <stdio.h>
@@ -69,21 +71,32 @@ extern "C" void SystemPostInit() {
}
extern uint32_t MSC_SD_Init(uint8_t pdrv);
extern HalSerial usb_serial;
int main(void) {
(void)MSC_SD_Init(0);
USB_Init(); // USB Initialization
USB_Connect(TRUE); // USB Connect
volatile uint32_t usb_timeout = millis() + 2000;
while (!USB_Configuration && millis() < usb_timeout) {
delay(50);
TOGGLE(13); // Flash fast while USB initialisation completes
#if PIN_EXISTS(LED)
TOGGLE(LED_PIN); // Flash fast while USB initialisation completes
#endif
}
debug_frmwrk_init();
usb_serial.printf("\n\nRe-ARM (LPC1768 @ %dMhz) UART0 Initialised\n", SystemCoreClock / 1000000);
// Only initialize the debug framework if using the USB emulated serial port
if ((HalSerial*) &MYSERIAL == &usb_serial)
debug_frmwrk_init();
MYSERIAL.begin(BAUDRATE);
MYSERIAL.printf("\n\nLPC1768 (%dMhz) UART0 Initialised\n", SystemCoreClock / 1000000);
#if TX_BUFFER_SIZE > 0
MYSERIAL.flushTX();
#endif
HAL_timer_init();