Add Atmel Studio support for the Arduino Yun and Micro boards.
[pub/USBasp.git] / LUFA / Drivers / Peripheral / AVR8 / SerialSPI_AVR8.h
index f12aa77..7afaf1b 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2013.
+     Copyright (C) Dean Camera, 2014.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
                        static inline void SerialSPI_Init(const uint8_t SPIOptions,
                                                          const uint32_t BaudRate)
                        {
                        static inline void SerialSPI_Init(const uint8_t SPIOptions,
                                                          const uint32_t BaudRate)
                        {
-                               UBRR1  = SERIAL_SPI_UBBRVAL(BaudRate);
+                               DDRD  |= ((1 << 3) | (1 << 5));
+                               PORTD |= (1 << 2);
 
                                UCSR1C = ((1 << UMSEL11) | (1 << UMSEL10) | SPIOptions);
                                UCSR1B = ((1 << TXEN1)  | (1 << RXEN1));
 
 
                                UCSR1C = ((1 << UMSEL11) | (1 << UMSEL10) | SPIOptions);
                                UCSR1B = ((1 << TXEN1)  | (1 << RXEN1));
 
-                               DDRD  |= (1 << 3);
-                               PORTD |= (1 << 2);
+                               UBRR1  = SERIAL_SPI_UBBRVAL(BaudRate);
                        }
 
                        /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */
                        }
 
                        /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */
 
                                UBRR1  = 0;
 
 
                                UBRR1  = 0;
 
-                               DDRD  &= ~(1 << 3);
+                               DDRD  &= ~((1 << 3) | (1 << 5));
                                PORTD &= ~(1 << 2);
                        }
 
                                PORTD &= ~(1 << 2);
                        }