aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-06-12 19:51:57 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-06-12 19:51:57 +0200
commitf7b9ebea02cf2a48fd4b287f6a445090ea433d52 (patch)
treebd63623df602229bba4d8f86902c823af97faf16
parent6d58628e85f473001cbacc012d7f25b477c3e797 (diff)
downloadlufa-f7b9ebea02cf2a48fd4b287f6a445090ea433d52.tar.gz
lufa-f7b9ebea02cf2a48fd4b287f6a445090ea433d52.tar.bz2
lufa-f7b9ebea02cf2a48fd4b287f6a445090ea433d52.zip
Update board Dataflash_Init() functions to automatically configure the appropriate communication interface.
-rw-r--r--Demos/Device/ClassDriver/MassStorage/MassStorage.c1
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c1
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c1
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.c1
-rw-r--r--LUFA/DoxygenPages/ChangeLog.txt1
-rw-r--r--LUFA/DoxygenPages/MigrationInformation.txt3
-rw-r--r--LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h6
-rw-r--r--LUFA/Drivers/Board/AVR8/STK525/Dataflash.h4
-rw-r--r--LUFA/Drivers/Board/AVR8/STK526/Dataflash.h4
-rw-r--r--LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h6
-rw-r--r--LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h6
-rw-r--r--LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h8
-rw-r--r--LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h9
-rw-r--r--LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h4
-rw-r--r--Projects/TempDataLogger/TempDataLogger.c1
-rw-r--r--Projects/Webserver/Webserver.c1
16 files changed, 37 insertions, 20 deletions
diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c
index a0fa7a2a9..82f02b918 100644
--- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c
+++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c
@@ -103,7 +103,6 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
Dataflash_Init();
USB_Init();
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
index 05fdfbe0c..2ed3f411b 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
@@ -129,7 +129,6 @@ void SetupHardware(void)
LEDs_Init();
Joystick_Init();
Buttons_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
Dataflash_Init();
USB_Init();
diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c
index f1dc04992..03f422b45 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c
+++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c
@@ -148,7 +148,6 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
Joystick_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
Dataflash_Init();
USB_Init();
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c
index cfb1686fd..fc6643331 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.c
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c
@@ -88,7 +88,6 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
Dataflash_Init();
USB_Init();
diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index b5c8fe1fb..e218fe3a3 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -24,6 +24,7 @@
* - Updated the Android Accessory Class to accept version 2 protocol devices (with version 1 functionality)
* - All board drivers now implement dummy functions and constants when BOARD is set to NONE
* - Added missing LEDs to the XMEGA A3BU Xplained board LED driver (thanks to Michael Janssen)
+ * - Changed board Dataflash drivers to automatically configure the appropriate SPI interface for the selected board
*
* <b>Fixed:</b>
* - Core:
diff --git a/LUFA/DoxygenPages/MigrationInformation.txt b/LUFA/DoxygenPages/MigrationInformation.txt
index 8643eb333..cbacbf0c1 100644
--- a/LUFA/DoxygenPages/MigrationInformation.txt
+++ b/LUFA/DoxygenPages/MigrationInformation.txt
@@ -11,7 +11,8 @@
* areas relevant to making older projects compatible with the API changes of each new release.
*
* \section Sec_MigrationXXXXXX Migrating from 130303 to XXXXXX
- * There is no migration information for this version.
+ * <b>Non-USB Library Components</b>
+ * - The Board Dataflash \c Dataflash_Init() function now automatically configures the appropriate communication interface.
*
* \section Sec_Migration130303 Migrating from 120730 to 130303
* <b>Device Mode</b>
diff --git a/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h b/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h
index ef04ebad6..a58a06c85 100644
--- a/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h
+++ b/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h
@@ -45,7 +45,7 @@
* <table>
* <tr><th>Name</th><th>Info</th><th>Select Pin</th><th>SPI Port</th></tr>
* <tr><td>DATAFLASH_CHIP1</td><td>AT45DB321C (4MB)</td><td>PORTE.6</td><td>SPI0</td></tr>
- * </table>
+ * </table>
*
* @{
*/
@@ -90,12 +90,14 @@
/* 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)
{
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
+
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
diff --git a/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h b/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h
index 608400c8d..b34907b03 100644
--- a/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h
+++ b/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h
@@ -90,12 +90,14 @@
/* 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)
{
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
+
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
diff --git a/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h b/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h
index f6e112417..511479f55 100644
--- a/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h
+++ b/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h
@@ -90,12 +90,14 @@
/* 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)
{
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
+
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
diff --git a/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h b/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h
index 14b94c506..648beb557 100644
--- a/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h
+++ b/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h
@@ -94,12 +94,14 @@
/* 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)
{
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
+
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
@@ -223,7 +225,7 @@
#if (DATAFLASH_TOTALCHIPS == 2)
PageAddress >>= 1;
#endif
-
+
Dataflash_SendByte(PageAddress >> 5);
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
diff --git a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h
index b02cce698..d8bb12bda 100644
--- a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h
+++ b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h
@@ -71,7 +71,7 @@
/* Includes: */
#include "../../../../Common/Common.h"
-
+
#include "../../../Misc/AT45DB642D.h"
#include "../../../Peripheral/SPI.h"
@@ -113,12 +113,14 @@
/* 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)
{
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
+
+ SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
diff --git a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
index 143fbbffc..7ba478ca4 100644
--- a/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
+++ b/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
@@ -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)
{
@@ -97,6 +97,12 @@
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.
diff --git a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
index 28c79f197..3430e0cbf 100644
--- a/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
+++ b/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
@@ -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)
{
@@ -98,7 +98,12 @@
PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm;
- PORTC.REMAP |= PORT_USART0_bm;
+ SerialSPI_Init(&USARTC0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), (F_CPU / 2));
+
+ PORTC.REMAP |= PORT_USART0_bm;
+ PORTC.DIRSET = PIN7_bm | PIN5_bm;
+ PORTC.DIRCLR = PIN6_bm;
+ PORTC.PIN6CTRL = PORT_OPC_PULLUP_gc;
}
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
diff --git a/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h b/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
index 7f5226b05..caae55a82 100644
--- a/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
+++ b/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
@@ -108,7 +108,7 @@
#define USART_SPI_SAMPLE_LEADING 0
/** SPI data sample mode mask for \ref SerialSPI_Init(). Indicates that the data should be sampled on the trailing edge. */
- #define USART_SPI_SAMPLE_TRAILING USART_UPCHA_bm
+ #define USART_SPI_SAMPLE_TRAILING (1 << 1)
//@}
/** \name SPI Data Ordering Configuration Masks */
@@ -117,7 +117,7 @@
#define USART_SPI_ORDER_MSB_FIRST 0
/** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out LSB first. */
- #define USART_SPI_ORDER_LSB_FIRST USART_UDORD_bm
+ #define USART_SPI_ORDER_LSB_FIRST (1 << 2)
//@}
/* Inline Functions: */
diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c
index 7590aeea3..0c59bc843 100644
--- a/Projects/TempDataLogger/TempDataLogger.c
+++ b/Projects/TempDataLogger/TempDataLogger.c
@@ -201,7 +201,6 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
Temperature_Init();
Dataflash_Init();
diff --git a/Projects/Webserver/Webserver.c b/Projects/Webserver/Webserver.c
index 173b52e95..b866d37b2 100644
--- a/Projects/Webserver/Webserver.c
+++ b/Projects/Webserver/Webserver.c
@@ -70,7 +70,6 @@ void SetupHardware(void)
#endif
/* Hardware Initialization */
- SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
Dataflash_Init();
LEDs_Init();
USB_Init(USB_MODE_UID);