From 0e1c93804369af27043c82ccc778c42bf54a9bd4 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Tue, 27 Mar 2012 23:19:30 +0200 Subject: [PATCH] support lolo's board serpi & zer0 --- DualVirtualSerial.c | 88 --------------- autoconf.h | 2 +- avr6.x | 269 ++++++++++++++++++++++++++++++++++++++++++++ cmdline.c | 34 ++++-- cmdline.h | 25 +++- main.c | 114 +++++++++++++++++-- makefile | 28 +++-- uart_config.h | 59 +++++++--- 8 files changed, 485 insertions(+), 134 deletions(-) create mode 100644 avr6.x diff --git a/DualVirtualSerial.c b/DualVirtualSerial.c index f5f4053..df22741 100644 --- a/DualVirtualSerial.c +++ b/DualVirtualSerial.c @@ -58,10 +58,6 @@ #include "main.h" #include "cmdline.h" -volatile uint16_t global_ms; -struct callout_manager cm; - - /** LUFA CDC Class driver interface configuration and state information. This structure is * passed to all CDC Class driver functions, so that multiple instances of the same class * within a device can be differentiated from one another. This is for the first CDC interface, @@ -113,90 +109,6 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface = }; -/* return time in milliseconds on unsigned 16 bits */ -static uint16_t get_time_ms(void) -{ - return global_ms; -} - -static void do_led_blink(struct callout_manager *cm, - struct callout *clt, void *dummy) -{ - static uint8_t a = 0; - - if (a & 1) - LEDs_SetAllLEDs(0); - else - LEDs_SetAllLEDs(0xff); - a++; -} - -static void increment_ms(void *dummy) -{ - global_ms++; -} - -static void main_timer_interrupt(void) -{ - static uint8_t cpt = 0; - cpt++; - sei(); - if ((cpt & 0x3) == 0) - scheduler_interrupt(); -} - - -/** Main program entry point. This routine contains the overall program flow, including initial - * setup of all components and the main program loop. - */ -int main(void) -{ - struct callout t1; - FILE *xbee_file; - int8_t err; - struct xbee_dev dev; - - SetupHardware(); - - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - - fdevopen(usbserial1_dev_send, usbserial1_dev_recv); - xbee_file = fdevopen(usbserial2_dev_send, usbserial2_dev_recv); - scheduler_init(); - timer_init(); - timer0_register_OV_intr(main_timer_interrupt); - sei(); - - scheduler_add_periodical_event_priority(increment_ms, NULL, - 1000L / SCHEDULER_UNIT, - LED_PRIO); - cmdline_init(); - callout_manager_init(&cm, get_time_ms); - callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL); - - /* initialize libxbee */ - err = xbee_init(); - if (err < 0) - return -1; - - xbee_dev = &dev; - - /* open xbee device */ - if (xbee_open(xbee_dev, xbee_file) < 0) - return -1; - - /* register default channel with a callback */ - if (xbee_register_channel(xbee_dev, XBEE_DEFAULT_CHANNEL, - xbee_rx, NULL) < 0) { - fprintf(stderr, "cannot register default channel\n"); - return -1; - } - - sei(); - xbee_mainloop(); - return 0; -} - /** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void) { diff --git a/autoconf.h b/autoconf.h index 6bec9b5..feb99d1 100644 --- a/autoconf.h +++ b/autoconf.h @@ -53,7 +53,7 @@ #undef CONFIG_MCU_ATMEGA2560 #undef CONFIG_MCU_ATMEGA256 #define CONFIG_MCU_ATMEGAUSB1287 -#define CONFIG_QUARTZ (16000000) +#define CONFIG_QUARTZ (8000000) /* * Generation options diff --git a/avr6.x b/avr6.x new file mode 100644 index 0000000..3ad392f --- /dev/null +++ b/avr6.x @@ -0,0 +1,269 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") +OUTPUT_ARCH(avr:6) +MEMORY +{ + text (rx) : ORIGIN = 0, LENGTH = 1024K + data (rw!x) : ORIGIN = 0x800200, LENGTH = 0xfe00 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K + lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K + signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K +} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + /* Internal text space or external memory. */ + .text : + { + *(.vectors) + KEEP(*(.vectors)) + . = 256 + ALIGN(256); /* placeholder for misc microb infos */ + /* For data that needs to reside in the lower 64k of progmem. */ + *(.progmem.gcc*) + *(.progmem*) + . = ALIGN(2048); + __trampolines_start = . ; + /* The jump trampolines for the 16-bit limited relocs will reside here. */ + *(.trampolines) + *(.trampolines*) + __trampolines_end = . ; + /* For future tablejump instruction arrays for 3 byte pc devices. + We don't relax jump/call instructions within these sections. */ + *(.jumptables) + *(.jumptables*) + /* For code that needs to reside in the lower 128k progmem. */ + *(.lowtext) + *(.lowtext*) + __ctors_start = . ; + *(.ctors) + __ctors_end = . ; + __dtors_start = . ; + *(.dtors) + __dtors_end = . ; + KEEP(SORT(*)(.ctors)) + KEEP(SORT(*)(.dtors)) + /* From this point on, we don't bother about wether the insns are + below or above the 16 bits boundary. */ + *(.init0) /* Start here after reset. */ + KEEP (*(.init0)) + *(.init1) + KEEP (*(.init1)) + *(.init2) /* Clear __zero_reg__, set up stack pointer. */ + KEEP (*(.init2)) + *(.init3) + KEEP (*(.init3)) + *(.init4) /* Initialize data and BSS. */ + KEEP (*(.init4)) + *(.init5) + KEEP (*(.init5)) + *(.init6) /* C++ constructors. */ + KEEP (*(.init6)) + *(.init7) + KEEP (*(.init7)) + *(.init8) + KEEP (*(.init8)) + *(.init9) /* Call main(). */ + KEEP (*(.init9)) + *(.text.*) /* trucs de gcc ? */ + . = ALIGN(2048); + /* some libc stuff */ + strc*(.text) + mem*(.text) + printf*(.text) + vfprintf*(.text) + sprintf*(.text) + snprintf*(.text) + malloc*(.text) + free*(.text) + fdevopen*(.text) + fputc*(.text) + . = ALIGN(2048); + uart*(.text) + pwm*(.text) + parse*(.text) + rdline*(.text) + vt100*(.text) + scheduler*(.text) + control_system*(.text) + pid*(.text) + f08*(.text) + f16*(.text) + f32*(.text) + f64*(.text) + vect2*(.text) + quadramp*(.text) + blocking*(.text) + obstacle*(.text) + trajectory*(.text) + position*(.text) + adc*(.text) + robot*(.text) + error*(.text) + encoders*(.text) + time*(.text) + cirbuf*(.text) + i2c*(.text) + spi*(.text) + ax12*(.text) + . = ALIGN(2048); + *(.text) + . = ALIGN(2); + *(.fini9) /* _exit() starts here. */ + KEEP (*(.fini9)) + *(.fini8) + KEEP (*(.fini8)) + *(.fini7) + KEEP (*(.fini7)) + *(.fini6) /* C++ destructors. */ + KEEP (*(.fini6)) + *(.fini5) + KEEP (*(.fini5)) + *(.fini4) + KEEP (*(.fini4)) + *(.fini3) + KEEP (*(.fini3)) + *(.fini2) + KEEP (*(.fini2)) + *(.fini1) + KEEP (*(.fini1)) + *(.fini0) /* Infinite loop after program termination. */ + KEEP (*(.fini0)) + _etext = . ; + } > text + .data : AT (ADDR (.text) + SIZEOF (.text)) + { + PROVIDE (__data_start = .) ; + *(.data) + *(.data*) + *(.rodata) /* We need to include .rodata here if gcc is used */ + *(.rodata*) /* with -fdata-sections. */ + *(.gnu.linkonce.d*) + . = ALIGN(2); + _edata = . ; + PROVIDE (__data_end = .) ; + } > data + .bss SIZEOF(.data) + ADDR(.data) : + { + PROVIDE (__bss_start = .) ; + *(.bss) + *(.bss*) + *(COMMON) + PROVIDE (__bss_end = .) ; + } > data + __data_load_start = LOADADDR(.data); + __data_load_end = __data_load_start + SIZEOF(.data); + /* Global data not cleared after reset. */ + .noinit SIZEOF(.bss) + ADDR(.bss) : + { + PROVIDE (__noinit_start = .) ; + *(.noinit*) + PROVIDE (__noinit_end = .) ; + _end = . ; + PROVIDE (__heap_start = .) ; + } > data + .eeprom : + { + *(.eeprom*) + __eeprom_end = . ; + } > eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } > fuse + .lock : + { + KEEP(*(.lock*)) + } > lock + .signature : + { + KEEP(*(.signature*)) + } > signature + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } +} diff --git a/cmdline.c b/cmdline.c index 36d1f31..60dc9a6 100644 --- a/cmdline.c +++ b/cmdline.c @@ -36,24 +36,33 @@ #include "main.h" #include "cmdline.h" -#include "DualVirtualSerial.h" +#ifdef USE_USB +#include "DualVirtualSerial.h" +#endif -/******** See in commands.c for the list of commands. */ extern parse_pgm_ctx_t main_ctx[]; -int usbserial1_dev_send(char c, FILE* f) +int cmdline_dev_send(char c, FILE* f) { +#ifdef USE_USB CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, (uint8_t)c); +#else + uart_send(CMDLINE_UART, c); +#endif return 0; } -int usbserial1_dev_recv(FILE* f) +int cmdline_dev_recv(FILE* f) { int16_t c; +#ifdef USE_USB /* non-blocking ! */ c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); +#else + c = uart_recv_nowait(CMDLINE_UART); +#endif if (c < 0) return _FDEV_EOF; @@ -61,25 +70,32 @@ int usbserial1_dev_recv(FILE* f) } -int usbserial2_dev_send(char c, FILE* f) +int xbee_dev_send(char c, FILE* f) { +#ifdef USE_USB CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)c); +#else + uart_send(XBEE_UART, c); +#endif return 0; } -int usbserial2_dev_recv(FILE* f) +int xbee_dev_recv(FILE* f) { int16_t c; +#ifdef USE_USB /* non-blocking ! */ c = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface); +#else + c = uart_recv_nowait(XBEE_UART); +#endif if (c < 0) return _FDEV_EOF; return c; } - static void valid_buffer(const char *buf, uint8_t size) { @@ -104,7 +120,7 @@ complete_buffer(const char *buf, char *dstbuf, uint8_t dstsize, static void write_char(char c) { - usbserial1_dev_send(c, NULL); + cmdline_dev_send(c, NULL); } @@ -170,7 +186,7 @@ int cmdline_poll(void) int8_t ret, same = 0; int16_t c; - c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + c = cmdline_dev_recv(NULL); if (c < 0) return -1; diff --git a/cmdline.h b/cmdline.h index 958660a..508d026 100644 --- a/cmdline.h +++ b/cmdline.h @@ -21,7 +21,12 @@ */ +#ifdef USE_USB #include "DualVirtualSerial.h" +#else +#define CMDLINE_UART 0 +#define XBEE_UART 2 +#endif void cmdline_init(void); @@ -34,24 +39,36 @@ void mylog(struct error * e, ...); /* poll cmdline */ int cmdline_poll(void); -int usbserial1_dev_send(char c, FILE* f); -int usbserial1_dev_recv(FILE* f); +int cmdline_dev_send(char c, FILE* f); +int cmdline_dev_recv(FILE* f); -int usbserial2_dev_send(char c, FILE* f); -int usbserial2_dev_recv(FILE* f); +int xbee_dev_send(char c, FILE* f); +int xbee_dev_recv(FILE* f); static inline uint8_t cmdline_keypressed(void) { +#ifdef USE_USB return (CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface) >= 0); +#else + return (uart_recv_nowait(CMDLINE_UART) != -1); +#endif } static inline int16_t cmdline_getchar(void) { +#ifdef USE_USB return CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); +#else + return uart_recv_nowait(CMDLINE_UART); +#endif } static inline uint8_t cmdline_getchar_wait(void) { +#ifdef USE_USB int16_t c; do { c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); } while (c < 0); return c; +#else + return uart_recv(CMDLINE_UART); +#endif } diff --git a/main.c b/main.c index d5c3f5a..2bcb3ec 100644 --- a/main.c +++ b/main.c @@ -60,6 +60,8 @@ #include "main.h" struct xbeeboard xbeeboard; +volatile uint16_t global_ms; +struct callout_manager cm; #define TIMEOUT_MS 1000 @@ -497,7 +499,7 @@ void xbee_unload_timeout(struct xbee_ctx *ctx) void bootloader(void) { -#define BOOTLOADER_ADDR 0x1e000 +#define BOOTLOADER_ADDR 0x1f800 if (pgm_read_byte_far(BOOTLOADER_ADDR) == 0xff) { printf_P(PSTR("Bootloader is not present\r\n")); return; @@ -526,13 +528,12 @@ void xbee_mainloop(void) int16_t c; /* from xbee to cmdline */ - c = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface); + c = xbee_dev_recv(NULL); if (c >= 0) - CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, - (uint8_t)c); + cmdline_dev_send((uint8_t)c, NULL); /* from cmdline to xbee */ - c = CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + c = cmdline_dev_recv(NULL); if (c == 4) { /* CTRL-d */ xbee_raw = 0; rdline_newline(&xbeeboard.rdl, @@ -540,11 +541,10 @@ void xbee_mainloop(void) } else if (c >= 0) { /* send to xbee */ - CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, - (uint8_t)c); + xbee_dev_send((uint8_t)c, NULL); + /* echo on cmdline */ - CDC_Device_SendByte(&VirtualSerial1_CDC_Interface, - (uint8_t)c); + cmdline_dev_send((uint8_t)c, NULL); } } else { @@ -553,8 +553,104 @@ void xbee_mainloop(void) xbee_proto_rx(xbee_dev); } +#ifdef USE_USB CDC_Device_USBTask(&VirtualSerial1_CDC_Interface); CDC_Device_USBTask(&VirtualSerial2_CDC_Interface); USB_USBTask(); +#endif } } + +/* return time in milliseconds on unsigned 16 bits */ +static uint16_t get_time_ms(void) +{ + return global_ms; +} + +static void do_led_blink(struct callout_manager *cm, + struct callout *clt, void *dummy) +{ + static uint8_t a = 0; + +#ifdef USE_USB + if (a & 1) + LEDs_SetAllLEDs(0); + else + LEDs_SetAllLEDs(0xff); +#else + /* XXX */ +#endif + a++; +} + +static void increment_ms(void *dummy) +{ + global_ms++; +} + +static void main_timer_interrupt(void) +{ + static uint8_t cpt = 0; + cpt++; + sei(); + if ((cpt & 0x3) == 0) + scheduler_interrupt(); +} + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + struct callout t1; + FILE *xbee_file; + int8_t err; + struct xbee_dev dev; + +#ifdef USE_USB + SetupHardware(); + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +#else + uart_init(); +#endif + + fdevopen(cmdline_dev_send, cmdline_dev_recv); + xbee_file = fdevopen(xbee_dev_send, xbee_dev_recv); + scheduler_init(); + timer_init(); + timer0_register_OV_intr(main_timer_interrupt); + + scheduler_add_periodical_event_priority(increment_ms, NULL, + 1000L / SCHEDULER_UNIT, + LED_PRIO); + cmdline_init(); +#ifndef USE_USB + /* in usb mode, it's done in usb callback */ + rdline_newline(&xbeeboard.rdl, xbeeboard.prompt); +#endif + callout_manager_init(&cm, get_time_ms); + callout_reset(&cm, &t1, 500, PERIODICAL, do_led_blink, NULL); + + /* initialize libxbee */ + err = xbee_init(); + if (err < 0) + return -1; + + xbee_dev = &dev; + + /* open xbee device */ + if (xbee_open(xbee_dev, xbee_file) < 0) + return -1; + + /* register default channel with a callback */ + if (xbee_register_channel(xbee_dev, XBEE_DEFAULT_CHANNEL, + xbee_rx, NULL) < 0) { + fprintf(stderr, "cannot register default channel\n"); + return -1; + } + + sei(); + xbee_mainloop(); + return 0; +} diff --git a/makefile b/makefile index 5360008..51feddd 100644 --- a/makefile +++ b/makefile @@ -61,8 +61,11 @@ # MCU name +ifneq ($(USE_USB),) MCU = at90usb1287 - +else +MCU = atmega2560 +endif # Target architecture (see library "Board Types" documentation). ARCH = AVR8 @@ -131,13 +134,17 @@ LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENAB # Create the LUFA source path variables by including the LUFA root makefile include $(LUFA_PATH)/LUFA/makefile - -# List C source files here. (C dependencies are automatically generated.) +ifneq ($(USE_USB),) SRC = \ $(TARGET).c \ Descriptors.c \ $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) \ + DualVirtualSerial.c +endif + +# List C source files here. (C dependencies are automatically generated.) +SRC += \ cirbuf_add_buf_head.c \ cirbuf_add_buf_tail.c \ cirbuf_add_head.c \ @@ -152,11 +159,8 @@ SRC = \ cirbuf_get_buf_tail.c \ cirbuf_get_head.c \ cirbuf_get_tail.c \ - cmdline.c \ commands.c \ commands_gen.c \ - Descriptors.c \ - DualVirtualSerial.c \ main.c \ rc_proto.c \ parse.c \ @@ -231,7 +235,8 @@ SRC = \ parse_neighbor.c \ parse_atcmd.c \ parse_monitor.c \ - time.c + time.c \ + cmdline.c # List C++ source files here. (C dependencies are automatically generated.) CPPSRC = @@ -327,6 +332,9 @@ CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) CFLAGS += $(CSTANDARD) CFLAGS += -std=gnu99 +ifneq ($(USE_USB),) +CFLAGS += -DUSE_USB +endif #---------------- Compiler Options C++ ---------------- @@ -428,8 +436,9 @@ LDFLAGS += -Wl,--gc-sections LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) -#LDFLAGS += -T linker_script.x - +ifeq ($(USE_USB),) +LDFLAGS = -T avr6.x +endif #---------------- Programming Options (avrdude) ---------------- @@ -694,6 +703,7 @@ extcoff: $(TARGET).elf %.hex: %.elf @echo @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O binary -R .eeprom -R .fuse -R .lock $< $(TARGET).bin $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ %.eep: %.elf diff --git a/uart_config.h b/uart_config.h index 8795a7e..f8b2f09 100644 --- a/uart_config.h +++ b/uart_config.h @@ -27,33 +27,64 @@ #define UART_CONFIG_H /* - * UART1 definitions + * UART0 definitions */ -/* compile uart1 fonctions, undefine it to pass compilation */ -#define UART1_COMPILE +/* compile uart0 fonctions, undefine it to pass compilation */ +#define UART0_COMPILE -/* enable uart1 if == 1, disable if == 0 */ -#define UART1_ENABLED 1 +/* enable uart0 if == 1, disable if == 0 */ +#define UART0_ENABLED 1 -/* enable uart1 interrupts if == 1, disable if == 0 */ -#define UART1_INTERRUPT_ENABLED 1 +/* enable uart0 interrupts if == 1, disable if == 0 */ +#define UART0_INTERRUPT_ENABLED 1 -#define UART1_BAUDRATE 57600 +#define UART0_BAUDRATE 57600 /* * if you enable this, the maximum baudrate you can reach is * higher, but the precision is lower. */ -#define UART1_USE_DOUBLE_SPEED 1 +#define UART0_USE_DOUBLE_SPEED 1 -#define UART1_RX_FIFO_SIZE 64 -#define UART1_TX_FIFO_SIZE 127 -#define UART1_NBITS 8 +#define UART0_RX_FIFO_SIZE 64 +#define UART0_TX_FIFO_SIZE 127 +#define UART0_NBITS 8 -#define UART1_PARITY UART_PARTITY_NONE +#define UART0_PARITY UART_PARTITY_NONE -#define UART1_STOP_BIT UART_STOP_BITS_1 +#define UART0_STOP_BIT UART_STOP_BITS_1 + +/* .... same for uart 1, 2, 3 ... */ + +/* + * UART2 definitions + */ + +/* compile uart2 fonctions, undefine it to pass compilation */ +#define UART2_COMPILE + +/* enable uart2 if == 1, disable if == 0 */ +#define UART2_ENABLED 1 + +/* enable uart2 interrupts if == 1, disable if == 0 */ +#define UART2_INTERRUPT_ENABLED 1 + +#define UART2_BAUDRATE 9600 + +/* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ +#define UART2_USE_DOUBLE_SPEED 1 + +#define UART2_RX_FIFO_SIZE 64 +#define UART2_TX_FIFO_SIZE 127 +#define UART2_NBITS 8 + +#define UART2_PARITY UART_PARTITY_NONE + +#define UART2_STOP_BIT UART_STOP_BITS_1 /* .... same for uart 1, 2, 3 ... */ -- 2.20.1