3 Commits

Author SHA1 Message Date
3ebbfa4dd3 Soft reset on DTR change 2017-01-16 14:20:52 -05:00
e0438230b5 readme: fix formatting 2017-01-15 20:21:04 -05:00
0fe1caff33 readme: download link 2017-01-15 20:14:59 -05:00
5 changed files with 32 additions and 11 deletions

View File

@ -157,7 +157,7 @@ build/%.hex : build/%.elf
.PHONY: flash
flash: build/grbl.hex
fm COM(13, 115200) DEVICE(LPC1769, 0.000000, 0) HARDWARE(BOOTEXEC, 50, 100) ERASEUSED(build\grbl.hex, PROTECTISP) HEXFILE(build\grbl.hex, NOCHECKSUMS, NOFILL, PROTECTISP)
fm COM(15, 115200) DEVICE(LPC1769, 0.000000, 0) HARDWARE(BOOTEXEC, 50, 100) ERASEUSED(build\grbl.hex, PROTECTISP) HEXFILE(build\grbl.hex, NOCHECKSUMS, NOFILL, PROTECTISP)
.PHONY: clean
clean:

View File

@ -1,5 +1,7 @@
![GitHub Logo](/doc/media/Grbl Logo 250px.png)
***
_Click the `Release` tab to download pre-compiled `.bin` files or just [click here](https://github.com/gnea/grbl-LPC/releases)_
***
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
Usage notes:
@ -33,6 +35,7 @@ Build notes:
* ```build/grbl.hex```: this is not compatible with the sdcard bootloader. It loads using Flash Magic
and is primarilly for developers who don't want to keep swapping sdcards. If you flash this,
then you'll have to reflash the bootloader if you want to go back.
***
Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. This version of Grbl runs on an Arduino with a 328p processor (Uno, Duemilanove, Nano, Micro, etc).

View File

@ -86,6 +86,7 @@ static U8 txdata[VCOM_FIFO_SIZE];
static fifo_t txfifo;
//static fifo_t rxfifo;
static UsbSerialLineStateCallback* usbSerialLineStateCallback = nullptr;
static UsbSerialReadCallback* usbSerialReadCallback = nullptr;
// forward declaration of interrupt handler
@ -299,10 +300,13 @@ static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData)
break;
// set control line state
case SET_CONTROL_LINE_STATE:
// bit0 = DTR, bit = RTS
case SET_CONTROL_LINE_STATE: {
bool dtr = (pSetup->wValue >> 0) & 1;
bool rts = (pSetup->wValue >> 1) & 1;
if (usbSerialLineStateCallback)
usbSerialLineStateCallback(dtr, rts);
break;
}
default:
return FALSE;
@ -376,8 +380,9 @@ void enable_USB_interrupts(void);
main
====
**************************************************************************/
int usbSerialInit(UsbSerialReadCallback* usbSerialReadCallback)
int usbSerialInit(UsbSerialLineStateCallback* usbSerialLineStateCallback, UsbSerialReadCallback* usbSerialReadCallback)
{
::usbSerialLineStateCallback = usbSerialLineStateCallback;
::usbSerialReadCallback = usbSerialReadCallback;
// initialise stack

View File

@ -98,10 +98,13 @@ void VCOM_gets_echo(char *str); // gets string terminated in '\r' or '\n' and ec
#include "serial_fifo.h"
// Receives line state. Called by an interrupt.
typedef void UsbSerialLineStateCallback(bool dtr, bool rts);
// Receives serial data. Called by an interrupt.
typedef void UsbSerialReadCallback(const U8* data, unsigned len);
int usbSerialInit(UsbSerialReadCallback* usbSerialReadCallback); // run once in main b4 main loop starts.
int usbSerialInit(UsbSerialLineStateCallback* usbSerialLineStateCallback, UsbSerialReadCallback* usbSerialReadCallback); // run once in main b4 main loop starts.
/*
Writes one character to VCOM port

View File

@ -49,6 +49,8 @@ void serialInterrupt(uint32_t event);
void legacy_ISR(uint8_t data);
uint8_t arm_rx_buf[1];
bool lastDtr = false;
// Returns the number of bytes available in the RX serial buffer.
uint16_t serial_get_rx_buffer_available()
{
@ -80,7 +82,15 @@ uint8_t serial_get_tx_buffer_count()
void serial_init()
{
#ifdef USE_USB
usbSerialInit([](const U8* data, unsigned len) {
usbSerialInit(
[](bool dtr, bool rts) {
if (dtr != lastDtr)
{
lastDtr = dtr;
mc_reset();
}
},
[](const U8* data, unsigned len) {
while (len--)
legacy_ISR(*data++);
});