Update copyrights for 2021.
[pub/lufa.git] / LUFA / Drivers / Board / XMEGA / A3BU_XPLAINED / Dataflash.h
index 143fbbf..09d7600 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2013.
+     Copyright (C) Dean Camera, 2021.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2021  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
@@ -89,7 +89,7 @@
 
                /* Inline Functions: */
                        /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
-                        *  The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used.
+                        *  The appropriate SPI interface will be automatically configured.
                         */
                        static inline void Dataflash_Init(void)
                        {
 
                                PORTCFG.MPCMASK                = DATAFLASH_CHIPCS_MASK;
                                DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
+
+                               SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), (F_CPU / 2));
+
+                               PORTD.DIRSET   = PIN3_bm | PIN1_bm;
+                               PORTD.DIRCLR   = PIN2_bm;
+                               PORTC.PIN2CTRL = PORT_OPC_PULLUP_gc;
                        }
 
                        /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.