diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 04480d514306ab9701fa82f09cbfafe3de6efece..67bbb9295b7ecf1cdf4d41e9f6639f7d48e246a4 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -62,7 +62,7 @@ #include "Atomic.h" - #define PROGMEM + #define PROGMEM const #else #include <avr/io.h> #endif diff --git a/LUFA/Drivers/Peripheral/AVR32/SPI.h b/LUFA/Drivers/Peripheral/AVR32/SPI.h index e07eb6c76fddde3ab6f5a201735af0d0719ce686..b7484799a1c6c8cf16067881d5765e1e763f8e2d 100644 --- a/LUFA/Drivers/Peripheral/AVR32/SPI.h +++ b/LUFA/Drivers/Peripheral/AVR32/SPI.h @@ -51,6 +51,7 @@ #define __SPI_AVR32_H__ /* Includes: */ + #include <avr32/io.h> #include <stdbool.h> /* Preprocessor Checks: */ diff --git a/LUFA/Drivers/Peripheral/AVR8/SPI.h b/LUFA/Drivers/Peripheral/AVR8/SPI.h index 3440cc9f10e8da9650eded8a48a79399ef633780..f466162beb7c2c8751a509962fcecafbcc15b8db 100644 --- a/LUFA/Drivers/Peripheral/AVR8/SPI.h +++ b/LUFA/Drivers/Peripheral/AVR8/SPI.h @@ -51,6 +51,7 @@ #define __SPI_AVR8_H__ /* Includes: */ + #include <avr/io.h> #include <stdbool.h> /* Preprocessor Checks: */ diff --git a/LUFA/Drivers/Peripheral/AVR8/Serial.h b/LUFA/Drivers/Peripheral/AVR8/Serial.h index 282528bb0e7f3fa3a21a48cb680ffa2555af4d1a..0421dea73968311ac9c4a82e2de4805d94140936 100644 --- a/LUFA/Drivers/Peripheral/AVR8/Serial.h +++ b/LUFA/Drivers/Peripheral/AVR8/Serial.h @@ -80,7 +80,7 @@ */ static inline bool Serial_IsCharReceived(void); #else - #define Serial_IsCharReceived() /* TODO */ + #define Serial_IsCharReceived() ((UCSR1A & (1 << RXC1)) ? true : false) #endif /* Inline Functions: */ @@ -92,13 +92,27 @@ */ static inline void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed) { - // TODO + UCSR1A = (DoubleSpeed ? (1 << U2X1) : 0); + UCSR1B = ((1 << TXEN1) | (1 << RXEN1)); + UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10)); + + DDRD |= (1 << 3); + PORTD |= (1 << 2); + + UBRR1 = (DoubleSpeed ? SERIAL_2X_UBBRVAL(BaudRate) : SERIAL_UBBRVAL(BaudRate)); } /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */ static inline void Serial_ShutDown(void) { - // TODO + UCSR1A = 0; + UCSR1B = 0; + UCSR1C = 0; + + DDRD &= ~(1 << 3); + PORTD &= ~(1 << 2); + + UBRR1 = 0; } /** Transmits a given byte through the USART. @@ -107,7 +121,8 @@ */ static inline void Serial_TxByte(const char DataByte) { - // TODO + while (!(UCSR1A & (1 << UDRE1))); + UDR1 = DataByte; } /** Receives a byte from the USART. @@ -116,7 +131,8 @@ */ static inline uint8_t Serial_RxByte(void) { - // TODO + while (!(UCSR1A & (1 << RXC1))); + return UDR1; } /* Disable C linkage for C++ Compilers: */ diff --git a/LUFA/Drivers/Peripheral/AVR8/TWI.h b/LUFA/Drivers/Peripheral/AVR8/TWI.h index 673f1b0711c1bfefa15730db7084e6f734c94e8e..d169b8230e5969d0a45f2ce6e9588bc50491064d 100644 --- a/LUFA/Drivers/Peripheral/AVR8/TWI.h +++ b/LUFA/Drivers/Peripheral/AVR8/TWI.h @@ -37,7 +37,7 @@ */ /** \ingroup Group_TWI - * @defgroup Group_TWI_AVR8 Series U4, U6 and U7 Model TWI Driver + * @defgroup Group_TWI_AVR8 8-Bit AVR TWI Driver * * Master mode TWI driver for the 8-Bit AVRs containing a hardware TWI module. * diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index f05ace33d30c6b5b7b949ea2c7b4beb775b41e12..ad43258c366ac0ff76814ab663155dfc2f39285e 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -9,7 +9,7 @@ * \section Sec_ChangeLogXXXXXX Version XXXXXX * * <b>New:</b> - * - (None) + * - Added support for the UC3B0256 AVR32 microcontroller * * <b>Changed:</b> * - AVRISP programmer project now has a more robust timeout system, allowing for a doubling of the software USART speed @@ -17,7 +17,7 @@ * - Increased the speed of both software and hardware TPI/PDI programming modes of the AVRISP project * * <b>Fixed:</b> - * - (None) + * - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin * * \section Sec_ChangeLog100219 Version 100219 * diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c index f1bb45a29445a6749fd98d7ebab9242349d66cf4..957084c0b10281b27c8466668f936c7e6e41c752 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c @@ -53,7 +53,7 @@ volatile uint16_t SoftUSART_Data; ISR(TIMER1_COMPA_vect, ISR_BLOCK) { /* Toggle CLOCK pin in a single cycle (see AVR datasheet) */ - BITBANG_PDICLOCK_PIN |= BITBANG_PDICLOCK_MASK; + BITBANG_PDICLOCK_PIN = BITBANG_PDICLOCK_MASK; /* If not sending or receiving, just exit */ if (!(SoftUSART_BitCount)) @@ -103,7 +103,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK) ISR(TIMER1_CAPT_vect, ISR_BLOCK) { /* Toggle CLOCK pin in a single cycle (see AVR datasheet) */ - BITBANG_TPICLOCK_PIN |= BITBANG_TPICLOCK_MASK; + BITBANG_TPICLOCK_PIN = BITBANG_TPICLOCK_MASK; /* If not sending or receiving, just exit */ if (!(SoftUSART_BitCount))