Make use of the new usb_serial (and drop usage of lufa_serial).

At this point in time not a single user of LUFA is known and
here is reported how usb_serial apparently works more reliable:

http://forums.reprap.org/read.php?147,33082,160724#msg-160724

So it's likely we can move from lufa_serial to usb_serial entirely.
This commit is contained in:
Markus Hitter 2012-10-17 12:44:30 +02:00
parent 7d6ffdae17
commit 0b11812ce5
3 changed files with 25 additions and 20 deletions

View File

@ -94,7 +94,7 @@ PROGID = stk500v2
PROGRAM = mendel PROGRAM = mendel
SOURCES = $(PROGRAM).c gcode_parse.c gcode_process.c dda.c dda_maths.c dda_queue.c timer.c temp.c sermsg.c watchdog.c debug.c sersendf.c heater.c analog.c intercom.c pinio.c clock.c home.c crc.c delay.c SOURCES = $(PROGRAM).c gcode_parse.c gcode_process.c dda.c dda_maths.c dda_queue.c timer.c temp.c sermsg.c watchdog.c debug.c sersendf.c heater.c analog.c intercom.c pinio.c clock.c home.c crc.c delay.c serial.c
ARCH = avr- ARCH = avr-
CC = $(ARCH)gcc CC = $(ARCH)gcc
@ -110,19 +110,14 @@ LIBDEPS =
SUBDIRS = SUBDIRS =
ifneq (,$(findstring usb,$(MCU_TARGET))) ifneq (,$(findstring usb,$(MCU_TARGET)))
USE_LUFA = true USE_USB = true
endif endif
ifneq (,$(findstring u4,$(MCU_TARGET))) ifneq (,$(findstring u4,$(MCU_TARGET)))
USE_LUFA = true USE_USB = true
endif endif
ifdef USE_LUFA ifdef USE_USB
LDFLAGS += -Llufa_serial CFLAGS += -DUSE_USB
SOURCES += usb_serial.c
LIBS += -llufa_serial
SUBDIRS += lufa_serial
LIBDEPS += lufa_serial/liblufa_serial.a
else
SOURCES += serial.c
endif endif
ifeq ($(PROGBAUD),0) ifeq ($(PROGBAUD),0)

View File

@ -24,6 +24,7 @@
/// ascii XON character /// ascii XON character
#define ASCII_XON 17 #define ASCII_XON 17
#ifndef USE_USB
/// rx buffer head pointer. Points to next available space. /// rx buffer head pointer. Points to next available space.
volatile uint8_t rxhead = 0; volatile uint8_t rxhead = 0;
/// rx buffer tail pointer. Points to last character in buffer /// rx buffer tail pointer. Points to last character in buffer
@ -223,6 +224,7 @@ void serial_writechar(uint8_t data)
// enable TX interrupt so we can send this character // enable TX interrupt so we can send this character
UCSR0B |= MASK(UDRIE0); UCSR0B |= MASK(UDRIE0);
} }
#endif /* USE_USB */
/// send a whole block /// send a whole block
void serial_writeblock(void *data, int datalen) void serial_writeblock(void *data, int datalen)

View File

@ -5,17 +5,25 @@
#include <avr/io.h> #include <avr/io.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
// initialise serial subsystem #ifdef USE_USB
void serial_init(void); #define serial_init() usb_init()
#define serial_rxchars() usb_serial_available()
#define serial_popchar() usb_serial_getchar()
#define serial_writechar(c) usb_serial_putchar(c)
#else
// initialise serial subsystem
void serial_init(void);
// return number of characters in the receive buffer, and number of spaces in the send buffer // return number of characters in the receive buffer,
uint8_t serial_rxchars(void); // and number of spaces in the send buffer
// uint8_t serial_txchars(void); uint8_t serial_rxchars(void);
// uint8_t serial_txchars(void);
// read one character // read one character
uint8_t serial_popchar(void); uint8_t serial_popchar(void);
// send one character // send one character
void serial_writechar(uint8_t data); void serial_writechar(uint8_t data);
#endif
// read/write many characters // read/write many characters
// uint8_t serial_recvblock(uint8_t *block, int blocksize); // uint8_t serial_recvblock(uint8_t *block, int blocksize);