Make USB_SERIAL fit for the Arduino IDE.
This also includes renaming of USE_USB to USB_SERIAL for more consistency.
This commit is contained in:
parent
ef6036c724
commit
9b018b7433
16
Makefile
16
Makefile
|
|
@ -94,7 +94,10 @@ PROGID = stk500v2
|
|||
|
||||
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 serial.c
|
||||
SOURCES = $(PROGRAM).c gcode_parse.c gcode_process.c dda.c dda_maths.c
|
||||
SOURCES += dda_queue.c timer.c temp.c sermsg.c watchdog.c debug.c sersendf.c
|
||||
SOURCES += heater.c analog.c intercom.c pinio.c clock.c home.c crc.c delay.c
|
||||
SOURCES += serial.c usb_serial.c
|
||||
|
||||
ARCH = avr-
|
||||
CC = $(ARCH)gcc
|
||||
|
|
@ -111,17 +114,6 @@ LIBS = -lm
|
|||
LIBDEPS =
|
||||
SUBDIRS =
|
||||
|
||||
ifneq (,$(findstring usb,$(MCU_TARGET)))
|
||||
USE_USB = true
|
||||
endif
|
||||
ifneq (,$(findstring u4,$(MCU_TARGET)))
|
||||
USE_USB = true
|
||||
endif
|
||||
ifdef USE_USB
|
||||
CFLAGS += -DUSE_USB
|
||||
SOURCES += usb_serial.c
|
||||
endif
|
||||
|
||||
ifeq ($(PROGBAUD),0)
|
||||
PROGBAUD_FLAG =
|
||||
else
|
||||
|
|
|
|||
|
|
@ -384,10 +384,18 @@ DEFINE_HEATER(bed, PB4, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -388,10 +388,18 @@ DEFINE_TEMP_SENSOR(bed, TT_INTERCOM, AIO1, 0)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -372,10 +372,18 @@ DEFINE_HEATER(extruder, PD6, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -383,10 +383,18 @@ DEFINE_HEATER(bed, DIO3, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -383,10 +383,18 @@ DEFINE_HEATER(bed, DIO3, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -381,10 +381,18 @@ DEFINE_HEATER(fan, PH6, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -383,10 +383,18 @@ DEFINE_HEATER(extruder, PB4, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -379,10 +379,18 @@ DEFINE_HEATER(bed, PD6, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -379,10 +379,18 @@ DEFINE_HEATER(bed, PD4, 1)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 115200
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
// #define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
|
|
@ -438,10 +438,18 @@ DEFINE_HEATER(fan, DIO8, 0)
|
|||
// #define REPRAP_HOST_COMPATIBILITY 20110509
|
||||
// #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break>
|
||||
|
||||
/**
|
||||
Baud rate for the connection to the host. Usually 115200, other common values are 19200, 38400 or 57600.
|
||||
/** \def BAUD
|
||||
Baud rate for the serial RS232 protocol connection to the host. Usually
|
||||
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
|
||||
is defined.
|
||||
*/
|
||||
#define BAUD 57600
|
||||
#define BAUD 115200
|
||||
|
||||
/** \def USB_SERIAL
|
||||
Define this for using USB instead of the serial RS232 protocol. Works on
|
||||
USB-equipped ATmegas, like the ATmega32U4, only.
|
||||
*/
|
||||
#define USB_SERIAL
|
||||
|
||||
/** \def XONXOFF
|
||||
Xon/Xoff flow control.
|
||||
|
|
|
|||
5
serial.c
5
serial.c
|
|
@ -13,7 +13,6 @@
|
|||
#include <avr/interrupt.h>
|
||||
#include "memory_barrier.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "arduino.h"
|
||||
|
||||
/// size of TX and RX buffers. MUST be a \f$2^n\f$ value
|
||||
|
|
@ -24,7 +23,7 @@
|
|||
/// ascii XON character
|
||||
#define ASCII_XON 17
|
||||
|
||||
#ifndef USE_USB
|
||||
#ifndef USB_SERIAL
|
||||
/// rx buffer head pointer. Points to next available space.
|
||||
volatile uint8_t rxhead = 0;
|
||||
/// rx buffer tail pointer. Points to last character in buffer
|
||||
|
|
@ -224,7 +223,7 @@ void serial_writechar(uint8_t data)
|
|||
// enable TX interrupt so we can send this character
|
||||
UCSR0B |= MASK(UDRIE0);
|
||||
}
|
||||
#endif /* USE_USB */
|
||||
#endif /* USB_SERIAL */
|
||||
|
||||
/// send a whole block
|
||||
void serial_writeblock(void *data, int datalen)
|
||||
|
|
|
|||
5
serial.h
5
serial.h
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef _SERIAL_H
|
||||
#define _SERIAL_H
|
||||
|
||||
#include "config.h"
|
||||
#include <stdint.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#ifdef USE_USB
|
||||
#ifdef USB_SERIAL
|
||||
#include "usb_serial.h"
|
||||
#define serial_init() usb_init()
|
||||
#define serial_rxchars() usb_serial_available()
|
||||
|
|
@ -24,7 +25,7 @@
|
|||
uint8_t serial_popchar(void);
|
||||
// send one character
|
||||
void serial_writechar(uint8_t data);
|
||||
#endif
|
||||
#endif /* USB_SERIAL */
|
||||
|
||||
// read/write many characters
|
||||
// uint8_t serial_recvblock(uint8_t *block, int blocksize);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@
|
|||
// Version 1.7: fix usb_serial_set_control
|
||||
// 2012-10-17: Import to Teacup firmware
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* protect this file from Arduino IDE */
|
||||
#ifdef USE_USB
|
||||
#ifdef USB_SERIAL
|
||||
|
||||
#define USB_SERIAL_PRIVATE_INCLUDE
|
||||
#include "usb_serial.h"
|
||||
|
|
@ -937,4 +939,4 @@ ISR(USB_COM_vect)
|
|||
UECONX = (1<<STALLRQ) | (1<<EPEN); // stall
|
||||
}
|
||||
|
||||
#endif /* USE_USB */
|
||||
#endif /* USB_SERIAL */
|
||||
|
|
|
|||
Loading…
Reference in New Issue